Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions InfoItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ CITEM (SQL_DRIVER_NAME, DRIVER_NAME)

CITEM (SQL_DRIVER_ODBC_VER, ODBC_DRIVER_VERSION)

NITEM (SQL_PARAM_ARRAY_ROW_COUNTS, SQL_PARC_BATCH)
NITEM (SQL_PARAM_ARRAY_SELECTS, SQL_PAS_BATCH)
NITEM (SQL_PARAM_ARRAY_ROW_COUNTS, SQL_PARC_NO_BATCH)
NITEM (SQL_PARAM_ARRAY_SELECTS, SQL_PAS_NO_SELECT)

CITEM (SQL_DRIVER_VER, DRIVER_VERSION)
CITEM (SQL_ROW_UPDATES, "Y")
Expand Down
3 changes: 3 additions & 0 deletions OdbcDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,9 @@ int OdbcDesc::getConciseSize(int type, int length)
case SQL_C_UBIGINT:
return 8;

case SQL_C_GUID:
return sizeof(SQLGUID);

case SQL_DECIMAL:
case SQL_C_NUMERIC:
return sizeof(tagSQL_NUMERIC_STRUCT);
Expand Down
50 changes: 44 additions & 6 deletions OdbcStatement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ OdbcStatement::OdbcStatement(OdbcConnection *connect, int statementNumber)
statement = connection->connection->createInternalStatement();
bulkInsert = NULL;
execute = &OdbcStatement::executeStatement;
updateCountParamArray = -1;
fetchNext = &ResultSet::nextFetch;
schemaFetchData = true;
metaData = NULL;
Expand Down Expand Up @@ -1987,7 +1988,12 @@ SQLRETURN OdbcStatement::sqlExecute()
enFetch = NoneFetch;
releaseResultSet();
parameterNeedData = 0;
retcode = (this->*execute)();
updateCountParamArray = -1;
if ( statement->isActiveModify() && applicationParamDescriptor->headArraySize > 1
&& execute != &OdbcStatement::executeStatementParamArray )
retcode = executeStatementParamArray();
else
retcode = (this->*execute)();
}
catch (const SQLException &ex)
{
Expand Down Expand Up @@ -2015,7 +2021,12 @@ SQLRETURN OdbcStatement::sqlExecDirect(SQLCHAR * sql, int sqlLength)
{
enFetch = NoneFetch;
parameterNeedData = 0;
retcode = (this->*execute)();
updateCountParamArray = -1;
if ( statement->isActiveModify() && applicationParamDescriptor->headArraySize > 1
&& execute != &OdbcStatement::executeStatementParamArray )
retcode = executeStatementParamArray();
else
retcode = (this->*execute)();
}
catch (const SQLException &ex)
{
Expand Down Expand Up @@ -2744,6 +2755,18 @@ void OdbcStatement::bindInputOutputParam(int param, DescRecord * recordApp)

recordApp->fnConv = convert->getAdressFunction( recordApp, record );

switch ( recordApp->conciseType )
{
case SQL_C_CHAR:
case SQL_C_WCHAR:
case SQL_C_BINARY:
break;

default:
if ( !recordApp->sizeColumnExtendedFetch )
recordApp->sizeColumnExtendedFetch = ipd->getConciseSize( recordApp->conciseType, recordApp->length );
}

// if ( convert->isIdentity() )
addBindParam ( param, record, recordApp );
}
Expand Down Expand Up @@ -2988,6 +3011,7 @@ SQLRETURN OdbcStatement::executeStatementParamArray()
: &rowCount;
SQLUSMALLINT *statusPtr = implementationParamDescriptor->headArrayStatusPtr ? implementationParamDescriptor->headArrayStatusPtr
: NULL;
SQLUSMALLINT *operationPtr = applicationParamDescriptor->headArrayStatusPtr;
int rowSize = applicationParamDescriptor->headBindType;
int nCountRow = applicationParamDescriptor->headArraySize;
SQLLEN *&headBindOffsetPtr = applicationParamDescriptor->headBindOffsetPtr;
Expand All @@ -2997,9 +3021,23 @@ SQLRETURN OdbcStatement::executeStatementParamArray()

headBindOffsetPtr = &bindOffsetPtrTmp;
*rowCountPt = rowNumberParamArray = 0;
updateCountParamArray = 0;

if ( statusPtr )
for ( int n = 0; n < nCountRow; ++n )
statusPtr[n] = SQL_PARAM_UNUSED;

while ( rowNumberParamArray < nCountRow )
{
if ( operationPtr && operationPtr[rowNumberParamArray] == SQL_PARAM_IGNORE )
{
bindOffsetPtrTmp += rowSize;
++rowNumberParamArray;
continue;
}

++*rowCountPt;

if ( arrayColumnWiseBinding )
bindOffsetIndColumnWiseBinding = ( bindOffsetPtrTmp + rowNumberParamArray ) * sizeof ( SQLLEN );

Expand All @@ -3008,21 +3046,21 @@ SQLRETURN OdbcStatement::executeStatementParamArray()
headBindOffsetPtr = bindOffsetPtrSave;
convert->setBindOffsetPtrFrom ( applicationParamDescriptor->headBindOffsetPtr, applicationParamDescriptor->headBindOffsetPtr );
if ( statusPtr )
*statusPtr = SQL_PARAM_ERROR;
statusPtr[rowNumberParamArray] = SQL_PARAM_ERROR;
return ret;
}

statement->executeStatement();
updateCountParamArray += statement->getUpdateCount();

if ( statusPtr )
*statusPtr++ = ret == SQL_SUCCESS_WITH_INFO ? SQL_PARAM_SUCCESS_WITH_INFO : SQL_PARAM_SUCCESS;
statusPtr[rowNumberParamArray] = ret == SQL_SUCCESS_WITH_INFO ? SQL_PARAM_SUCCESS_WITH_INFO : SQL_PARAM_SUCCESS;

bindOffsetPtrTmp += rowSize;
parameterNeedData = 1;
++rowNumberParamArray;
}

*rowCountPt = rowNumberParamArray;
headBindOffsetPtr = bindOffsetPtrSave;
convert->setBindOffsetPtrFrom ( applicationParamDescriptor->headBindOffsetPtr, applicationParamDescriptor->headBindOffsetPtr );

Expand Down Expand Up @@ -3639,7 +3677,7 @@ SQLRETURN OdbcStatement::sqlRowCount(SQLLEN *rowCount)
if ( enFetch != NoneFetch )
*rowCount = rowNumber;
else if ( statement->isActive() )
*rowCount = statement->getUpdateCount();
*rowCount = updateCountParamArray >= 0 ? updateCountParamArray : statement->getUpdateCount();
else
*rowCount = -1;
}
Expand Down
1 change: 1 addition & 0 deletions OdbcStatement.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class OdbcStatement : public OdbcObject
bool asyncEnable;
int rowNumber;
int rowNumberParamArray;
SQLLEN updateCountParamArray;
int lastRowsetSize;
SQLLEN indicatorRowNumber;
int maxRows;
Expand Down
Loading
Loading