AV (access violation) when calling TzMysql41PlainDriver.init

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
maxoverdrive
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 14.04.2009, 22:31

AV (access violation) when calling TzMysql41PlainDriver.init

Post by maxoverdrive »

var mydriver:IMysqlPlainDriver;
mysqldb:PZMysqlConnection;
begin
mydriver := Tzmysql41PlainDriver.create()
mydriver.init(mysqldb);<-- causes access violation, @MYSQL_API.mysql_init = $00000000
...
end;

what am I doing wrong, is there another step I am missing?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi Max,

Is this just a first try or did this way of working work before I partially rewrote the Plaindriver stuff?

I think adding mydriver.Initialize; should do the trick. This effectively loads the dll and assigns the function addresses.

Can you tell why you want to use the zeoslib plaindriver layer directly? I'm just curious. Because it means you would have to do all data fetching code yourself (which is quite cumbersome using mysql) and that code is not portable to other databases. Of course, when you only want to use some simple calls (like getting the library version) this would be the most efficient way of working. Otherwise i'd suggest to use at least the zdbc layer.

Mark
Image
maxoverdrive
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 14.04.2009, 22:31

didn't work

Post by maxoverdrive »

@MYSQL_API.mysql_connect is still nil
though @MYSQL_API.mysql_realconnect seems to work.

(I had tried the Initialize method before but gave up when mydriver.connect didn't work)

perhaps the plain api needs to check for nil functions and raise some exceptions? :D
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Isn't an AV an exception? :P Checking before every call would be vey expensive.

Anyhow, I'd think mysql_connect should be loaded. Or is it already removed from more recent dll's? As far as I know our higher level layers use the real_connect call.

Mark
Image
Post Reply