def getDefaultsQueries(): sqlQueries = [] sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "bookmark": "'Home'", "value": "'" + fu.userDirectoryPath + "'", "type": "''" }, ["value"]) if uni.isWindows: sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "bookmark": "'C:\\'", "value": "'C:\\'", "type": "''" }, ["value"]) else: sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "bookmark": "'MNT'", "value": "'/mnt'", "type": "''" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "bookmark": "'MEDIA'", "value": "'/media'", "type": "''" }, ["value"]) return sqlQueries
def getDefaultsQueries(): sqlQueries = [] sqlQueries += getAmendedSQLInsertOrUpdateQueries(tableName, { "objectName": "'*'", "value": "'Hamsi'" }, ["objectName", "value"]) return sqlQueries
def getDefaultsQueries(): sqlQueries = [] sqlQueries += getAmendedSQLInsertOrUpdateQueries(tableName, {"label": "'delete url'", "searching": "'(([A-Za-z]{3,9})://)?([-;:&=\+\$,\w]+@{1})?(([-A-Za-z0-9]+\.)+[A-Za-z]{2,3})(:\d+)?((/[-\+~%/\.\w]+)?/?([&?][-\+=&;%@\.\w]+)?(#[\w]+)?)?'", "replacing": "''", "intIsActive": "0", "intIsCaseSensitive": "1", "intIsRegExp": "1"}, ["searching"]) return sqlQueries
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(_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(_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(_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 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 getDefaultsQueries(): sqlQueries = [] sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['baseName~|~-', '~||~', 'artist~|~', 'title~|~']") + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql( "['trackNum~|~', 'Concatenate-0~|~ - ', 'title~|~', '~||~', 'baseName~|~']" ) + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['album~|~', '~||~', 'baseNameOfDirectory~|~']") + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['artist~|~', '~||~', 'albumArtist~|~']") + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['albumArtist~|~', '~||~', 'artist~|~']") + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['baseNameOfDirectory~|~', '~||~', 'album~|~']") + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql( "['baseNameOfDirectory~|~-', '~||~', 'artist~|~', 'album~|~']") + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql( "['baseNameOfDirectory~|~-', '~||~', 'year~|~', 'album~|~']") + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql( "['baseName~|~-', '~||~', 'trackNum~|~', 'title~|~']") + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql( "['artist~|~', 'Concatenate-0~|~ + ', 'title~|~', '~||~', 'baseName~|~']" ) + "'", "type": "'music'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['baseName~|~', '~||~', 'baseNameOfDirectory~|~']") + "'", "type": "'file'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['baseNameOfDirectory~|~', '~||~', 'baseName~|~']") + "'", "type": "'file'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['baseNameOfDirectory~|~', '~||~', 'baseName~|~']") + "'", "type": "'directory'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['baseName~|~', '~||~', 'baseNameOfDirectory~|~']") + "'", "type": "'directory'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['currentCover~|~', '~||~', 'sourceCover~|~']") + "'", "type": "'cover'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['currentCover~|~', '~||~', 'destinationCover~|~']") + "'", "type": "'cover'" }, ["value"]) sqlQueries += getAmendedSQLInsertOrUpdateQueries( tableName, { "value": "'" + correctForSql("['baseName~|~', '~||~', 'destinationCover~|~']") + "'", "type": "'cover'" }, ["value"]) return sqlQueries
def getDefaultsQueries(): sqlQueries = [] sqlQueries += getAmendedSQLInsertOrUpdateQueries(tableName, {"objectName": "'*'", "value": "'Hamsi'"}, ["objectName", "value"]) return sqlQueries