Hello folks.
I recently updated a mysql server from version 5.0.19 to version 5.0.41 (the newest version on mysql.org download site). After that a problem begins to happens in my code that was running fine on that previews version of mysql.
Follow the description of the problem:
- Some query: "SELECT A_FIELD FROM A_TABLE WHERE DATE_FIELD = :A_PARAMETER"
- I use a TMyQuery component, named 'query' for instance, to execute the previous statement.
- In my c++ builder 6 project, before openning the query, i have the following lines of code:
...
query->ParamByName("A_PARAMETER")->DataType = ftDateTime;
query->ParamByName("A_PARAMETER")->Value = a_valid_date_value;
query->Open();
....
- The problem is: on MySQL version 5.0.19 this query returns the correct data. But on the recently updated MySQL version 5.0.41 this query simple returns no data. After the open method the query is empty.
- What have i done to solve this problem? I changed the DataType of the parameters to ftString and use FormatString, like this:
...
query->ParamByName("A_PARAMETER")->DataType = ftString;
query->ParamByName("A_PARAMETER")->Value = a_valid_date_value.FormatString("yyyy-mm-dd");
query->Open();
....
- This works fine on both versions of mysql.
- But the real problem is that i have dozens of queries in a lot of projects using similar code.
- I'm asking you from CoreLab to check this out for me and for every one
who might face the same problem.
- Here's my environment:
Windows XP Professional all updated
C++ Builder 6 all updated
MySQL Server community edition versions 5.0.19 and 5.0.41 running on localhost (windows).
MyDAC version 4.40.0.25
Please, ask me if you need more details.
Thanks a lot.
Coral
Parameters problem (CBuilder6 + MyDAC 4.40.0.25 + MySQL 5.0.41)
More information
Hello
I forgot to say that i tested the same query using ADOQuery and it worked well in both versions of mysql.
Thanks.
Coral
I forgot to say that i tested the same query using ADOQuery and it worked well in both versions of mysql.
Thanks.
Coral
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
Re: More information
This is a issue of MySQL 5.0.41, try this:Coral wrote:Hello
I forgot to say that i tested the same query using ADOQuery and it worked well in both versions of mysql.
Thanks.
Coral
query->ParamByName("A_PARAMETER")->DataType = ftDate;
query->ParamByName("A_PARAMETER")->Value = a_valid_date_value;
query->Open();
look this post http://crlab.com/forums/viewtopic.php?t=9741
go works fine.