コード例 #1
0
ファイル: db.py プロジェクト: timtadh/twik
def execute(query, *args):
    logger.writeln('execute', query, '%', args)
    connection = connections.get_con()
    cursor = DictCursor(connection)
    cursor.execute(query, args)
    results = tuple(_results_gen(cursor))
    cursor.close()
    connections.release_con(connection)
    
    if len(results) == 1: return results[0]
    else: return results
コード例 #2
0
ファイル: db.py プロジェクト: timtadh/twik
def callproc(name, *args):
    logger.writeln('callproc', name, '%', args)
    connection = connections.get_con()
    cursor = DictCursor(connection)
    cursor.callproc(name, args)
    results = tuple(_results_gen(cursor))
    cursor.close()
    connections.release_con(connection)
    
    if len(results) == 1: return results[0]
    else: return results
コード例 #3
0
ファイル: safecursor.py プロジェクト: andreww5au/Prosp
 def close(self):
   DictCursor.close(self)
コード例 #4
0
ファイル: test.py プロジェクト: irskep/diplomacy
import twik.db as db
import config_db_con
from MySQLdb.cursors import DictCursor

con = db.connections.get_con()
cur = DictCursor(con)
cur.callproc('user_data_byemail', ('*****@*****.**',))
r = cur.fetchall()
print r



cur.close()
db.connections.release_con(con)