]> git.saurik.com Git - wxWidgets.git/blame - demos/dbbrowse/browsedb.h
fix memory leak as Dimitri suggested
[wxWidgets.git] / demos / dbbrowse / browsedb.h
CommitLineData
c92b0f9a 1//----------------------------------------------------------------------------------------
b5ffecfc 2// Name: browsedb.h
f6bcfd97 3// Purpose: a wxDb class
829c421b 4// Author: Mark Johnson
b5ffecfc
GT
5// Modified by:
6// Created: 19991127.mj10777
7// Copyright: (c) Mark Johnson
8// Licence: wxWindows license
c09d434d 9// RCS-ID: $Id$
c92b0f9a 10//----------------------------------------------------------------------------------------
b5ffecfc 11//-- Zu tun in browsedb.h
c92b0f9a 12//----------------------------------------------------------------------------------------
b5ffecfc 13//-- 1)
c92b0f9a 14//----------------------------------------------------------------------------------------
b5ffecfc 15// Global structure for holding ODBC connection information
c92b0f9a 16//----------------------------------------------------------------------------------------
eacf9d88 17//extern wxDbConnectInf DbConnectInf;
3fa0976a 18class MainDoc;
645889ad 19
c92b0f9a 20//----------------------------------------------------------------------------------------
b5ffecfc
GT
21class BrowserDB
22{
645889ad
GT
23public:
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();
eacf9d88 64 void PointerToNULL(int Art);
645889ad
GT
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);
c55dea60 73 wxDbColInf* OnGetColumns(char *tableName, UWORD numCols,int Quiet);
645889ad
GT
74 void OnFillSqlTyp();
75 void OnFilldbTyp();
76 //---------------------------------------------------------------------------------------
b5ffecfc 77}; // BrowserDB class definition
645889ad 78 //----------------------------------------------------------------------------------------