本文整理匯總了C++中DiscardStatementSvp函數的典型用法代碼示例。如果您正苦於以下問題:C++ DiscardStatementSvp函數的具體用法?C++ DiscardStatementSvp怎麽用?C++ DiscardStatementSvp使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DiscardStatementSvp函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: SQLBindCol
RETCODE SQL_API
SQLBindCol(HSTMT StatementHandle,
SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
PTR TargetValue, SQLLEN BufferLength,
SQLLEN *StrLen_or_Ind)
{
RETCODE ret;
StatementClass *stmt = (StatementClass *) StatementHandle;
mylog("[SQLBindCol]");
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
ret = PGAPI_BindCol(StatementHandle, ColumnNumber,
TargetType, TargetValue, BufferLength, StrLen_or_Ind);
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
return ret;
}
示例2: SQLSetPos
RETCODE SQL_API
SQLSetPos(
HSTMT hstmt,
SQLSETPOSIROW irow,
SQLUSMALLINT fOption,
SQLUSMALLINT fLock)
{
RETCODE ret;
StatementClass *stmt = (StatementClass *) hstmt;
mylog("[SQLSetPos]");
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
ret = PGAPI_SetPos(hstmt, irow, fOption, fLock);
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
return ret;
}
示例3: SQLSetStmtAttrW
RETCODE SQL_API SQLSetStmtAttrW(SQLHSTMT hstmt,
SQLINTEGER fAttribute,
PTR rgbValue,
SQLINTEGER cbValueMax)
{
CSTR func = "SQLSetStmtAttrW";
RETCODE ret;
StatementClass *stmt = (StatementClass *) hstmt;
mylog("[%s]", func);
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
ret = PGAPI_SetStmtAttr(hstmt, fAttribute, rgbValue,
cbValueMax);
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
return ret;
}
示例4: SQLPrimaryKeysW
RETCODE SQL_API SQLPrimaryKeysW(
HSTMT hstmt,
SQLWCHAR *szCatalogName,
SQLSMALLINT cbCatalogName,
SQLWCHAR *szSchemaName,
SQLSMALLINT cbSchemaName,
SQLWCHAR *szTableName,
SQLSMALLINT cbTableName)
{
CSTR func = "SQLPrimaryKeysW";
RETCODE ret;
char *ctName, *scName, *tbName;
SQLLEN nmlen1, nmlen2, nmlen3;
StatementClass *stmt = (StatementClass *) hstmt;
ConnectionClass *conn;
BOOL lower_id;
mylog("[%s]", func);
conn = SC_get_conn(stmt);
lower_id = SC_is_lower_case(stmt, conn);
ctName = ucs2_to_utf8(szCatalogName, cbCatalogName, &nmlen1, lower_id);
scName = ucs2_to_utf8(szSchemaName, cbSchemaName, &nmlen2, lower_id);
tbName = ucs2_to_utf8(szTableName, cbTableName, &nmlen3, lower_id);
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
if (SC_opencheck(stmt, func))
ret = SQL_ERROR;
else
ret = PGAPI_PrimaryKeys(hstmt, ctName, (SQLSMALLINT) nmlen1,
scName, (SQLSMALLINT) nmlen2, tbName, (SQLSMALLINT) nmlen3, 0);
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
if (ctName)
free(ctName);
if (scName)
free(scName);
if (tbName)
free(tbName);
return ret;
}
示例5: SQLDescribeParam
RETCODE SQL_API
SQLDescribeParam(HSTMT hstmt,
SQLUSMALLINT ipar,
SQLSMALLINT *pfSqlType,
SQLULEN *pcbParamDef,
SQLSMALLINT *pibScale,
SQLSMALLINT *pfNullable)
{
RETCODE ret;
StatementClass *stmt = (StatementClass *) hstmt;
mylog("[SQLDescribeParam]");
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
ret = PGAPI_DescribeParam(hstmt, ipar, pfSqlType, pcbParamDef,
pibScale, pfNullable);
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
return ret;
}
示例6: SQLBindParam
/* SQLBindParameter/SQLSetParam -> SQLBindParam */
RETCODE SQL_API
SQLBindParam(HSTMT StatementHandle,
SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
SQLSMALLINT ParameterType, SQLULEN LengthPrecision,
SQLSMALLINT ParameterScale, PTR ParameterValue,
SQLLEN *StrLen_or_Ind)
{
CSTR func = "SQLBindParam";
RETCODE ret;
StatementClass *stmt = (StatementClass *) StatementHandle;
int BufferLength = 512; /* Is it OK ? */
mylog("[[%s]]", func);
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
ret = PGAPI_BindParameter(StatementHandle, ParameterNumber, SQL_PARAM_INPUT, ValueType, ParameterType, LengthPrecision, ParameterScale, ParameterValue, BufferLength, StrLen_or_Ind);
ret = DiscardStatementSvp(stmt,ret, FALSE);
LEAVE_STMT_CS(stmt);
return ret;
}
示例7: SQLSetCursorNameW
RETCODE SQL_API SQLSetCursorNameW(HSTMT StatementHandle,
SQLWCHAR *CursorName, SQLSMALLINT NameLength)
{
CSTR func = "SQLSetCursorNameW";
RETCODE ret;
StatementClass *stmt = (StatementClass *) StatementHandle;
char *crName;
SQLLEN nlen;
mylog("[%s]", func);
crName = ucs2_to_utf8(CursorName, NameLength, &nlen, FALSE);
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
ret = PGAPI_SetCursorName(StatementHandle, crName, (SQLSMALLINT) nlen);
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
if (crName)
free(crName);
return ret;
}
示例8: SQLDescribeCol
RETCODE SQL_API
SQLDescribeCol(HSTMT StatementHandle,
SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
SQLSMALLINT *DataType, SQLULEN *ColumnSize,
SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable)
{
RETCODE ret;
StatementClass *stmt = (StatementClass *) StatementHandle;
mylog("[SQLDescribeCol]");
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
ret = PGAPI_DescribeCol(StatementHandle, ColumnNumber,
ColumnName, BufferLength, NameLength,
DataType, ColumnSize, DecimalDigits, Nullable);
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
return ret;
}
示例9: SQLColAttributes
RETCODE SQL_API
SQLColAttributes(HSTMT hstmt,
SQLUSMALLINT icol,
SQLUSMALLINT fDescType,
PTR rgbDesc,
SQLSMALLINT cbDescMax,
SQLSMALLINT *pcbDesc,
SQLLEN *pfDesc)
{
RETCODE ret;
StatementClass *stmt = (StatementClass *) hstmt;
mylog("[SQLColAttributes]");
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
ret = PGAPI_ColAttributes(hstmt, icol, fDescType, rgbDesc,
cbDescMax, pcbDesc, pfDesc);
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
return ret;
}
示例10: SQLPrepare
RETCODE SQL_API
SQLPrepare(HSTMT StatementHandle,
SQLCHAR *StatementText, SQLINTEGER TextLength)
{
CSTR func = "SQLPrepare";
RETCODE ret;
StatementClass *stmt = (StatementClass *) StatementHandle;
mylog("[SQLPrepare]");
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
if (SC_opencheck(stmt, func))
ret = SQL_ERROR;
else
{
StartRollbackState(stmt);
ret = PGAPI_Prepare(StatementHandle, StatementText, TextLength);
ret = DiscardStatementSvp(stmt, ret, FALSE);
}
LEAVE_STMT_CS(stmt);
return ret;
}
示例11: SQLPrepareW
RETCODE SQL_API SQLPrepareW(HSTMT StatementHandle,
SQLWCHAR *StatementText, SQLINTEGER TextLength)
{
CSTR func = "SQLPrepareW";
StatementClass *stmt = (StatementClass *) StatementHandle;
RETCODE ret;
char *stxt;
SQLLEN slen;
mylog("[%s]", func);
stxt = ucs2_to_utf8(StatementText, TextLength, &slen, FALSE);
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
if (SC_opencheck(stmt, func))
ret = SQL_ERROR;
else
ret = PGAPI_Prepare(StatementHandle, stxt, (SQLINTEGER) slen);
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
if (stxt)
free(stxt);
return ret;
}
示例12: SQLExecute
RETCODE SQL_API
SQLExecute(HSTMT StatementHandle)
{
CSTR func = "SQLExecute";
RETCODE ret;
StatementClass *stmt = (StatementClass *) StatementHandle;
UWORD flag = 0;
mylog("[%s]", func);
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
if (PG_VERSION_GE(SC_get_conn(stmt), 7.4))
flag |= PODBC_WITH_HOLD;
if (SC_opencheck(stmt, func))
ret = SQL_ERROR;
else
{
StartRollbackState(stmt);
ret = PGAPI_Execute(StatementHandle, flag);
ret = DiscardStatementSvp(stmt, ret, FALSE);
}
LEAVE_STMT_CS(stmt);
return ret;
}
示例13: PGAPI_ParamData
//.........這裏部分代碼省略.........
goto cleanup;
}
if (estmt->data_at_exec > apdopts->allocated)
{
SC_set_error(stmt, STMT_SEQUENCE_ERROR, "Too many execution-time parameters were present", func);
retval = SQL_ERROR;
goto cleanup;
}
/* close the large object */
if (estmt->lobj_fd >= 0)
{
odbc_lo_close(conn, estmt->lobj_fd);
/* commit transaction if needed */
if (!CC_cursor_count(conn) && CC_does_autocommit(conn))
{
if (!CC_commit(conn))
{
SC_set_error(stmt, STMT_EXEC_ERROR, "Could not commit (in-line) a transaction", func);
retval = SQL_ERROR;
goto cleanup;
}
}
estmt->lobj_fd = -1;
}
/* Done, now copy the params and then execute the statement */
ipdopts = SC_get_IPDF(estmt);
inolog("ipdopts=%p\n", ipdopts);
if (estmt->data_at_exec == 0)
{
BOOL exec_end;
UWORD flag = SC_is_with_hold(stmt) ? PODBC_WITH_HOLD : 0;
retval = Exec_with_parameters_resolved(estmt, &exec_end);
if (exec_end)
{
/**SC_reset_delegate(retval, stmt);**/
retval = dequeueNeedDataCallback(retval, stmt);
goto cleanup;
}
if (retval = PGAPI_Execute(estmt, flag), SQL_NEED_DATA != retval)
{
goto cleanup;
}
}
/*
* Set beginning param; if first time SQLParamData is called , start
* at 0. Otherwise, start at the last parameter + 1.
*/
i = estmt->current_exec_param >= 0 ? estmt->current_exec_param + 1 : 0;
num_p = estmt->num_params;
if (num_p < 0)
PGAPI_NumParams(estmt, &num_p);
inolog("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++)
{
inolog("i=%d", i);
if (apdopts->parameters[i].data_at_exec)
{
inolog(" at exec buffer=%p", apdopts->parameters[i].buffer);
estmt->data_at_exec--;
estmt->current_exec_param = i;
estmt->put_data = FALSE;
if (prgbValue)
{
/* returns token here */
if (stmt->execute_delegate)
{
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;
inolog(" offset=%d perrow=%d", offset, perrow);
*prgbValue = apdopts->parameters[i].buffer + offset + estmt->exec_current_row * perrow;
}
else
*prgbValue = apdopts->parameters[i].buffer;
}
break;
}
inolog("\n");
}
retval = SQL_NEED_DATA;
inolog("return SQL_NEED_DATA\n");
cleanup:
#undef return
SC_setInsertedTable(stmt, retval);
if (stmt->internal)
retval = DiscardStatementSvp(stmt, retval, FALSE);
mylog("%s: returning %d\n", func, retval);
return retval;
}
示例14: SQLProcedures
RETCODE SQL_API
SQLProcedures(
HSTMT hstmt,
SQLCHAR *szCatalogName,
SQLSMALLINT cbCatalogName,
SQLCHAR *szSchemaName,
SQLSMALLINT cbSchemaName,
SQLCHAR *szProcName,
SQLSMALLINT cbProcName)
{
CSTR func = "SQLProcedures";
RETCODE ret;
StatementClass *stmt = (StatementClass *) hstmt;
SQLCHAR *ctName = szCatalogName, *scName = szSchemaName,
*prName = szProcName;
UWORD flag = 0;
mylog("[%s]", func);
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
StartRollbackState(stmt);
#if (ODBCVER >= 0x0300)
if (stmt->options.metadata_id)
flag |= PODBC_NOT_SEARCH_PATTERN;
#endif
if (SC_opencheck(stmt, func))
ret = SQL_ERROR;
else
ret = PGAPI_Procedures(hstmt, ctName, cbCatalogName,
scName, cbSchemaName, prName,
cbProcName, flag);
if (SQL_SUCCESS == ret && 0 == QR_get_num_total_tuples(SC_get_Result(stmt)))
{
BOOL ifallupper = TRUE, reexec = FALSE;
char *newCt = NULL, *newSc = NULL, *newPr = NULL;
ConnectionClass *conn = SC_get_conn(stmt);
if (SC_is_lower_case(stmt, conn)) /* case-insensitive identifier */
ifallupper = FALSE;
if (newCt = make_lstring_ifneeded(conn, szCatalogName, cbCatalogName, ifallupper), NULL != newCt)
{
ctName = newCt;
reexec = TRUE;
}
if (newSc = make_lstring_ifneeded(conn, szSchemaName, cbSchemaName, ifallupper), NULL != newSc)
{
scName = newSc;
reexec = TRUE;
}
if (newPr = make_lstring_ifneeded(conn, szProcName, cbProcName, ifallupper), NULL != newPr)
{
prName = newPr;
reexec = TRUE;
}
if (reexec)
{
ret = PGAPI_Procedures(hstmt, ctName, cbCatalogName,
scName, cbSchemaName, prName, cbProcName, flag);
if (newCt)
free(newCt);
if (newSc)
free(newSc);
if (newPr)
free(newPr);
}
}
ret = DiscardStatementSvp(stmt, ret, FALSE);
LEAVE_STMT_CS(stmt);
return ret;
}
示例15: PGAPI_DescribeParam
//.........這裏部分代碼省略.........
SQLSMALLINT FAR * pfNullable)
{
StatementClass *stmt = (StatementClass *) hstmt;
CSTR func = "PGAPI_DescribeParam";
IPDFields *ipdopts;
RETCODE ret = SQL_SUCCESS;
int num_params;
OID pgtype;
mylog("%s: entering...%d\n", func, ipar);
if (!stmt)
{
SC_log_error(func, "", NULL);
return SQL_INVALID_HANDLE;
}
SC_clear_error(stmt);
ipdopts = SC_get_IPDF(stmt);
/*if ((ipar < 1) || (ipar > ipdopts->allocated))*/
num_params = stmt->num_params;
if (num_params < 0)
{
SQLSMALLINT num_p;
PGAPI_NumParams(stmt, &num_p);
num_params = num_p;
}
if ((ipar < 1) || (ipar > num_params))
{
inolog("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;
}
extend_iparameter_bindings(ipdopts, stmt->num_params);
#define return DONT_CALL_RETURN_FROM_HERE???
/* StartRollbackState(stmt); */
if (NOT_YET_PREPARED == stmt->prepared)
{
decideHowToPrepare(stmt, FALSE);
inolog("howTo=%d\n", SC_get_prepare_method(stmt));
switch (SC_get_prepare_method(stmt))
{
case NAMED_PARSE_REQUEST:
case PARSE_TO_EXEC_ONCE:
case PARSE_REQ_FOR_INFO:
if (ret = prepareParameters(stmt), SQL_ERROR == ret)
goto cleanup;
}
}
ipar--;
pgtype = PIC_get_pgtype(ipdopts->parameters[ipar]);
/*
* This implementation is not very good, since it is supposed to
* describe
*/
/* parameter markers, not bound parameters. */
if (pfSqlType)
{
inolog("[%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)
*pfSqlType = pgtype_to_concise_type(stmt, pgtype, PG_STATIC);
else
{
ret = SQL_ERROR;
SC_set_error(stmt, STMT_EXEC_ERROR, "Unfortunatley couldn't get this paramater's info", func);
goto cleanup;
}
}
if (pcbParamDef)
{
*pcbParamDef = 0;
if (ipdopts->parameters[ipar].SQLType)
*pcbParamDef = ipdopts->parameters[ipar].column_size;
if (0 == *pcbParamDef && pgtype)
*pcbParamDef = pgtype_column_size(stmt, pgtype, PG_STATIC, PG_STATIC);
}
if (pibScale)
{
*pibScale = 0;
if (ipdopts->parameters[ipar].SQLType)
*pibScale = ipdopts->parameters[ipar].decimal_digits;
else if (pgtype)
*pibScale = pgtype_scale(stmt, pgtype, -1);
}
if (pfNullable)
*pfNullable = pgtype_nullable(SC_get_conn(stmt), ipdopts->parameters[ipar].paramType);
cleanup:
#undef return
if (stmt->internal)
ret = DiscardStatementSvp(stmt, ret, FALSE);
return ret;
}