Better handling of blobs, query print length limited by compiler flag

This commit is contained in:
2020-10-07 16:59:24 +01:00
parent fb92672739
commit 02b108635d
2 changed files with 13 additions and 4 deletions

View File

@@ -13,12 +13,19 @@
#ifndef SQL_DEBUG_COLOUR
# define SQL_DEBUG_COLOUR 36
#endif
#ifndef SQL_DEBUG_MAX_LEN
# define SQL_DEBUG_MAX_LEN 512
#endif
uint64_t simpleQuery(struct stored_conn_t *sconn, const char *qry, size_t qry_len)
{
#if defined DEBUG || defined SQL_DEBUG
printf("\x1b[%dm" "QRY: %s" "\x1b[0m" "\n", SQL_DEBUG_COLOUR, qry);
printf("\x1b[%dm" "QRY: %.*s%s" "\x1b[0m" "\n",
SQL_DEBUG_COLOUR,
SQL_DEBUG_MAX_LEN, qry,
(qry_len > SQL_DEBUG_MAX_LEN ? "..." : "")
);
#endif
char *old_ptr;