Page 1 of 1

AV (access violation) when calling TzMysql41PlainDriver.init

Posted: 14.04.2009, 22:41
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?

Posted: 15.04.2009, 10:38
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

didn't work

Posted: 16.04.2009, 00:14
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

Posted: 16.04.2009, 00:42
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