mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.Sql: modified SqlSession::SetError logic to overwrite last error out of transactions
.TSql: adjusted SqlBlock to do a ClearError when starting a transaction +Core: added ArrayMap::Insert(int i, const K& key, T *newt) in analogy to Array git-svn-id: svn://ultimatepp.org/upp/trunk@3466 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c709bb9479
commit
0cc4a5f10a
3 changed files with 6 additions and 5 deletions
|
|
@ -157,8 +157,9 @@ class ArrayMap : public MoveableAndDeepCopyOption< ArrayMap<K, T, HashFn> >,
|
|||
public:
|
||||
T& Add(const K& k, const T& x) { return B::Add(k, x); }
|
||||
T& Add(const K& k) { return B::Add(k); }
|
||||
T& Add(const K& k, T *newt) { B::key.Add(k); B::value.Add(newt); return *newt; }
|
||||
template <class TT> TT& Create(const K& k) { TT *q = new TT; B::key.Add(k); B::value.Add(q); return *q; }
|
||||
T& Add(const K& k, T *newt) { B::key.Add(k); return B::value.Add(newt); }
|
||||
T& Insert(int i, const K& k, T *newt) { B::key.Insert(i, k); return B::value.Insert(i, newt); }
|
||||
template <class TT> TT& Create(const K& k) { TT *q = new TT; B::key.Add(k); return B::value.Add(q); }
|
||||
|
||||
T& Set(int i, T *ptr) { return B::value.Set(i, ptr); }
|
||||
T *PopDetach() { B::key.Drop(); return B::value.PopDetach(); }
|
||||
|
|
|
|||
|
|
@ -682,7 +682,7 @@ Vector<SqlColumnInfo> SqlSession::EnumColumns(String database, String table)
|
|||
void SqlSession::SetError(String error, String stmt, int code, const char *scode, Sql::ERRORCLASS clss) {
|
||||
if(error_handler && (*error_handler)(error, stmt, code, scode, clss))
|
||||
return;
|
||||
if(errorstatement.GetCount())
|
||||
if(GetTransactionLevel() && errorstatement.GetCount())
|
||||
return;
|
||||
lasterror = error;
|
||||
errorstatement = stmt;
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ class SqlBlock
|
|||
public:
|
||||
#ifndef NOAPPSQL
|
||||
SqlBlock(SqlSession& session = SQL.GetSession())
|
||||
: session(session), done(false) { session.Begin(); }
|
||||
: session(session), done(false) { session.ClearError(); session.Begin(); }
|
||||
#else
|
||||
SqlBlock(SqlSession& session)
|
||||
: session(session), done(false) { session.Begin(); }
|
||||
: session(session), done(false) { session.ClearError(); session.Begin(); }
|
||||
#endif
|
||||
~SqlBlock() { if(!done) session.Rollback(); }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue