예제 #1
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()
예제 #2
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()
예제 #3
0
def test_update():
    database = MySQLServer()
    database.set_mysql('../config/mysql_account.json')
    database.start()
    database.use_db('create_db')
    database.update('MovieList', {
        'id': '3'
    }, {
                        'id': '123'
                    })
    database.stop()
예제 #4
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()
예제 #5
0
def test_create_db():
    database = MySQLServer()
    database.set_mysql('../config/mysql_account.json')
    database.start()
    database.create_db('create_db')
    database.stop()
예제 #6
0
def test_start_stop():
    database = MySQLServer()
    database.set_mysql('../config/mysql_account.json')
    database.start()
    database.stop()