.developing Sql

git-svn-id: svn://ultimatepp.org/upp/trunk@4288 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-12-10 11:30:08 +00:00
parent 9501700765
commit 97bfa2f508
3 changed files with 17 additions and 3 deletions

View file

@ -715,6 +715,13 @@ void SqlSession::InstallErrorHandler(bool (*handler)(String error, String stmt,
error_handler = handler;
}
Sql& SqlSession::GetSessionSql()
{
if(!sql)
sql = new Sql(*this);
return *sql;
}
void SqlSession::ClearError()
{
lasterror.Clear();

View file

@ -254,6 +254,7 @@ AppSql& AppCursor();
#endif
struct StatementExecutor {
virtual bool Execute(const String& stmt) = 0;
virtual ~StatementExecutor() {}
@ -298,6 +299,8 @@ protected:
bool (*error_handler)(String error, String stmt, int code, const char *scode, Sql::ERRORCLASS clss);
int status;
One<Sql> sql;
public:
virtual void Begin();
@ -354,18 +357,21 @@ public:
int GetTime() const { return exectime; }
String GetUser() { return Sql(*this).GetUser(); }
Sql& GetSessionSql();
operator bool() const { return IsOpen(); }
SqlSession();
virtual ~SqlSession();
int GetStatus() { return status; }
void SetStatus(int s) { status = s; WhenDatabaseActivity(*this); }
bool operator == (int s) const { return status == s; }
bool operator != (int s) const { return status != s; }
Callback1<const SqlSession&> WhenDatabaseActivity;
SqlSession();
virtual ~SqlSession();
};
class OciConnection;

View file

@ -347,6 +347,7 @@ bool Sqlite3Session::Open(const char* filename) {
return false;
}
void Sqlite3Session::Close() {
sql.Clear();
if (NULL != db) {
int retval;
#ifndef flagNOAPPSQL