Пример #1
0
 def getDB():
     db = mdb(db_host=db_config['db_host'],
              db_port=db_config['db_port'],
              db_user=db_config['db_user'],
              db_pass=db_config['db_pass'],
              db_name=db_config['db_name'],
              autocommit=True)
     return db
Пример #2
0
 def getDB():
     db = mdb(db_host=db_config['db_host'],
              db_port=db_config['db_port'],
              db_user=db_config['db_user'],
              db_pass=db_config['db_pass'],
              db_name=db_config['db_name'],
              autocommit=True)
     return db
Пример #3
0
# author: Tiger <*****@*****.**>

from mysql_helper import mysql_helper as mdb

import datetime, time

config = {
    'db_host': 'localhost',
    'db_port': 3306,
    'db_user': '******',
    'db_pass': '******',
    'db_name': 'test',
    'charset': 'utf8'
}

db = mdb()
# db.autocommit = True
res = db.charset('utf8')

# db.query('show tables')
# db.query('select * from `test`')

print '------------------------'
res = db.select_db('test')
print 'res', res
u = {
    # 'id':12345,
    'name': 'test',
    'pass': '******',
    'email': 'ab@test',
    'reg_time': int(time.time()),
Пример #4
0

from mysql_helper import mysql_helper as mdb

import datetime,time

config = {
        'db_host'   : 'localhost',
        'db_port'   : 3306,
        'db_user'   : 'root',
        'db_pass'   : '123456',
        'db_name'   : 'test',
        'charset'   : 'utf8'
    }

db = mdb()
# db.autocommit = True
res=db.charset('utf8')

# db.query('show tables')
# db.query('select * from `test`')

print '------------------------'
res = db.select_db('test')
print 'res',res
u={
    # 'id':12345,
    'name':'test',
    'pass':'******',
    'email':'ab@test',
    'reg_time':int(time.time()),