Ejemplo n.º 1
0
def test_create_table():
    database = MySQLServer()
    database.set_mysql('../config/mysql_account.json')
    database.start()
    database.use_db('create_db')
    database.create_table('../config/table_MovieList.json')
    database.stop()
Ejemplo n.º 2
0
def test_insert():
    database = MySQLServer()
    database.set_mysql('../config/mysql_account.json')
    database.start()
    database.use_db('create_db')
    database.insert('MovieList', {
        'id': '123'
    })
    database.stop()
Ejemplo n.º 3
0
def test_count():
    # start
    database = MySQLServer('../config/mysql_account.json')
    database.start()
    database.use_db('douban_movies')

    # select
    num = database.count(table_name='my_proxy')
    print(num)

    # stop
    database.stop()
Ejemplo n.º 4
0
def test_select():
    # start
    database = MySQLServer('../config/mysql_account.json')
    database.start()
    database.use_db('douban_movies')

    # select
    database.select(table_name='my_proxy')
    print(database.fetchone())
    database.select(table_name='my_proxy', where={}, limit=2)
    print(database.fetchall())

    # stop
    database.stop()
Ejemplo n.º 5
0
def test_create_db():
    database = MySQLServer()
    database.set_mysql('../config/mysql_account.json')
    database.start()
    database.create_db('create_db')
    database.stop()
Ejemplo n.º 6
0
def test_start_stop():
    database = MySQLServer()
    database.set_mysql('../config/mysql_account.json')
    database.start()
    database.stop()