Page 1 of 1

Bug in dbExpress driver for MySQL 3.0

Posted: Sat 04 Mar 2006 19:47
by Jim Maurer
I downdoaded the evaluation copy about a month ago and developed my application. I do not know the version number.

I just registered a few days ago and updated my system with the registered version 3.0. Now my tClientDataSet.edit commands no longer work. When I try to post, I get the error 'Unable to find record. No key specified'.

I would be happy to supply additional information if needed. My app is broke until this is resolved. Please help.

Thank you,
Jim Maurer
Northstar Data Systems

Posted: Mon 06 Mar 2006 10:48
by Antaeus
We couldn't reproduce the problem.
Please send us (dbxMda*crlab*com) a complete small sample to demonstrate it, including script to create and fill table.

Also supply us following information
- Exact version of Delphi, C++ Builder or Kylix
- Exact version of dbxMda.
- Exact version of MySQL server and MySQL client.

Posted: Sat 01 Apr 2006 12:53
by creams
I also have the problem since I've changed the standard DBX library to the CRLab DBXMySQL. I'm interested in a fix as well.

Posted: Mon 03 Apr 2006 12:30
by Antaeus
Unfortunately we can't reproduce this problem without any additional information as stated in my previous post. To speed up fixing this problem, please report us this information.

Posted: Tue 04 Apr 2006 19:22
by creams
In my application I use your library to connect to mySQL servers. Most of the work is done using dynamically created components, additionaly working on threads. Only the DataSource for the localview is added to the form.

I have my own object TDBConnector. In its constructor I create a sql_db which is type of TSQLConnection. Then if I want to query a database I use the following code:

Code: Select all

sql_query := TSqlQuery.Create(nil);
sql_query.SQLConnection := sql_db; // an instance of the TSQLConnection class
sql_query.SQL.Text := FParam2;
provider := TDataSetProvider.Create(nil);
provider.DataSet := sql_query;

// ... some other unimportant code here (exception handlin, etc.)

// then I create a local dataset, which I use to present data in the XDBGrid.

FPub_ResultClientDataSet := TClientDataSet.Create(nil);
FPub_ResultClientDataSet.Active := false;
FPub_ResultClientDataSet.SetProvider(provider);
FPub_ResultClientDataSet.Active := true;

// ... some other unimportant code here (exception handlin, etc.)

// now I've got the dataset so, the provider is freed
FPub_ResultClientDataSet.SetProvider(nil);
provider.Free;
sql_query.Free;
Until now everything works ok. Now the update record problem. To do this I call the following code:

Code: Select all

sql_table := TSqlTable.Create(nil);
sql_table.SQLConnection := sql_db;
sql_table.TableName := FParam2;

// ... some other unimportant code here (exception handlin, etc.)

provider := TDataSetProvider.Create(nil);
provider.UpdateMode := upWhereKey; // or upWhereAll or upWhereChanged
provider.DataSet := sql_table;
provider.ResolveToDataSet := false;

// ... some other unimportant code here (exception handlin, etc.)

FPub_ResultVariant := provider.ApplyUpdates(FVariant, -1, FPub_ResultInteger);

provider.Free;
sql_table.Free;
The FVariant variable passed to the provider.ApplyUpdates is the local dataset Delta passed as FPub_ResultClientDataSet.Delta.

Unfortunately during the ApplyUpdates I receive the "Unable to find record. No key specified" error. It seems that the Delta doesn't know anything about the ProviderFlags := plflKey; which are set for the appropriate fields in the FPub_ResultClientDataSet (local) dataset.

I've also tried the upWhereAll UpdateMode for the provider, but it returns the "Record not found" error (which is strange, depending on that all fields are passed to the WHERE clause of the UPDATE sql). The upWhereChanged is unsufficient (too many records can fit the rule).

I hope I've given you enough information to solve the problem or to help me to solve the problem by my side.

Posted: Fri 07 Apr 2006 15:25
by Antaeus
Please test your application using standard driver. If problem disappears using standard driver then send us(dbxmda*crlab*com) a complete small sample to demonstrate it, including script to create and fill table.

Posted: Sat 20 May 2006 07:21
by pepito_juanito
Did you set in the TSQLDataset's TField definitions (NOT TClientDataSet) the pfInKey flag in Providerflags? Icannot see it in your code. The borland driver uses to set this flag, but I think the corelab's one doesn´t.

Something like that

Code: Select all

sqldataset.fieldbyname('pkfield').ProviderFlags:=[pfInUpdate,pfInWhere,pfInKey];
Maybe i´m wrong but this is a common issue in dbexpress newsgroup. It works for me and I´m using dbxmda!

Good luck!

(sorry about my terrible english ;)