Bug #30770 | Access Violation in myodbc3.dll | ||
---|---|---|---|
Submitted: | 3 Sep 2007 12:40 | Modified: | 8 Jul 2008 9:04 |
Reporter: | Dietmar Augsten | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / ODBC | Severity: | S2 (Serious) |
Version: | 3.51.17 up | OS: | Windows (XP SP2) |
Assigned to: | Bogdan Degtyariov | CPU Architecture: | Any |
Tags: | 3.51, 5.1, av, odbc_postga51 |
[3 Sep 2007 12:40]
Dietmar Augsten
[3 Sep 2007 17:33]
Kent Boortz
Could you attach to this bug report a manager trace log when it works and when it doesn't? Would help a lot.
[4 Sep 2007 7:20]
Tonci Grgin
Hi Dietmar and thanks for your report. I have no problem with Delphi. Can you please do as Kent suggested and attach: - my.ini/cnf - Full Delphi test case - ODBC DM trace what is the version of Delphi you're using? Are you going through BDE?
[5 Sep 2007 4:13]
Dietmar Augsten
Delphi using: Delphi 6 and Delphi 2006. Runnig in IDE or compiled by commandline-bcc32 and runnig after it. All four combinations will show the same error. Logs, and i hope so a testcace, will follow later this day.
[5 Sep 2007 7:56]
Dietmar Augsten
ODBC log
Attachment: odbclog.zip (application/x-zip-compressed, text), 85.57 KiB.
[5 Sep 2007 8:27]
Tonci Grgin
Dietmar, this suits me perfectly as I have both versions. Waiting on test case.
[5 Sep 2007 8:44]
Dietmar Augsten
Testcase Delphi incl. logs and my.ini
Attachment: Testcase_Delphi_Src.zip (application/x-zip-compressed, text), 15.43 KiB.
[12 Sep 2007 6:10]
Dietmar Augsten
AV also in ver 3.51.20
[14 Sep 2007 9:06]
Tonci Grgin
Dietmar, yes, and in 5.1 too... I will need some time to figure out what's going on behind the scene.
[14 Sep 2007 10:56]
Tonci Grgin
Dietmar, VBS test case passes but it has 1 significant difference from your test case, it searches for table names by itself: option explicit dim connectionString : connectionString = "DSN=myodbccln;uid=root;pwd=***" ' Open ADO connection Dim Conn : set conn = CreateObject("ADODB.Connection") conn.ConnectionString = connectionString conn.Open conn.Execute "USE tst1" conn.Execute "USE tst2" dim txt : txt = "" Dim TablesSchema : Set TablesSchema = Conn.OpenSchema(20) ' this line is also used in the plugin Do While Not TablesSchema.EOF dim tableName : tableName = TablesSchema("TABLE_NAME") txt = txt & tableName & VBCRLF & " -> " 'Get all columns of the current table Dim ColumnsSchema : Set ColumnsSchema = Conn.OpenSchema(4, Array(Empty, Empty,tableName)) ' Add all channels Do While Not ColumnsSchema.EOF dim columnName : columnName = ColumnsSchema("COLUMN_NAME") txt = txt & columnName & ";" ColumnsSchema.MoveNext Loop txt = txt & VBCRLF ' Next table TablesSchema.MoveNext Loop MsgBox txt Can you try and mimic this in your Delphi app and see if it works (i.e. do not send table_name but rewrite function to loop through retrieved table names)?
[14 Sep 2007 12:11]
Dietmar Augsten
a possible alternative in Delphi would be function GetFieldList(table: String; sC : TADoConnection): String; VAR DS, DS2 : TADODataSet; name : ShortString; AT : TADOTable; lokTable : OLEVariant; lokTableStr: String; BEGIN DS := TADODataSet.Create(Nil); DS2 := TADODataSet.Create(Nil); result := ''; try DS.Recordset := sC.ConnectionObject.OpenSchema(adSchemaTables,VarArrayOf([Unassigned, Unassigned, Unassigned, Unassigned]), EmptyParam); DS.First; WHILE NOT DS.Eof DO BEGIN lokTableStr := DS.FieldByName('TABLE_NAME').Value; if AnsiUpperCase(lokTableStr) = AnsiUpperCase(table) then begin StrPCopy(lokTable,DS.FieldByName('TABLE_NAME').Value); DS2.Recordset := sC.ConnectionObject.OpenSchema(adSchemaColumns,VarArrayOf([Unassigned, Unassigned, Unassigned, DS.FieldByName('TABLE_NAME').Value]), EmptyParam); WHILE NOT DS2.Eof DO BEGIN name := DS2.FieldByName('COLUMN_NAME').AsString; if result = '' then result := name else result := result + ', '+name; END; end; DS.Next; END; except end; DS.Free; DS2.Free; end; The outer OpenSchema works, but the inner shows the "normal" AV.
[14 Sep 2007 12:45]
Tonci Grgin
Same here...
[11 Feb 2008 13:55]
Tonci Grgin
Verified as described, traces & test cases already attached.
[11 Feb 2008 13:56]
Tonci Grgin
Imo, this has got to do with CodeGear implementation of ADO, not MyODBC per se, but will see what dev's have to say.
[29 Apr 2008 18:14]
Bogdan Degtyariov
Access Violation occurs in SQLColumns: TestmySQL 9f0-100 ENTER SQLColumnsW HSTMT 02C02510 WCHAR * 0x00000000 [ -3] <empty string> SWORD -3 WCHAR * 0x00000000 [ -3] <empty string> SWORD -3 WCHAR * 0x023B7990 [ -3] "sqlabfragen\ 0" SWORD -3 WCHAR * 0x00000000 [ -3] <empty string> SWORD -3
[5 May 2008 15:26]
Bogdan Degtyariov
patch and test case
Attachment: patch30770.diff (application/octet-stream, text), 2.05 KiB.
[5 May 2008 15:38]
Jim Winstead
looks good, but i would change 0 to NULL in the new ?: expression.
[15 May 2008 14:43]
Bogdan Degtyariov
The patch has been committed to the source repository. Will be included in MyODBC 3.51.26
[8 Jul 2008 9:04]
Tony Bedford
An entry has been added to the 3.51.26 Changelog: When an ADOConnection is created and attempts to open a schema with ADOConnection.OpenSchema an access violation occurs in myodbc3.dll.