diff options
-rw-r--r-- | src/mysql.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mysql.c b/src/mysql.c index 81364b4..1310212 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -131,6 +131,20 @@ s_mysql_connect (SCM parmlist, const char *func_name) return smob; } +static void +flush_result(MYSQL *mysql) +{ + while (mysql_next_result(mysql) == 0) { + MYSQL_RES *result = mysql_store_result(mysql); + if (!result) + break; + if (mysql_field_count(mysql)) + while (mysql_fetch_row(result)) + ; + mysql_free_result(result); + } +} + static SCM s_mysql_query(struct sql_connect *conn, const char *query) { @@ -186,6 +200,7 @@ s_mysql_query(struct sql_connect *conn, const char *query) } cell = row_head; mysql_free_result(result); + flush_result(mysql); } else { /* should it have returned something? */ if (mysql_field_count(mysql) == 0) { cell = scm_from_ulong(mysql_affected_rows(mysql)); |