X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fsenslab%2Fslabpostgres.py;h=ac9f99436ba544b2d1daa15fee4bb26c663c0270;hb=03dc21a0ac95b4fbe8c950c8dc052955d281cc44;hp=f24d0b8a7ff6d7609c5f35e719f3274a2d581f7a;hpb=8475bb45b6de453336946885435ff323606c1d47;p=sfa.git diff --git a/sfa/senslab/slabpostgres.py b/sfa/senslab/slabpostgres.py index f24d0b8a..ac9f9943 100644 --- a/sfa/senslab/slabpostgres.py +++ b/sfa/senslab/slabpostgres.py @@ -199,6 +199,7 @@ class SlabDB: """ #Creates the values string for the update SQL command + vclause = valueclause if len(column_names) is not len(values): return else: @@ -206,12 +207,14 @@ class SlabDB: valuesdict = dict(zip(column_names,values)) for k in valuesdict.keys(): valuesdict[k] = str(valuesdict[k]) - v = ' \''+ str(k) + '\''+ '='+' \''+ valuesdict[k]+'\'' + #v = ' \''+ str(k) + '\''+ '='+' \''+ valuesdict[k]+'\'' + v = str(k) + '=' + valuesdict[k] valueslist.append(v) - + if isinstance(vclause,str): + vclause = '\''+ vclause + '\'' statement = "UPDATE %s SET %s WHERE %s = %s" % \ - (table, ", ".join(valueslist), whereclause, valueclause) - + (table, ", ".join(valueslist), whereclause, vclause) + print>>sys.stderr,"\r\n \r\n SLABPOSTGRES.PY update statement %s valuesdict %s valueslist %s" %(statement,valuesdict,valueslist) mark = self.cursor() mark.execute(statement) self.connection.commit()