Version: 1.0.0
sqlite_database.h
Go to the documentation of this file.
1 #ifndef _WX_DATABASE_SQLITE_DATABASE_H_
2 #define _WX_DATABASE_SQLITE_DATABASE_H_
3 
4 #include "wx/database/wxprec.h"
5 
7 
9 {
10 public:
11  // ctor()
13  wxSqliteDatabase(const wxString& strDatabase, bool mustExist = false);
14  wxSqliteDatabase(void* pDatabase) { m_pDatabase = pDatabase; }
15 
16  // dtor()
17  virtual ~wxSqliteDatabase();
18 
19  // open database
20  virtual bool Open(const wxString& strDatabase);
21  virtual bool Open(const wxString& strDatabase, bool mustExist);
22 
23  // close database
24  virtual bool Close();
25 
26  // Is the connection to the database open?
27  virtual bool IsOpen();
28 
29  // transaction support
30  virtual void BeginTransaction();
31  virtual void Commit();
32  virtual void RollBack();
33 
34  // query database
35  virtual int RunQuery(const wxString& strQuery, bool bParseQuery);
36  virtual wxDatabaseResultSet* RunQueryWithResults(const wxString& strQuery);
37 
38  // wxPreparedStatement support
39  virtual wxPreparedStatement* PrepareStatement(const wxString& strQuery);
40  wxPreparedStatement* PrepareStatement(const wxString& strQuery, bool bLogForCleanup);
41 
42  // Database schema API contributed by M. Szeftel (author of wxActiveRecordGenerator)
43  virtual bool TableExists(const wxString& table);
44  virtual bool ViewExists(const wxString& view);
45  virtual wxArrayString GetTables();
46  virtual wxArrayString GetViews();
47  virtual wxArrayString GetColumns(const wxString& table);
48  virtual wxArrayString GetPKColumns(const wxString& table);
49 
50  static int TranslateErrorCode(int nCode);
51 
52 private:
53 
54  //sqlite3* m_pDatabase;
55  void* m_pDatabase;
56 };
57 
58 #endif//_WX_DATABASE_SQLITE_DATABASE_H_
59 
virtual wxArrayString GetPKColumns(const wxString &table)=0
get Primary keys column names
virtual wxArrayString GetViews()=0
Retrieve all view names.
virtual wxPreparedStatement * PrepareStatement(const wxString &strQuery)=0
Prepare a SQL statement which can be reused with different parameters.
virtual void RollBack()=0
Rollback the current transaction.
virtual bool IsOpen()=0
Is the connection to the database open?
virtual int RunQuery(const wxString &strQuery)
Run an insert, update, or delete query on the database.
Definition: database.cpp:19
virtual void BeginTransaction()=0
Begin a transaction.
virtual bool Open(const wxString &strDatabase)=0
virtual bool ViewExists(const wxString &view)=0
Check for the existence of a view by name.
virtual void Commit()=0
Commit the current transaction.
virtual wxArrayString GetColumns(const wxString &table)=0
Retrieve all column names for a table.
virtual bool Close()=0
close database
virtual bool TableExists(const wxString &table)=0
Check for the existence of a table by name.
wxSqliteDatabase(void *pDatabase)
#define WXDLLIMPEXP_DATABASE
virtual wxArrayString GetTables()=0
Retrieve all table names.
virtual wxDatabaseResultSet * RunQueryWithResults(const wxString &strQuery)=0
Run a select query on the database.