Logo
~Sockets~
~Examples~
~Contact~


Session.cpp

Go to the documentation of this file.
00001 // Session.cpp
00002 /*
00003 Copyright (C) 2001-2005  Anders Hedstrom
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 */
00019 
00020 #include <stdio.h>
00021 #include <stdlib.h>
00022 #include <sys/types.h>
00023 namespace SQLITE {
00024 #include <sqlite/sqlite.h>
00025 }
00026 // STL include begin
00027 #ifdef WIN32
00028 #pragma warning(push, 3)
00029 #endif
00030 //
00031 #include <vector>
00032 #include <string>
00033 //
00034 #ifdef WIN32
00035 #pragma warning(pop)
00036 #endif
00037 // STL include end
00038 using std::string;
00039 
00040 #include "Session.h"
00041 
00042 
00043 Session::Session()
00044 :m_sqlite(NULL)
00045 ,m_bBusy(false)
00046 {
00047 }
00048 
00049 
00050 Session::~Session()
00051 {
00052   Disconnect();
00053 }
00054 
00055 
00056 int Session::Connect(const char *filename,int mode)
00057 {
00058   char *errmsg;
00059   m_sqlite = SQLITE::sqlite_open(filename,mode,&errmsg);
00060   return 0;
00061 }
00062 
00063 
00064 void Session::Disconnect()
00065 {
00066   if (m_sqlite)
00067   {
00068     SQLITE::sqlite_close(m_sqlite);
00069     m_sqlite = NULL;
00070   }
00071 }
00072 
00073 
00074 void *Session::GetHandle()
00075 {
00076   return m_sqlite;
00077 }
00078 
00079 
00080 void Session::SetBusy(bool b)
00081 {
00082   m_bBusy = b;
00083 }
00084 
00085 
00086 bool Session::IsBusy()
00087 {
00088   return m_bBusy;
00089 }
00090 
00091 
Page, code, and content Copyright (C) 2006 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4