[solved] ZeosLib version and SQLite error

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

Moderators: gto, EgonHugeist

Post Reply
jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre

[solved] ZeosLib version and SQLite error

Post by jjeffman »

Hello.

I am posting this topic in this forum because I do not know how to check which ZeosLib version I have installed on C++Builder 6.0 Professional Edition.

I have chosen sqlite-3 Protocol for the TZConnection component.

The SQL select command bellow raises an EZSQLEception (SQL logic error or missing database) when I call the Open method, but it does not raise any exception at design time ( data shownn in a grid!) and runs fine on "SQLite Expert Personal 3":

[SQL]
SELECT usr.apuser, IFNULL( usr.name, usr.username ) AS name
FROM apuser usr
WHERE
UPPER(usr.username) = UPPER(:usrname) AND
(usr.password IS NULL
OR UPPER(usr.password) = UPPER(:pwd)) AND
usr.status = 'S'
[/SQL]

What am I doing wrong ?

Thanks a lot.

Jayme Jeffman Filho
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

jjeffman,

did you assign the Parameters? In ZClasses.pas is a constant which declares the Major, Minior and Release Vesion+ stable/beta/alfa. But no SVN version is availabe..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre

Post by jjeffman »

Thank you for answering.

Yes I did.

Parameter "pwd" should may have a null value, and it works at design time.

Code: Select all

   QAppLogin->Close();
    QAppLogin->ParamByName("pwd")->Clear();
    QAppLogin->ParamByName("usrname")->AsString = cAppUser;
    if(cAppPwd.Length() > 0)
      QAppLogin->ParamByName("pwd")->AsString = cAppPwd;
    QAppLogin->Open();
I was not able to check if the value assignment is working because Zeos components do not behave the same way CBuilders' do.

My Zeos version is ZEOS_VERSION = '6.6.6-stable';
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br
jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre

Post by jjeffman »

I have found the problem, at runtime the column name "password" is not permited although it runs perfectly at design time. Perhaps it is a component bug because SQLite allows naming a column as "password".

Is there a way around of this without changing the column name ? Like MySQL putting the column name between special quotes.

I have tried all options given at http://www.sqlite.org/lang_keywords.html, all of them are suported by "SQLite Express Personal 3" but none of them has worked on TZReadOnlyQuery.

Thank you very much.
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

jjeffman,

hmm currently i can't see what should be going wrong. IMHO your code should work. Which compiler do you use? Can you provide a little template app which points me to this issue? Also would it be a good idea to update to Zeos7-7.0.1-Beta or SVN. Then we are on the same bandwidth..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre

Post by jjeffman »

I have made a simple C++Builder application using the same SQLite table structure which I have failed on perform a SQL select to perform user login to the application.

When testing the application I saw it was working perfectly. The diferences are :

1. I have said it works at design time. The SQL parameters are set through the IDE, not by code;

2. On the new application I am using the Borland's "InputQuery" function to get the SQL parameters;

So the problem must be on the way I am passing parameters at runtime on the old application. I will go after the solution checking the parameters values. They can have been corrupted by the way I am getting them.

Thank you very much.

Kind regards.
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br
jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre

Post by jjeffman »

Hi,

The problem was the code to get the network user using Windows API GetUserName function which returns a buffer ended by a '\0' character.

I have cut the '\0' when present and the application is working fine.

Thank you very much.

Kind regards.
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

jjeffman,

:up: Allways nice to heare it works!
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Post Reply