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
2 changes: 0 additions & 2 deletions OdbcDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ void OdbcDesc::setDefaultImplDesc (StatementMetaData * ptMetaDataOut, StatementM

headAllocType = SQL_DESC_ALLOC_AUTO;
headArraySize = 1;
headArrayStatusPtr = (SQLUSMALLINT*)NULL;
headBindOffsetPtr = (SQLLEN*)NULL;
headRowsProcessedPtr = (SQLULEN*)NULL;
headCount = 0;

if( metaDataOut == NULL )
Expand Down
21 changes: 10 additions & 11 deletions OdbcStatement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,19 +801,19 @@ SQLRETURN OdbcStatement::fetchData()
}
else // if ( schemaExtendedFetchData )
{
SQLLEN bindOffsetPtrData = 0;
SQLLEN bindOffsetPtrInd = 0;
SQLLEN bindOffset = bindOffsetPtrSave ? *bindOffsetPtrSave : 0;
SQLLEN bindOffsetPtrData = bindOffset;
SQLLEN bindOffsetPtrInd = bindOffset;
convert->setBindOffsetPtrTo(&bindOffsetPtrData, &bindOffsetPtrInd);
while ( nRow < nCountRow && (resultSet->*fetchNext)() )
{
++countFetched;
++rowNumber; // Should stand only here!!!

if ( fetchRetData == SQL_RD_ON )
returnDataFromExtendedFetch();
returnDataFromExtendedFetch( nRow, bindOffset );

bindOffsetPtrInd += sizeof(SQLLEN);
++bindOffsetPtrTmp;
++nRow;

if ( maxRows && nRow == maxRows )
Expand Down Expand Up @@ -1136,19 +1136,19 @@ SQLRETURN OdbcStatement::sqlFetchScrollCursorStatic(int orientation, int offset)
}
else
{
SQLLEN bindOffsetPtrData = 0;
SQLLEN bindOffsetPtrInd = 0;
SQLLEN bindOffset = bindOffsetPtrSave ? *bindOffsetPtrSave : 0;
SQLLEN bindOffsetPtrData = bindOffset;
SQLLEN bindOffsetPtrInd = bindOffset;
convert->setBindOffsetPtrTo(&bindOffsetPtrData, &bindOffsetPtrInd);
while ( nRow < rowsetSize && rowNumber < sqlDiagCursorRowCount )
{
resultSet->copyNextSqldaFromBufferStaticCursor();
++countFetched;
++rowNumber; // Should stand only here!!!

returnDataFromExtendedFetch();
returnDataFromExtendedFetch( nRow, bindOffset );

bindOffsetPtrInd += sizeof(SQLLEN);
++bindOffsetPtrTmp;
++nRow;

if ( maxRows && nRow == maxRows )
Expand Down Expand Up @@ -3352,11 +3352,10 @@ SQLRETURN OdbcStatement::returnData()
}

inline
SQLRETURN OdbcStatement::returnDataFromExtendedFetch()
SQLRETURN OdbcStatement::returnDataFromExtendedFetch( int row, SQLLEN bindOffset )
{
SQLRETURN retCode, ret = SQL_SUCCESS;
SQLLEN &bindOffsetPtrTo = convert->getBindOffsetPtrTo();
SQLLEN &currentRow = *applicationRowDescriptor->headBindOffsetPtr;
int count = listBindOut->GetCount();
convert->statusReturnData = true;

Expand All @@ -3369,7 +3368,7 @@ SQLRETURN OdbcStatement::returnDataFromExtendedFetch()
DescRecord *& imp = bindCol->impRecord;
DescRecord *& app = bindCol->appRecord;

bindOffsetPtrTo = app->sizeColumnExtendedFetch * currentRow;
bindOffsetPtrTo = bindOffset + app->sizeColumnExtendedFetch * row;
retCode = (convert->*imp->fnConv)(imp, app);
if ( retCode != SQL_SUCCESS )
{
Expand Down
4 changes: 2 additions & 2 deletions OdbcStatement.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class OdbcStatement : public OdbcObject
SQLRETURN sqlMoreResults();
inline SQLRETURN fetchData();
inline SQLRETURN returnData();
inline SQLRETURN returnDataFromExtendedFetch();
inline SQLRETURN returnDataFromExtendedFetch( int row, SQLLEN bindOffset );
#ifdef _WIN64
SQLRETURN sqlColAttribute( int column, int fieldId, SQLPOINTER attributePtr, int bufferLength, SQLSMALLINT *strLengthPtr, SQLLEN *numericAttributePtr );
#else
Expand Down Expand Up @@ -134,7 +134,7 @@ class OdbcStatement : public OdbcObject
~OdbcStatement();
bool isStaticCursor(){ return cursorType != SQL_CURSOR_FORWARD_ONLY && cursorScrollable == SQL_SCROLLABLE || isResultSetFromSystemCatalog; }
int getCurrentFetched(){ return countFetched; }
bool getSchemaFetchData(){ return applicationRowDescriptor->headBindType || applicationRowDescriptor->headBindOffsetPtr; }
bool getSchemaFetchData(){ return applicationRowDescriptor->headBindType != SQL_BIND_BY_COLUMN; }
inline StatementMetaData *getStatementMetaDataIRD();
inline void clearErrors();
SQLRETURN prepareGetData(int column, DescRecord *recordARD);
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ add_executable(firebird_odbc_tests
test_param_conversions.cpp
test_prepare.cpp
test_cursors.cpp
test_block_cursor.cpp
test_cursor_commit.cpp
test_cursor_name.cpp
test_data_at_execution.cpp
Expand Down
Loading
Loading