[fpc-devel] MS SQL tests: fix for string settings & invalid dates

Reinier Olislagers reinierolislagers at gmail.com
Fri Mar 7 11:38:31 CET 2014


Ran dbtestframework on trunk, Windows x86 against MS SQL Server 2008R2
(also earlier revision Linux x64 against MS SQL Server 2005)

1) Committed adding
SET ANSI_PADDING
to test setup
http://msdn.microsoft.com/en-us/library/ms187403%28v=sql.105%29.aspx
In fact, MS recommends this be always on and the OFF option is deprecated.
this fixed:
TestInactSwitchIndex  Failed:  expected: < 'quotes' > but was: < 'quotes'>
TestIndexFieldNamesAct  Failed:  expected: < 'quotes' > but was: < 'quotes'>
TestStringParamQuery  Failed:  expected: < 'quotes' > but was: < 'quotes'>
TestFixedStringParamQuery  Failed:  expected: <          > but was: < >

No new errors/failures introduced.

BTW, perhaps a good idea to set ansi padding to on in the mssqlconn
code, or perhaps even ansi defaults?


2) noticed date values were often off by one:
e.g.
TestDateTime  Failed:  expected: <1899-12-29> but was: <1899-12-30>
TestDateParamQuery  Failed:  expected: <1899-12-29> but was: <1899-12-30>
TestCrossStringDateParam  Failed:  expected: <1899-12-29> but was:
<1899-12-30>
TestStreamingDataFieldsXML  Failed: FDate expected: <31/03/1800> but
was: <01/04/1800>

Similar in my earlier Linux run,
 aptitude show freetds-devPackage: freetds-dev
State: installed
Automatically installed: no
Version: 0.91-5

Is this a new thing in FPC trunk or perhaps an error in freetds?
Even before introduction of new date/time types in v 2008, SQL Server
docs indicate date should work from about 1753:
http://msdn.microsoft.com/en-us/library/ms187819%28v=sql.90%29.aspx

Anyway, I think I'm off to looking again at using csvdocument for
sdfdataset...

Thanks,
Reinier
-------------- next part --------------
 N:275 E:7 F:12 I:12
  TTestBasics N:9 E:0 F:0 I:0
    TestParseSQL
    TestInitFielddefsFromFields
    TestDoubleFieldDef
    TestFieldDefWithoutDS
    TestGetParamList
    TestGetFieldList
    TestExtractFieldName
    TestCheckFieldNames
    TestFindField
  TTestDBBasics N:33 E:0 F:3 I:2
    TestSetFieldValues
    TestGetFieldValues
    TestSupportIntegerFields
    TestSupportSmallIntFields
    TestSupportWordFields  Ignored test: Fields of the type Word are not supported by this type of dataset
    TestSupportStringFields  Failed: DataSize expected: <11> but was: <41>
    TestSupportBooleanFields
    TestSupportFloatFields
    TestSupportLargeIntFields
    TestSupportDateFields  Failed: DataType expected: <9> but was: <11>
    TestSupportTimeFields  Ignored test: Fields of the type Time are not supported by this type of dataset
    TestSupportCurrencyFields
    TestSupportBCDFields
    TestSupportfmtBCDFields
    TestSupportFixedStringFields  Failed: DataSize expected: <11> but was: <41>
    TestSupportBlobFields
    TestSupportMemoFields
    TestDoubleClose
    TestCalculatedField
    TestAssignFieldftString
    TestAssignFieldftFixedChar
    TestSelectQueryBasics
    TestPostOnlyInEditState
    TestMove
    TestActiveBufferWhenClosed
    TestEOFBOFClosedDataset
    TestLayoutChangedEvents
    TestDataEventsResync
    TestRecordcountAfterReopen
    TestdeFieldListChange
    TestExceptionLocateClosed
    TestCanModifySpecialFields
    TestDetectionNonMatchingDataset
  TTestCursorDBBasics N:29 E:0 F:0 I:0
    TestCancelUpdDelete1
    TestCancelUpdDelete2
    TestAppendInsertRecord
    TestBookmarks
    TestBookmarkValid
    TestDelete1
    TestDelete2
    TestLocate
    TestLocateCaseIns
    TestLocateCaseInsInts
    TestLookup
    TestOnFilter
    TestIntFilter
    TestNegativeIntFilter
    TestStringFilter
    TestNullAtOpen
    TestAppendOnEmptyDataset
    TestInsertOnEmptyDataset
    TestFirst
    TestEofAfterFirst
    TestLastAppendCancel
    TestRecNo
    TestSetRecNo
    TestBug7007
    TestBug6893
    TestRequired
    TestOldValueObsolete
    TestOldValue
    TestModified
  TTestBufDatasetDBBasics N:31 E:0 F:0 I:0
    TestClosedIndexFieldNames
    TestFileNameProperty
    TestClientDatasetAsMemDataset
    TestSaveAsXML
    TestIsEmpty
    TestBufDatasetCancelUpd
    TestBufDatasetCancelUpd1
    TestMultipleDeleteUpdateBuffer
    TestDoubleDelete
    TestReadOnly
    TestMergeChangeLog
    TestAddIndexInteger
    TestAddIndexSmallInt
    TestAddIndexBoolean
    TestAddIndexFloat
    TestAddIndexLargeInt
    TestAddIndexDateTime
    TestAddIndexCurrency
    TestAddIndexBCD
    TestAddIndex
    TestAddDescIndex
    TestAddCaseInsIndex
    TestInactSwitchIndex
    TestAddIndexActiveDS
    TestAddIndexEditDS
    TestIndexFieldNames
    TestIndexFieldNamesAct
    TestIndexCurRecord
    TestAddDblIndex
    TestIndexEditRecord
    TestIndexAppendRecord
  TTestUniDirectionalDBBasics N:33 E:1 F:3 I:2
    TestSetFieldValues
    TestGetFieldValues
    TestSupportIntegerFields
    TestSupportSmallIntFields
    TestSupportWordFields  Ignored test: Fields of the type Word are not supported by this type of dataset
    TestSupportStringFields  Failed: DataSize expected: <11> but was: <41>
    TestSupportBooleanFields
    TestSupportFloatFields
    TestSupportLargeIntFields
    TestSupportDateFields  Failed: DataType expected: <9> but was: <11>
    TestSupportTimeFields  Ignored test: Fields of the type Time are not supported by this type of dataset
    TestSupportCurrencyFields
    TestSupportBCDFields
    TestSupportfmtBCDFields
    TestSupportFixedStringFields  Failed: DataSize expected: <11> but was: <41>
    TestSupportBlobFields
    TestSupportMemoFields
    TestDoubleClose
    TestCalculatedField
    TestAssignFieldftString
    TestAssignFieldftFixedChar
    TestSelectQueryBasics
    TestPostOnlyInEditState
    TestMove
    TestActiveBufferWhenClosed
    TestEOFBOFClosedDataset
    TestLayoutChangedEvents
    TestDataEventsResync
    TestRecordcountAfterReopen
    TestdeFieldListChange
    TestExceptionLocateClosed
    TestCanModifySpecialFields  Error: EMSSQLDatabaseError
      Exception:   TMSSQLConnection : Error 20019 : 
Attempt to initiate a new Adaptive Server operation with results pending

      Source unit: 
      Method name: 
      Line number: 0
    TestDetectionNonMatchingDataset
  TTestFieldTypes N:76 E:6 F:5 I:7
    TestInt
    TestTinyint
    TestNumeric
    TestFloat
    TestDate  Failed: DataSize expected: <8> but was: <41>
    TestDateTime  Failed:  expected: <1899-12-29> but was: <1899-12-30>
    TestString  Failed: DataSize expected: <11> but was: <41>
    TestUnlVarChar  Ignored test: This test does only apply to Postgres, since others don't support varchars without length given
    TestBlob
    TestChangeBlob
    TestBlobGetText
    TestBlobSize
    TestSQLClob
    TestSQLLargeint
    TestSQLInterval  Ignored test: This test does not apply to this sqldb connection type
    TestSQLIdentity
    TestSQLReal
    TestStringLargerThen8192  Error: EMSSQLDatabaseError
      Exception:   TMSSQLConnection : Error 131 : 
General SQL Server error: Check messages from the SQL Server

The size (9000) given to the column 'FT' exceeds the maximum allowed for any data type (8000).
      Source unit: 
      Method name: 
      Line number: 0
    TestInsertLargeStrFields  Error: EMSSQLDatabaseError
      Exception:   TMSSQLConnection : Error 131 : 
General SQL Server error: Check messages from the SQL Server

The size (16000) given to the column 'NAME' exceeds the maximum allowed for any data type (8000).
      Source unit: 
      Method name: 
      Line number: 0
    TestLargeRecordSize  Error: EMSSQLDatabaseError
      Exception:   TMSSQLConnection : Error 131 : 
General SQL Server error: Check messages from the SQL Server

The size (8192) given to the column 'plant' exceeds the maximum allowed for any data type (8000).
      Source unit: 
      Method name: 
      Line number: 0
    TestNullValues
    TestAggregates
    TestBug9744
    TestDoubleFieldNames
    TestNumericFieldNames
    TestApplyUpdFieldNames
    TestParseJoins
    TestParseUnion
    TestClearUpdateableStatus  Ignored test: This test does only apply to MySQL because the used SQL-statement is MySQL only.
    TestReadOnlyParseSQL  Error: EDatabaseError
      Exception:   Field ID cannot be modified, it is read-only.
      Source unit: 
      Method name: 
      Line number: 0
    TestDblQuoteEscComments
    TestpfInUpdateFlag
    TestParamQuery
    TestStringParamQuery
    TestFixedStringParamQuery
    TestDateParamQuery  Failed:  expected: <1899-12-29> but was: <1899-12-30>
    TestCrossStringDateParam  Failed:  expected: <1899-12-29> but was: <1899-12-30>
    TestSmallIntParamQuery
    TestIntParamQuery
    TestLargeIntParamQuery
    TestTimeParamQuery  Ignored test: Fields of the type Time are not supported by this sqldb-connection type
    TestDateTimeParamQuery
    TestFmtBCDParamQuery
    TestFloatParamQuery
    TestBCDParamQuery
    TestBytesParamQuery
    TestVarBytesParamQuery
    TestBooleanParamQuery
    TestSetBlobAsMemoParam  Error: EMSSQLDatabaseError
      Exception:   TMSSQLConnection : Error 206 : 
General SQL Server error: Check messages from the SQL Server

Operand type clash: nvarchar is incompatible with image
      Source unit: 
      Method name: 
      Line number: 0
    TestSetBlobAsBlobParam
    TestSetBlobAsStringParam  Error: EMSSQLDatabaseError
      Exception:   TMSSQLConnection : Error 206 : 
General SQL Server error: Check messages from the SQL Server

Operand type clash: nvarchar is incompatible with image
      Source unit: 
      Method name: 
      Line number: 0
    Test11Params
    TestCircularParams
    TestNonNullableParams
    TestParametersAndDates  Ignored test: This test does not apply to this sqldb connection type, since it doesn't use semicolons for casts
    TestInsertReturningQuery  Ignored test: This test does not apply to this sqldb connection type
    TestOpenStoredProc
    TestOpenSpecialStatements
    TestErrorOnEmptyStatement
    TestExceptOnsecClose
    TestServerFilter
    TestRowsAffected
    TestLocateNull
    TestLocateOnMoreRecords
    TestRefresh
    TestTableNames
    TestGetTables
    TestFieldNames
    TestGetFieldNames
    TestUpdateIndexDefs
    TestMultipleFieldPKIndexDefs
    TestGetIndexDefs
    TestEmptyUpdateQuery
    TestTemporaryTable  Ignored test: This test does not apply to this sqldb connection type, since it doesn't support temporary tables
    TestQueryAfterReconnect
    TestStringsReplace
  TTestBufDatasetStreams N:37 E:0 F:1 I:0
    TestSimpleEditCancelUpd
    TestSimpleDeleteCancelUpd
    TestMoreDeletesCancelUpd
    TestSimpleInsertCancelUpd
    MoreInsertsCancelUpd
    SeveralEditsCancelUpd
    DeleteAllCancelUpd
    DeleteAllInsertCancelUpd
    AppendDeleteCancelUpd
    TestSimpleEditApplUpd
    TestSimpleDeleteApplUpd
    TestMoreDeletesApplUpd
    TestSimpleInsertApplUpd
    MoreInsertsApplUpd
    SeveralEditsApplUpd
    DeleteAllApplUpd
    DeleteAllInsertApplUpd
    NullInsertUpdateApplUpd
    TestBasicsXML
    TestSimpleEditXML
    TestSimpleDeleteXML
    TestMoreDeletesXML
    TestSimpleInsertXML
    TestMoreInsertsXML
    TestSeveralEditsXML
    TestDeleteAllXML
    TestDeleteAllInsertXML
    TestStreamingDataFieldsBIN
    TestStreamingDataFieldsXML  Failed: FDate expected: <31/03/1800> but was: <01/04/1800>
    TestStreamingBigBlobFieldsXML
    TestStreamingNullFieldsBIN
    TestStreamingNullFieldsXML
    TestStreamingCalculatedFieldsXML
    TestAppendDeleteBIN
    TestFileNameProperty
    TestXmlFileRecognition
    TestCloseDatasetNoConnection
  TTestTSQLQuery N:2 E:0 F:0 I:0
    TestMasterDetail
    TestUpdateServerIndexDefs
  TTestTSQLConnection N:1 E:0 F:0 I:0
    ReplaceMe
  TTestTSQLScript N:3 E:0 F:0 I:1
    TestExecuteScript
    TestScriptColon  Ignored test: This test does not apply to this sqldb connection type
    TestUseCommit
  TTestDBExport N:21 E:0 F:0 I:0
    TestDBFExport_DBaseIV
    TestDBFExport_DBaseVII
    TestDBFExport_FoxPro
    TestDBFExport_VisualFoxPro
    TestCSVExport
    TestCSVExport_RFC4180WithHeader
    TestCSVExport_TweakSettingsSemicolon
    TestFixedTextExport
    TestJSONExport
    TestRTFExport
    TestSQLExport
    TestTeXExport
    TestXMLExport
    TestXSDExport_Access_NoXSD_DecimalOverride
    TestXSDExport_Access_NoXSD_NoDecimalOverride
    TestXSDExport_Access_XSD_DecimalOverride
    TestXSDExport_Access_XSD_NoDecimalOverride
    TestXSDExport_ADONET_NoXSD
    TestXSDExport_ADONET_XSD
    TestXSDExport_DelphiClientDataset
    TestXSDExport_Excel

Number of run tests: 275
Number of errors:    7
Number of failures:  12

List of errors:
  Error: 
    Message:           TTestUniDirectionalDBBasics.TestCanModifySpecialFields: TMSSQLConnection : Error 20019 : 
Attempt to initiate a new Adaptive Server operation with results pending

    Exception class:   EMSSQLDatabaseError
    Exception message: TMSSQLConnection : Error 20019 : 
Attempt to initiate a new Adaptive Server operation with results pending

    Source unitname:   
    Line number:       0
    Failed methodname: 

  Error: 
    Message:           TTestFieldTypes.TestStringLargerThen8192: TMSSQLConnection : Error 131 : 
General SQL Server error: Check messages from the SQL Server

The size (9000) given to the column 'FT' exceeds the maximum allowed for any data type (8000).
    Exception class:   EMSSQLDatabaseError
    Exception message: TMSSQLConnection : Error 131 : 
General SQL Server error: Check messages from the SQL Server

The size (9000) given to the column 'FT' exceeds the maximum allowed for any data type (8000).
    Source unitname:   
    Line number:       0
    Failed methodname: 

  Error: 
    Message:           TTestFieldTypes.TestInsertLargeStrFields: TMSSQLConnection : Error 131 : 
General SQL Server error: Check messages from the SQL Server

The size (16000) given to the column 'NAME' exceeds the maximum allowed for any data type (8000).
    Exception class:   EMSSQLDatabaseError
    Exception message: TMSSQLConnection : Error 131 : 
General SQL Server error: Check messages from the SQL Server

The size (16000) given to the column 'NAME' exceeds the maximum allowed for any data type (8000).
    Source unitname:   
    Line number:       0
    Failed methodname: 

  Error: 
    Message:           TTestFieldTypes.TestLargeRecordSize: TMSSQLConnection : Error 131 : 
General SQL Server error: Check messages from the SQL Server

The size (8192) given to the column 'plant' exceeds the maximum allowed for any data type (8000).
    Exception class:   EMSSQLDatabaseError
    Exception message: TMSSQLConnection : Error 131 : 
General SQL Server error: Check messages from the SQL Server

The size (8192) given to the column 'plant' exceeds the maximum allowed for any data type (8000).
    Source unitname:   
    Line number:       0
    Failed methodname: 

  Error: 
    Message:           TTestFieldTypes.TestReadOnlyParseSQL: Field ID cannot be modified, it is read-only.
    Exception class:   EDatabaseError
    Exception message: Field ID cannot be modified, it is read-only.
    Source unitname:   
    Line number:       0
    Failed methodname: 

  Error: 
    Message:           TTestFieldTypes.TestSetBlobAsMemoParam: TMSSQLConnection : Error 206 : 
General SQL Server error: Check messages from the SQL Server

Operand type clash: nvarchar is incompatible with image
    Exception class:   EMSSQLDatabaseError
    Exception message: TMSSQLConnection : Error 206 : 
General SQL Server error: Check messages from the SQL Server

Operand type clash: nvarchar is incompatible with image
    Source unitname:   
    Line number:       0
    Failed methodname: 

  Error: 
    Message:           TTestFieldTypes.TestSetBlobAsStringParam: TMSSQLConnection : Error 206 : 
General SQL Server error: Check messages from the SQL Server

Operand type clash: nvarchar is incompatible with image
    Exception class:   EMSSQLDatabaseError
    Exception message: TMSSQLConnection : Error 206 : 
General SQL Server error: Check messages from the SQL Server

Operand type clash: nvarchar is incompatible with image
    Source unitname:   
    Line number:       0
    Failed methodname: 


List of failures:
  Failure: 
    Message:           TTestDBBasics.TestSupportStringFields: DataSize expected: <11> but was: <41>
    Exception class:   EAssertionFailedError
    Exception message: DataSize expected: <11> but was: <41>
  Failure: 
    Message:           TTestDBBasics.TestSupportDateFields: DataType expected: <9> but was: <11>
    Exception class:   EAssertionFailedError
    Exception message: DataType expected: <9> but was: <11>
  Failure: 
    Message:           TTestDBBasics.TestSupportFixedStringFields: DataSize expected: <11> but was: <41>
    Exception class:   EAssertionFailedError
    Exception message: DataSize expected: <11> but was: <41>
  Failure: 
    Message:           TTestUniDirectionalDBBasics.TestSupportStringFields: DataSize expected: <11> but was: <41>
    Exception class:   EAssertionFailedError
    Exception message: DataSize expected: <11> but was: <41>
  Failure: 
    Message:           TTestUniDirectionalDBBasics.TestSupportDateFields: DataType expected: <9> but was: <11>
    Exception class:   EAssertionFailedError
    Exception message: DataType expected: <9> but was: <11>
  Failure: 
    Message:           TTestUniDirectionalDBBasics.TestSupportFixedStringFields: DataSize expected: <11> but was: <41>
    Exception class:   EAssertionFailedError
    Exception message: DataSize expected: <11> but was: <41>
  Failure: 
    Message:           TTestFieldTypes.TestDate: DataSize expected: <8> but was: <41>
    Exception class:   EAssertionFailedError
    Exception message: DataSize expected: <8> but was: <41>
  Failure: 
    Message:           TTestFieldTypes.TestDateTime:  expected: <1899-12-29> but was: <1899-12-30>
    Exception class:   EAssertionFailedError
    Exception message:  expected: <1899-12-29> but was: <1899-12-30>
  Failure: 
    Message:           TTestFieldTypes.TestString: DataSize expected: <11> but was: <41>
    Exception class:   EAssertionFailedError
    Exception message: DataSize expected: <11> but was: <41>
  Failure: 
    Message:           TTestFieldTypes.TestDateParamQuery:  expected: <1899-12-29> but was: <1899-12-30>
    Exception class:   EAssertionFailedError
    Exception message:  expected: <1899-12-29> but was: <1899-12-30>
  Failure: 
    Message:           TTestFieldTypes.TestCrossStringDateParam:  expected: <1899-12-29> but was: <1899-12-30>
    Exception class:   EAssertionFailedError
    Exception message:  expected: <1899-12-29> but was: <1899-12-30>
  Failure: 
    Message:           TTestBufDatasetStreams.TestStreamingDataFieldsXML: FDate expected: <31/03/1800> but was: <01/04/1800>
    Exception class:   EAssertionFailedError
    Exception message: FDate expected: <31/03/1800> but was: <01/04/1800>


List of ignored tests:
  Ignored test: 
    Message:           TTestDBBasics.TestSupportWordFields: Fields of the type Word are not supported by this type of dataset
    Exception class:   EIgnoredTest
    Exception message: Fields of the type Word are not supported by this type of dataset
  Ignored test: 
    Message:           TTestDBBasics.TestSupportTimeFields: Fields of the type Time are not supported by this type of dataset
    Exception class:   EIgnoredTest
    Exception message: Fields of the type Time are not supported by this type of dataset
  Ignored test: 
    Message:           TTestUniDirectionalDBBasics.TestSupportWordFields: Fields of the type Word are not supported by this type of dataset
    Exception class:   EIgnoredTest
    Exception message: Fields of the type Word are not supported by this type of dataset
  Ignored test: 
    Message:           TTestUniDirectionalDBBasics.TestSupportTimeFields: Fields of the type Time are not supported by this type of dataset
    Exception class:   EIgnoredTest
    Exception message: Fields of the type Time are not supported by this type of dataset
  Ignored test: 
    Message:           TTestFieldTypes.TestUnlVarChar: This test does only apply to Postgres, since others don't support varchars without length given
    Exception class:   EIgnoredTest
    Exception message: This test does only apply to Postgres, since others don't support varchars without length given
  Ignored test: 
    Message:           TTestFieldTypes.TestSQLInterval: This test does not apply to this sqldb connection type
    Exception class:   EIgnoredTest
    Exception message: This test does not apply to this sqldb connection type
  Ignored test: 
    Message:           TTestFieldTypes.TestClearUpdateableStatus: This test does only apply to MySQL because the used SQL-statement is MySQL only.
    Exception class:   EIgnoredTest
    Exception message: This test does only apply to MySQL because the used SQL-statement is MySQL only.
  Ignored test: 
    Message:           TTestFieldTypes.TestTimeParamQuery: Fields of the type Time are not supported by this sqldb-connection type
    Exception class:   EIgnoredTest
    Exception message: Fields of the type Time are not supported by this sqldb-connection type
  Ignored test: 
    Message:           TTestFieldTypes.TestParametersAndDates: This test does not apply to this sqldb connection type, since it doesn't use semicolons for casts
    Exception class:   EIgnoredTest
    Exception message: This test does not apply to this sqldb connection type, since it doesn't use semicolons for casts
  Ignored test: 
    Message:           TTestFieldTypes.TestInsertReturningQuery: This test does not apply to this sqldb connection type
    Exception class:   EIgnoredTest
    Exception message: This test does not apply to this sqldb connection type
  Ignored test: 
    Message:           TTestFieldTypes.TestTemporaryTable: This test does not apply to this sqldb connection type, since it doesn't support temporary tables
    Exception class:   EIgnoredTest
    Exception message: This test does not apply to this sqldb connection type, since it doesn't support temporary tables
  Ignored test: 
    Message:           TTestTSQLScript.TestScriptColon: This test does not apply to this sqldb connection type
    Exception class:   EIgnoredTest
    Exception message: This test does not apply to this sqldb connection type





More information about the fpc-devel mailing list