diff -c psqlodbc.orig\connection.c psqlodbc\connection.c *** psqlodbc.orig\connection.c Wed Nov 30 13:44:11 2005 --- psqlodbc\connection.c Thu Dec 01 21:44:40 2005 *************** *** 1781,1786 **** --- 1795,1801 ---- char errbuffer[ERROR_MSG_LENGTH + 1]; int pos=0; + mylog("LIBPQ_execute_query: entering ...\n"); qres=QR_Constructor(); if(!qres) { *************** *** 1793,1798 **** --- 1808,1815 ---- pgres = PQexec(self->pgconn,query); PQsetNoticeProcessor(self->pgconn, CC_handle_notice, NULL); + mylog("LIBPQ_execute_query: query = %s\n",query); + qres->status = PQresultStatus(pgres); /* Check the connection status */ *************** *** 1857,1862 **** --- 1874,1881 ---- return qres; } + mylog("LIBPQ_execute_query: rest types ...\n"); + qres=CC_mapping(self,pgres,qres); QR_set_command(qres, query); PQclear(pgres); *************** *** 1870,1875 **** --- 1889,1895 ---- QResultClass * CC_mapping(ConnectionClass *self, PGresult *pgres,QResultClass *qres) { + CSTR func = "CC_mapping"; int i=0,j=0; TupleNode *node, *temp; Oid typid; *************** *** 1878,1886 **** --- 1898,1909 ---- int num_tuples = PQntuples(pgres); ConnInfo *ci = &(self->connInfo); + mylog("%s: entering ...\n",func); CI_set_num_fields(qres->fields, num_attributes); + mylog("%s: rows = %i, columns = %i\n",func,num_tuples,num_attributes); for(i = 0 ; i < num_attributes ; i++) { + mylog("%s: column = %i\n",func,i); typid = PQftype(pgres,i); atttypmod = PQfmod(pgres,i); *************** *** 1933,1938 **** --- 1956,1962 ---- } } + mylog("%s: set field info: name = %s, typ = %i, typlen = %i, attypmod = %i\n", func, PQfname(pgres,i), typid, (Int2)typlen, atttypmod); CI_set_field_info(qres->fields, i, PQfname(pgres,i), typid, (Int2)typlen, atttypmod); } *************** *** 1970,1978 **** --- 1994,2008 ---- /* PQgetvalue returns an empty string even the data value is null. * An additional checking is provided to set the null value */ if (PQgetisnull(pgres,i,j)) + { + mylog("%s: fetch column = %s, value = NULL\n",func,PQfname(pgres,j)); set_tuplefield_null(&qres->manual_tuples->list_end->tuple[j]); + } else + { + mylog("%s: fetch column = %s, value = %s\n",func,PQfname(pgres,j),PQgetvalue(pgres,i,j)); set_tuplefield_string(&qres->manual_tuples->list_end->tuple[j], PQgetvalue(pgres,i,j)); + } } }