Page 1 of 1

ERangeError by Query

Posted: 08.03.2007, 15:28
by hamza
Hello,


I'm trying to use ZeosDBO6.6.0 with Turbo Delphi Prof (BDS 2006).

If I try to set "ZQuery1.active:= true" I get an ERangeError (in German: "Fehler bei Bereichsüberprüfung").

What can I do?

Posted: 08.03.2007, 23:09
by mdaems
No idea, but your information is quite 'limited'.
Can you provide some detail information?
Does it fail for one specific query or for all queries? If only for a specific case, can you provide an easy reproduction setup (table creation script and failing query)?

Mark

Posted: 09.03.2007, 19:58
by hamza
mdaems wrote:No idea, but your information is quite 'limited'.
Can you provide some detail information?
Does it fail for one specific query or for all queries? If only for a specific case, can you provide an easy reproduction setup (table creation script and failing query)?

Mark
It fails for all SELECT-Queries (query.open).

I can insert data into the database but cannot read by "SELECT".

This is the code I wrote:

Code: Select all

ZQuery1.SQL.Text:= 'SELECT * FROM artikeldaten_stamm';
Zquery1.Open;
Here I get an error.

If I use "ExecSQL" instead of "Open" I don't get an error. But I also don't get any data.

And with

Code: Select all

ZQuery1.SQL.Text:= 'INSERT INTO artikeldaten_stamm SET ' +
                   'bezeichnung = ''turbo delphi'', ' +
                   'barcode = 12981928';
ZQuery1.ExecSQL;
I cant insert a new line.

Posted: 10.03.2007, 17:15
by mdaems
Strange, it must be a range check error while fetching the results. Maybe you use an incompatible dll for the protocol you selected (so we could point to the wrong places in buffers). Can you find the exact statement where the range check error occurs?

BTW, selects do work for most users, even for BDS2006...

Mark

Posted: 12.03.2007, 11:28
by hamza
Hi again,

I tried the same way with a Firebird 2.0-database and that works without any problems (The other database was Mysql5).

Posted: 13.03.2007, 00:24
by mdaems
Hi Hamza,

Did you not add the point where the failure was? I was thinking you wrote it failed on a call in the plain driver units.
This typically happens when the layout of the mysql buffers changed between versions. Did you use the DLL we provide and was your app actually loading this version? You can be a little more sure when you name the dll libmysql50.dll and put it in the same dir as your app. Early mysql 5 versions certainly have this problem. Also, when a mysql 4 dll is in your path, you may have this kind of trouble.

Mark

Posted: 13.03.2007, 10:08
by hamza
:wallb:

Ok. It was that!

I had already copied the dll in the application directory but it was mysqld50.dll and not mysql50.dll.

It would be better if there were an error message that the correct dll-file is missing in the directory.

Posted: 13.03.2007, 11:52
by mdaems
I agree this kind of problem is an horror. Problem her was that he actually found a dll (windows behaviour : if it finds a dll with the right name somewhere he's happy). So it used a dll in your path.

There is a way you can detect bad dll versions for mysql, however.
You can use the Serverversion properties of your connection. If you use the 6.6.1 release it should be included and working before you connect. Just check if serverversion > 5000000 (5.0.0) and you should be allright. (to be correct: there was also a different buffer layout in earlier dll versions for version 5, so you better use a number like 5000020.

A second solution is enabling the {$DEFINE MYSQL_STRICT_DLL_LOADING} directive in zeos.inc. That way only the dll with versioned name is tried.

Mark