added the mio_svc_marc_dev_error_t type
This commit is contained in:
parent
31d92b9292
commit
dce9353bc8
@ -138,9 +138,12 @@ printf ("[%lu] NO DATA..\n", sid);
|
||||
break;
|
||||
|
||||
case MIO_SVC_MARC_RCODE_ERROR:
|
||||
printf ("QUERY ERROR - %s\n", data); /* TODO: how to get both error code and error message? */
|
||||
{
|
||||
mio_svc_marc_dev_error_t* err = (mio_svc_marc_dev_error_t*)data;
|
||||
printf ("QUERY ERROR - [%d] %s\n", err->mar_errcode, err->mar_errmsg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
|
@ -219,13 +219,16 @@ static void mar_on_query_started (mio_dev_mar_t* dev, int mar_ret, const mio_bch
|
||||
|
||||
if (mar_ret)
|
||||
{
|
||||
mio_svc_marc_dev_error_t err;
|
||||
printf ("QUERY FAILED...%d -> %s\n", mar_ret, mar_errmsg);
|
||||
#if 0
|
||||
if (mar_ret == CR_SERVER_GONE_ERROR || /* server gone away between queries */
|
||||
mar_ret == CR_SERVER_LOST) /* server gone away during a query */
|
||||
#endif
|
||||
|
||||
sq->on_result(sess->svc, sess->sid, MIO_SVC_MARC_RCODE_ERROR, mysql_error(dev->hnd), sq->qctx);
|
||||
err.mar_errcode = mar_ret;
|
||||
err.mar_errmsg = mar_errmsg;
|
||||
sq->on_result(sess->svc, sess->sid, MIO_SVC_MARC_RCODE_ERROR, &err, sq->qctx);
|
||||
|
||||
dequeue_session_query (sess->svc->mio, sess);
|
||||
send_pending_query_if_any (sess);
|
||||
|
@ -168,10 +168,18 @@ enum mio_svc_marc_rcode_t
|
||||
{
|
||||
MIO_SVC_MARC_RCODE_ROW, /* has row *- data is MYSQL_ROW */
|
||||
MIO_SVC_MARC_RCODE_DONE, /* completed or no more row - data is NULL */
|
||||
MIO_SVC_MARC_RCODE_ERROR /* query error - data is a numeric database error code cast to void* */
|
||||
MIO_SVC_MARC_RCODE_ERROR /* query error - data is mio_sv_marc_dev_error_t* */
|
||||
};
|
||||
typedef enum mio_svc_marc_rcode_t mio_svc_marc_rcode_t;
|
||||
|
||||
|
||||
struct mio_svc_marc_dev_error_t
|
||||
{
|
||||
int mar_errcode;
|
||||
const mio_bch_t* mar_errmsg;
|
||||
};
|
||||
typedef struct mio_svc_marc_dev_error_t mio_svc_marc_dev_error_t;
|
||||
|
||||
typedef void (*mio_svc_marc_on_result_t) (
|
||||
mio_svc_marc_t* marc,
|
||||
mio_oow_t sid,
|
||||
|
Loading…
Reference in New Issue
Block a user