fixed wrong functions names in mar-cli.c

This commit is contained in:
hyung-hwan 2020-06-24 09:09:56 +00:00
parent 0d745ce3d4
commit 9d91b96cf7
4 changed files with 21 additions and 19 deletions

View File

@ -167,14 +167,14 @@ static void send_test_query (mio_t* mio, const mio_ntime_t* now, mio_tmrjob_t* j
mio_bch_t tmp[256]; mio_bch_t tmp[256];
int len; int len;
if (mio_svc_mar_querywithbchars(marc, 0, MIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, MIO_NULL) <= -1) if (mio_svc_marc_querywithbchars(marc, 0, MIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, MIO_NULL) <= -1)
{ {
MIO_INFO1 (mio, "FAILED TO SEND QUERY - %js\n", mio_geterrmsg(mio)); MIO_INFO1 (mio, "FAILED TO SEND QUERY - %js\n", mio_geterrmsg(mio));
} }
mio_svc_mar_escapebchars (marc, "wild", 4, tmp); mio_svc_marc_escapebchars (marc, "wild", 4, tmp);
len = snprintf(buf, MIO_COUNTOF(buf), "SELECT name, content FROM records WHERE name like '%%%s%%'", tmp); len = snprintf(buf, MIO_COUNTOF(buf), "SELECT name, content FROM records WHERE name like '%%%s%%'", tmp);
if (mio_svc_mar_querywithbchars(marc, 1, MIO_SVC_MARC_QTYPE_SELECT, buf, len, on_result, MIO_NULL) <= -1) if (mio_svc_marc_querywithbchars(marc, 1, MIO_SVC_MARC_QTYPE_SELECT, buf, len, on_result, MIO_NULL) <= -1)
{ {
MIO_INFO1 (mio, "FAILED TO SEND QUERY - %js\n", mio_geterrmsg(mio)); MIO_INFO1 (mio, "FAILED TO SEND QUERY - %js\n", mio_geterrmsg(mio));
} }
@ -238,10 +238,10 @@ int main (int argc, char* argv[])
goto oops; goto oops;
} }
mio_svc_mar_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, MIO_NULL); mio_svc_marc_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, MIO_NULL);
mio_svc_mar_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_ACTION, "DELETE FROM", 11, on_result, MIO_NULL); mio_svc_marc_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_ACTION, "DELETE FROM", 11, on_result, MIO_NULL);
// mio_svc_mar_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, MIO_NULL); // mio_svc_marc_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, MIO_NULL);
mio_svc_mar_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_ACTION, "DELETE FROM XXX", 14, on_result, MIO_NULL); mio_svc_marc_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_ACTION, "DELETE FROM XXX", 14, on_result, MIO_NULL);
#if 0 #if 0
memset (&mi, 0, MIO_SIZEOF(mi)); memset (&mi, 0, MIO_SIZEOF(mi));

View File

@ -434,7 +434,7 @@ static sess_t* get_session (mio_svc_marc_t* marc, mio_oow_t sid)
} }
int mio_svc_mar_querywithbchars (mio_svc_marc_t* marc, mio_oow_t sid, mio_svc_marc_qtype_t qtype, const mio_bch_t* qptr, mio_oow_t qlen, mio_svc_marc_on_result_t on_result, void* qctx) int mio_svc_marc_querywithbchars (mio_svc_marc_t* marc, mio_oow_t sid, mio_svc_marc_qtype_t qtype, const mio_bch_t* qptr, mio_oow_t qlen, mio_svc_marc_on_result_t on_result, void* qctx)
{ {
mio_t* mio = marc->mio; mio_t* mio = marc->mio;
sess_t* sess; sess_t* sess;
@ -483,7 +483,7 @@ int mio_svc_mar_querywithbchars (mio_svc_marc_t* marc, mio_oow_t sid, mio_svc_ma
return 0; return 0;
} }
mio_oow_t mio_svc_mar_escapebchars (mio_svc_marc_t* marc, const mio_bch_t* qptr, mio_oow_t qlen, mio_bch_t* buf) mio_oow_t mio_svc_marc_escapebchars (mio_svc_marc_t* marc, const mio_bch_t* qptr, mio_oow_t qlen, mio_bch_t* buf)
{ {
return mysql_real_escape_string(marc->edev, buf, qptr, qlen); return mysql_real_escape_string(marc->edev, buf, qptr, qlen);
} }

View File

@ -177,7 +177,6 @@ static void start_fetch_row (mio_dev_mar_t* rdev)
MIO_DEV_MAR_SET_PROGRESS (rdev, MIO_DEV_MAR_ROW_FETCHING); MIO_DEV_MAR_SET_PROGRESS (rdev, MIO_DEV_MAR_ROW_FETCHING);
if (status) if (status)
{ {
printf ("fetch_row_start not fetched %d\n", status);
/* row not fetched */ /* row not fetched */
rdev->row_fetched_deferred = 0; rdev->row_fetched_deferred = 0;
watch_mysql (rdev, status); watch_mysql (rdev, status);
@ -185,7 +184,6 @@ printf ("fetch_row_start not fetched %d\n", status);
else else
{ {
/* row fetched - don't handle it immediately here */ /* row fetched - don't handle it immediately here */
printf ("fetch_row_start returning %d %p \n", status, row);
rdev->row_fetched_deferred = 1; rdev->row_fetched_deferred = 1;
rdev->row_wstatus = status; rdev->row_wstatus = status;
rdev->row = row; rdev->row = row;
@ -502,7 +500,6 @@ static int dev_evcb_mar_ready (mio_dev_t* dev, int events)
MIO_DEV_MAR_SET_PROGRESS (rdev, MIO_DEV_MAR_ROW_FETCHED); MIO_DEV_MAR_SET_PROGRESS (rdev, MIO_DEV_MAR_ROW_FETCHED);
if (MIO_LIKELY(rdev->on_row_fetched)) rdev->on_row_fetched (rdev, row); if (MIO_LIKELY(rdev->on_row_fetched)) rdev->on_row_fetched (rdev, row);
printf ("CALLING sTARTING FFETCH ROW %p \n", row);
if (row) start_fetch_row (rdev); if (row) start_fetch_row (rdev);
} }
else else
@ -510,7 +507,6 @@ printf ("CALLING sTARTING FFETCH ROW %p \n", row);
/* TODO: if rdev->res is MIO_NULL, error.. */ /* TODO: if rdev->res is MIO_NULL, error.. */
status = mysql_fetch_row_cont(&row, rdev->res, events_to_mysql_wstatus(events)); status = mysql_fetch_row_cont(&row, rdev->res, events_to_mysql_wstatus(events));
printf ("FETCH_ROW -> %d %p\n", status, row);
if (!status) if (!status)
{ {
/* row is available */ /* row is available */

View File

@ -237,6 +237,12 @@ static MIO_INLINE void mio_dev_mar_halt (mio_dev_mar_t* mar) { mio_dev_halt ((mi
# define mio_dev_mar_halt(mar) mio_dev_halt((mio_dev_t*)mar) # define mio_dev_mar_halt(mar) mio_dev_halt((mio_dev_t*)mar)
#endif #endif
MIO_EXPORT mio_oow_t mio_dev_mar_escapebchars (
mio_dev_mar_t* dev,
const mio_bch_t* qstr,
mio_oow_t qlen,
mio_bch_t* buf
);
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* MARDB CLIENT SERVICE */ /* MARDB CLIENT SERVICE */
@ -258,7 +264,7 @@ static MIO_INLINE mio_t* mio_svc_marc_getmio(mio_svc_marc_t* svc) { return mio_s
# define mio_svc_marc_getmio(svc) mio_svc_getmio(svc) # define mio_svc_marc_getmio(svc) mio_svc_getmio(svc)
#endif #endif
MIO_EXPORT int mio_svc_mar_querywithbchars ( MIO_EXPORT int mio_svc_marc_querywithbchars (
mio_svc_marc_t* marc, mio_svc_marc_t* marc,
mio_oow_t sid, mio_oow_t sid,
mio_svc_marc_qtype_t qtype, mio_svc_marc_qtype_t qtype,
@ -268,8 +274,8 @@ MIO_EXPORT int mio_svc_mar_querywithbchars (
void* qctx void* qctx
); );
MIO_EXPORT mio_oow_t mio_dev_mar_escapebchars ( MIO_EXPORT mio_oow_t mio_svc_marc_escapebchars (
mio_dev_mar_t* dev, mio_svc_marc_t* marc,
const mio_bch_t* qstr, const mio_bch_t* qstr,
mio_oow_t qlen, mio_oow_t qlen,
mio_bch_t* buf mio_bch_t* buf