src/include/evsql.h
changeset 64 83d53afa2551
parent 63 76a782abddca
equal deleted inserted replaced
63:76a782abddca 64:83d53afa2551
   413 struct evsql *evsql_new_pq (struct event_base *ev_base, const char *pq_conninfo, 
   413 struct evsql *evsql_new_pq (struct event_base *ev_base, const char *pq_conninfo, 
   414     evsql_error_cb error_fn, 
   414     evsql_error_cb error_fn, 
   415     void *cb_arg
   415     void *cb_arg
   416 );
   416 );
   417 
   417 
   418 // @}
   418 /**
   419 
   419  * Close the evsql handle. IMPORTANT: There are severe restrictions on the use of this function. It must *NOT* be
   420 /**
   420  * called from any evsql_*_cb callback, or the program will probably crash after the callback returns.
   421  * Close a connection. Callbacks for waiting queries will not be run.
   421  *
   422  *
   422  * Currently, the evsql handle can only be free'd if the entire evsql is idle, so this will silently abort any
   423  * XXX: not implemented yet.
   423  * pending queries and transactions, which may lead to nasty things.
       
   424  *
       
   425  * As a workaround to the callback-issue, you can call evsql_destroy from the next event loop iteration, which is
       
   426  * what evsql_destroy_next does for you.
   424  *
   427  *
   425  * @param evsql the context handle from \ref evsql_new_
   428  * @param evsql the context handle from \ref evsql_new_
   426  */
   429  */
   427 void evsql_close (struct evsql *evsql);
   430 void evsql_destroy (struct evsql *evsql);
       
   431 
       
   432 /**
       
   433  * Call evsql_destroy in the next event loop iteration. If scheduling this fails, we return -1 (not a meaningful error
       
   434  * code, but nonzero).
       
   435  */
       
   436 evsql_err_t evsql_destroy_next (struct evsql *evsql);
   428 
   437 
   429 // @}
   438 // @}
   430 
   439 
   431 /**
   440 /**
   432  * Query API
   441  * Query API