language-extensions/python/test/src/PythonGetResultsTests.cpp
// Name: CheckStringDataEquality
//
// Description:
//  Compare the given character data & nullMap with rowsNumber for equality.
//
CheckStringDataEquality
Description:
Compare the given character data & nullMap with rowsNumber for equality.
CheckStringDataEquality Description : Compare the given character data & nullMap with rowsNumber for equality .
void PythonExtensionApiTests::CheckStringDataEquality(
		SQLULEN    rowsNumber,
		char       *expectedColumnData,
		char       *columnData,
		SQLINTEGER *expectedColumnStrLenOrInd,
		SQLINTEGER *columnStrLenOrInd)
	{
		SQLINTEGER cumulativeLength = 0;
		if (rowsNumber == 0)
		{
			EXPECT_EQ(columnData, nullptr);
			EXPECT_EQ(columnStrLenOrInd, nullptr);
		}
		for (SQLULEN index = 0; index < rowsNumber; ++index)
		{
			if (expectedColumnStrLenOrInd != nullptr)
			{
				EXPECT_EQ(columnStrLenOrInd[index], expectedColumnStrLenOrInd[index]);
				if (columnStrLenOrInd[index] != SQL_NULL_DATA)
				{
					for (SQLINTEGER strIndex = 0; strIndex < columnStrLenOrInd[index]; ++strIndex)
					{
						EXPECT_EQ((expectedColumnData + cumulativeLength)[strIndex], 
							(columnData + cumulativeLength)[strIndex]);
					}
					cumulativeLength += expectedColumnStrLenOrInd[index];
				}
			}
			else
			{
				EXPECT_EQ(columnStrLenOrInd[index], SQL_NULL_DATA);
			}
		}
	}
void PythonExtensionApiTests :: CheckStringDataEquality ( SQLULEN rowsNumber , char * expectedColumnData , char * columnData , SQLINTEGER * expectedColumnStrLenOrInd , SQLINTEGER * columnStrLenOrInd ) { SQLINTEGER cumulativeLength = 0 ; if ( rowsNumber == 0 ) { EXPECT_EQ ( columnData , nullptr ) ; EXPECT_EQ ( columnStrLenOrInd , nullptr ) ; } for ( SQLULEN index = 0 ; index < rowsNumber ; ++ index ) { if ( expectedColumnStrLenOrInd != nullptr ) { EXPECT_EQ ( columnStrLenOrInd [ index ] , expectedColumnStrLenOrInd [ index ] ) ; if ( columnStrLenOrInd [ index ] != SQL_NULL_DATA ) { for ( SQLINTEGER strIndex = 0 ; strIndex < columnStrLenOrInd [ index ] ; ++ strIndex ) { EXPECT_EQ ( ( expectedColumnData + cumulativeLength ) [ strIndex ] , ( columnData + cumulativeLength ) [ strIndex ] ) ; } cumulativeLength += expectedColumnStrLenOrInd [ index ] ; } } else { EXPECT_EQ ( columnStrLenOrInd [ index ] , SQL_NULL_DATA ) ; } } }
Name: CheckStringDataEquality
Description:
Compare the given character data & nullMap with rowsNumber for equality.
Name : CheckStringDataEquality Description : Compare the given character data & nullMap with rowsNumber for equality .
// Compare the two strings byte by byte   // because encoded strings mess up EXPECT_EQ //