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 |
|
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 |
|
mirek
Messages: 14039 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 #30272 is a reply to message #30166] |
Tue, 21 December 2010 14:30 |
|
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
|
|
|
Goto Forum:
Current Time: Fri Sep 20 10:53:30 CEST 2024
Total time taken to generate the page: 0.06320 seconds
|