BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DBX2.5 and DBX3 define SQLResult different from DBX4

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress)
View previous topic :: View next topic  
Author Message
Martijn Tonies
Guest





PostPosted: Wed Apr 11, 2007 10:15 pm    Post subject: DBX2.5 and DBX3 define SQLResult different from DBX4 Reply with quote



Now, this is a problem when using the native drivers...

D2007 loads a driver by using a wrapper and then expects
TDBXErrorCode to be of type "Longint" (TInt32).

However, D2006 and before defined SQLResult (the old
TDBXErrorCode) to be of type Word.

My driver fails loading here:

procedure TDBXDynalinkConnection.DerivedOpen;
var
Count: TInt32;
Names: TWideStringArray;
Values: TWideStringArray;
IsolationLevel: Integer;
DBXError: TDBXErrorCode;
begin
Count := FConnectionProperties.Properties.Count;
FConnectionProperties.GetLists(Names, Values);

CheckResult(FMethodTable.FDBXConnection_Connect(FConnectionHandle, Count,
Names, Values));
DBXError := FMethodTable.FDBXConnection_GetIsolation(FConnectionHandle,
IsolationLevel);
// Some drivers like mysql do not support isoalation level.
//
if DBXError = TDBXErrorCodes.NotSupported then
IsolationLevel := TInt32(TDBXIsolations.DirtyRead)
else
CheckResult(DBXError);

FIsolationLevel := TDBXIsolation(IsolationLevel);

end;

When checking "IsolationLevel", the driver returns SQL_SUCCESS (0).

But the value in DBXError is $00 $00 $12 $00 at that moment.

Word(DBXError) = 0 though.

Why is this failing like this? Why is TDBXError Int32?


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
Back to top
Robert
Guest





PostPosted: Thu Apr 12, 2007 4:14 am    Post subject: Re: DBX2.5 and DBX3 define SQLResult different from DBX4 Reply with quote



Martijn,

why don't you create a different dll for DBX3 ie.

DBX2.5 and before:

dbx_upfb.dll

DBX3 and above:

dbx3_upfb.dll

Regards,

Robert.




"Martijn Tonies" <m.tonies (AT) upscene (DOT) removethis.com> wrote in message
news:461d1785$1 (AT) newsgroups (DOT) borland.com...
Quote:
Now, this is a problem when using the native drivers...

D2007 loads a driver by using a wrapper and then expects
TDBXErrorCode to be of type "Longint" (TInt32).

However, D2006 and before defined SQLResult (the old
TDBXErrorCode) to be of type Word.

My driver fails loading here:

procedure TDBXDynalinkConnection.DerivedOpen;
var
Count: TInt32;
Names: TWideStringArray;
Values: TWideStringArray;
IsolationLevel: Integer;
DBXError: TDBXErrorCode;
begin
Count := FConnectionProperties.Properties.Count;
FConnectionProperties.GetLists(Names, Values);

CheckResult(FMethodTable.FDBXConnection_Connect(FConnectionHandle, Count,
Names, Values));
DBXError := FMethodTable.FDBXConnection_GetIsolation(FConnectionHandle,
IsolationLevel);
// Some drivers like mysql do not support isoalation level.
//
if DBXError = TDBXErrorCodes.NotSupported then
IsolationLevel := TInt32(TDBXIsolations.DirtyRead)
else
CheckResult(DBXError);

FIsolationLevel := TDBXIsolation(IsolationLevel);

end;

When checking "IsolationLevel", the driver returns SQL_SUCCESS (0).

But the value in DBXError is $00 $00 $12 $00 at that moment.

Word(DBXError) = 0 though.

Why is this failing like this? Why is TDBXError Int32?


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle
&
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

Back to top
Martijn Tonies
Guest





PostPosted: Thu Apr 12, 2007 8:11 am    Post subject: Re: DBX2.5 and DBX3 define SQLResult different from DBX4 Reply with quote



Robert,

Quote:
why don't you create a different dll for DBX3 ie.

DBX2.5 and before:

dbx_upfb.dll

DBX3 and above:

dbx3_upfb.dll

I am compiling a different one for DBX3, cause bugs in the
TSQL<range> of components don't allow for a single library.

That being said, in D2006 (DBX3), "SQLResult" is defined
as a Word, 2 bytes, as I mentioned in my original post.

This fails when used with the dynalink driver in D2007.


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
Back to top
Robert
Guest





PostPosted: Fri Apr 13, 2007 7:55 am    Post subject: Re: DBX2.5 and DBX3 define SQLResult different from DBX4 Reply with quote

I got an idea since DBX3 in D2007 is not the same as in D2006

you could create a DBX4 driver.
no previous version of delphi handles DBX4

Apparently according to the sales pitch ( and I believe the salesman ;-> )

A DBX4 driver is MUCH more easier to create than a DBX3 and below driver.
( even a dimwit like me could do it. )

Kind regards,

Robert.




"Martijn Tonies" <m.tonies (AT) upscene (DOT) removethis.com> wrote in message
news:461ddd95 (AT) newsgroups (DOT) borland.com...
Quote:
Robert,

why don't you create a different dll for DBX3 ie.

DBX2.5 and before:

dbx_upfb.dll

DBX3 and above:

dbx3_upfb.dll

I am compiling a different one for DBX3, cause bugs in the
TSQL<range> of components don't allow for a single library.

That being said, in D2006 (DBX3), "SQLResult" is defined
as a Word, 2 bytes, as I mentioned in my original post.

This fails when used with the dynalink driver in D2007.


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle
&
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

Back to top
Martijn Tonies
Guest





PostPosted: Fri Apr 13, 2007 8:11 am    Post subject: Re: DBX2.5 and DBX3 define SQLResult different from DBX4 Reply with quote

Quote:
I got an idea since DBX3 in D2007 is not the same as in D2006

DBX3 doesn't really come with D2007, that's why the dynalink
driver was developed by Borland/CodeGear. Problem is, something
is going wrong there, and I don't know why.

Quote:
you could create a DBX4 driver.
no previous version of delphi handles DBX4

Apparently according to the sales pitch ( and I believe the salesman ;-> )

A DBX4 driver is MUCH more easier to create than a DBX3 and below driver.
( even a dimwit like me could do it. )

Well, might be easier, but requires a total restructuring of a driver that
works NOW in D6, D7, D2006 and K3...

I'm not gonna re-write that this week or next week :-)


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

If you can't dazzle em with brilliance, baffle em with bullshit
Back to top
Peter Sawatzki
Guest





PostPosted: Sat Apr 14, 2007 4:08 am    Post subject: Re: DBX2.5 and DBX3 define SQLResult different from DBX4 Reply with quote

Martijn,

I found this last week before going to vaccation and I think it is this
bug report I filed #43200 and wrote a mail to Steve.

QC #43200 Status: Reported
dbxadapt30 does not communicate all connection parameters to driver.

I circumevented the problem for now by putting a dummy setting into my
drivers ini file because the code in dbxadapter30 has an if/then wrong
(IMO)

IsolationLevel=Dummy
CA400 TransIsolation=DirtyRead


Additional info from me:
------------------------------------------------------------
I think there is a bug in dbxadapt30 when determining the <driver name>
isolation level. I kept getting only calls setting
eConnTxnIsolationLevel to 0, despite correctly setting my drivers
"CA400 TransIsolation] to a certain value. I've now debugged
dbxadapt30.dll and think it is first checking for an entry of
"IsolationLevel", and if it is not present, it skips checking for
"<drivername> TransIsolation". It should be vice versa, if
IsolationLevel is NOT present, check for the <drivername>
TransIsolation.
(BTW now that I know this, when I set TransIsolation to a dummy value
in my connection parameters it works fine retrieving the drivername
TransIsolation value.)


From dbxadapt30.dll

..text:00402230 push offset aIsolationlevel ;
"IsolationLevel"
..text:00402235 push edi ; int
..text:00402236 call sub_40543C
..text:0040223B mov ebx, eax
..text:0040223D test eax, eax
..text:0040223F jz short skipIsolationLevel
..text:00402241 push [ebp+s] ; s
..text:00402244 call _wcslen
..text:00402249 pop ecx
..text:0040224A mov ebx, eax
..text:0040224C push offset aSTransisolation ; "%s
TransIsolation"
..text:00402251 call _wcslen
..text:00402256 pop ecx
..text:00402257 add ebx, eax
..text:00402259 inc ebx
..text:0040225A add ebx, ebx
..text:0040225C push ebx
..text:0040225D call @$bnwa$qui ; operator
new[](uint)
..text:00402262 pop ecx
..text:00402263 mov [ebp+block], eax
..text:00402266 push [ebp+s]
..text:00402269 push offset aSTransisolation ; "%s
TransIsolation"
..text:0040226E push [ebp+block] ; buffer
..text:00402271 call _swprintf
..text:00402276 add esp, 0Ch
..text:00402279 push [ebp+block] ; s1
..text:0040227C push edi ; int
..text:0040227D call sub_40543C
..text:00402282 mov ebx, eax
..text:00402284 push [ebp+block] ; block
..text:00402287 call unknown_libname_52 ; BCC
v4.x/5.x & BCB v1.0/v7.0 BDS2006 win32 runtime
..text:0040228C pop ecx
..text:0040228D
..text:0040228D skipIsolationLevel: ; CODE XREF:
setOptions?+1B3j
..text:0040228D mov [ebp+var_1], 0
..text:00402291 test ebx, ebx
..text:00402293 jz short loc_4022EC
..text:00402295 push offset aRepeatableread ;
"RepeatableRead"
..text:0040229A push ebx ; s1
..text:0040229B call __wcsicmp
..text:004022A0 add esp, 8
..text:004022A3 test eax, eax
..text:004022A5 jnz short loc_4022AD
..text:004022A7 mov [ebp+var_1], 1
..text:004022AB jmp short loc_4022EC
..text:004022AD ;
------------------------------------------------------------------------
---
..text:004022AD
..text:004022AD loc_4022AD: ; CODE XREF:
setOptions?+219j
..text:004022AD push offset aDirtyread ; "DirtyRead"
..text:004022B2 push ebx ; s1
..text:004022B3 call __wcsicmp
..text:004022B8 add esp, 8
..text:004022BB test eax, eax
..text:004022BD jnz short loc_4022C5
..text:004022BF mov [ebp+var_1], 2
..text:004022C3 jmp short loc_4022EC
..text:004022C5 ;
------------------------------------------------------------------------
---
..text:004022C5
..text:004022C5 loc_4022C5: ; CODE XREF:
setOptions?+231j
..text:004022C5 push ebx
..text:004022C6 push offset aUnrecognizedIsola ;
"Unrecognized isolation level %s"
..text:004022CB lea eax, [ebp+src]
..text:004022D1 push eax ; buffer
..text:004022D2 call _swprintf
..text:004022D7 add esp, 0Ch
..text:004022DA lea edx, [ebp+src]
..text:004022E0 push edx ; src
..text:004022E1 push 5 ; int
..text:004022E3 lea ecx, [esi+0Ch]
..text:004022E6 push ecx ; int
..text:004022E7 call sub_405350
..text:004022EC
..text:004022EC loc_4022EC: ; CODE XREF:
setOptions?+207j
..text:004022EC ;
setOptions?+21Fj ...

Peter

Martijn Tonies wrote:

Quote:
Now, this is a problem when using the native drivers...

D2007 loads a driver by using a wrapper and then expects
TDBXErrorCode to be of type "Longint" (TInt32).

However, D2006 and before defined SQLResult (the old
TDBXErrorCode) to be of type Word.

My driver fails loading here:

procedure TDBXDynalinkConnection.DerivedOpen;
var
Count: TInt32;
Names: TWideStringArray;
Values: TWideStringArray;
IsolationLevel: Integer;
DBXError: TDBXErrorCode;
begin
Count := FConnectionProperties.Properties.Count;
FConnectionProperties.GetLists(Names, Values);

CheckResult(FMethodTable.FDBXConnection_Connect(FConnectionHandle,
Count, Names, Values));
DBXError :=
FMethodTable.FDBXConnection_GetIsolation(FConnectionHandle,
IsolationLevel); // Some drivers like mysql do not support
isoalation level. //
if DBXError = TDBXErrorCodes.NotSupported then
IsolationLevel := TInt32(TDBXIsolations.DirtyRead)
else
CheckResult(DBXError);

FIsolationLevel := TDBXIsolation(IsolationLevel);

end;

When checking "IsolationLevel", the driver returns SQL_SUCCESS (0).

But the value in DBXError is $00 $00 $12 $00 at that moment.

Word(DBXError) = 0 though.

Why is this failing like this? Why is TDBXError Int32?



--
Back to top
Martijn Tonies
Guest





PostPosted: Sat Apr 14, 2007 10:24 pm    Post subject: Re: DBX2.5 and DBX3 define SQLResult different from DBX4 Reply with quote

Hello Peter,

Quote:
I found this last week before going to vaccation and I think it is this
bug report I filed #43200 and wrote a mail to Steve.

QC #43200 Status: Reported
dbxadapt30 does not communicate all connection parameters to driver.

No, this is different.

I'm glad to read you can use "IsolationLevel" instead of "<Drivername>
IsolationLevel" now though ;)

My problem is that my driver returns an error code of 0 (SQL_SUCCESS),
but the dbxadapter fails to read it properly, cause it thinks it gets 4
bytes
as a result, while SQLResult is only 2 bytes in Delphi < 2007 (Word).


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

If you can't dazzle em with brilliance, baffle em with bullshit
Back to top
Martijn Tonies
Guest





PostPosted: Thu Apr 19, 2007 5:57 pm    Post subject: Re: DBX2.5 and DBX3 define SQLResult different from DBX4 Reply with quote

No-one from CodeGear to shed a light on this?

--
Martijn


Quote:
Now, this is a problem when using the native drivers...

D2007 loads a driver by using a wrapper and then expects
TDBXErrorCode to be of type "Longint" (TInt32).

However, D2006 and before defined SQLResult (the old
TDBXErrorCode) to be of type Word.

My driver fails loading here:

procedure TDBXDynalinkConnection.DerivedOpen;
var
Count: TInt32;
Names: TWideStringArray;
Values: TWideStringArray;
IsolationLevel: Integer;
DBXError: TDBXErrorCode;
begin
Count := FConnectionProperties.Properties.Count;
FConnectionProperties.GetLists(Names, Values);

CheckResult(FMethodTable.FDBXConnection_Connect(FConnectionHandle,
Count,
Names, Values));
DBXError := FMethodTable.FDBXConnection_GetIsolation(FConnectionHandle,
IsolationLevel);
// Some drivers like mysql do not support isoalation level.
//
if DBXError = TDBXErrorCodes.NotSupported then
IsolationLevel := TInt32(TDBXIsolations.DirtyRead)
else
CheckResult(DBXError);

FIsolationLevel := TDBXIsolation(IsolationLevel);

end;

When checking "IsolationLevel", the driver returns SQL_SUCCESS (0).

But the value in DBXError is $00 $00 $12 $00 at that moment.

Word(DBXError) = 0 though.

Why is this failing like this? Why is TDBXError Int32?


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle
&
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.