don't include wx/wxprec.h from headers, it's bad style (patch from Tim Stahlhut)
[wxWidgets.git] / demos / dbbrowse / browsedb.h
1 //----------------------------------------------------------------------------------------
2 // Name: browsedb.h
3 // Purpose: a wxDb class
4 // Author: Mark Johnson
5 // Modified by:
6 // Created: 19991127.mj10777
7 // Copyright: (c) Mark Johnson
8 // Licence: wxWindows license
9 // RCS-ID: $Id$
10 //----------------------------------------------------------------------------------------
11 //-- Zu tun in browsedb.h
12 //----------------------------------------------------------------------------------------
13 //-- 1)
14 //----------------------------------------------------------------------------------------
15 // Global structure for holding ODBC connection information
16 //----------------------------------------------------------------------------------------
17 //extern wxDbConnectInf DbConnectInf;
18 class MainDoc;
19
20 //----------------------------------------------------------------------------------------
21 class BrowserDB
22 {
23 public:
24 //---------------------------------------------------------------------------------------
25 // Pointer to the main database connection used in the program. This
26 // pointer would normally be used for doing things as database lookups
27 // for user login names and passwords, getting workstation settings, etc.
28 // ---> IMPORTANT <---
29 //
30 // For each database object created which uses this wxDb pointer
31 // connection to the database, when a CommitTrans() or RollBackTrans()
32 // will commit or rollback EVERY object which uses this wxDb pointer.
33 //
34 // To allow each table object (those derived from wxDbTable) to be
35 // individually committed or rolled back, you MUST use a different
36 // instance of wxDb in the constructor of the table. Doing so creates
37 // more overhead, and will use more database connections (some DBs have
38 // connection limits...), so use connections sparringly.
39 //
40 // It is recommended that one "main" database connection be created for
41 // the entire program to use for READ-ONLY database accesses, but for each
42 // table object which will do a CommitTrans() or RollbackTrans() that a
43 // new wxDb object be created and used for it.
44 //---------------------------------------------------------------------------------------
45 wxDb* db_BrowserDB;
46 wxDbInf* ct_BrowserDB;
47 wxDbColInf* cl_BrowserDB;
48 wxString ODBCSource, UserName, Password;
49 MainDoc *pDoc;
50 //---------------------------------------------------------------------------------------
51 wxString Temp0, Temp1, Temp2, Temp3, Temp4, Temp5;
52 wxString ODBCText;
53 wxTextCtrl* p_LogWindow;
54 wxString s_SqlTyp[25];
55 int i_SqlTyp[25];
56 wxString s_dbTyp[5];
57 int i_dbTyp[5];
58 int i_Which;
59 int i_Records;
60 int i_Cols;
61 //---------------------------------------------------------------------------------------
62 BrowserDB();
63 ~BrowserDB();
64 void PointerToNULL(int Art);
65 bool Initialize(int Quiet);
66 //---------------------------------------------------------------------------------------
67 bool OnStartDB(int Quiet);
68 bool OnCloseDB(int Quiet);
69 bool OnSelect(wxString tb_Name,int Quiet);
70 bool OnExecSql(wxString SQLStmt,int Quiet);
71 bool OnGetNext(int Cols,int Quiet);
72 wxDbInf* OnGetCatalog(int Quiet);
73 wxDbColInf* OnGetColumns(wxChar *tableName, UWORD numCols,int Quiet);
74 void OnFillSqlTyp();
75 void OnFilldbTyp();
76 //---------------------------------------------------------------------------------------
77 }; // BrowserDB class definition
78 //----------------------------------------------------------------------------------------