Example #1
0
def storage_db_connection(uri):
    conn = connectionForURI(uri)
    def cb(res):
        if res[0:1][0:1] and res[0][0]:
            print '%s xcap documents in the database' % res[0][0]
        return res
    def eb(fail):
        fail.printTraceback()
        return fail
    # connect early, so database problem are detected early
    d = conn.runQuery('SELECT count(*) from %s' % Config.xcap_table)
    d.addCallback(cb)
    d.addErrback(eb)
    return conn
Example #2
0
def storage_db_connection(uri):
    conn = connectionForURI(uri)

    def cb(res):
        if res[0:1][0:1] and res[0][0]:
            print '%s xcap documents in the database' % res[0][0]
        return res

    def eb(fail):
        fail.printTraceback()
        return fail

    # connect early, so database problem are detected early
    d = conn.runQuery('SELECT count(*) from %s' % Config.xcap_table)
    d.addCallback(cb)
    d.addErrback(eb)
    return conn
Example #3
0
def auth_db_connection(uri):
    conn = connectionForURI(uri)
    return conn
Example #4
0
def auth_db_connection(uri):
    conn = connectionForURI(uri)
    return conn