Divide *level 1(detail)* log into *level 1(tuple level)* log and *level 2(detail)* log.
break;
default:
SC_set_error(stmt, STMT_PROGRAM_TYPE_OUT_OF_RANGE, "Bind column 0 is not of type SQL_C_BOOKMARK", func);
-MYLOG(1, "Bind column 0 is type %d not of type SQL_C_BOOKMARK\n", fCType);
+MYLOG(DETAIL_LOG_LEVEL, "Bind column 0 is type %d not of type SQL_C_BOOKMARK\n", fCType);
ret = SQL_ERROR;
goto cleanup;
}
}
if ((ipar < 1) || (ipar > num_params))
{
-MYLOG(1, "num_params=%d\n", stmt->num_params);
+MYLOG(DETAIL_LOG_LEVEL, "num_params=%d\n", stmt->num_params);
SC_set_error(stmt, STMT_BAD_PARAMETER_NUMBER_ERROR, "Invalid parameter number for PGAPI_DescribeParam.", func);
return SQL_ERROR;
}
if (NOT_YET_PREPARED == stmt->prepared)
{
decideHowToPrepare(stmt, FALSE);
-MYLOG(1, "howTo=%d\n", SC_get_prepare_method(stmt));
+MYLOG(DETAIL_LOG_LEVEL, "howTo=%d\n", SC_get_prepare_method(stmt));
switch (SC_get_prepare_method(stmt))
{
case NAMED_PARSE_REQUEST:
/* parameter markers, not bound parameters. */
if (pfSqlType)
{
-MYLOG(1, "[%d].SQLType=%d .PGType=%d\n", ipar, ipdopts->parameters[ipar].SQLType, pgtype);
+MYLOG(DETAIL_LOG_LEVEL, "[%d].SQLType=%d .PGType=%d\n", ipar, ipdopts->parameters[ipar].SQLType, pgtype);
if (ipdopts->parameters[ipar].SQLType)
*pfSqlType = ipdopts->parameters[ipar].SQLType;
else if (pgtype)
SC_set_error(stmt, STMT_EXEC_ERROR, "parameter count address is null", func);
return SQL_ERROR;
}
-MYLOG(1, "num_params=%d,%d\n", stmt->num_params, stmt->proc_return);
+MYLOG(DETAIL_LOG_LEVEL, "num_params=%d,%d\n", stmt->num_params, stmt->proc_return);
if (stmt->num_params >= 0)
*pcpar = stmt->num_params;
else if (!stmt->statement)
stmt->proc_return = proc_return;
stmt->multi_statement = multi;
}
-MYLOG(1, "num_params=%d,%d\n", stmt->num_params, stmt->proc_return);
+MYLOG(DETAIL_LOG_LEVEL, "num_params=%d,%d\n", stmt->num_params, stmt->proc_return);
return SQL_SUCCESS;
}
{
Int2 lf;
-MYLOG(1, "freeall=%d allocated=%d bindings=%p\n", freeall, self->allocated, self->bindings);
+MYLOG(DETAIL_LOG_LEVEL, "freeall=%d allocated=%d bindings=%p\n", freeall, self->allocated, self->bindings);
for (lf = 1; lf <= self->allocated; lf++)
reset_a_column_binding(self, lf);
if (freeall)
{
Int2 lf;
-MYLOG(1, "freeall=%d allocated=%d gdata=%p\n", freeall, self->allocated, self->gdata);
+MYLOG(DETAIL_LOG_LEVEL, "freeall=%d allocated=%d gdata=%p\n", freeall, self->allocated, self->gdata);
if (self->fdata.ttlbuf)
{
free(self->fdata.ttlbuf);
char *errmsg = NULL;
size_t errmsglen;
char *sqlstate = NULL;
- int level = 0;
+ int level = MIN_LOG_LEVEL;
- MYLOG(1, "entering\n");
+ MYLOG(DETAIL_LOG_LEVEL, "entering\n");
sqlstate = PQresultErrorField(pgres, PG_DIAG_SQLSTATE);
if (res && pgres)
#endif /* _MSC_VER */
);
QLOG(0, "%s", vermsg);
- MYLOG(1, "Global Options: fetch=%d, unknown_sizes=%d, max_varchar_size=%d, max_longvarchar_size=%d\n",
+ MYLOG(DETAIL_LOG_LEVEL, "Global Options: fetch=%d, unknown_sizes=%d, max_varchar_size=%d, max_longvarchar_size=%d\n",
ci->drivers.fetch_max,
ci->drivers.unknown_sizes,
ci->drivers.max_varchar_size,
ci->drivers.max_longvarchar_size);
- MYLOG(1, " unique_index=%d, use_declarefetch=%d\n",
+ MYLOG(DETAIL_LOG_LEVEL, " unique_index=%d, use_declarefetch=%d\n",
ci->drivers.unique_index,
ci->drivers.use_declarefetch);
- MYLOG(1, " text_as_longvarchar=%d, unknowns_as_longvarchar=%d, bools_as_char=%d NAMEDATALEN=%d\n",
+ MYLOG(DETAIL_LOG_LEVEL, " text_as_longvarchar=%d, unknowns_as_longvarchar=%d, bools_as_char=%d NAMEDATALEN=%d\n",
ci->drivers.text_as_longvarchar,
ci->drivers.unknowns_as_longvarchar,
ci->drivers.bools_as_char,
{
encoding = check_client_encoding(ci->conn_settings);
CC_set_locale_encoding(self, encoding);
- MYLOG(1, " extra_systable_prefixes='%s', conn_settings='%s' conn_encoding='%s'\n",
+ MYLOG(DETAIL_LOG_LEVEL, " extra_systable_prefixes='%s', conn_settings='%s' conn_encoding='%s'\n",
ci->drivers.extra_systable_prefixes,
PRINT_NAME(ci->conn_settings),
encoding ? encoding : "");
QR_set_cursor(res, NULL);
QR_Destructor(wres);
CONNLOCK_ACQUIRE(self);
-MYLOG(1, "%p->permanent -> %d %p\n", res, QR_is_permanent(res), QR_get_cursor(res));
+MYLOG(DETAIL_LOG_LEVEL, "%p->permanent -> %d %p\n", res, QR_is_permanent(res), QR_get_cursor(res));
}
else
QR_set_permanent(res);
{
discard_next_savepoint = FALSE;
discard_next_release = TRUE;
-MYLOG(1, "Discarded a SAVEPOINT result\n");
+MYLOG(DETAIL_LOG_LEVEL, "Discarded a SAVEPOINT result\n");
break; /* discard the result */
}
if (SAVEPOINT_IN_PROGRESS == self->internal_op)
{
if (discard_next_release)
{
-MYLOG(1, "Discarded a RELEASE result\n");
+MYLOG(DETAIL_LOG_LEVEL, "Discarded a RELEASE result\n");
discard_next_release = FALSE;
break; /* discard the result */
}
PQclear(pgres);
pgres = NULL;
}
-MYLOG(1, " rollback_on_error=%d CC_is_in_trans=%d discard_next_savepoint=%d query_rollback=%d\n", rollback_on_error, CC_is_in_trans(self), discard_next_savepoint, query_rollback);
+MYLOG(DETAIL_LOG_LEVEL, " rollback_on_error=%d CC_is_in_trans=%d discard_next_savepoint=%d query_rollback=%d\n", rollback_on_error, CC_is_in_trans(self), discard_next_savepoint, query_rollback);
if (rollback_on_error && CC_is_in_trans(self) && !discard_next_savepoint)
{
if (query_rollback)
CC_set_errornumber(self, CONN_ERROR_IGNORED);
if (retres)
QR_set_rstatus(retres, PORES_NONFATAL_ERROR);
-MYLOG(1, " ignored abort_on_conn\n");
+MYLOG(DETAIL_LOG_LEVEL, " ignored abort_on_conn\n");
}
else if (retres)
{
if (self)
{
MYLOG(0, "CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->__error_number, NULLCHECK(self->__error_message));
- MYLOG(1, " ------------------------------------------------------------\n");
- MYLOG(1, " henv=%p, conn=%p, status=%u, num_stmts=%d\n", self->henv, self, self->status, self->num_stmts);
- MYLOG(1, " pqconn=%p, stmts=%p, lobj_type=%d\n", self->pqconn, self->stmts, self->lobj_type);
+ MYLOG(DETAIL_LOG_LEVEL, " ------------------------------------------------------------\n");
+ MYLOG(DETAIL_LOG_LEVEL, " henv=%p, conn=%p, status=%u, num_stmts=%d\n", self->henv, self, self->status, self->num_stmts);
+ MYLOG(DETAIL_LOG_LEVEL, " pqconn=%p, stmts=%p, lobj_type=%d\n", self->pqconn, self->stmts, self->lobj_type);
}
else
{
if (CONNECTION_OK != pqret)
{
const char *errmsg;
-MYLOG(1, "status=%d\n", pqret);
+MYLOG(DETAIL_LOG_LEVEL, "status=%d\n", pqret);
errmsg = PQerrorMessage(pqconn);
CC_set_error(self, CONNECTION_SERVER_NOT_REACHED, errmsg, func);
MYLOG(0, "Could not establish connection to the database; LIBPQ returned -> %s\n", errmsg);
*/
bZone = FALSE; /* time zone stuff is unreliable */
timestamp2stime(value, &std_time, &bZone, &zone);
-MYLOG(1, "2stime fr=%d\n", std_time.fr);
+MYLOG(DETAIL_LOG_LEVEL, "2stime fr=%d\n", std_time.fr);
}
else
{
{
UInt4 ival = ATOI32U(neut_str);
-MYLOG(1, "SQL_C_VARBOOKMARK value=%d\n", ival);
+MYLOG(DETAIL_LOG_LEVEL, "SQL_C_VARBOOKMARK value=%d\n", ival);
if (pcbValue)
*pcbValueBindRow = sizeof(ival);
if (cbValueMax >= sizeof(ival))
QueryParse query_org, *qp;
QueryBuild query_crt, *qb;
-MYLOG(1, "entering\n");
+MYLOG(DETAIL_LOG_LEVEL, "entering\n");
qp = &query_org;
QP_initialize(qp, stmt);
qb = &query_crt;
SQLSMALLINT num_pa = 0;
ProcessedStmt *pstmt;
-MYLOG(1, "entering\n");
+MYLOG(DETAIL_LOG_LEVEL, "entering\n");
retval = SQL_ERROR;
#define return DONT_CALL_RETURN_FROM_HERE???
return SQL_SUCCESS;
}
-MYLOG(1, "calling prepareParameters\n");
+MYLOG(DETAIL_LOG_LEVEL, "calling prepareParameters\n");
if (prepareParametersNoDesc(stmt, fake_params, PARSE_PARAM_CAST) == SQL_ERROR)
return SQL_ERROR;
ConnInfo *ci = &(conn->connInfo);
const char *bestitem = NULL;
-MYLOG(1, "entering prepared=%d\n", stmt->prepared);
+MYLOG(DETAIL_LOG_LEVEL, "entering prepared=%d\n", stmt->prepared);
if (!stmt->statement)
{
SC_set_error(stmt, STMT_INTERNAL_ERROR, "No statement string", func);
qp->from_pos = stmt->from_pos;
qp->where_pos = stmt->where_pos;
}
-MYLOG(1, "type=%d concur=%d\n", stmt->options.cursor_type, stmt->options.scroll_concurrency);
+MYLOG(DETAIL_LOG_LEVEL, "type=%d concur=%d\n", stmt->options.cursor_type, stmt->options.scroll_concurrency);
}
SC_miscinfo_clear(stmt);
qp->prev_token_end = TRUE;
qp->token_curr[qp->token_len] = '\0';
strncpy_null(finished_token, qp->token_curr, sizeof(qp->token_curr));
-MYLOG(1, "finished token=%s\n", finished_token);
+MYLOG(DETAIL_LOG_LEVEL, "finished token=%s\n", finished_token);
ret = qp->token_len;
}
return ret;
qb.flags |= FLGB_BINARY_AS_POSSIBLE;
- MYLOG(1, "num_params=%d proc_return=%d\n", num_params, stmt->proc_return);
+ MYLOG(DETAIL_LOG_LEVEL, "num_params=%d proc_return=%d\n", num_params, stmt->proc_return);
num_p = num_params - qb.num_discard_params;
-MYLOG(1, "num_p=%d\n", num_p);
+MYLOG(DETAIL_LOG_LEVEL, "num_p=%d\n", num_p);
discard_output = (0 != (qb.flags & FLGB_DISCARD_OUTPUT));
*nParams = 0;
if (num_p > 0)
goto cleanup;
}
- MYLOG(1, "%dth parameter type oid is %u\n", i, PIC_dsp_pgtype(conn, parameters[i]));
+ MYLOG(DETAIL_LOG_LEVEL, "%dth parameter type oid is %u\n", i, PIC_dsp_pgtype(conn, parameters[i]));
if (i < qb.proc_return)
continue;
UCHAR calv[MAX_NUMERIC_DIGITS];
int precision;
-MYLOG(1, "C_NUMERIC [prec=%d scale=%d]", ns->precision, ns->scale);
+MYLOG(DETAIL_LOG_LEVEL, "C_NUMERIC [prec=%d scale=%d]", ns->precision, ns->scale);
if (0 == ns->precision)
{
* digit is at calv[0]
*/
-MYPRINTF(1, " len2=%d", len);
+MYPRINTF(DETAIL_LOG_LEVEL, " len2=%d", len);
/* build the final output string. */
newlen = 0;
if (0 == len)
chrform[newlen++] = '0';
chrform[newlen] = '\0';
-MYLOG(1, " convval(2) len=%d %s\n", newlen, chrform);
+MYLOG(DETAIL_LOG_LEVEL, " convval(2) len=%d %s\n", newlen, chrform);
}
/*
*/
param_number = ++qb->param_number;
-MYLOG(1, "para:%d(%d,%d)\n", param_number, ipdopts->allocated, apdopts->allocated);
+MYLOG(DETAIL_LOG_LEVEL, "para:%d(%d,%d)\n", param_number, ipdopts->allocated, apdopts->allocated);
apara = NULL;
ipara = NULL;
if (param_number < apdopts->allocated)
return SQL_ERROR;
}
-MYLOG(1, "ipara=%p paramType=%d %d proc_return=%d\n", ipara, ipara ? ipara->paramType : -1, PG_VERSION_LT(conn, 8.1), qb->proc_return);
+MYLOG(DETAIL_LOG_LEVEL, "ipara=%p paramType=%d %d proc_return=%d\n", ipara, ipara ? ipara->paramType : -1, PG_VERSION_LT(conn, 8.1), qb->proc_return);
if (param_number < qb->proc_return)
{
if (ipara && SQL_PARAM_OUTPUT != ipara->paramType)
for (i = 0; i < len; i++)
{
inc = in[i];
- MYLOG(1, "in[" FORMAT_SIZE_T "] = %d, %c\n", i, inc, inc);
+ MYLOG(DETAIL_LOG_LEVEL, "in[" FORMAT_SIZE_T "] = %d, %c\n", i, inc, inc);
if (inc < 128 && (isalnum(inc) || inc == ' '))
out[o++] = inc;
else
{
int i;
-MYLOG(1, "entering count=%d\n", count);
+MYLOG(DETAIL_LOG_LEVEL, "entering count=%d\n", count);
if (ti)
{
for (i = 0; i < count; i++)
}
void FI_Constructor(FIELD_INFO *self, BOOL reuse)
{
-MYLOG(1, "entering reuse=%d\n", reuse);
+MYLOG(DETAIL_LOG_LEVEL, "entering reuse=%d\n", reuse);
if (reuse)
FI_Destructor(&self, 1, FALSE);
memset(self, 0, sizeof(FIELD_INFO));
{
int i;
-MYLOG(1, "entering count=%d\n", count);
+MYLOG(DETAIL_LOG_LEVEL, "entering count=%d\n", count);
if (fi)
{
for (i = 0; i < count; i++)
static void ARDFields_free(ARDFields * self)
{
-MYLOG(1, "entering %p bookmark=%p\n", self, self->bookmark);
+MYLOG(DETAIL_LOG_LEVEL, "entering %p bookmark=%p\n", self, self->bookmark);
if (self->bookmark)
{
free(self->bookmark);
}
if (targethd->type_defined)
{
-MYLOG(1, "source type=%d -> target type=%d\n", srchd->desc_type, targethd->desc_type);
+MYLOG(DETAIL_LOG_LEVEL, "source type=%d -> target type=%d\n", srchd->desc_type, targethd->desc_type);
if (SQL_ATTR_IMP_ROW_DESC == targethd->desc_type)
{
MYLOG(0, "can't modify IRD\n");
switch (srchd->desc_type)
{
case SQL_ATTR_APP_ROW_DESC:
-MYLOG(1, "src=%p target=%p type=%d", src, target, srchd->desc_type);
+MYLOG(DETAIL_LOG_LEVEL, "src=%p target=%p type=%d", src, target, srchd->desc_type);
if (!targethd->type_defined)
{
targethd->desc_type = srchd->desc_type;
}
ard_src = &(src->ardf);
-MYPRINTF(1, " rowset_size=" FORMAT_LEN " bind_size=%d ope_ptr=%p off_ptr=%p\n",
+MYPRINTF(DETAIL_LOG_LEVEL, " rowset_size=" FORMAT_LEN " bind_size=%d ope_ptr=%p off_ptr=%p\n",
ard_src->size_of_rowset, ard_src->bind_size,
ard_src->row_operation_ptr, ard_src->row_offset_ptr);
ard_tgt = &(target->ardf);
-MYPRINTF(1, " target=%p", ard_tgt);
+MYPRINTF(DETAIL_LOG_LEVEL, " target=%p", ard_tgt);
ARDFields_copy(ard_src, ard_tgt);
-MYPRINTF(1, " offset_ptr=%p\n", ard_tgt->row_offset_ptr);
+MYPRINTF(DETAIL_LOG_LEVEL, " offset_ptr=%p\n", ard_tgt->row_offset_ptr);
break;
case SQL_ATTR_APP_PARAM_DESC:
if (!targethd->type_defined)
BOOL abbrev = (len < 1024) || 0 < ci->force_abbrev_connstr;
UInt4 flag;
-MYLOG(1, "force_abbrev=%d abbrev=%d\n", ci->force_abbrev_connstr, abbrev);
+MYLOG(DETAIL_LOG_LEVEL, "force_abbrev=%d abbrev=%d\n", ci->force_abbrev_connstr, abbrev);
encode(ci->password, encoded_item, sizeof(encoded_item));
/* fundamental info */
nlen = MAX_CONNECT_STRING;
/* extra info */
hlen = strlen(connect_string);
nlen = MAX_CONNECT_STRING - hlen;
-MYLOG(1, "hlen=" FORMAT_SSIZE_T "\n", hlen);
+MYLOG(DETAIL_LOG_LEVEL, "hlen=" FORMAT_SSIZE_T "\n", hlen);
if (!abbrev)
{
char protocol_and[16];
get_Ci_Drivers(DSN, ODBC_INI, &(ci->drivers));
STR_TO_NAME(ci->drivers.drivername, drivername);
- MYLOG(1, "DSN info: DSN='%s',server='%s',port='%s',dbase='%s',user='%s',passwd='%s'\n",
+ MYLOG(DETAIL_LOG_LEVEL, "DSN info: DSN='%s',server='%s',port='%s',dbase='%s',user='%s',passwd='%s'\n",
DSN,
ci->server,
ci->port,
ci->database,
ci->username,
NAME_IS_VALID(ci->password) ? "xxxxx" : "");
- MYLOG(1, " onlyread='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n",
+ MYLOG(DETAIL_LOG_LEVEL, " onlyread='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n",
ci->onlyread,
ci->show_oid_column,
ci->fake_oid_index,
#ifdef NOT_USED
char *enc = (char *) check_client_encoding(ci->conn_settings);
- MYLOG(1, " conn_settings='%s', conn_encoding='%s'\n", ci->conn_settings,
+ MYLOG(DETAIL_LOG_LEVEL, " conn_settings='%s', conn_encoding='%s'\n", ci->conn_settings,
NULL != enc ? enc : "(null)");
if (NULL != enc)
free(enc);
#endif /* NOT_USED */
- MYLOG(1, " translation_dll='%s',translation_option='%s'\n",
+ MYLOG(DETAIL_LOG_LEVEL, " translation_dll='%s',translation_option='%s'\n",
ci->translation_dll,
ci->translation_option);
}
return 0;
}
+#define INIT_DISP_LOGVAL 2
+
static int
driver_options_update(HWND hdlg, ConnInfo *ci)
{
GLOBAL_VALUES *comval;
BOOL bTranslated;
-MYLOG(2, "entering\n");
+MYLOG(3, "entering\n");
comval = &(ci->drivers);
- (comval->commlog = GetDlgItemInt(hdlg, DS_COMMLOG, &bTranslated, FALSE)) || bTranslated || (comval->commlog = 1);
+ (comval->commlog = GetDlgItemInt(hdlg, DS_COMMLOG, &bTranslated, FALSE)) || bTranslated || (comval->commlog = INIT_DISP_LOGVAL);
comval->unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
comval->use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
comval->parse = IsDlgButtonChecked(hdlg, DRV_PARSE);
- (comval->debug = GetDlgItemInt(hdlg, DS_DEBUG, &bTranslated, FALSE)) || bTranslated || (comval->debug = 1);
- if (!bTranslated)
- comval->debug = 1;
+ (comval->debug = GetDlgItemInt(hdlg, DS_DEBUG, &bTranslated, FALSE)) || bTranslated || (comval->debug = INIT_DISP_LOGVAL);
comval->fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_SIZE, NULL, FALSE);
comval->max_varchar_size = GetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, NULL, FALSE);
{
ShowWindow(GetDlgItem(hdlg, nIDint), SW_SHOW);
if (bTranslated)
- SetDlgItemInt(hdlg, nIDint, 1, FALSE);
+ SetDlgItemInt(hdlg, nIDint, INIT_DISP_LOGVAL, FALSE);
}
break;
case BST_UNCHECKED:
#ifdef WIN32
dialog:
#endif
-MYLOG(1, "DriverCompletion=%d\n", fDriverCompletion);
+MYLOG(DETAIL_LOG_LEVEL, "DriverCompletion=%d\n", fDriverCompletion);
switch (fDriverCompletion)
{
#ifdef WIN32
}
reqs = 0;
-MYLOG(1, "before CC_connect\n");
+MYLOG(DETAIL_LOG_LEVEL, "before CC_connect\n");
/* do the actual connect */
retval = CC_connect(conn, salt);
if (retval < 0)
cleanup:
#undef return
-MYLOG(1, "leaving %d\n", retval);
+MYLOG(DETAIL_LOG_LEVEL, "leaving %d\n", retval);
return retval;
}
* execute this statement again
*/
stmt->statement = make_string(szSqlStr, cbSqlStr, NULL, 0);
-MYLOG(1, "a2\n");
+MYLOG(DETAIL_LOG_LEVEL, "a2\n");
if (!stmt->statement)
{
SC_set_error(stmt, STMT_NO_MEMORY_ERROR, "No memory available to store statement", func);
if (HowToPrepareBeforeExec(stmt, FALSE) >= allowParse)
prepare_before_exec = TRUE;
-MYLOG(1, "prepare_before_exec=%d srv=%d\n", prepare_before_exec, conn->connInfo.use_server_side_prepare);
+MYLOG(DETAIL_LOG_LEVEL, "prepare_before_exec=%d srv=%d\n", prepare_before_exec, conn->connInfo.use_server_side_prepare);
/* Create the statement with parameters substituted. */
retval = copy_statement_with_parameters(stmt, prepare_before_exec);
stmt->current_exec_param = -1;
ConnectionClass *conn;
ConnInfo *ci = NULL;
-MYLOG(1, "entering %p->external=%d\n", stmt, stmt->external);
+MYLOG(DETAIL_LOG_LEVEL, "entering %p->external=%d\n", stmt, stmt->external);
conn = SC_get_conn(stmt);
if (conn)
ci = &conn->connInfo;
ENTER_CONN_CS(conn);
conn->lock_CC_for_rb++;
}
-MYLOG(1, " %p->accessed=%d opt=%u in_progress=%u prev=%u\n", conn, CC_accessed_db(conn), option, conn->opt_in_progress, conn->opt_previous);
+MYLOG(DETAIL_LOG_LEVEL, " %p->accessed=%d opt=%u in_progress=%u prev=%u\n", conn, CC_accessed_db(conn), option, conn->opt_in_progress, conn->opt_previous);
conn->opt_in_progress &= option;
switch (stmt->statement_type)
{
}
}
CC_set_accessed_db(conn);
-MYLOG(1, "leaving %p->accessed=%d\n", conn, CC_accessed_db(conn));
+MYLOG(DETAIL_LOG_LEVEL, "leaving %p->accessed=%d\n", conn, CC_accessed_db(conn));
return ret;
}
ConnectionClass *conn = SC_get_conn(stmt);
BOOL start_stmt = FALSE;
-MYLOG(1, "entering %p->accessed=%d is_in=%d is_rb=%d is_tc=%d\n", conn, CC_accessed_db(conn),
+MYLOG(DETAIL_LOG_LEVEL, "entering %p->accessed=%d is_in=%d is_rb=%d is_tc=%d\n", conn, CC_accessed_db(conn),
CC_is_in_trans(conn), SC_is_rb_stmt(stmt), SC_is_tc_stmt(stmt));
if (conn->lock_CC_for_rb > 0)
MYLOG(0, "in_progress=%u previous=%d\n", conn->opt_in_progress, conn->opt_previous);
}
else if (errorOnly)
return ret;
-MYLOG(1, "\tret=%d\n", ret);
+MYLOG(DETAIL_LOG_LEVEL, "\tret=%d\n", ret);
cleanup:
#ifdef NOT_USED
if (!SC_is_prepare_statement(stmt) && ONCE_DESCRIBED == stmt->prepared)
{
LEAVE_CONN_CS(conn);
conn->lock_CC_for_rb--;
- MYLOG(1, " release conn_lock\n");
+ MYLOG(DETAIL_LOG_LEVEL, " release conn_lock\n");
}
CC_start_stmt(conn);
}
- MYLOG(1, "leaving %d\n", ret);
+ MYLOG(DETAIL_LOG_LEVEL, "leaving %d\n", ret);
return ret;
}
/* Done, now copy the params and then execute the statement */
ipdopts = SC_get_IPDF(estmt);
-MYLOG(1, "ipdopts=%p\n", ipdopts);
+MYLOG(DETAIL_LOG_LEVEL, "ipdopts=%p\n", ipdopts);
if (estmt->data_at_exec == 0)
{
BOOL exec_end;
num_p = estmt->num_params;
if (num_p < 0)
PGAPI_NumParams(estmt, &num_p);
-MYLOG(1, "i=%d allocated=%d num_p=%d\n", i, apdopts->allocated, num_p);
+MYLOG(DETAIL_LOG_LEVEL, "i=%d allocated=%d num_p=%d\n", i, apdopts->allocated, num_p);
if (num_p > apdopts->allocated)
num_p = apdopts->allocated;
/* At least 1 data at execution parameter, so Fill in the token value */
for (; i < num_p; i++)
{
-MYLOG(1, "i=%d", i);
+MYLOG(DETAIL_LOG_LEVEL, "i=%d", i);
if (apdopts->parameters[i].data_at_exec)
{
-MYPRINTF(1, " at exec buffer=%p", apdopts->parameters[i].buffer);
+MYPRINTF(DETAIL_LOG_LEVEL, " at exec buffer=%p", apdopts->parameters[i].buffer);
estmt->data_at_exec--;
estmt->current_exec_param = i;
estmt->put_data = FALSE;
SQLULEN offset = apdopts->param_offset_ptr ? *apdopts->param_offset_ptr : 0;
SQLLEN perrow = apdopts->param_bind_type > 0 ? apdopts->param_bind_type : apdopts->parameters[i].buflen;
-MYPRINTF(1, " offset=" FORMAT_LEN " perrow=" FORMAT_LEN, offset, perrow);
+MYPRINTF(DETAIL_LOG_LEVEL, " offset=" FORMAT_LEN " perrow=" FORMAT_LEN, offset, perrow);
*prgbValue = apdopts->parameters[i].buffer + offset + estmt->exec_current_row * perrow;
}
else
}
break;
}
-MYPRINTF(1, "\n");
+MYPRINTF(DETAIL_LOG_LEVEL, "\n");
}
retval = SQL_NEED_DATA;
-MYLOG(1, "return SQL_NEED_DATA\n");
+MYLOG(DETAIL_LOG_LEVEL, "return SQL_NEED_DATA\n");
cleanup:
#undef return
SC_setInsertedTable(stmt, retval);
if (sqlType == SQL_LONGVARBINARY)
{
ConnInfo *ci = &(conn->connInfo);
-MYLOG(1, "%d sqltype=%d -> pgtype=%d\n", ci->bytea_as_longvarbinary, sqlType, pgType);
+MYLOG(DETAIL_LOG_LEVEL, "%d sqltype=%d -> pgtype=%d\n", ci->bytea_as_longvarbinary, sqlType, pgType);
}
if (fSqlType == SQL_ALL_TYPES || fSqlType == sqlType)
{
set_tuplefield_string(&tuple[GETTYPE_TYPE_NAME], PGTYPE_TO_NAME(conn, pgType, TRUE));
set_tuplefield_int2(&tuple[GETTYPE_NULLABLE], SQL_NO_NULLS);
-MYLOG(1, "serial in\n");
+MYLOG(DETAIL_LOG_LEVEL, "serial in\n");
}
else
{
set_tuplefield_int4(&tuple[SPECOLS_BUFFER_LENGTH], PGTYPE_ATTR_BUFFER_LENGTH(conn, the_type, atttypmod));
set_tuplefield_int2(&tuple[SPECOLS_DECIMAL_DIGITS], PGTYPE_ATTR_DECIMAL_DIGITS(conn, the_type, atttypmod));
set_tuplefield_int2(&tuple[SPECOLS_PSEUDO_COLUMN], SQL_PC_NOT_PSEUDO);
-MYLOG(1, "Add ctid\n");
+MYLOG(DETAIL_LOG_LEVEL, "Add ctid\n");
}
}
else
return buf;
}
-MYLOG(1, "malloc size=" FORMAT_SIZE_T "\n", length);
+MYLOG(DETAIL_LOG_LEVEL, "malloc size=" FORMAT_SIZE_T "\n", length);
str = malloc(length + 1);
-MYLOG(1, "str=%p\n", str);
+MYLOG(DETAIL_LOG_LEVEL, "str=%p\n", str);
if (!str)
return NULL;
#define QPRINTF(level, ...) ((level < get_qlog() ? qprintf(__VA_ARGS__) : 0), MYPRINTF(level, __VA_ARGS__))
#endif /* __GNUC__ */
+#define MIN_LOG_LEVEL 0
+#define TUPLE_LOG_LEVEL 1
+#define DETAIL_LOG_LEVEL 2
+
int get_qlog(void);
int get_mylog(void);
ENTER_CONN_CS(conn);
ret = PGAPI_AllocDesc(InputHandle, OutputHandle);
LEAVE_CONN_CS(conn);
-MYLOG(1, "OutputHandle=%p\n", *OutputHandle);
+MYLOG(DETAIL_LOG_LEVEL, "OutputHandle=%p\n", *OutputHandle);
break;
default:
ret = SQL_ERROR;
ConnectionClass *conn = (ConnectionClass *) hdbc;
ConnInfo *ci = &(conn->connInfo);
-MYLOG(1, "lie=%d\n", ci->drivers.lie);
+MYLOG(DETAIL_LOG_LEVEL, "lie=%d\n", ci->drivers.lie);
CC_examine_global_transaction(conn);
CC_clear_error(conn);
if (fFunction != SQL_API_ODBC3_ALL_FUNCTIONS)
utf8_to_ucs2(szOut, maxlen, szConnStrOut, cbConnStrOutMax);
if (outlen >= cbConnStrOutMax && NULL != szConnStrOut && NULL != pcbConnStrOut)
{
-MYLOG(1, "cbConnstrOutMax=%d pcb=%p\n", cbConnStrOutMax, pcbConnStrOut);
+MYLOG(DETAIL_LOG_LEVEL, "cbConnstrOutMax=%d pcb=%p\n", cbConnStrOutMax, pcbConnStrOut);
if (SQL_SUCCESS == ret)
{
CC_set_error(conn, CONN_TRUNCATED, "the ConnStrOut is too small", func);
{
char *str;
-MYLOG(1, "entering non-manual result\n");
+MYLOG(DETAIL_LOG_LEVEL, "entering non-manual result\n");
fi->dquote = TRUE;
STR_TO_NAME(fi->column_name, QR_get_value_backend_text(col_info->result, k, COLUMNS_COLUMN_NAME));
OID basetype;
const char *col;
-MYLOG(1, "entering num_cols=" FORMAT_ULEN " col=%s\n", QR_get_num_cached_tuples(col_info->result), PRINT_NAME(fi->column_name));
+MYLOG(DETAIL_LOG_LEVEL, "entering num_cols=" FORMAT_ULEN " col=%s\n", QR_get_num_cached_tuples(col_info->result), PRINT_NAME(fi->column_name));
if (fi->attnum < 0)
return FALSE;
for (k = 0; k < QR_get_num_cached_tuples(col_info->result); k++)
if (basetype = (OID) strtoul(QR_get_value_backend_text(col_info->result, k, COLUMNS_BASE_TYPEID), NULL, 10), 0 == basetype)
basetype = (OID) strtoul(QR_get_value_backend_text(col_info->result, k, COLUMNS_FIELD_TYPE), NULL, 10);
atttypmod = QR_get_value_backend_int(col_info->result, k, COLUMNS_ATTTYPMOD, NULL);
-MYLOG(1, "%d attnum=%d\n", k, attnum);
+MYLOG(DETAIL_LOG_LEVEL, "%d attnum=%d\n", k, attnum);
if (attnum == fi->attnum &&
basetype == fi->basetype &&
atttypmod == fi->typmod)
else if (NAME_IS_VALID(fi->column_name))
{
col = QR_get_value_backend_text(col_info->result, k, COLUMNS_COLUMN_NAME);
-MYLOG(1, "%d col=%s\n", k, col);
+MYLOG(DETAIL_LOG_LEVEL, "%d col=%s\n", k, col);
if (fi->dquote)
cmp = strcmp(col, GET_NAME(fi->column_name));
else
BOOL multi_table = FALSE;
QResultClass *res;
-MYLOG(1, "entering ntab=%d", stmt->ntab);
+MYLOG(DETAIL_LOG_LEVEL, "entering ntab=%d", stmt->ntab);
if (1 < stmt->ntab)
multi_table = TRUE;
else if (SC_has_join(stmt))
reloid = greloid;
else if (reloid != greloid)
{
-MYPRINTF(1, " DOHHH i=%d %u!=%u ", i, reloid, greloid);
+MYPRINTF(DETAIL_LOG_LEVEL, " DOHHH i=%d %u!=%u ", i, reloid, greloid);
multi_table = TRUE;
break;
}
}
}
}
-MYPRINTF(1, " multi=%d\n", multi_table);
+MYPRINTF(DETAIL_LOG_LEVEL, " multi=%d\n", multi_table);
return multi_table;
}
/*
STR_TO_NAME(wti->table_name,
QR_get_value_backend_text(res, 0, COLUMNS_TABLE_NAME));
}
-MYLOG(1, "#2 %p->table_name=%s(%u)\n", wti, PRINT_NAME(wti->table_name), wti->table_oid);
+MYLOG(DETAIL_LOG_LEVEL, "#2 %p->table_name=%s(%u)\n", wti, PRINT_NAME(wti->table_name), wti->table_oid);
/*
* Store the table name and the SQLColumns result
* structure
conn->ntables++;
if (res && QR_get_num_cached_tuples(res) > 0)
-MYLOG(1, "oid item == %s\n", (const char *) QR_get_value_backend_text(res, 0, 3));
+MYLOG(DETAIL_LOG_LEVEL, "oid item == %s\n", (const char *) QR_get_value_backend_text(res, 0, 3));
MYLOG(0, "Created col_info table='%s', ntables=%d\n", PRINT_NAME(wti->table_name), conn->ntables);
/* Associate a table from the statement with a SQLColumn info */
TABLE_INFO *wti = *pti;
COL_INFO *coli;
-MYLOG(1, "entering reloid=%u ti=%p\n", reloid, wti);
+MYLOG(DETAIL_LOG_LEVEL, "entering reloid=%u ti=%p\n", reloid, wti);
if (!conn)
conn = SC_get_conn(stmt);
if (!wti) /* SQLColAttribute case */
}
if (!wti)
{
-MYLOG(1, "before increaseNtab\n");
+MYLOG(DETAIL_LOG_LEVEL, "before increaseNtab\n");
if (!increaseNtab(stmt, func))
return FALSE;
wti = stmt->ti[stmt->ntab - 1];
}
*pti = wti;
}
-MYLOG(1, "fi=%p greloid=%d col_info=%p\n", wti, greloid, wti->col_info);
+MYLOG(DETAIL_LOG_LEVEL, "fi=%p greloid=%d col_info=%p\n", wti, greloid, wti->col_info);
if (0 == greloid)
greloid = wti->table_oid;
if (NULL != wti->col_info)
STR_TO_NAME(wti->table_name,
QR_get_value_backend_text(res, 0, COLUMNS_TABLE_NAME));
}
-MYLOG(1, "#1 %p->table_name=%s(%u)\n", wti, PRINT_NAME(wti->table_name), wti->table_oid);
+MYLOG(DETAIL_LOG_LEVEL, "#1 %p->table_name=%s(%u)\n", wti, PRINT_NAME(wti->table_name), wti->table_oid);
if (colatt /* SQLColAttribute case */
&& 0 == (wti->flags & TI_COLATTRIBUTE))
{
}
else if (!colatt && stmt)
SC_set_parse_status(stmt, STMT_PARSE_FATAL);
-MYLOG(1, "leaving returns %d\n", found);
+MYLOG(DETAIL_LOG_LEVEL, "leaving returns %d\n", found);
return found;
}
BOOL contains_key = FALSE;
int i;
-MYLOG(1, "entering fields=" FORMAT_SIZE_T " ntab=%d\n", nfields, stmt->ntab);
+MYLOG(DETAIL_LOG_LEVEL, "entering fields=" FORMAT_SIZE_T " ntab=%d\n", nfields, stmt->ntab);
if (!fi) return ret;
if (0 >= nfields) return ret;
if (!has_multi_table(stmt) && 1 == stmt->ntab)
if (oneti == tfi->ti &&
strcmp(keycolnam, SAFE_NAME(tfi->column_name)) == 0)
{
-MYLOG(1, "key %s found at %p\n", keycolnam, fi + i);
+MYLOG(DETAIL_LOG_LEVEL, "key %s found at %p\n", keycolnam, fi + i);
tfi->columnkey = TRUE;
break;
}
goto cleanup;
ret = SQL_SUCCESS;
}
-MYLOG(1, "contains_key=%d\n", contains_key);
+MYLOG(DETAIL_LOG_LEVEL, "contains_key=%d\n", contains_key);
for (i = 0; i < nfields; i++)
{
if (tfi = fi[i], NULL == tfi)
#include <stdio.h>
#include <string.h>
+
#include "environ.h"
#include "connection.h"
#include "statement.h"
rc = QR_get_num_total_tuples(res) - res->dl_count;
}
*((SQLLEN *) DiagInfoPtr) = rc;
-MYLOG(1, "rc=" FORMAT_LEN "\n", rc);
+MYLOG(DETAIL_LOG_LEVEL, "rc=" FORMAT_LEN "\n", rc);
ret = SQL_SUCCESS;
break;
case SQL_DIAG_ROW_COUNT:
}
if (RecNumber <=0)
{
-MYLOG(1, "RecN=%d allocated=%d\n", RecNumber, opts->allocated);
+MYLOG(DETAIL_LOG_LEVEL, "RecN=%d allocated=%d\n", RecNumber, opts->allocated);
DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR,
"bad parameter number");
return SQL_ERROR;
}
if (RecNumber > opts->allocated)
{
-MYLOG(1, "RecN=%d allocated=%d\n", RecNumber, opts->allocated);
+MYLOG(DETAIL_LOG_LEVEL, "RecN=%d allocated=%d\n", RecNumber, opts->allocated);
parameter_bindings_set(opts, RecNumber, TRUE);
/* DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR,
"bad parameter number");
}
if (RecNumber <= 0 || RecNumber > ipdopts->allocated)
{
-MYLOG(1, "RecN=%d allocated=%d\n", RecNumber, ipdopts->allocated);
+MYLOG(DETAIL_LOG_LEVEL, "RecN=%d allocated=%d\n", RecNumber, ipdopts->allocated);
DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR,
"bad parameter number");
return SQL_ERROR;
break;
default:if (RecNumber <= 0 || RecNumber > opts->allocated)
{
-MYLOG(1, "RecN=%d allocated=%d\n", RecNumber, opts->allocated);
+MYLOG(DETAIL_LOG_LEVEL, "RecN=%d allocated=%d\n", RecNumber, opts->allocated);
DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR,
"bad parameter number");
return SQL_ERROR;
break;
default:if (RecNumber <= 0 || RecNumber > ipdopts->allocated)
{
-MYLOG(1, "RecN=%d allocated=%d\n", RecNumber, ipdopts->allocated);
+MYLOG(DETAIL_LOG_LEVEL, "RecN=%d allocated=%d\n", RecNumber, ipdopts->allocated);
DC_set_error(desc, DESC_BAD_PARAMETER_NUMBER_ERROR,
"bad parameter number");
return SQL_ERROR;
else
{
stmt->ard = (DescriptorClass *) Value;
-MYLOG(1, "set ard=%p\n", stmt->ard);
+MYLOG(DETAIL_LOG_LEVEL, "set ard=%p\n", stmt->ard);
}
break;
case SQL_ATTR_APP_PARAM_DESC: /* 10011 */
* Static ColumnSize (i.e., the Maximum ColumnSize of the datatype) This
* has nothing to do with a result set.
*/
-MYLOG(1, "!!! atttypmod < 0 ?\n");
+MYLOG(DETAIL_LOG_LEVEL, "!!! atttypmod < 0 ?\n");
if (atttypmod < 0 && adtsize_or_longestlen < 0)
return maxsize;
-MYLOG(1, "!!! adtsize_or_logngest=%d\n", adtsize_or_longestlen);
+MYLOG(DETAIL_LOG_LEVEL, "!!! adtsize_or_logngest=%d\n", adtsize_or_longestlen);
p = adtsize_or_longestlen; /* longest */
/*
* Catalog Result Sets -- use assigned column width (i.e., from
* set_tuplefield_string)
*/
-MYLOG(1, "!!! catalog_result=%d\n", handle_unknown_size_as);
+MYLOG(DETAIL_LOG_LEVEL, "!!! catalog_result=%d\n", handle_unknown_size_as);
if (UNKNOWNS_AS_LONGEST == handle_unknown_size_as)
{
MYLOG(0, "LONGEST: p = %d\n", p);
case PG_TYPE_XID:
return "xid";
case PG_TYPE_INT4:
-MYLOG(1, "pgtype_to_name int4\n");
+MYLOG(DETAIL_LOG_LEVEL, "pgtype_to_name int4\n");
return auto_increment ? "serial" : "int4";
case PG_TYPE_FLOAT4:
return "float4";
UInt4 num_fields;
if (!self) return NULL;
-MYLOG(1, FORMAT_ULEN "th row(%d fields) alloc=" FORMAT_LEN "\n", self->num_cached_rows, QR_NumResultCols(self), self->count_backend_allocated);
+MYLOG(DETAIL_LOG_LEVEL, FORMAT_ULEN "th row(%d fields) alloc=" FORMAT_LEN "\n", self->num_cached_rows, QR_NumResultCols(self), self->count_backend_allocated);
if (num_fields = QR_NumResultCols(self), !num_fields) return NULL;
if (self->num_fields <= 0)
{
if (SQL_PARAM_OUTPUT == paramType ||
SQL_PARAM_INPUT_OUTPUT == paramType)
{
-MYLOG(1, "[%d].PGType %u->%u\n", i, PIC_get_pgtype(ipdopts->parameters[i]), CI_get_oid(QR_get_fields(self), cidx));
+MYLOG(DETAIL_LOG_LEVEL, "[%d].PGType %u->%u\n", i, PIC_get_pgtype(ipdopts->parameters[i]), CI_get_oid(QR_get_fields(self), cidx));
PIC_set_pgtype(ipdopts->parameters[i], CI_get_oid(QR_get_fields(self), cidx));
cidx++;
}
if (!QR_read_tuples_from_pgres(self, pgres))
return FALSE;
-MYLOG(1, "!!%p->cursTup=" FORMAT_LEN " total_read=" FORMAT_ULEN "\n", self, self->cursTuple, self->num_total_read);
+MYLOG(DETAIL_LOG_LEVEL, "!!%p->cursTup=" FORMAT_LEN " total_read=" FORMAT_ULEN "\n", self, self->cursTuple, self->num_total_read);
if (!QR_once_reached_eof(self) && self->cursTuple >= (Int4) self->num_total_read)
self->num_total_read = self->cursTuple + 1;
/* EOF is 'fetched < fetch requested' */
does_commit = TRUE;
}
-MYLOG(1, " Case I CC_send_query %s flag=%x\n", buf, flag);
+MYLOG(DETAIL_LOG_LEVEL, " Case I CC_send_query %s flag=%x\n", buf, flag);
res = CC_send_query(conn, buf, NULL, flag, NULL);
QR_Destructor(res);
if (does_commit)
BOOL haskeyset = QR_haskeyset(self);
SQLULEN num_total_rows = QR_get_num_total_tuples(self);
-MYLOG(1, "entering %p->num_fields=%d\n", self, self->num_fields);
+MYLOG(DETAIL_LOG_LEVEL, "entering %p->num_fields=%d\n", self, self->num_fields);
if (!QR_get_cursor(self))
{
ConnInfo *ci;
BOOL reached_eof_now = FALSE, curr_eof; /* detecting EOF is pretty important */
-MYLOG(1, "Oh %p->fetch_number=" FORMAT_LEN "\n", self, self->fetch_number);
-MYLOG(1, "in total_read=" FORMAT_ULEN " cursT=" FORMAT_LEN " currT=" FORMAT_LEN " ad=%d total=" FORMAT_ULEN " rowsetSize=%d\n", self->num_total_read, self->cursTuple, stmt->currTuple, self->ad_count, QR_get_num_total_tuples(self), self->rowset_size_include_ommitted);
+MYLOG(DETAIL_LOG_LEVEL, "Oh %p->fetch_number=" FORMAT_LEN "\n", self, self->fetch_number);
+MYLOG(DETAIL_LOG_LEVEL, "in total_read=" FORMAT_ULEN " cursT=" FORMAT_LEN " currT=" FORMAT_LEN " ad=%d total=" FORMAT_ULEN " rowsetSize=%d\n", self->num_total_read, self->cursTuple, stmt->currTuple, self->ad_count, QR_get_num_total_tuples(self), self->rowset_size_include_ommitted);
num_total_rows = QR_get_num_total_tuples(self);
conn = QR_get_conn(self);
}
else
self->cache_size = req_size;
-MYLOG(1, "cache=" FORMAT_ULEN " rowset=%d movement=" FORMAT_ULEN "\n", self->cache_size, req_size, movement);
+MYLOG(DETAIL_LOG_LEVEL, "cache=" FORMAT_ULEN " rowset=%d movement=" FORMAT_ULEN "\n", self->cache_size, req_size, movement);
SPRINTF_FIXED(movecmd,
"move backward " FORMAT_ULEN " in \"%s\"",
movement, QR_get_cursor(self));
moved = movement;
if (sscanf(mres->command, "MOVE " FORMAT_ULEN, &moved) > 0)
{
-MYLOG(1, "moved=" FORMAT_ULEN " ? " FORMAT_ULEN "\n", moved, movement);
+MYLOG(DETAIL_LOG_LEVEL, "moved=" FORMAT_ULEN " ? " FORMAT_ULEN "\n", moved, movement);
if (moved < movement)
{
if (0 < moved)
/* return a row from cache */
MYLOG(0, "fetch_number < fcount: returning tuple " FORMAT_LEN ", fcount = " FORMAT_LEN "\n", fetch_number, num_backend_rows);
self->tupleField = the_tuples + (fetch_number * num_fields);
-MYLOG(1, "tupleField=%p\n", self->tupleField);
+MYLOG(DETAIL_LOG_LEVEL, "tupleField=%p\n", self->tupleField);
/* move to next row */
QR_inc_next_in_cache(self);
RETURN(TRUE)
/* not a correction */
self->cache_size = fetch_size;
/* clear obsolete tuples */
-MYLOG(1, "clear obsolete " FORMAT_LEN " tuples\n", num_backend_rows);
+MYLOG(DETAIL_LOG_LEVEL, "clear obsolete " FORMAT_LEN " tuples\n", num_backend_rows);
ClearCachedRows(tuple, num_fields, num_backend_rows);
self->dataFilled = FALSE;
QR_stop_movement(self);
self->tupleField = NULL;
curr_eof = reached_eof_now = (QR_once_reached_eof(self) && self->cursTuple >= (Int4)self->num_total_read);
-MYLOG(1, "reached_eof_now=%d\n", reached_eof_now);
+MYLOG(DETAIL_LOG_LEVEL, "reached_eof_now=%d\n", reached_eof_now);
MYLOG(0, ": PGresult: fetch_total = " FORMAT_ULEN " & this_fetch = " FORMAT_ULEN "\n", self->num_total_read, self->num_cached_rows);
MYLOG(0, ": PGresult: cursTuple = " FORMAT_LEN ", offset = " FORMAT_LEN "\n", self->cursTuple, offset);
add_size = fetch_size - cur_fetch;
else if (add_size < 0)
add_size = 0;
-MYLOG(1, "will add " FORMAT_LEN " added_tuples from " FORMAT_LEN " and select the " FORMAT_LEN "th added tuple " FORMAT_LEN "\n", add_size, start_idx, offset - num_backend_rows + start_idx, cur_fetch);
+MYLOG(DETAIL_LOG_LEVEL, "will add " FORMAT_LEN " added_tuples from " FORMAT_LEN " and select the " FORMAT_LEN "th added tuple " FORMAT_LEN "\n", add_size, start_idx, offset - num_backend_rows + start_idx, cur_fetch);
if (enlargeKeyCache(self, add_size, "Out of memory while adding tuples") < 0)
RETURN(FALSE)
/* append the KeySet info first */
for (i = 0; i < num_backend_rows; i++)
{
self->keyset[i].status &= (~CURS_NEEDS_REREAD);
-/*MYLOG(1, "keyset[%d].status=%x\n", i, self->keyset[i].status);*/
+/*MYLOG(DETAIL_LOG_LEVEL, "keyset[%d].status=%x\n", i, self->keyset[i].status);*/
}
}
LEAVE_CONN_CS(conn);
#undef RETURN
#undef return
-MYLOG(1, "returning %d offset=" FORMAT_LEN "\n", ret, offset);
+MYLOG(DETAIL_LOG_LEVEL, "returning %d offset=" FORMAT_LEN "\n", ret, offset);
return ret;
}
this_keyset->status = 0;
}
- QLOG(1, "\t");
+ QLOG(TUPLE_LOG_LEVEL, "\t");
for (field_lf = 0; field_lf < ci_num_fields; field_lf++)
{
BOOL isnull = FALSE;
{
this_tuplefield[field_lf].len = 0;
this_tuplefield[field_lf].value = 0;
- QPRINTF(1, " (null)");
+ QPRINTF(TUPLE_LOG_LEVEL, " (null)");
continue;
}
else
memcpy(buffer, value, len);
buffer[len] = '\0';
- QPRINTF(1, " '%s'(%d)", buffer, len);
+ QPRINTF(TUPLE_LOG_LEVEL, " '%s'(%d)", buffer, len);
if (field_lf >= effective_cols)
{
}
}
}
- QPRINTF(1, "\n");
+ QPRINTF(TUPLE_LOG_LEVEL, "\n");
self->cursTuple++;
if (self->num_fields > 0)
{
self->dataFilled = TRUE;
self->tupleField = self->backend_tuples + (self->fetch_number * self->num_fields);
-MYLOG(1, "tupleField=%p\n", self->tupleField);
+MYLOG(DETAIL_LOG_LEVEL, "tupleField=%p\n", self->tupleField);
QR_set_rstatus(self, PORES_TUPLES_OK);
if (stmt->proc_return > 0)
{
*pcrow = 0;
- MYLOG(1, "returning RowCount=" FORMAT_LEN "\n", *pcrow);
+ MYLOG(DETAIL_LOG_LEVEL, "returning RowCount=" FORMAT_LEN "\n", *pcrow);
return SQL_SUCCESS;
}
FIELD_INFO *fi;
TABLE_INFO *ti = NULL;
-MYLOG(1, "build_fi=%d reloid=%u\n", build_fi, reloid);
+MYLOG(DETAIL_LOG_LEVEL, "build_fi=%d reloid=%u\n", build_fi, reloid);
if (build_fi && 0 != QR_get_attid(result, col_idx))
getCOLIfromTI(func, NULL, stmt, reloid, &ti);
-MYLOG(1, "nfields=%d\n", irdflds->nfields);
+MYLOG(DETAIL_LOG_LEVEL, "nfields=%d\n", irdflds->nfields);
if (irdflds->fi && col_idx < (int) irdflds->nfields)
{
fi = irdflds->fi[col_idx];
{
SQLSMALLINT fType = stmt->options.use_bookmarks == SQL_UB_VARIABLE ? SQL_BINARY : SQL_INTEGER;
-MYLOG(1, "answering bookmark info\n");
+MYLOG(DETAIL_LOG_LEVEL, "answering bookmark info\n");
if (szColName && cbColNameMax > 0)
*szColName = '\0';
if (pcbColName)
res = SC_get_Curres(stmt);
if (0 == icol && SQL_DESC_COUNT != fDescType) /* bookmark column */
{
-MYLOG(1, "answering bookmark info\n");
+MYLOG(DETAIL_LOG_LEVEL, "answering bookmark info\n");
switch (fDescType)
{
case SQL_DESC_OCTET_LENGTH:
/* otherwise same as column name -- FALL THROUGH!!! */
case SQL_DESC_NAME:
- MYLOG(1, "fi=%p (alias, name)=", fi);
+ MYLOG(DETAIL_LOG_LEVEL, "fi=%p (alias, name)=", fi);
if (fi)
- MYPRINTF(1, "(%s,%s)\n", PRINT_NAME(fi->column_alias), PRINT_NAME(fi->column_name));
+ MYPRINTF(DETAIL_LOG_LEVEL, "(%s,%s)\n", PRINT_NAME(fi->column_alias), PRINT_NAME(fi->column_name));
else
- MYPRINTF(1, "NULL\n");
+ MYPRINTF(DETAIL_LOG_LEVEL, "NULL\n");
p = fi ? (NAME_IS_NULL(fi->column_alias) ? SAFE_NAME(fi->column_name) : GET_NAME(fi->column_alias)) : QR_get_fieldname(res, col_idx);
MYLOG(0, "COLUMN_NAME = '%s'\n", p);
case SQL_COLUMN_MONEY: /* == SQL_DESC_FIXED_PREC_SCALE */
value = pgtype_money(conn, field_type);
-MYLOG(1, "COLUMN_MONEY=" FORMAT_LEN "\n", value);
+MYLOG(DETAIL_LOG_LEVEL, "COLUMN_MONEY=" FORMAT_LEN "\n", value);
break;
case SQL_DESC_NULLABLE:
value = TRUE;
else
value = fi ? fi->nullable : pgtype_nullable(conn, field_type);
-MYLOG(1, "COLUMN_NULLABLE=" FORMAT_LEN "\n", value);
+MYLOG(DETAIL_LOG_LEVEL, "COLUMN_NULLABLE=" FORMAT_LEN "\n", value);
break;
case SQL_COLUMN_OWNER_NAME: /* == SQL_DESC_SCHEMA_NAME */
case SQL_COLUMN_SCALE: /* in 2.x */
value = pgtype_decimal_digits(stmt, field_type, col_idx);
-MYLOG(1, "COLUMN_SCALE=" FORMAT_LEN "\n", value);
+MYLOG(DETAIL_LOG_LEVEL, "COLUMN_SCALE=" FORMAT_LEN "\n", value);
if (value < 0)
value = 0;
break;
case SQL_C_VARBOOKMARK:
break;
default:
-MYLOG(1, "GetData Column 0 is type %d not of type SQL_C_BOOKMARK\n", target_type);
+MYLOG(DETAIL_LOG_LEVEL, "GetData Column 0 is type %d not of type SQL_C_BOOKMARK\n", target_type);
SC_set_error(stmt, STMT_PROGRAM_TYPE_OUT_OF_RANGE, "Column 0 is not of type SQL_C_BOOKMARK", func);
return SQL_ERROR;
}
{
SQLLEN curt = GIdx2CacheIdx(stmt->currTuple, stmt, res);
value = QR_get_value_backend_row(res, curt, icol);
-MYLOG(1, "currT=" FORMAT_LEN " base=" FORMAT_LEN " rowset=" FORMAT_LEN "\n", stmt->currTuple, QR_get_rowstart_in_cache(res), SC_get_rowset_start(stmt));
+MYLOG(DETAIL_LOG_LEVEL, "currT=" FORMAT_LEN " base=" FORMAT_LEN " rowset=" FORMAT_LEN "\n", stmt->currTuple, QR_get_rowstart_in_cache(res), SC_get_rowset_start(stmt));
MYLOG(0, " value = '%s'\n", NULL_IF_NULL(value));
}
}
cleanup:
#undef return
-MYLOG(1, "leaving %d\n", result);
+MYLOG(DETAIL_LOG_LEVEL, "leaving %d\n", result);
return result;
}
if (!QR_once_reached_eof(res))
num_tuples = INT_MAX;
/* Note that the parameter nth is 1-based */
-MYLOG(1, "get " FORMAT_ULEN "th Valid data from " FORMAT_LEN " to %s [dlt=%d]", nth, sta, orientation == SQL_FETCH_PRIOR ? "backward" : "forward", res->dl_count);
+MYLOG(DETAIL_LOG_LEVEL, "get " FORMAT_ULEN "th Valid data from " FORMAT_LEN " to %s [dlt=%d]", nth, sta, orientation == SQL_FETCH_PRIOR ? "backward" : "forward", res->dl_count);
if (0 == res->dl_count)
{
- MYPRINTF(1, "\n");
+ MYPRINTF(DETAIL_LOG_LEVEL, "\n");
if (SQL_FETCH_PRIOR == orientation)
{
if (sta + 1 >= (SQLLEN) nth)
{
*nearest = sta + 1 - nth;
delsta = (-1);
- MYPRINTF(1, "deleted ");
+ MYPRINTF(DETAIL_LOG_LEVEL, "deleted ");
for (i = res->dl_count - 1; i >=0 && *nearest <= deleted[i]; i--)
{
- MYPRINTF(1, "[" FORMAT_LEN "]=" FORMAT_LEN " ", i, deleted[i]);
+ MYPRINTF(DETAIL_LOG_LEVEL, "[" FORMAT_LEN "]=" FORMAT_LEN " ", i, deleted[i]);
if (sta >= deleted[i])
{
(*nearest)--;
delsta = i;
}
}
- MYPRINTF(1, "nearest=" FORMAT_LEN "\n", *nearest);
+ MYPRINTF(DETAIL_LOG_LEVEL, "nearest=" FORMAT_LEN "\n", *nearest);
if (*nearest < 0)
{
*nearest = -1;
}
else
{
- MYPRINTF(1, "\n");
+ MYPRINTF(DETAIL_LOG_LEVEL, "\n");
*nearest = sta - 1 + nth;
delsta = res->dl_count;
if (!QR_once_reached_eof(res))
if (0 == (keyset->status & (CURS_SELF_DELETING | CURS_SELF_DELETED | CURS_OTHER_DELETED)))
{
*nearest = i;
-MYPRINTF(1, " nearest=" FORMAT_LEN "\n", *nearest);
+MYPRINTF(DETAIL_LOG_LEVEL, " nearest=" FORMAT_LEN "\n", *nearest);
if (++count == nth)
return count;
}
if (0 == (keyset->status & (CURS_SELF_DELETING | CURS_SELF_DELETED | CURS_OTHER_DELETED)))
{
*nearest = i;
-MYPRINTF(1, " nearest=" FORMAT_LEN "\n", *nearest);
+MYPRINTF(DETAIL_LOG_LEVEL, " nearest=" FORMAT_LEN "\n", *nearest);
if (++count == nth)
return count;
}
}
*nearest = num_tuples;
}
-MYPRINTF(1, " nearest not found\n");
+MYPRINTF(DETAIL_LOG_LEVEL, " nearest not found\n");
return -(SQLLEN)count;
}
res->move_offset = 0;
return;
}
-MYLOG(1, "BASE=" FORMAT_LEN " numb=" FORMAT_LEN " curr=" FORMAT_LEN " cursT=" FORMAT_LEN "\n", QR_get_rowstart_in_cache(res), res->num_cached_rows, self->currTuple, res->cursTuple);
+MYLOG(DETAIL_LOG_LEVEL, "BASE=" FORMAT_LEN " numb=" FORMAT_LEN " curr=" FORMAT_LEN " cursT=" FORMAT_LEN "\n", QR_get_rowstart_in_cache(res), res->num_cached_rows, self->currTuple, res->cursTuple);
/* normal case */
res->move_offset = 0;
*/
#define EXTFETCH_RETURN_BOF(stmt, res) \
{ \
-MYLOG(1, "RETURN_BOF\n"); \
+MYLOG(DETAIL_LOG_LEVEL, "RETURN_BOF\n"); \
SC_set_rowset_start(stmt, -1, TRUE); \
stmt->currTuple = -1; \
/* move_cursor_position_if_needed(stmt, res); */ \
}
#define EXTFETCH_RETURN_EOF(stmt, res) \
{ \
-MYLOG(1, "RETURN_EOF\n"); \
+MYLOG(DETAIL_LOG_LEVEL, "RETURN_EOF\n"); \
SC_set_rowset_start(stmt, num_tuples, TRUE); \
stmt->currTuple = -1; \
/* move_cursor_position_if_needed(stmt, res); */ \
if (useCursor && !reached_eof)
num_tuples = INT_MAX;
-MYLOG(1, "num_tuples=" FORMAT_LEN "\n", num_tuples);
+MYLOG(DETAIL_LOG_LEVEL, "num_tuples=" FORMAT_LEN "\n", num_tuples);
/* Save and discard the saved rowset size */
save_rowset_size = stmt->save_rowset_size;
stmt->save_rowset_size = -1;
if (SQL_NO_DATA_FOUND != result && res->keyset)
{
currp = GIdx2KResIdx(SC_get_rowset_start(stmt), stmt, res);
-MYLOG(1, "currp=" FORMAT_LEN "\n", currp);
+MYLOG(DETAIL_LOG_LEVEL, "currp=" FORMAT_LEN "\n", currp);
if (currp < 0)
{
result = SQL_ERROR;
break;
}
}
-MYLOG(1, "ExtFetch result=%d\n", result);
+MYLOG(DETAIL_LOG_LEVEL, "ExtFetch result=%d\n", result);
if (currp_is_valid && SQL_SUCCESS_WITH_INFO == result && 0 == stmt->last_fetch_count)
{
-MYLOG(1, "just skipping deleted row " FORMAT_LEN "\n", currp);
+MYLOG(DETAIL_LOG_LEVEL, "just skipping deleted row " FORMAT_LEN "\n", currp);
if (rowsetSize - i + fc_io > reqsize)
QR_set_reqsize(res, (Int4) (rowsetSize - i + fc_io));
result = SC_fetch(stmt);
/* Set the number of rows retrieved */
if (pcrow)
*pcrow = i;
-MYLOG(1, "pcrow=" FORMAT_LEN "\n", i);
+MYLOG(DETAIL_LOG_LEVEL, "pcrow=" FORMAT_LEN "\n", i);
if (i == 0)
/* Only DeclareFetch should wind up here */
if (!CC_is_in_trans(conn))
return;
-MYLOG(1, "entering " FORMAT_LEN "(%u,%u) %s\n", index, keyset->blocknum, keyset->offset, dmlcode == SQL_ADD ? "ADD" : (dmlcode == SQL_UPDATE ? "UPDATE" : (dmlcode == SQL_DELETE ? "DELETE" : "REFRESH")));
+MYLOG(DETAIL_LOG_LEVEL, "entering " FORMAT_LEN "(%u,%u) %s\n", index, keyset->blocknum, keyset->offset, dmlcode == SQL_ADD ? "ADD" : (dmlcode == SQL_UPDATE ? "UPDATE" : (dmlcode == SQL_DELETE ? "DELETE" : "REFRESH")));
if (!res->rollback)
{
res->rb_count = 0;
{
if (tuple->value)
{
-MYLOG(1, "freeing tuple[" FORMAT_LEN "][" FORMAT_LEN "].value=%p\n", i / num_fields, i % num_fields, tuple->value);
+MYLOG(DETAIL_LOG_LEVEL, "freeing tuple[" FORMAT_LEN "][" FORMAT_LEN "].value=%p\n", i / num_fields, i % num_fields, tuple->value);
free(tuple->value);
tuple->value = NULL;
}
{
SQLLEN i;
-MYLOG(1, "entering %p num_fields=%d num_rows=" FORMAT_LEN "\n", otuple, num_fields, num_rows);
+MYLOG(DETAIL_LOG_LEVEL, "entering %p num_fields=%d num_rows=" FORMAT_LEN "\n", otuple, num_fields, num_rows);
for (i = 0; i < num_fields * num_rows; i++, ituple++, otuple++)
{
if (otuple->value)
if (ituple->value)
{
otuple->value = strdup(ituple->value);
-MYLOG(1, "[" FORMAT_LEN "," FORMAT_LEN "] %s copied\n", i / num_fields, i % num_fields, (const char *) otuple->value);
+MYLOG(DETAIL_LOG_LEVEL, "[" FORMAT_LEN "," FORMAT_LEN "] %s copied\n", i / num_fields, i % num_fields, (const char *) otuple->value);
}
if (otuple->value)
otuple->len = ituple->len;
{
int i;
-MYLOG(1, "entering %p num_fields=%d num_rows=" FORMAT_LEN "\n", otuple, num_fields, num_rows);
+MYLOG(DETAIL_LOG_LEVEL, "entering %p num_fields=%d num_rows=" FORMAT_LEN "\n", otuple, num_fields, num_rows);
for (i = 0; i < num_fields * num_rows; i++, ituple++, otuple++)
{
if (otuple->value)
{
otuple->value = ituple->value;
ituple->value = NULL;
-MYLOG(1, "[%d,%d] %s copied\n", i / num_fields, i % num_fields, (const char *) otuple->value);
+MYLOG(DETAIL_LOG_LEVEL, "[%d,%d] %s copied\n", i / num_fields, i % num_fields, (const char *) otuple->value);
}
otuple->len = ituple->len;
ituple->len = -1;
if (!res) return;
num_fields = res->num_fields;
-MYLOG(1, "entering index=" FORMAT_LEN ", tuple=%p, num_fields=%d\n", index, tuple_added, num_fields);
+MYLOG(DETAIL_LOG_LEVEL, "entering index=" FORMAT_LEN ", tuple=%p, num_fields=%d\n", index, tuple_added, num_fields);
ad_count = res->ad_count;
res->ad_count++;
if (QR_get_cursor(res))
}
if (status != added_keyset[i].status)
{
-MYLOG(1, "!!Commit Added=" FORMAT_ULEN "(%d)\n", QR_get_num_total_read(res) + i, i);
+MYLOG(DETAIL_LOG_LEVEL, "!!Commit Added=" FORMAT_ULEN "(%d)\n", QR_get_num_total_read(res) + i, i);
added_keyset[i].status = status;
}
}
UWORD status;
Int2 num_fields = res->num_fields;
-MYLOG(1, "entering " FORMAT_ULEN "\n", index);
+MYLOG(DETAIL_LOG_LEVEL, "entering " FORMAT_ULEN "\n", index);
dl_count = res->dl_count;
res->dl_count++;
if (!QR_get_cursor(res))
}
if (status != deleted_keyset->status)
{
-MYLOG(1, "Deleted=" FORMAT_LEN "(%d)\n", *deleted, i);
+MYLOG(DETAIL_LOG_LEVEL, "Deleted=" FORMAT_LEN "(%d)\n", *deleted, i);
deleted_keyset->status = status;
}
}
int i;
UWORD status;
-MYLOG(1, "entering index=" FORMAT_LEN "\n", index);
+MYLOG(DETAIL_LOG_LEVEL, "entering index=" FORMAT_LEN "\n", index);
if (!stmt) return;
if (res = SC_get_Curres(stmt), !res) return;
if (!keyset) return;
}
if (status != updated_keyset[i].status)
{
-MYLOG(1, "!!Commit Updated=" FORMAT_LEN "(%d)\n", res->updated[i], i);
+MYLOG(DETAIL_LOG_LEVEL, "!!Commit Updated=" FORMAT_LEN "(%d)\n", res->updated[i], i);
updated_keyset[i].status = status;
}
}
KeySet *keyset;
BOOL kres_is_valid;
-MYLOG(1, "entering\n");
+MYLOG(DETAIL_LOG_LEVEL, "entering\n");
if (QR_get_cursor(res))
{
CommitAdded(res);
int doubtp;
int j;
- MYLOG(1, " ");
+ MYLOG(DETAIL_LOG_LEVEL, " ");
for (i = 0, doubtp = 0; i < res->rb_count; i++)
{
keys.status = 0;
keys.offset = rollback[i].offset;
keys.oid = rollback[i].oid;
texist = tupleExists(stmt, &keys);
-MYPRINTF(1, "texist[%d]=%d", i, texist);
+MYPRINTF(DETAIL_LOG_LEVEL, "texist[%d]=%d", i, texist);
if (SQL_ADD == rollback[i].option)
{
if (texist)
if (doubtp == i)
doubtp = i + 1;
}
-MYPRINTF(1, " (doubtp=%d)", doubtp);
+MYPRINTF(DETAIL_LOG_LEVEL, " (doubtp=%d)", doubtp);
}
rollbp = i;
-MYPRINTF(1, " doubtp=%d,rollbp=%d\n", doubtp, rollbp);
+MYPRINTF(DETAIL_LOG_LEVEL, " doubtp=%d,rollbp=%d\n", doubtp, rollbp);
do
{
rollbps = rollbp;
index = rollback[i].index;
if (SQL_ADD == rollback[i].option)
{
-MYLOG(1, "index[%d]=" FORMAT_LEN "\n", i, index);
+MYLOG(DETAIL_LOG_LEVEL, "index[%d]=" FORMAT_LEN "\n", i, index);
if (index < 0)
{
midx = index;
pidx = index;
midx = res->num_total_read - index - 1;
}
-MYLOG(1, "pidx=" FORMAT_LEN ",midx=" FORMAT_LEN "\n", pidx, midx);
+MYLOG(DETAIL_LOG_LEVEL, "pidx=" FORMAT_LEN ",midx=" FORMAT_LEN "\n", pidx, midx);
for (j = rollbp - 1; j > i; j--)
{
if (rollback[j].index == midx ||
{
if (SQL_DELETE == rollback[j].option)
{
-MYLOG(1, "delete[%d].index=" FORMAT_LEN "\n", j, rollback[j].index);
+MYLOG(DETAIL_LOG_LEVEL, "delete[%d].index=" FORMAT_LEN "\n", j, rollback[j].index);
break;
}
/*else if (SQL_UPDATE == rollback[j].option)
{
-MYLOG(1, "update[%d].index=%d\n", j, rollback[j].index);
+MYLOG(DETAIL_LOG_LEVEL, "update[%d].index=%d\n", j, rollback[j].index);
if (IndexExists(stmt, res, rollback + j))
break;
}*/
}
} while (rollbp < rollbps);
}
-MYLOG(1, "rollbp=%d\n", rollbp);
+MYLOG(DETAIL_LOG_LEVEL, "rollbp=%d\n", rollbp);
for (i = res->rb_count - 1; i >= rollbp; i--)
{
-MYLOG(1, "do %d(%d)\n", i, rollback[i].option);
+MYLOG(DETAIL_LOG_LEVEL, "do %d(%d)\n", i, rollback[i].option);
index = rollback[i].index;
if (curs)
{
status = wkey->status;
}
}
-MYLOG(1, " index=" FORMAT_LEN " status=%hx", index, status);
+MYLOG(DETAIL_LOG_LEVEL, " index=" FORMAT_LEN " status=%hx", index, status);
if (kres_is_valid)
{
QResultClass *qres;
continue;
else
{
-MYPRINTF(1, " (%u, %u)", wkey->blocknum, wkey->offset);
+MYPRINTF(DETAIL_LOG_LEVEL, " (%u, %u)", wkey->blocknum, wkey->offset);
wkey->blocknum = rollback[i].blocknum;
wkey->offset = rollback[i].offset;
wkey->oid = rollback[i].oid;
-MYPRINTF(1, "->(%u, %u)", wkey->blocknum, wkey->offset);
+MYPRINTF(DETAIL_LOG_LEVEL, "->(%u, %u)", wkey->blocknum, wkey->offset);
wkey->status &= ~KEYSET_INFO_PUBLIC;
if (SQL_DELETE == rollback[i].option)
wkey->status &= ~CURS_SELF_DELETING;
}
}
}
- MYPRINTF(1, "\n");
+ MYPRINTF(DETAIL_LOG_LEVEL, "\n");
res->rb_count = rollbp;
if (0 == rollbp)
{
const ssize_t from_pos = stmt->load_from_pos;
const char *load_stmt = stmt->load_statement;
-MYLOG(1, "entering bestitem=%s bestqual=%s\n", SAFE_NAME(ti->bestitem), SAFE_NAME(ti->bestqual));
+MYLOG(DETAIL_LOG_LEVEL, "entering bestitem=%s bestqual=%s\n", SAFE_NAME(ti->bestitem), SAFE_NAME(ti->bestqual));
initPQExpBuffer(&selstr);
#define return DONT_CALL_RETURN_FROM_HERE???
if (TI_has_subclass(ti))
appendData = TRUE;
else
{
-MYLOG(1, "total " FORMAT_LEN " <> backend " FORMAT_LEN " - base " FORMAT_LEN " + start " FORMAT_LEN " cursor_type=%d\n",
+MYLOG(DETAIL_LOG_LEVEL, "total " FORMAT_LEN " <> backend " FORMAT_LEN " - base " FORMAT_LEN " + start " FORMAT_LEN " cursor_type=%d\n",
num_total_rows, num_cached_rows,
QR_get_rowstart_in_cache(res), SC_get_rowset_start(stmt), stmt->options.cursor_type);
}
}
if (appendData)
{
-MYLOG(1, "total " FORMAT_LEN " == backend " FORMAT_LEN " - base " FORMAT_LEN " + start " FORMAT_LEN " cursor_type=%d\n",
+MYLOG(DETAIL_LOG_LEVEL, "total " FORMAT_LEN " == backend " FORMAT_LEN " - base " FORMAT_LEN " + start " FORMAT_LEN " cursor_type=%d\n",
num_total_rows, num_cached_rows,
QR_get_rowstart_in_cache(res), SC_get_rowset_start(stmt), stmt->options.cursor_type);
if (num_cached_rows >= res->count_backend_allocated)
{
MYLOG(0, "entering\n");
ret = irow_update(ret, s->stmt, s->qstmt, s->global_ridx, &s->old_keyset);
-MYLOG(1, "irow_update ret=%d,%d\n", ret, SC_get_errornumber(s->qstmt));
+MYLOG(DETAIL_LOG_LEVEL, "irow_update ret=%d,%d\n", ret, SC_get_errornumber(s->qstmt));
if (ret != SQL_SUCCESS)
SC_error_copy(s->stmt, s->qstmt, TRUE);
PGAPI_FreeStmt(s->qstmt, SQL_DROP);
}
else
res->keyset[kres_ridx].status |= (SQL_ROW_DELETED | CURS_SELF_DELETED);
-MYLOG(1, ".status[" FORMAT_ULEN "]=%x\n", global_ridx, res->keyset[kres_ridx].status);
+MYLOG(DETAIL_LOG_LEVEL, ".status[" FORMAT_ULEN "]=%x\n", global_ridx, res->keyset[kres_ridx].status);
}
if (irdflds->rowStatusArray)
{
res->recent_processed_row_count = s->stmt->diag_row_count = s->processed;
if (opts) /* logging */
{
- MYLOG(1, "processed=" FORMAT_POSIROW " ret=%d rowset=" FORMAT_LEN, s->processed, ret, opts->size_of_rowset_odbc2);
- MYPRINTF(1, "," FORMAT_LEN "\n", opts->size_of_rowset);
+ MYLOG(DETAIL_LOG_LEVEL, "processed=" FORMAT_POSIROW " ret=%d rowset=" FORMAT_LEN, s->processed, ret, opts->size_of_rowset_odbc2);
+ MYPRINTF(DETAIL_LOG_LEVEL, "," FORMAT_LEN "\n", opts->size_of_rowset);
}
return ret;
QResultClass *res = SC_get_Curres(stmt);
SQLLEN incr = start - stmt->rowset_start;
-MYLOG(1, "%p->SC_set_rowstart " FORMAT_LEN "->" FORMAT_LEN "(%s) ", stmt, stmt->rowset_start, start, valid_base ? "valid" : "unknown");
+MYLOG(DETAIL_LOG_LEVEL, "%p->SC_set_rowstart " FORMAT_LEN "->" FORMAT_LEN "(%s) ", stmt, stmt->rowset_start, start, valid_base ? "valid" : "unknown");
if (res != NULL)
{
BOOL valid = QR_has_valid_base(res);
-MYPRINTF(1, ":(%p)QR is %s", res, QR_has_valid_base(res) ? "valid" : "unknown");
+MYPRINTF(DETAIL_LOG_LEVEL, ":(%p)QR is %s", res, QR_has_valid_base(res) ? "valid" : "unknown");
if (valid)
{
}
if (!QR_get_cursor(res))
res->key_base = start;
-MYPRINTF(1, ":(%p)QR result=" FORMAT_LEN "(%s)", res, QR_get_rowstart_in_cache(res), QR_has_valid_base(res) ? "valid" : "unknown");
+MYPRINTF(DETAIL_LOG_LEVEL, ":(%p)QR result=" FORMAT_LEN "(%s)", res, QR_get_rowstart_in_cache(res), QR_has_valid_base(res) ? "valid" : "unknown");
}
stmt->rowset_start = start;
-MYPRINTF(1, ":stmt result=" FORMAT_LEN "\n", stmt->rowset_start);
+MYPRINTF(DETAIL_LOG_LEVEL, ":stmt result=" FORMAT_LEN "\n", stmt->rowset_start);
}
void
SC_inc_rowset_start(StatementClass *stmt, SQLLEN inc)
/* Free the parsed table/field information */
SC_initialize_cols_info(self, TRUE, TRUE);
-MYLOG(1, "SC_clear_parse_status\n");
+MYLOG(DETAIL_LOG_LEVEL, "SC_clear_parse_status\n");
SC_clear_parse_status(self, conn);
break;
}
SC_set_rowset_start(self, -1, FALSE);
SC_set_current_col(self, -1);
self->bind_row = 0;
-MYLOG(1, "statement=%p ommitted=0\n", self);
+MYLOG(DETAIL_LOG_LEVEL, "statement=%p ommitted=0\n", self);
self->last_fetch_count = self->last_fetch_count_include_ommitted = 0;
self->__error_message = NULL;
{
StatementClass *child = stmt, *parent;
-MYLOG(1, "entering stmt=%p\n", stmt);
+MYLOG(DETAIL_LOG_LEVEL, "entering stmt=%p\n", stmt);
for (child = stmt, parent = child->execute_parent; parent; child = parent, parent = child->execute_parent)
{
- MYLOG(1, "parent=%p\n", parent);
+ MYLOG(DETAIL_LOG_LEVEL, "parent=%p\n", parent);
}
return child;
}
QResultClass *self_res;
BOOL repstate;
-MYLOG(1, "entering %p->%p check=%i\n", from_res ,self, check);
+MYLOG(DETAIL_LOG_LEVEL, "entering %p->%p check=%i\n", from_res ,self, check);
if (check)
{
if (0 == number) return;
QResultClass *self_res, *from_res;
BOOL repstate;
-MYLOG(1, "entering %p->%p check=%i\n", from ,self, check);
+MYLOG(DETAIL_LOG_LEVEL, "entering %p->%p check=%i\n", from ,self, check);
if (!from) return; /* for safety */
if (self == from) return; /* for safety */
if (check)
{
PG_ErrorInfo *pgerror;
-MYLOG(1, "entering %p->%p\n", from ,self);
+MYLOG(DETAIL_LOG_LEVEL, "entering %p->%p\n", from ,self);
if (!from) return; /* for safety */
if (self == from) return; /* for safety */
if (self->__error_message)
/* TupleField *tupleField; */
-MYLOG(1, "entering statement=%p res=%p ommitted=0\n", self, res);
+MYLOG(DETAIL_LOG_LEVEL, "entering statement=%p res=%p ommitted=0\n", self, res);
self->last_fetch_count = self->last_fetch_count_include_ommitted = 0;
if (!res)
return SQL_ERROR;
if (kres_ridx >= 0 && kres_ridx < res->num_cached_keys)
{
UWORD pstatus = res->keyset[kres_ridx].status;
-MYLOG(1, "SC_ pstatus[" FORMAT_LEN "]=%hx fetch_count=" FORMAT_LEN "\n", kres_ridx, pstatus, self->last_fetch_count);
+MYLOG(DETAIL_LOG_LEVEL, "SC_ pstatus[" FORMAT_LEN "]=%hx fetch_count=" FORMAT_LEN "\n", kres_ridx, pstatus, self->last_fetch_count);
if (0 != (pstatus & (CURS_SELF_DELETING | CURS_SELF_DELETED)))
return SQL_SUCCESS_WITH_INFO;
if (SQL_ROW_DELETED != (pstatus & KEYSET_INFO_PUBLIC) &&
result = SQL_SUCCESS;
self->last_fetch_count++;
-MYLOG(1, "stmt=%p ommitted++\n", self);
+MYLOG(DETAIL_LOG_LEVEL, "stmt=%p ommitted++\n", self);
self->last_fetch_count_include_ommitted++;
opts = SC_get_ARDF(self);
else
{
SQLLEN curt = GIdx2CacheIdx(self->currTuple, self, res);
-MYLOG(1, "%p->base=" FORMAT_LEN " curr=" FORMAT_LEN " st=" FORMAT_LEN " valid=%d\n", res, QR_get_rowstart_in_cache(res), self->currTuple, SC_get_rowset_start(self), QR_has_valid_base(res));
-MYLOG(1, "curt=" FORMAT_LEN "\n", curt);
+MYLOG(DETAIL_LOG_LEVEL, "%p->base=" FORMAT_LEN " curr=" FORMAT_LEN " st=" FORMAT_LEN " valid=%d\n", res, QR_get_rowstart_in_cache(res), self->currTuple, SC_get_rowset_start(self), QR_has_valid_base(res));
+MYLOG(DETAIL_LOG_LEVEL, "curt=" FORMAT_LEN "\n", curt);
value = QR_get_value_backend_row(res, curt, lf);
}
case COPY_RESULT_TRUNCATED:
SC_set_error(self, STMT_TRUNCATED, "Fetched item was truncated.", func);
- MYLOG(1, "The %dth item was truncated\n", lf + 1);
- MYLOG(1, "The buffer size = " FORMAT_LEN, opts->bindings[lf].buflen);
- MYLOG(1, " and the value is '%s'\n", value);
+ MYLOG(DETAIL_LOG_LEVEL, "The %dth item was truncated\n", lf + 1);
+ MYLOG(DETAIL_LOG_LEVEL, "The buffer size = " FORMAT_LEN, opts->bindings[lf].buflen);
+ MYLOG(DETAIL_LOG_LEVEL, " and the value is '%s'\n", value);
result = SQL_SUCCESS_WITH_INFO;
break;
}
}
-MYLOG(1, "!!%p->miscinfo=%x res=%p\n", self, self->miscinfo, res);
+MYLOG(DETAIL_LOG_LEVEL, "!!%p->miscinfo=%x res=%p\n", self, self->miscinfo, res);
/*
* special handling of result for keyset driven cursors.
* Use the columns info of the 1st query and
*/
#ifdef REFCUR_SUPPORT
-MYLOG(1, "!!! numfield=%d field_type=%u\n", QR_NumResultCols(res), QR_get_field_type(res, 0));
+MYLOG(DETAIL_LOG_LEVEL, "!!! numfield=%d field_type=%u\n", QR_NumResultCols(res), QR_get_field_type(res, 0));
if (!has_out_para &&
0 < QR_NumResultCols(res) &&
PG_TYPE_REFCURSOR == QR_get_field_type(res, 0))
self->bind_row = 0;
ret = SC_fetch(hstmt);
-MYLOG(1, "!!SC_fetch return =%d\n", ret);
+MYLOG(DETAIL_LOG_LEVEL, "!!SC_fetch return =%d\n", ret);
if (SQL_SUCCEEDED(ret))
{
APDFields *apdopts = SC_get_APDF(self);
stmt->callbacks[stmt->num_callbacks].data = data;
stmt->num_callbacks++;
-MYLOG(1, "stmt=%p, func=%p, count=%d\n", stmt, func, stmt->num_callbacks);
+MYLOG(DETAIL_LOG_LEVEL, "stmt=%p, func=%p, count=%d\n", stmt, func, stmt->num_callbacks);
return stmt->num_callbacks;
}
static void log_params(int nParams, const Oid *paramTypes, const UCHAR * const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
{
- const int level = 1;
int i, j;
BOOL isBinary;
{
isBinary = paramFormats ? paramFormats[i] : FALSE;
if (!paramValues[i])
- QLOG(level, "\t%c (null) OID=%u\n", isBinary ? 'b' : 't', paramTypes ? paramTypes[i] : 0);
+ QLOG(TUPLE_LOG_LEVEL, "\t%c (null) OID=%u\n", isBinary ? 'b' : 't', paramTypes ? paramTypes[i] : 0);
else if (isBinary)
{
- QLOG(level, "\tb '");
+ QLOG(TUPLE_LOG_LEVEL, "\tb '");
for (j = 0; j < paramLengths[i]; j++)
- QPRINTF(level, "%02x", paramValues[i][j]);
- QPRINTF(level, " OID=%u\n", paramTypes ? paramTypes[i] : 0);
+ QPRINTF(TUPLE_LOG_LEVEL, "%02x", paramValues[i][j]);
+ QPRINTF(TUPLE_LOG_LEVEL, " OID=%u\n", paramTypes ? paramTypes[i] : 0);
}
else
- QLOG(level, "\tt '%s' OID=%u\n", paramValues[i], paramTypes ? paramTypes[i] : 0);
+ QLOG(TUPLE_LOG_LEVEL, "\tt '%s' OID=%u\n", paramValues[i], paramTypes ? paramTypes[i] : 0);
}
}
}
/* 3. Receive results */
-MYLOG(1, "get_Result=%p %p %d\n", res, SC_get_Result(stmt), stmt->curr_param_result);
+MYLOG(DETAIL_LOG_LEVEL, "get_Result=%p %p %d\n", res, SC_get_Result(stmt), stmt->curr_param_result);
pgresstatus = PQresultStatus(pgres);
switch (pgresstatus)
{
/* Extract parameter information from the result set */
num_p = PQnparams(pgres);
-MYLOG(1, "num_params=%d info=%d\n", stmt->num_params, num_p);
+MYLOG(DETAIL_LOG_LEVEL, "num_params=%d info=%d\n", stmt->num_params, num_p);
if (get_qlog() > 0 || get_mylog() > 0)
{
int i;
if (SQL_PARAM_OUTPUT == paramType ||
SQL_PARAM_INPUT_OUTPUT == paramType)
{
- MYLOG(1, "!![%d].PGType %u->%u\n", i, PIC_get_pgtype(ipdopts->parameters[i]), CI_get_oid(QR_get_fields(res), cidx));
+ MYLOG(DETAIL_LOG_LEVEL, "!![%d].PGType %u->%u\n", i, PIC_get_pgtype(ipdopts->parameters[i]), CI_get_oid(QR_get_fields(res), cidx));
PIC_set_pgtype(ipdopts->parameters[i], CI_get_oid(QR_get_fields(res), cidx));
cidx++;
}
SQLULEN rtn, ocount, wcode;
const UCHAR *str;
-MYLOG(1, "ilen=" FORMAT_LEN " bufcount=" FORMAT_ULEN, ilen, bufcount);
+MYLOG(DETAIL_LOG_LEVEL, "ilen=" FORMAT_LEN " bufcount=" FORMAT_ULEN, ilen, bufcount);
if (!utf8str)
return 0;
-MYPRINTF(1, " string=%s", utf8str);
+MYPRINTF(DETAIL_LOG_LEVEL, " string=%s", utf8str);
if (!bufcount)
ucs2str = NULL;
}
if (ocount < bufcount && ucs2str)
ucs2str[ocount] = 0;
-MYPRINTF(1, " ocount=" FORMAT_ULEN "\n", ocount);
+MYPRINTF(DETAIL_LOG_LEVEL, " ocount=" FORMAT_ULEN "\n", ocount);
return rtn;
}