Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Strange exception raising with SQL.ExecuteX()
Strange exception raising with SQL.ExecuteX() [message #30104] Thu, 09 December 2010 10:54 Go to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi all,

The following code, which compiles correctly, raises an exception while the updating operations are correctly implemented in my database tables:

void qsSKillFormDlg::RefreshInfosProcOwner(String newValue,String owner,int fieldId)
{
SqlId TBLOWN("OWNERS"),FIRSTNAME("OWNERFIRSTNAME"),FAMILYNAME( "OWNERNAME");
Vector<String> infos;

try
{
infos.Clear();
infos = Split(infosProcOwner.At(2),' ',false);

switch(fieldId)
{
case 0: infosProcOwner.At(2).Clear();
infosProcOwner.At(2)<<infos.At(0)<<' '<<newValue;
SQL.ExecuteX(" Update(TBLOWN)(FAMILYNAME,newValue).Where(FAMILYNAME==owner) ");

break;

case 1: SQL.ExecuteX("Update(TBLOWN)(FIRSTNAME,newValue).Where(FAMILYNAME==owner) ");
break;
}
}
catch(SqlExc& err)
{
PanicMessageBox(t_("Erreur SQL"),err);
}
}


I use MySql Server 5.0 and U++ 2884. Of course, if I replace ExecuteX and no longer implement the exception Try/Catch, no error is shown in runtime.

Perhaps I misuse the SqlId syntax or is there a bug?. Is anyone has an idea ?

Thanks for suggestions

Regards

Biobytes
Re: Strange exception raising with SQL.ExecuteX() [message #30153 is a reply to message #30104] Sun, 12 December 2010 09:39 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
BioBytes wrote on Thu, 09 December 2010 04:54

Hi all,

The following code, which compiles correctly, raises an exception while the updating operations are correctly implemented in my database tables:

void qsSKillFormDlg::RefreshInfosProcOwner(String newValue,String owner,int fieldId)
{
SqlId TBLOWN("OWNERS"),FIRSTNAME("OWNERFIRSTNAME"),FAMILYNAME( "OWNERNAME");
Vector<String> infos;

try
{
infos.Clear();
infos = Split(infosProcOwner.At(2),' ',false);

switch(fieldId)
{
case 0: infosProcOwner.At(2).Clear();
infosProcOwner.At(2)<<infos.At(0)<<' '<<newValue;
SQL.ExecuteX(" Update(TBLOWN)(FAMILYNAME,newValue).Where(FAMILYNAME==owner) ");

break;

case 1: SQL.ExecuteX("Update(TBLOWN)(FIRSTNAME,newValue).Where(FAMILYNAME==owner) ");
break;
}
}
catch(SqlExc& err)
{
PanicMessageBox(t_("Erreur SQL"),err);
}
}


I use MySql Server 5.0 and U++ 2884. Of course, if I replace ExecuteX and no longer implement the exception Try/Catch, no error is shown in runtime.

Perhaps I misuse the SqlId syntax or is there a bug?. Is anyone has an idea ?

Thanks for suggestions

Regards

Biobytes


What is SQL error? I mean, what is reported to be in 'err'?

Mirek
Re: Strange exception raising with SQL.ExecuteX() [message #30166 is a reply to message #30153] Sun, 12 December 2010 21:28 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi Mirek,

Thanks for considering this question. Please find hereafter the Sql error (err) displayed in the PanicMessageBox:

[MySQL][ODBC 5.1 Driver][mysqld-5.0.45-community-nt]You have an error in your SQL syntax, check the manual that corresponds to your MySQL server version for he right syntax to use near '(FAMILYNAME,newValue).Where(FAMILYNAME==owner)'at line 1
SQL error:
Update(TBLOWN)(FAMILYNAME,newValue).Where(FAMILYNAME==owner)


I compile under MingW 5.16.

Hoping this could be helpful

Regards
Biobytes
Re: Strange exception raising with SQL.ExecuteX() [message #30272 is a reply to message #30166] Tue, 21 December 2010 14:30 Go to previous message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi all,

I solved this problem by using SqlId syntax. The following code works perfectly and does not raise any unexpected exception :

void qsSKillFormDlg::RefreshInfosProcOwner(String newValue,String owner,int fieldId)
{
SqlId TBLOWN("OWNERS"),FIRSTNAME("OWNERFIRSTNAME"),FAMILYNAME( "OWNERNAME");
Vector<String> infos;

try
{
infos.Clear();
infos = Split(infosProcOwner.At(2),' ',false);
infosProcOwner.At(2).Clear();

switch(fieldId)
{
case 0: infosProcOwner.At(2)<<infos.At(0)<<' '<<newValue;
SQL &SqlUpdate(TBLOWN)(FAMILYNAME,newValue).Where(FAMILYNAME ==owner);

break;

case 1: infosProcOwner.At(2)<<newValue<<' '<<infos.At(1);
SQL &SqlUpdate(TBLOWN)(FIRSTNAME,newValue).Where(FAMILYNAME= =owner);
break;
}
}
catch(SqlExc& err)
{
PanicMessageBox(t_("Erreur SQL"),err);
}
}


To avoid problems with the MySql engine, SqlId syntax must be used.

The problem should be considered closed.

Regards
Biobytes
Previous Topic: Missing ASSERT?
Next Topic: In Oracle9 and higher, TIMESTAMP data type will cause ORA-1402 exception w/ Oracle8 Oci8.cpp
Goto Forum:
  


Current Time: Thu Apr 18 16:19:27 CEST 2024

Total time taken to generate the page: 0.01675 seconds