"Unknown column "concat(r.ime,' ',r,prezime)" in where clause"

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
vortex77
Posts: 15
Joined: Wed 20 Sep 2006 11:03

"Unknown column "concat(r.ime,' ',r,prezime)" in where clause"

Post by vortex77 » Fri 09 Nov 2007 08:48

Hello,

I've stumbled at problem that I just cant get my mind around.
This is the query :

select r.*,
CONCAT(r.ime,' ',r.prezime),
vk.nazivk
from mkrodjeni r,
vrstek vk
where
r.sifops = :so AND
r.kljuc = :k AND
vk.brknjige = r.brknjige


Query needs to read and write new and modified data with prior locking.
Everything work fine until I call external "order by" (from TGrid).
When I try to call MyQuery1.Lock(lrImmediately) I get message :

"Unknown column "concat(r.ime,' ',r,prezime)" in where clause"

This happens with any and all queries with concat statement.

Please help!!! :)

ps. I work with Delphi7 and MyDAC 5.20.0.11

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 09 Nov 2007 14:20

Most likely that your mkrodjeni table does not contain a primary key. Try to define a primary key in mkrodjeni.

vortex77
Posts: 15
Joined: Wed 20 Sep 2006 11:03

Post by vortex77 » Mon 12 Nov 2007 07:35

No, it has a primary key, foreign keys and all normalizations are done.

Error comes only after I implicitly add "order by" clause in query with

Query.SetOrderBy(Field); // Field = "r.ime" from example
Query.SQL.Add(OrderBy); // OrderBy can be "asc" or "desc"
Query.Execute;

After I reset query.Sql everything work fine....

vortex77
Posts: 15
Joined: Wed 20 Sep 2006 11:03

Post by vortex77 » Mon 12 Nov 2007 08:56

Ok...
Ive tested application a bit more and this is what I came to:

1) If I have CONCAT and ORDER BY in query and call LOCK - Error shows.
2) If I have CONCAT without ORDER BY - Lock works fine
3) If I have ORDER BY without CONCAT - Lock works fine.

Did I misunderstand Lock command or is this a bug?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 14 Nov 2007 14:10

I could not reproduce the problem.
Please send me a complete small sample at mydac*crlab*com to demonstrate it, including script to create and fill table.

Also supply me the following information:
- exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- exact version of your IDE;
- exact version of MySQL server and MySQL client. You can see it in the Info sheet of TMyConnection Editor.

vortex77
Posts: 15
Joined: Wed 20 Sep 2006 11:03

Post by vortex77 » Thu 15 Nov 2007 12:19

I've just send test application (full source code and compiled exe)
to demonstrate error, along with sql file with complete data and definitions.

Hope this will help.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 16 Nov 2007 14:58

Thank you for your example. Please download MyDAC 5.20.0.12 from our site. It should fix this problem.

vortex77
Posts: 15
Joined: Wed 20 Sep 2006 11:03

Post by vortex77 » Mon 19 Nov 2007 08:04

I have downloaded latest version, but problem remains!

Not even test application worked.

The error is still here.

Please help,coz I need to resolve this problem quickly due to clients deadline.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 20 Nov 2007 10:45

Thanks you for information. It looks like this problem has not been fixed completely.
Please send me your registration information by e-mail.

vortex77
Posts: 15
Joined: Wed 20 Sep 2006 11:03

Post by vortex77 » Wed 21 Nov 2007 11:45

License info has been send to your e mail.

Hope this helps us solve this problem

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 21 Nov 2007 13:39

We have checked your license. You have access to MyDAC sources. So I have sent you instructions on how to change the source code to fix this problem. Please check the e-mail address you used for MyDAC registration.

Post Reply