A couple of Basic Questions.

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mfbrowne
Posts: 13
Joined: Mon 15 Nov 2010 00:17

A couple of Basic Questions.

Post by mfbrowne » Thu 20 Jun 2013 15:38

Hello,

I am using Builder 2010 as my platform.

I am testing some things with the unidac controls and I have a couple of questions. One is an operational question and one is more of a "I would like to know question".

First the operational question:

I have a connection to my MySQL database through an ODBC connection. I am using the following SQl Statement.

Show full columns for tablename

Now the statement runs fine and I get results into a DBGrid. However the column titled "Type" shows as (memo) instead of the type of column it is. I would have expected a result of "int(11)" or whatever the type of column it is.

So can someone tell me why this is happening and how to have the actual db column type show.

Now my second question:

This deal with opening and closing of the Database. Is it better to open the database for an application once and keep it open for the duration of the application usage, or, is it better to open the database, get the info I need, then close the database and open it again when I need to get more information.

I would like some guidance on which way is better.

Thanks very much, and I appreciate any information provided.

Mike

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: A couple of Basic Questions.

Post by DemetrionQ » Wed 26 Jun 2013 14:48

Hello.

1) Data display in DBGrid depends on the DBGrid component. For example, the standard TDBGrid component allows displaying data with types of the fixed length only, while the `type` field in the dataset returned by the specified SQL query has the TEXT type (it is a not fixed length type). When accessing data directly via our components (e.g., via UniQuery1.FieldByName('type').AsString;), you won't have problems.
If you need to display contents of fields of not fixed length in DBGrid, use the DBGrid component, that supports such capability.

2) To keep the connection open or to open it only during query execution - depends on the task and demands. If you need to open connection only during query execution, you can set the TUniConnection.Options.DisconnectedMode option to True - and UniDAC will do this automatically. The detailed information about the DisconnectedMode property can be found in the UniDAC documentation.

Post Reply