def updateEndSparqlJob(self,jobid,state,nr=-1, data=None, file=None): import json conn = sqlite3.connect(self.pathdb,uri=True) c = conn.cursor() d = 'NULL' if data: d = "'"+ParamManager.encode(json.dumps(data, ensure_ascii=False))+"'" f = 'NULL' if file: f = "'"+file+"'" reqSql = "UPDATE jobs SET "\ + " state = '"+ state +"'," \ + " end = strftime('%s','now'),"\ + " nr = "+str(nr)+","\ + " data = "+ d +"," \ + " file = "+ f \ + " WHERE jobID = "+str(jobid) c.execute(reqSql) conn.commit() conn.close()
def updateEndSparqlJob(self, jobid, state, nr=-1, data=None, file=None): import json conn = sqlite3.connect(self.pathdb, uri=True) c = conn.cursor() d = 'NULL' if data: d = "'" + ParamManager.encode(json.dumps(data, ensure_ascii=False)) + "'" f = 'NULL' if file: f = "'" + file + "'" reqSql = "UPDATE jobs SET "\ + " state = '"+ state +"'," \ + " end = strftime('%s','now'),"\ + " nr = "+str(nr)+","\ + " data = "+ d +"," \ + " file = "+ f \ + " WHERE jobID = "+str(jobid) c.execute(reqSql) conn.commit() conn.close()
def saveStartSparqlJob(self,typeJob,requestGraph="{}",variates="{}"): conn = sqlite3.connect(self.pathdb,uri=True) c = conn.cursor() requestGraph = urllib.parse.quote(requestGraph) variates = ParamManager.encode(str(variates)) reqSql = "INSERT INTO jobs VALUES ("\ + "NULL," \ +"'"+typeJob+"'," \ + "'Wait'," \ + "strftime('%s','now'),"\ + "0,"\ + "NULL,"\ + "''," \ + "''," \ + "'"+requestGraph+"'," \ + "'"+variates+"'," \ + "-1" \ + ");" c.execute(reqSql) ID = c.lastrowid conn.commit() conn.close() return ID
def saveStartSparqlJob(self, typeJob, requestGraph="{}", variates="{}"): conn = sqlite3.connect(self.pathdb, uri=True) c = conn.cursor() requestGraph = urllib.parse.quote(requestGraph) variates = ParamManager.encode(str(variates)) reqSql = "INSERT INTO jobs VALUES ("\ + "NULL," \ +"'"+typeJob+"'," \ + "'Wait'," \ + "strftime('%s','now'),"\ + "0,"\ + "NULL,"\ + "''," \ + "''," \ + "'"+requestGraph+"'," \ + "'"+variates+"'," \ + "-1" \ + ");" c.execute(reqSql) ID = c.lastrowid conn.commit() conn.close() return ID
def test_decode(self): r = ParamManager.encode("@&###:::123%%%%!!!") assert ParamManager.decode(r) == "@&###:::123%%%%!!!"
def test_encode(self): r = ParamManager.encode("@&###:::123%%%%!!!") assert r != "@&###123%%%%!!!"