Commit 30f35ef9 authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Test for and handle NULL arguments to mylog() print statements.

Include definition for _IN_ADDR_T if INADDR_NONE is not defined.
parent f47bd801
...@@ -120,7 +120,7 @@ struct tm *tim; ...@@ -120,7 +120,7 @@ struct tm *tim;
st.d = tim->tm_mday; st.d = tim->tm_mday;
st.y = tim->tm_year + 1900; st.y = tim->tm_year + 1900;
mylog("copy_and_convert: field_type = %d, fctype = %d, value = '%s', cbValueMax=%d\n", field_type, fCType, value, cbValueMax); mylog("copy_and_convert: field_type = %d, fctype = %d, value = '%s', cbValueMax=%d\n", field_type, fCType, (value==NULL)?"<NULL>":value, cbValueMax);
if ( ! value) { if ( ! value) {
/* handle a null just by returning SQL_NULL_DATA in pcbValue, */ /* handle a null just by returning SQL_NULL_DATA in pcbValue, */
......
...@@ -186,7 +186,8 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor) ...@@ -186,7 +186,8 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
if (conn != NULL) { if (conn != NULL) {
self->conn = conn; self->conn = conn;
mylog("QR_fetch_tuples: cursor = '%s', self->cursor=%u\n", cursor, self->cursor); mylog("QR_fetch_tuples: cursor = '%s', self->cursor=%u\n",
(cursor==NULL)?"":cursor, self->cursor);
if (self->cursor) if (self->cursor)
free(self->cursor); free(self->cursor);
......
...@@ -855,7 +855,7 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result); ...@@ -855,7 +855,7 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
value = QR_get_value_backend_row(res, stmt->currTuple, lf); value = QR_get_value_backend_row(res, stmt->currTuple, lf);
} }
mylog("value = '%s'\n", value); mylog("value = '%s'\n", (value==NULL)?"<NULL>":value);
retval = copy_and_convert_field_bindinfo(stmt, type, value, lf); retval = copy_and_convert_field_bindinfo(stmt, type, value, lf);
......
...@@ -23,6 +23,13 @@ ...@@ -23,6 +23,13 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#define closesocket(xxx) close(xxx) #define closesocket(xxx) close(xxx)
#define SOCKETFD int #define SOCKETFD int
#ifndef INADDR_NONE
#ifndef _IN_ADDR_T
#define _IN_ADDR_T
typedef unsigned int in_addr_t;
#endif
#define INADDR_NONE ((in_addr_t)-1)
#endif
#else #else
#include <winsock.h> #include <winsock.h>
#define SOCKETFD SOCKET #define SOCKETFD SOCKET
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment