Exemple #1
0
def test():
    yield from orm.create_pool(loop=loop, host='127.0.0.1', port=3306, user = '******', password='******', db='monkeyfarm')

    # findAll
    r = yield from User.findAll()
    print(r)

    # insert
    # u = User(name='Test3', email='*****@*****.**', password='******', image='about:blank')
    # yield from u.save()
    
    # update
    # if len(r) != 0:
    for user in r:
        # if user.name == 'Test2':
        #     user.name = 'Test222'
        #     user.email = '*****@*****.**'
        #     user.admin = True
        #     yield from user.update()
        
        # delete
         if user.name == 'Test3':
               yield from user.remove()
    r = yield from User.findAll()
    print(r)

    yield from orm.destroy_pool()
Exemple #2
0
def test(loop):
    yield from orm.create_pool(loop=loop,
                               user='******',
                               password='******',
                               db='webapp')
    u = User(name='test23',
             email='*****@*****.**',
             passwd='test',
             image='about:blank')
    yield from u.save()
    yield from orm.destroy_pool()
    def test():
        yield from orm.create_pool(loop=loop, host='localhost', port=3306, user='******', password='******', db='awesome')
        print('!!!!!!zheli????/')
        u = User(name='xiaoming', email='*****@*****.**', passwd='1234', image='image')
        yield from u.save()
        yield from orm.destroy_pool()

        loop = asyncio.get_event_loop()

        loop.run_until_complete(test())

        loop.close()
Exemple #4
0
def test(loop):
    yield from orm.create_pool(loop,
                               user='******',
                               password='******',
                               db='awesome')

    u = User(name='Test',
             email='*****@*****.**',
             passwd='1234567890',
             image='about:blank')

    yield from u.save()
    yield from orm.destroy_pool()
Exemple #5
0
    def test():
        b = yield from orm.create_pool(loop=loop,
                                       host='localhost',
                                       port=3306,
                                       user='******',
                                       password='******',
                                       db='mypython')
        user = User(name='Jack',
                    email='*****@*****.**',
                    passwd='1234567890',
                    image='about:blank')
        yield from user.save()
        # r = yield from User.findAll(name = 'Jack')
        # r = yield from user.findAll()
        # print(r)

        yield from orm.destroy_pool()
Exemple #6
0
def test(loop):
    yield from orm.create_pool(loop=loop,
                               host='localhost',
                               port=3306,
                               user='******',
                               password='******',
                               db='awesome')
    u = User(id=12345,
             name='Payne',
             email='*****@*****.**',
             passwd='password',
             admin=True,
             image='about:blank')
    yield from u.save()

    yield from orm.destroy_pool()

    print('test ok')