bug in dbexpmda40.dll when using stored proc

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for MySQL in Delphi and C++Builder
Post Reply
johnkuiper
Posts: 6
Joined: Tue 06 Nov 2007 17:17

bug in dbexpmda40.dll when using stored proc

Post by johnkuiper » Tue 06 Nov 2007 17:30

I'm evaluating the dbexpress drivers for mysql (crlab release 4.20.004). This one works for me, beause it can work with only one databaseconnection.
But when using stored proc on MySQL 5.1 it creates an error:

Access violation at address 010B185C in module 'dpexpmda40.dll'. Read of address 00000008

This occurs everytime I want to give a parameter a value

Code: Select all

procedure TForm4.DBEdit1Exit(Sender: TObject);
begin
  SQLstoredproc1.ParamByName('charveld').Value := 'hello';
  SQLstoredproc1.ParamByName('chardomeininput').Value := 'hello2';
  SQLstoredproc1.ExecProc;
  if SQLstoredproc1.ParamByName('gevonden').AsInteger = 0 then
     showmessage('nothing found');
end;
Please help. The dbxmys30.dll has an serious bug and I really want to use your drivers

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

Post by Antaeus » Fri 09 Nov 2007 16:34

Thank you for information. The investigation of the problem is in progress. As soon as we have results or we need more information, we will let you know.

johnkuiper
Posts: 6
Joined: Tue 06 Nov 2007 17:17

Post by johnkuiper » Thu 15 Nov 2007 15:46

I have some more information for you. I replaced the .value into .AsString and got the same error (see previous post).

Do you know something more. I really need a good working DBExpress driver and the default driver of D2007 doesn't work well.

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

Post by Antaeus » Wed 21 Nov 2007 10:50

We reproduced the problem. It should disappear if you remove output parameters from SQLStoredProc1. Please check whether my supposition is correct in your case.

johnkuiper
Posts: 6
Joined: Tue 06 Nov 2007 17:17

Post by johnkuiper » Fri 23 Nov 2007 10:56

I really want to try, but the evaluation is expired. Is there another way to test it. Reinstall didn't work. If your workaround is working, I can buy it.

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

Post by Antaeus » Fri 23 Nov 2007 16:08

Please contact us by e-mail (dbxmda*crlab*com). As soon as we fix the problem, we will send you the driver for test.

sklim82
Posts: 9
Joined: Thu 13 Dec 2007 10:50

dbexpmda.dll crash with out parameter in stored procedure

Post by sklim82 » Thu 13 Dec 2007 10:56

Hi,

I had tested the dbexpmda.dll 4.20.0.5 with C++ builder 6.0 and the problem that you mentioned still occur where dbexpmda.dll crash when there is out parameter in stored procedure. We would like to confirm this before purchasing the library.

Any help?

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

Post by Antaeus » Fri 14 Dec 2007 16:15

Try to download DbxMda once again and install it.

sklim82
Posts: 9
Joined: Thu 13 Dec 2007 10:50

Post by sklim82 » Mon 17 Dec 2007 03:54

Hi,

I had re-download the dbxmda.exe and tested dbexpmda.dll with the stored procedure. Yes, it is working now even the stored procedure consist of the output type of parameter.

However, new issue is the input type of parameter fail to carry the value. I set the value to 1 and it show 0 in database. I tested the same stored procedure with mydac and it is working.

Maybe you can have a look on it :)

Thanks.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 17 Dec 2007 13:16

We can not reproduce the problem.
Please send me a complete small sample to dmitryg*crlab*com to demonstrate it, including script to create your stored procedure.

sklim82
Posts: 9
Joined: Thu 13 Dec 2007 10:50

Post by sklim82 » Tue 18 Dec 2007 02:26

Hi,

I create a dummy project to simulate the problem. The following are the dummy stored procedure and table:

Code: Select all

CREATE PROCEDURE `sp_GenerateTransactionID`(IN CommandID DECIMAL(4), OUT TransactionID INTEGER(11))

BEGIN
            INSERT INTO CREWMAIL_TRANSACTION(CT_ID, CT_CC_ID) VALUES(1, CommandID);
            SELECT LAST_INSERT_ID() INTO TransactionID;
END;

Code: Select all

CREATE TABLE `crewmail_transaction` (
  `CT_ID` int(10) unsigned NOT NULL,
  `CT_CC_ID` decimal(4,0) NOT NULL
) ;

And these are the c++ code:

Code: Select all

 TSQLConnection *sqlCon = new TSQLConnection(NULL);
        sqlCon->DriverName = AnsiString("dbxmysql");
        sqlCon->GetDriverFunc = AnsiString("getSQLDriverMySQL");

        sqlCon->VendorLib = AnsiString("libmysql.dll");
        sqlCon->LibraryName = AnsiString("dbexpmda.dll");
        sqlCon->KeepConnection = true;
        sqlCon->LoadParamsOnConnect = false;
        sqlCon->LoginPrompt = false;
        sqlCon->ConnectionName = "MySQLConnection";

        sqlCon->Params->Clear();
        sqlCon->Params->Add(AnsiString("HostName=10.97.6.218"));
        sqlCon->Params->Add(AnsiString("USER_NAME=root"));
        sqlCon->Params->Add(AnsiString("PASSWORD=marlinksecret"));
        sqlCon->Params->Add(AnsiString("Database=new_db"));

        sqlCon->Open();

        int iTransactionID = 0;
        int iCommandType = 1;
        TParam *prmTransactionID;
        TParam *prmCommandType;
        TSQLStoredProc *sp = new TSQLStoredProc(NULL);
        sp->StoredProcName = "sp_GenerateTransactionID";
        sp->ParamCheck = true;
        sp->Params->Clear();
        prmCommandType = sp->Params->CreateParam(ftInteger, "CommandID", ptInput);
        prmTransactionID = sp->Params->CreateParam(ftInteger, "TransactionID", ptOutput);
        prmCommandType->AsInteger = iCommandType;
        sp->SQLConnection = sqlCon;
        sp->Prepared = true;
        sp->ExecProc();
Hope this is help. Thanks for the reply.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 20 Dec 2007 09:44

The LAST_INSERT_ID function works only for AUTO_INCREMENT columns.
The following code creates the correct procedure and table, so that the LAST_INSERT_ID function returns the correct value.

Code: Select all

CREATE TABLE `crewmail_transaction` ( 
  `CT_ID` int(11) AUTO_INCREMENT PRIMARY KEY, 
  `CT_CC_ID` decimal(4,0) NOT NULL 
);

Code: Select all

CREATE PROCEDURE `sp_GenerateTransactionID`(IN CommandID DECIMAL(4), OUT TransactionID INTEGER(11)) 
BEGIN 
    INSERT INTO CREWMAIL_TRANSACTION(CT_CC_ID) VALUES(CommandID); 
    SELECT LAST_INSERT_ID() INTO TransactionID; 
END;

Post Reply