def delete(_id): global allForFetch allForFetch = None con = getDefaultConnection() cur = con.cursor() cur.execute("delete from " + tableName + " where id=" + str(int(_id))) con.commit()
def delete(_id): global allForFetch allForFetch = None con = getDefaultConnection() cur = con.cursor() cur.execute("delete from " + tableName + " where id=" + str(int(_id))) con.commit()
def fetchAll(): global allForFetch if allForFetch is None: con = getDefaultConnection() cur = con.cursor() cur.execute("SELECT * FROM " + tableName) allForFetch = cur.fetchall() return allForFetch
def fetchAll(): global allForFetch if allForFetch is None: con = getDefaultConnection() cur = con.cursor() cur.execute("SELECT * FROM " + tableName) allForFetch = cur.fetchall() return allForFetch
def delete(_id, _type=None): if _type is None: _type = getMainTable().keyName global allForFetch, allForFetchByType allForFetch, allForFetchByType[_type] = None, None con = getDefaultConnection() cur = con.cursor() cur.execute("delete from " + tableName + " where id=" + str(int(_id))) con.commit()
def checkUpdates(_oldVersion): if _oldVersion < 4: con = getDefaultConnection() cur = con.cursor() cur.execute(str("DROP TABLE " + tableName + ";")) con.commit() cur.execute(getTableCreateQuery()) con.commit() for sqlCommand in getDefaultsQueries(): cur = con.cursor() cur.execute(str(sqlCommand)) con.commit()
def checkUpdates(_oldVersion): if _oldVersion < 2: con = getDefaultConnection() cur = con.cursor() cur.execute(str("DROP TABLE " + tableName + ";")) con.commit() cur.execute(getTableCreateQuery()) con.commit() for sqlCommand in getDefaultsQueries(): cur = con.cursor() cur.execute(str(sqlCommand)) con.commit()
def update(_id, _bookmark, _value, _type=""): global allForFetch if checkValues(_bookmark, _value, _type): allForFetch = None con = getDefaultConnection() cur = con.cursor() cur.execute( str("update " + tableName + " set bookmark='" + correctForSql(_bookmark) + "', value='" + correctForSql(_value) + "', type='" + correctForSql(_type) + "' where id=" + str(int(_id)))) con.commit()
def update(_id, _label, _searching, _replacing, _intIsActive, _intIsCaseSensitive, _intIsRegExp): global allForFetch if checkValues(_label, _searching, _replacing, _intIsActive, _intIsCaseSensitive, _intIsRegExp): allForFetch = None con = getDefaultConnection() cur = con.cursor() cur.execute(str( "update " + tableName + " set label='" + correctForSql(_label) + "', searching='" + correctForSql( _searching) + "', replacing='" + correctForSql(_replacing) + "', intIsActive='" + correctForSql( _intIsActive) + "', intIsCaseSensitive='" + correctForSql( _intIsCaseSensitive) + "', intIsRegExp='" + correctForSql(_intIsRegExp) + "' where id=" + str( int(_id)))) con.commit()
def update(_id, _value, _type=None): global allForFetch, allForFetchByType if _type is None: _type = getMainTable().keyName if checkValues(_value, _type): allForFetch, allForFetchByType[_type] = None, None con = getDefaultConnection() cur = con.cursor() cur.execute( str("update " + tableName + " set value='" + correctForSql(_value) + "', type='" + correctForSql(_type) + "' where id=" + str(int(_id)))) con.commit()
def insert(_objectName, _value): _objectName = str(_objectName) _value = str(_value) global allForFetch, allForFetchByObjectName if checkValues(_objectName, _value): allForFetch, allForFetchByObjectName[_objectName], allForFetchByObjectName["%*%"] = None, None, None con = getDefaultConnection() cur = con.cursor() sqlQueries = getAmendedSQLInsertOrUpdateQueries(tableName, {"objectName": "'" + correctForSql(_objectName) + "'", "value": "'" + correctForSql(_value) + "'"}, ["objectName", "value"]) cur.execute(sqlQueries[0]) # cur.execute(sqlQueries[1]) # does not need update query con.commit() return None
def fetchAllByObjectName(_objectName=None): global allForFetchByObjectName if _objectName is None: _objectName = "%*%" if _objectName not in allForFetchByObjectName or allForFetchByObjectName[_objectName] is None: con = getDefaultConnection() cur = con.cursor() if _objectName == "%*%": cur.execute("SELECT DISTINCT value FROM " + tableName) else: cur.execute( "SELECT DISTINCT value FROM " + tableName + " where objectName='" + _objectName + "' or objectName='*'") myValues = [] for myval in cur.fetchall(): myValues.append(myval[0]) allForFetchByObjectName[_objectName] = myValues return allForFetchByObjectName[_objectName]
def fetchAllByType(_type=None): global allForFetchByType if _type is None: _type = getMainTable().keyName if _type not in allForFetchByType or allForFetchByType[_type] is None: from SpecialTools import SpecialActions con = getDefaultConnection() cur = con.cursor() cur.execute("SELECT * FROM " + tableName + " where type='" + _type + "'") myBookmarks = [] for mybm in cur.fetchall(): newText = SpecialActions.whatDoesSpecialCommandDo( eval(str(mybm[1])), False, True) myBookmarks.append([mybm[0], newText, mybm[1], mybm[2]]) allForFetchByType[_type] = myBookmarks return allForFetchByType[_type]
def insert(_bookmark, _value, _type=""): global allForFetch if checkValues(_bookmark, _value, _type): allForFetch = None con = getDefaultConnection() cur = con.cursor() sqlQueries = getAmendedSQLInsertOrUpdateQueries( tableName, { "bookmark": "'" + correctForSql(_bookmark) + "'", "value": "'" + correctForSql(_value) + "'", "type": "'" + correctForSql(_type) + "'" }, ["value"]) cur.execute(sqlQueries[0]) cur.execute(sqlQueries[1]) con.commit() cur.execute("SELECT last_insert_rowid();") return cur.fetchall()[0][0] return None
def insert(_objectName, _value): _objectName = str(_objectName) _value = str(_value) global allForFetch, allForFetchByObjectName if checkValues(_objectName, _value): allForFetch, allForFetchByObjectName[ _objectName], allForFetchByObjectName["%*%"] = None, None, None con = getDefaultConnection() cur = con.cursor() sqlQueries = getAmendedSQLInsertOrUpdateQueries( tableName, { "objectName": "'" + correctForSql(_objectName) + "'", "value": "'" + correctForSql(_value) + "'" }, ["objectName", "value"]) cur.execute(sqlQueries[0]) # cur.execute(sqlQueries[1]) # does not need update query con.commit() return None
def insert(_value, _type=None): global allForFetch, allForFetchByType if _type is None: _type = getMainTable().keyName if checkValues(_value, _type): allForFetch, allForFetchByType[_type] = None, None con = getDefaultConnection() cur = con.cursor() sqlQueries = getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql(_value) + "'", "type": "'" + correctForSql(_type) + "'" }, ["value"]) cur.execute(sqlQueries[0]) cur.execute(sqlQueries[1]) con.commit() cur.execute("SELECT last_insert_rowid();") return cur.fetchall()[0][0] return None
def fetchAllByObjectName(_objectName=None): global allForFetchByObjectName if _objectName is None: _objectName = "%*%" if _objectName not in allForFetchByObjectName or allForFetchByObjectName[ _objectName] is None: con = getDefaultConnection() cur = con.cursor() if _objectName == "%*%": cur.execute("SELECT DISTINCT value FROM " + tableName) else: cur.execute("SELECT DISTINCT value FROM " + tableName + " where objectName='" + _objectName + "' or objectName='*'") myValues = [] for myval in cur.fetchall(): myValues.append(myval[0]) allForFetchByObjectName[_objectName] = myValues return allForFetchByObjectName[_objectName]
def insert(_label, _searching, _replacing, _intIsActive, _intIsCaseSensitive, _intIsRegExp): global allForFetch if checkValues(_label, _searching, _replacing, _intIsActive, _intIsCaseSensitive, _intIsRegExp): allForFetch = None con = getDefaultConnection() cur = con.cursor() sqlQueries = getAmendedSQLInsertOrUpdateQueries(tableName, {"label": "'" + correctForSql(_label) + "'", "searching": "'" + correctForSql(_searching) + "'", "replacing": "'" + correctForSql(_replacing) + "'", "intIsActive": correctForSql(_intIsActive), "intIsCaseSensitive": correctForSql( _intIsCaseSensitive), "intIsRegExp": correctForSql(_intIsRegExp)}, ["searching"]) cur.execute(sqlQueries[0]) cur.execute(sqlQueries[1]) con.commit() cur.execute("SELECT last_insert_rowid();") return cur.fetchall()[0][0] return None
def fetch(_id): con = getDefaultConnection() cur = con.cursor() cur.execute("SELECT * FROM " + tableName + " where id=" + str(int(_id))) return cur.fetchall()
def fetch(_id): con = getDefaultConnection() cur = con.cursor() cur.execute("SELECT * FROM " + tableName + " where id=" + str(int(_id))) return cur.fetchall()