mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Sql: Fixed issue with lowercase SqlId in operator[]
git-svn-id: svn://ultimatepp.org/upp/trunk@5113 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5091ad3a9f
commit
3cfe5186a4
3 changed files with 22 additions and 10 deletions
|
|
@ -17,6 +17,7 @@ SqlSession::SqlSession()
|
|||
errorclass = Sql::ERROR_UNSPECIFIED;
|
||||
error_handler = NULL;
|
||||
throwonerror = false;
|
||||
error_log = NULL;
|
||||
}
|
||||
|
||||
SqlSession::~SqlSession()
|
||||
|
|
@ -71,7 +72,9 @@ void SqlSession::SetError(String error, String stmt, int code, const char *sco
|
|||
errorclass = clss;
|
||||
String err;
|
||||
err << "ERROR " << error << "(" << code << "): " << stmt << '\n';
|
||||
if(GetTrace())
|
||||
if(error_log)
|
||||
*error_log << err;
|
||||
if(trace && trace != error_log)
|
||||
*GetTrace() << err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -310,11 +310,14 @@ void Sql::GetColumn(int i, Ref r) const {
|
|||
void Sql::GetColumn(SqlId colid, Ref r) const
|
||||
{
|
||||
String s = ~colid;
|
||||
for(int i = 0; i < cn->info.GetCount(); i++)
|
||||
if(cn->info[i].name == s) {
|
||||
GetColumn(i, r);
|
||||
return;
|
||||
}
|
||||
for(int j = 0; j < 2; j++) {
|
||||
for(int i = 0; i < cn->info.GetCount(); i++)
|
||||
if(cn->info[i].name == s) {
|
||||
GetColumn(i, r);
|
||||
return;
|
||||
}
|
||||
s = ToUpper(s);
|
||||
}
|
||||
r.SetNull();
|
||||
}
|
||||
|
||||
|
|
@ -326,9 +329,12 @@ Value Sql::operator[](int i) const {
|
|||
|
||||
Value Sql::operator[](SqlId id) const {
|
||||
String s = ~id;
|
||||
for(int i = 0; i < cn->info.GetCount(); i++)
|
||||
if(cn->info[i].name == s)
|
||||
return operator[](i);
|
||||
for(int j = 0; j < 2; j++) {
|
||||
for(int i = 0; i < cn->info.GetCount(); i++)
|
||||
if(cn->info[i].name == s)
|
||||
return operator[](i);
|
||||
s = ToUpper(s);
|
||||
}
|
||||
NEVER();
|
||||
return Value();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ protected:
|
|||
|
||||
friend class Sql;
|
||||
|
||||
Stream *trace;
|
||||
Stream *trace, *error_log;
|
||||
bool tracetime;
|
||||
int traceslow;
|
||||
int dialect;
|
||||
|
|
@ -355,6 +355,9 @@ public:
|
|||
Stream *GetTrace() const { return trace; }
|
||||
void KillTrace() { trace = NULL; }
|
||||
|
||||
void LogErrors(Stream& s = VppLog()) { error_log = &s; }
|
||||
void LogErrors(bool b) { error_log = b ? &VppLog() : NULL; }
|
||||
|
||||
void TraceTime(bool b = true) { tracetime = b; }
|
||||
bool IsTraceTime() const { return tracetime; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue