Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
-
Minotaurus007
- Posts: 14
- Joined: Wed 27 Aug 2008 16:03
Post
by Minotaurus007 » Fri 29 Aug 2008 17:01
Migrating directly from microOLAP to MyDAC I found that Post() isn't working anymore. I guess some properties have to be switched. But which?
Code: Select all
Query->First();
for( int i = 0; i RecordCount; i++, Query->Next() ) {
Query->Edit();
Query->FieldValues["Flag"] = true;
//Query->FieldByName("Flag")->AsBoolean = true;
//Query->FieldValues["nWDH"] = 7;
Query->Post();
}
Query->Close();
No(!) variables are actually posted, as verified with Navicat.
It is not a boolean problem and another field (nWDH) also does not work (outcommented above).
What am I missing???
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
Post
by eduardosic » Fri 29 Aug 2008 17:51
Minotaurus007 wrote:Migrating directly from microOLAP to MyDAC I found that Post() isn't working anymore. I guess some properties have to be switched. But which?
Code: Select all
Query->First();
for( int i = 0; i RecordCount; i++, Query->Next() ) {
Query->Edit();
Query->FieldValues["Flag"] = true;
//Query->FieldByName("Flag")->AsBoolean = true;
//Query->FieldValues["nWDH"] = 7;
Query->Post();
}
Query->Close();
No(!) variables are actually posted, as verified with Navicat.
It is not a boolean problem and another field (nWDH) also does not work (outcommented above).
What am I missing???
Any Exception Message?
What the value of Query.SQL property?
What Version of MyDAC and C++ Builder?
What Version of MySQL?
The Table Have a Primary key? See DDL of Table

-
Minotaurus007
- Posts: 14
- Joined: Wed 27 Aug 2008 16:03
Post
by Minotaurus007 » Fri 29 Aug 2008 18:36
Any Exception Message?
None.
What the value of Query.SQL property?
Empty.
What Version of MyDAC and C++ Builder?
What Version of MySQL?
mydac555cb6pro
C++Builder 6
MySQL 4.0.13
The Table Have a Primary key? See DDL of Table
Yes, called "ID" in my case.
Meanwhile I managed to Post() by switching the queries' CachedUpdate to OFF. I do not understand why it works now, but it works. However, another problem is being persistent: I still cannot Post() the "nWDH" field:
Code: Select all
Query->First();
for( int i = 0; i RecordCount; i++, Query->Next() ) {
Query->Edit();
Query->FieldValues["Flag"] = true;
Query->FieldValues["nWDH"] = 7; // doesn't work, remains zero "0".
Query->FieldValues["nWDH"] = Query->FieldValues["nWDH"] + 7;
// doesn't work either, remains zero "0".
Query->Post();
}
Query->Close();
What's going wrong?!
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
Post
by eduardosic » Fri 29 Aug 2008 18:46
Hi, you need open the table..
In Delphi
Code: Select all
Query.Close;
Query.SQL.Text := 'Select * from TableName';
Query.Execute;
Query.First;
While not Query.Eof do begin
Query.Edit;
Query.FieldValues["Flag"] = true;
Query.FieldValues["nWDH"] = 7; // doesn't work, remains zero "0".
Query.FieldValues["nWDH"] = Query.FieldValues["nWDH"] + 7;
Query.Post;
Query.Next;
end;
Query.Close;
-
Minotaurus007
- Posts: 14
- Joined: Wed 27 Aug 2008 16:03
Post
by Minotaurus007 » Fri 29 Aug 2008 19:12
Of course, the table(query) was open. But meanwhile I found the strange and surprising solution:
I formerly had set the field "nWDH" to
unsigned int. The microOLAP-package tolerated this obviously. Setting this back to
int solved the problem immediately for MyDAC. Now Post() updates this field like it should. Perhaps I could have also used a cast like:
Code: Select all
Query->FieldValues["nWDH"] = (unsigned int) 7;
Don't know if it is a bug or a feature in MyDAC. Anyway,
thx again from Germany!
-Mino
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
Post
by eduardosic » Fri 29 Aug 2008 20:37
Minotaurus007 wrote:Of course, the table(query) was open. But meanwhile I found the strange and surprising solution:
I formerly had set the field "nWDH" to
unsigned int. The microOLAP-package tolerated this obviously. Setting this back to
int solved the problem immediately for MyDAC. Now Post() updates this field like it should. Perhaps I could have also used a cast like:
Code: Select all
Query->FieldValues["nWDH"] = (unsigned int) 7;
Don't know if it is a bug or a feature in MyDAC. Anyway,
thx again from Germany!
-Mino
Hi, i don't know C++ Builder Only Delphi...
i go to test Query.FieldValues["nWDH"] := 7; in Delphi..
i use Query.FieldByName( 'xx' ).AsInteger := 7;
please wait the Dimon goes to answer of correct form.
-
Dimon
- Devart Team
- Posts: 2910
- Joined: Mon 05 Mar 2007 16:32
Post
by Dimon » Mon 01 Sep 2008 07:44
Minotaurus007 wrote:I formerly had set the field "nWDH" to
unsigned int. The microOLAP-package tolerated this obviously. Setting this back to
int solved the problem immediately for MyDAC. Now Post() updates this field like it should. Perhaps I could have also used a cast like:
Code: Select all
Query->FieldValues["nWDH"] = (unsigned int) 7;
I could not reproduce the problem. Please specify how you have set the field "nWDH" to unsigned int.
-
Minotaurus007
- Posts: 14
- Joined: Wed 27 Aug 2008 16:03
Post
by Minotaurus007 » Mon 01 Sep 2008 12:12
Hi Dimon,
since the column "nWDH" is a simple counter, I once had set this MySQL(!) column to unsigned int. In my C++-program however, I used int to do those calculations everywhere. The old software tolerated this, MyDAC doesn't. To keep things simple, I changed the MySQL column to int. Now everything is working fine.
And no, I did not yet a test with unsigned int, because there are way too many occurences in my C++code and I don't want to rewrite the whole thing.
-Mino
-
Dimon
- Devart Team
- Posts: 2910
- Joined: Mon 05 Mar 2007 16:32
Post
by Dimon » Wed 03 Sep 2008 13:58
The problem appears because there is created TLargeInt field for MySQL unsigned int field. In Delphi and in C++Builder this field type does not assign value via the Value property.
In order to solve this problem you should use the following code:
Code: Select all
Query->FieldByName("nWDH")->AsInteger = 7;