Wrong field size in result set - TMyQuery

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mydac4std
Posts: 13
Joined: Mon 20 Feb 2006 19:05

Wrong field size in result set - TMyQuery

Post by mydac4std » Tue 28 Mar 2006 12:33

Hello there.

I have a TMyConnection connected to a MySQL Server 4.1.18 with all properties set to defaults and a TMyQuery linked to that connection with the following SQL:

EXPLAIN BANKS

All others properties of this MyQuery is set to defaults too.
This query returns 6 columns: Field, Type, Null, Key, Default and Extra.
The problem is in the Type column. Its always have a fixed size of 40 characters, even when the field data has strings bigger than this size.
I tested with persistent fields and with the FieldByName function. The problem persist in both ways.

After i try to do the same using ADO with MyODBC and it worked fine.
Using a TADOConnection and a TADOQuery connected to the same database and with the same SQL the result set was correct with the Type column having the size of the biggest string of the set of rows returned.

Am I forgetting something here?
Thanks for any help and hint!!!

Ricardo Bueno
Sao Paulo - Brazil.

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

Post by Antaeus » Tue 28 Mar 2006 14:23

We couldn't reproduce the problem.
Please send us (mydac*crlab*com) the script to create and fill BANKS table.

Also supply us following information:
- Exact version of Delphi, C++ Builder or Kylix
- Exact version of MyDAC. You can see it in About sheet of TMyConnection Editor
- Value of MyConnection.Options.UseUnicode option
- Value of MyConnection.Options.Direct option

mydac4std
Posts: 13
Joined: Mon 20 Feb 2006 19:05

Post by mydac4std » Tue 28 Mar 2006 17:01

Hello.

Sorry for the lack of information in my first message.

Here´s my configuration:

- C++ Builder 6 (Build 10.166)
- MyDac 4.30.0.10 for C++ Builder 6
- MyConnection.Options.UseUnicode = false
- MyConnection.Options.Direct = true

Here´s the code to generate the table (all names in portuguese):

//--------------------------------
CREATE TABLE `bancos` (
`CONTA` smallint(5) unsigned NOT NULL default '0',
`TIPO` enum('CAIXA','Movimento','Especial','Vinculada','Arrecadadores') NOT NULL default 'Movimento',
`NOME` varchar(120) NOT NULL default '',
`VINCULOA` char(1) default NULL,
`VINCULOB` char(1) default NULL,
`CONTACORRENTE` varchar(20) default NULL,
`FUNDO` int(10) unsigned default NULL,
PRIMARY KEY (`CONTA`),
KEY `porNome` (`NOME`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
//--------------------------------

The error ocurred even when the table is empty, but i´m sending some data for you to test:

INSERT INTO `bancos` VALUES("1", "CAIXA", "CAIXA \"TESOURARIA DA PREFEITURA\"", "", NULL, NULL, NULL);
INSERT INTO `bancos` VALUES("1002", "Movimento", "BANCO DO BRASIL S/A", NULL, NULL, NULL, NULL);
INSERT INTO `bancos` VALUES("1001", "Movimento", "BANCO BRADESCO S/A", NULL, NULL, "2180-6", NULL);
INSERT INTO `bancos` VALUES("2004", "Arrecadadores", "BCO BANESPA - TM", NULL, NULL, "45000002/8", NULL);
INSERT INTO `bancos` VALUES("3012", "Movimento", "BCO BANESPA - FDO MUN SAUDE", NULL, NULL, "45000028-6", NULL);
INSERT INTO `bancos` VALUES("3054", "Arrecadadores", "BCO BANESPA - TRIBUTOS", NULL, NULL, "45000040-6", NULL);
INSERT INTO `bancos` VALUES("3059", "Arrecadadores", "BCO BANESPA - IPVA", NULL, NULL, "45000030-3", NULL);
INSERT INTO `bancos` VALUES("2003", "Movimento", "BCO BRASIL - FD ESPECIAL", NULL, NULL, "10704-2", NULL);
INSERT INTO `bancos` VALUES("3020", "Movimento", "BCO BRASIL - FMS - SUS", NULL, NULL, "10500-7", NULL);
INSERT INTO `bancos` VALUES("3002", "Movimento", "BCO BRASIL - FPM", NULL, NULL, "10309-8", NULL);

The problem with the size occurred on the second field called TIPO that´s of type ENUM with five components. When i get the result of the EXPLAIN BANCOS query the field Type has only the first 40 characters. 40 is the size of the field Type if i include it as a persistent field.

Thanks again.


Ricardo Bueno
Sao Paulo - Brazil

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 30 Mar 2006 09:29

This is MySQL server version 4.1 and older bug. We will avoid it in nearest MyDAC build.

mydac4std
Posts: 13
Joined: Mon 20 Feb 2006 19:05

Post by mydac4std » Thu 30 Mar 2006 12:14

Ok

I´ll wait for this new build release.

Thanks a lot.


Ricardo
Sao Paulo - Brazil

Post Reply