I find some problem in MySQL (bugs)

I find some problem in MySQL (bugs)

am 31.01.2006 11:43:38 von Hristo Markov

--0-1548158512-1138704218=:90886
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Dear Sirs,

My name is Hristo Markov. I am programmer from Bulgaria / Europe /.

Last week I downloaded MySQL 5.0 and ODBC 3.51 and want to try how the programs are connect to the database.

I use Windows XP and Microsoft C++.

I find some problems with “update” command and I think that it is the bugs in MySQL (or ODBC driver), because the same example program working with other databases.

I want to send new values on to the record and to make update.

The problem is that “update” command do updates on to the record, but the program receive error signal => "Query-based update failed because the row to update could not be found."

Below I apply simple source code of “C++” that demonstrate the problem.

I hope you will help me.

Sincerely,

Hristo Markov



/*example programm*/
#include "stdafx.h"
#include
#include
#include
#include
#include
#define INITGUID
#pragma warning (disable: 4146)
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename_namespace("ADOCG") rename("EOF", "EndOfFile")
using namespace ADOCG;
#include "icrsint.h"

void dump_com_error(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
char *str=(char *)malloc(200+strlen(e.ErrorMessage())+strlen((LPCSTR) bstrSource)+strlen((LPCSTR)bstrDescription));
sprintf(str,"Error\n\a\tCode = %08lx\n\a\tCode meaning = %s\a\tSource = %s\n\a\tDescription = %s\n",e.Error(),e.ErrorMessage(),(LPCSTR) bstrSource,(LPCSTR) bstrDescription);
MessageBox(NULL,str,"error",0);
free(str);
}
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
_ConnectionPtr pconn;
_CommandPtr pcmd;
_RecordsetPtr prs;
_variant_t vnull;
vnull.vt=VT_ERROR;
vnull.scode=DISP_E_PARAMNOTFOUND;

int rc,ret=CoInitialize(NULL);
if(ret!=S_OK) return 1;

try{pconn.CreateInstance(__uuidof(Connection));}
catch(_com_error &e){dump_com_error(e);exit(0);}

try{rc=pconn->Open("myodbc","client","password",adOpenUnspec ified);}
catch(_com_error &e){dump_com_error(e);}

try{rc=pcmd.CreateInstance(__uuidof(Command));}
catch(_com_error &e){dump_com_error(e);}

pcmd->ActiveConnection=pconn;

try{rc=prs.CreateInstance(__uuidof(Recordset));}
catch(_com_error &e){dump_com_error(e);}

pcmd->CommandText="SELECT * FROM TABLE1";
prs->PutRefSource(pcmd);

try
{
prs->Open(vnull,vnull,adOpenStatic,adLockOptimistic,adCmdUnk nown);
}
catch(_com_error &e){dump_com_error(e);}

try
{
prs->MoveFirst();
}
catch(_com_error &e){dump_com_error(e);}

/*****/
//If you remove the next fragment, "update" will be ok.
//"update" do updates on to the record, but the program receive error signal.

//I can put other values on “vp”

_variant_t vp=prs->Fields->GetItem("FIELD1")->Value;
prs->Fields->GetItem("FIELD1")->Value=vp;

/*****/

try
{
prs->Update();
}
catch(_com_error &e)
{
dump_com_error(e);
}
prs->Close();
prs->Release();
prs.Detach();

pcmd->Release();
pcmd.Detach();

rc=pconn->Close();
rc=pconn->Release();
pconn.Detach();

CoUninitialize();

return 0;
}




---------------------------------
Do you Yahoo!?
With a free 1 GB, there's more in store with Yahoo! Mail.
--0-1548158512-1138704218=:90886--

RE: I find some problem in MySQL (bugs)

am 01.02.2006 19:46:57 von David Dindorp

Hristo Markov wrote:
> The problem is that "update" command do updates on to the
> record, but the program receive error signal =3D>
> "Query-based update failed because the row to update could
> not be found."
[...]
> _variant_t vp=3Dprs->Fields->GetItem("FIELD1")->Value;
> prs->Fields->GetItem("FIELD1")->Value=3Dvp;
[...]

I must admit that I haven't tried your application.
But based on the error message, I would guess that you should
probably include your table structure in the report, so we
can see fx. what FIELD1 is.

(SHOW FULL COLUMNS FROM

or
SHOW CREATE TABLE
can be used for that.)


--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=3Dgcdmo-myodbc@m.gmane.o rg