Example #1
0
def get_category_from_title(title):
    import sire.printer as printer
    import sire.dbman as dbman
    from sire.shared import db, config
    res = dbman.dbexec("SELECT cat FROM item WHERE title = '%s'" % format_text_in(title), None, False)
    if len(res) > 0:
        return res[0][0]
    error(Misc.ERROR["notitle"] % c(title))
    sys.exit(1)
Example #2
0
def get_category_from_id(id):
    import sire.helpers as helpers
    import sire.printer as printer
    import sire.dbman as dbman
    import sys
    res = dbman.dbexec("SELECT cat FROM item WHERE id = '%s'" % id, None, False)
    if len(res) > 0:
        return res[0][0]
    error(Misc.ERROR["item"] % c(id))
    sys.exit(1)
Example #3
0
def get_title_from_id(id):
    if not is_valid_id(id):
        text_error(Misc.ERROR['bad_id'] % c(id))
        sys.exit(1);

    cursor = dbman.dbexec("SELECT title FROM item WHERE id = '%s'" % id, None, False)
    res = cursor
    if len(res) > 0:
        return res[0][0]
    text_error(Misc.ERROR["item"] % c(id)) 
    sys.exit(1)
Example #4
0
def item_exists(item):
    import sire.dbman as dbman
    cursor = dbman.dbexec("SELECT * FROM item WHERE title = '%s'" % format_text_in(item), None, False)
    if len(cursor) > 0:
        return True
    return False