Value SqlStatement::Fetch(Sql& cursor) const { ASSERT(text.GetCount()); if(!Execute(cursor)) return ErrorValue(SqlExc(cursor.GetSession())); if(!cursor.Fetch()) return Null; return cursor[0]; }
String ForceInsertRowid(const String& insert, Sql& cursor) { if(!cursor.Execute(insert + " returning ROWID into ?%s")) throw SqlExc(cursor.GetSession()); if(!cursor.Fetch()) throw Exc(t_("FETCH internal error (ForceInsertRowid)")); ASSERT(!IsNull(cursor[0])); return cursor[0]; }
int SqlError( #ifdef PLATFORM_WIN32 HWND parent, #endif const char *text, const Sql& sql, bool retry) { return SqlError( #ifdef PLATFORM_WIN32 parent, #endif text, sql.GetSession(), retry); }
void SqlStatement::Force(Sql& cursor) const { ASSERT(text.GetCount()); if(!cursor.Execute(*this)) throw SqlExc(cursor.GetSession()); }
bool ShowError(Sql& sql, const char *msg) { return ShowError(sql.GetSession(), msg); }
bool DisplayError(const Sql& sql, const char *msg) { return DisplayError(sql.GetSession(), msg); }
bool OkCommit(Sql& sql, const char *emsg) { return OkCommit(sql.GetSession(), emsg); }
bool ErrorRollback(Sql& sql, const char *emsg) { return ErrorRollback(sql.GetSession(), emsg); }
SqlExc::SqlExc(const Sql& sql) : Exc(sql_error) { SetSessionError(sql.GetSession()); }