Problems executing SHOW MASTER STATUS

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for MySQL in Delphi and C++Builder
Post Reply
PerMalmberg
Posts: 2
Joined: Thu 08 Nov 2007 13:14

Problems executing SHOW MASTER STATUS

Post by PerMalmberg » Thu 08 Nov 2007 14:03

Hello,

We've been using DbxMda 3.0 in C++ Builder 6.0 Pro for quite some time now with great success until today.

Previously we've only used it for regular INSERT/UPDATE/SELECT statements but we now want to execute the "SHOW MASTER STATUS" and "SHOW SLAVE STATUS" commands. So far all attempts has failed with the exception "DXB Error: Operation not supported".

Is it possible to execute these commands and if so, how should it be done?

We're using MySQL 5.0.11 and 5.1.1

Update:
Ok, it seems the command is executed correctly after all, it is reading TSQLDataSet->RecordCount that throws the exception mentioned above; seems you can't use it:
- The dataset represents stored procedure.
- The dataset represents a query that contains parameters.
- The dataset represents a multi-table join.

I guess the first option applies to this scenario.

Note to self: RTFM twice :)

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

Post by Antaeus » Fri 09 Nov 2007 13:29

I checked the SHOW MASTER STATUS query and found no problems with it. I used the last DbxMda (3.20.5). Try to download DbxMda 3.20.5 and test it.
If the problem is still persists, send me a complete small sample at dbxmda*crlab*com to demonstrate it. What is the result if you run these queries with a MySQL client tool like the standard client (mysql.exe)? Also describe your replication settings.

PerMalmberg
Posts: 2
Joined: Thu 08 Nov 2007 13:14

Post by PerMalmberg » Fri 09 Nov 2007 14:25

Are you saying that you can read the TSQLDataSet->RecordCount after executing this command? From what I've now understood it's not possible according to the documentation, and my attempts shows the same thing.

I'm now using dataSet->Eof and dataSet->Bof to determine if the data set is empty or not, and this works.

Fyi, the code looks something like:

// Open database connections etc...
dataSet->SQLConnection = theConnection;
dataSet->CommandText = statusCommand;
dataSet->Open();
int foo = dataSet->RecordCount; // Throws the exception

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

Post by Antaeus » Mon 12 Nov 2007 08:41

The reason of this problem is in dbExpress code. You can take a look at the GetRecordCount method in the SqlExpr unit. The GetTableNameFromSQL function cannot find a table name in this query, and returns an empty string. Then the following condition is verified, and the exception is raised:

Code: Select all

if (TableName = '') or (Params.Count > 0) then
  DatabaseError(SNotSupported);

Post Reply