示例#1
0
def get_latest_feed_json(c, feed_url):
    return get_value(c, '''select rr.data

                             from rss_result rr,
                                  feed_result_last frl

                            where frl.feed_result_id = rr.feed_result_id
                              and rr.result_url = ? ''', (feed_url, ))
示例#2
0
文件: zeromq.py 项目: dipstef/requem
def main():
    databases = DatabasesZeroMqClient('localhost', 9090)

    with databases.connect('test') as conn:
        with conn.cursor() as cursor:
            assert 1 == get_value(cursor, '''select 1''')

            test_connection(cursor)
示例#3
0
def main():
    databases = RemoteDatabasesClient(remote_connections(connections))

    with databases.connect('test') as conn:
        with conn.cursor() as cursor:
            result = get_value(cursor, '''select 1''')
            assert 1 == result
            test_connection(cursor)
示例#4
0
文件: http.py 项目: dipstef/requem
def main():
    client = HttpServerRequests(('localhost', 8086))

    databases = DatabaseHttpClient(client)

    with databases.connect('test') as conn:
        with conn.cursor() as cursor:
            assert 1 == get_value(cursor, '''select 1''')
            test_connection(cursor)
示例#5
0
def main():
    #Start server in servers/queue
    databases = RemoteDatabasesClient(queue_client(server_address=('127.0.0.1', 50000)))

    with databases.connect('test') as conn:
        with conn.cursor() as cursor:
            result = get_value(cursor, '''select 1''')
            assert 1 == result
            test_connection(cursor)
示例#6
0
def main():
    pool = pool_manager_process(connections)
    connection = pool.connect('test')

    with closing(connection) as conn:
        cursor = conn.cursor()
        with closing(cursor) as cursor:
            assert 1 == get_value(cursor, '''select 1''')

            test_connection(cursor)
示例#7
0
def main():
    pool = pool_client(server_address=('127.0.0.1', 50001))

    connection = pool.connect('test')

    with closing(connection) as conn:
        cursor = conn.cursor()
        with closing(cursor) as cursor:
            assert 1 == get_value(cursor, '''select 1''')

            test_connection(cursor)
示例#8
0
def get_feed_entry_id(c, feed_id, url):
    return get_value(
        c, '''select id
                            from feed_entry
                           where feed_id = ?
                             and url = ? ''', (feed_id, url))
示例#9
0
def get_feed_id(cursor, url):
    return get_value(cursor, '''select id
                                  from feed
                                 where url = ? ''', (url, ))
示例#10
0
def get_feed_result_entry_id(c, feed_result_id, feed_entry_id):
    return get_value(c, '''select id
                             from feed_result_entry
                            where feed_result_id = ?
                              and feed_entry_id = ?''', (feed_result_id, feed_entry_id))
示例#11
0
def get_feed_result_id(c, result_id, published):
    return get_value(c, '''select id
                             from feed_result
                            where result_id = ?
                              and published = ?''', (result_id, published))
示例#12
0
def get_feed_result_location_id(c, feed_id, result_url):
    return get_value(c, '''select id
                             from feed_result_location
                            where feed_id = ?
                              and url = ? ''', (feed_id, result_url))
示例#13
0
def get_feed_entry_id(c, feed_id, url):
    return get_value(c, '''select id
                            from feed_entry
                           where feed_id = ?
                             and url = ? ''', (feed_id, url))