#include <podbc.h>
Inheritance diagram for PODBC:
Public Types | |
LongVarChar = -1 | |
Binary = -2 | |
VarBinary = -3 | |
LongVarBinary = -4 | |
BigInt = -5 | |
TinyInt = -6 | |
Bit = -7 | |
Guid = -11 | |
Boolean. | |
Unknown = 0 | |
Char = 1 | |
Numeric = 2 | |
Decimal = 3 | |
Integer = 4 | |
SmallInt = 5 | |
Float = 6 | |
Real = 7 | |
Double = 8 | |
DateTime = 9 | |
VarChar = 12 | |
Date = 91 | |
Time = 92 | |
Structure. | |
TimeStamp = 93 | |
Structure. | |
oPString | |
oBOOL | |
ochar | |
oshort | |
oint | |
olong | |
odouble | |
oPBYTEArray | |
oPInt64 | |
oPTime | |
oPGUID | |
mySQL | |
MSSQL | |
Oracle | |
IBM_DB2 | |
DBASE | |
Paradox | |
Excel | |
Ascii | |
Foxpro | |
MSAccess | |
postgreSQL | |
MSSQLNamedPipes | |
MSSQLWinSock | |
MSSQLIPX | |
MSSQLBanyan | |
MSSQLRPC | |
Enumerators | |
enum | FieldTypes { LongVarChar = -1, Binary = -2, VarBinary = -3, LongVarBinary = -4, BigInt = -5, TinyInt = -6, Bit = -7, Guid = -11, Unknown = 0, Char = 1, Numeric = 2, Decimal = 3, Integer = 4, SmallInt = 5, Float = 6, Real = 7, Double = 8, DateTime = 9, VarChar = 12, Date = 91, Time = 92, TimeStamp = 93 } |
Raw SQL data type codes Refer <sql.h> SQL_* This list is not inclusive. More... | |
enum | PwType { oPString, oBOOL, ochar, oshort, oint, olong, odouble, oPBYTEArray, oPInt64, oPTime, oPGUID } |
Converted Pwlib Field Types. More... | |
enum | DataSources { mySQL, MSSQL, Oracle, IBM_DB2, DBASE, Paradox, Excel, Ascii, Foxpro, MSAccess, postgreSQL } |
Datasources that are supported by this implementation used in the PODBC::DataSource Function. More... | |
enum | MSSQLProtocols { MSSQLNamedPipes, MSSQLWinSock, MSSQLIPX, MSSQLBanyan, MSSQLRPC } |
MSSQL protocols.If your interested? More... | |
Public Member Functions | |
Constructor/Deconstructor | |
PODBC () | |
Constructor. | |
~PODBC () | |
Deconstructor. | |
Data Queries | |
Table | LoadTable (PString table) |
Load a specified Table/Stored Query or General 'SELECT' SQL Query. | |
PBoolean | Query (PString Query) |
Added Information to the DataSource. | |
DataSource Access | |
PBoolean | DataSource (DataSources Source, ConnectData Data) |
DataSource This is the main function to call to contact a DataSource. | |
virtual PBoolean | Connect (LPCTSTR svSource) |
General Connect Function Custom connection strings should call this to connect Don't ask why its LPCTSTR! | |
PBoolean | Connect_DB2 (PFilePath DBPath) |
Connect to IBM DB2 DataSource. | |
PBoolean | Connect_XLS (PFilePath XLSPath, PString DefDir="") |
Connect to MS Office excel spreadsheet. | |
PBoolean | Connect_TXT (PFilePath TXTPath) |
Connect to an ascii text or cvs file. | |
PBoolean | Connect_FOX (PFilePath DBPath, PString User="", PString Pass="", PString Type="DBF", PBoolean Exclusive=false) |
Connect to a Foxpro dataSource. | |
PBoolean | Connect_MDB (PFilePath MDBPath, PString User="", PString Pass="", PBoolean Exclusive=false) |
Connect to a MS Access *.mdb DataSource. | |
PBoolean | Connect_PDOX (PDirectory DBPath, PDirectory DefaultDir, int version=5) |
Connect to a paradox database datastore. | |
PBoolean | Connect_Oracle (PString Server, PString User="", PString Pass="") |
Connect to an Oracle Datasource. | |
PBoolean | Connect_DBASE (PDirectory DBPath) |
Connect to a DBase DataStore. | |
PBoolean | Connect_MSSQL (PString User="", PString Pass="", PString Host="(local)", PBoolean Trusted=true, MSSQLProtocols Proto=MSSQLNamedPipes) |
Connect to a MS SQL Server. | |
PBoolean | Connect_mySQL (PString User="", PString Pass="", PString Host="localhost", int Port=3306, int Option=0) |
Connect to a mySQL Server. | |
PBoolean | ConnectDB_mySQL (PString DB, PString User="", PString Pass="", PString Host="localhost", int Port=3306, int Option=0) |
Connect to a mySQL Server's specified DataBase. | |
PBoolean | Connect_postgreSQL (PString DB, PString User, PString Pass, PString Host, int Port=5432, int Option=0) |
Connect to a postgreSQL Server. | |
void | Disconnect () |
General Disconnect from DataSource. | |
Utilities | |
PStringArray | TableList (PString option="") |
Retrieve a List of Tables in the Datasource use the option field to specify the type of data to access. | |
PBoolean | NeedLongDataLen () |
Check whether their is a limit to Datalength when obtaining Long Data. | |
virtual void | OnSQLError (PString RetCode, PString RetString) |
OnSQL Error. | |
void | SetPrecision (int Digit) |
Set the Number of Decimal places to round to By Default it is 4. | |
void | SetTimeFormat (PTime::TimeFormat tformat) |
Set the Time Display Format. | |
operator HDBC () | |
Operator Handle DataBase Connection. | |
Public Attributes | |
PODBC::DataSources | dbase |
Protected Attributes | |
SQLRETURN | m_nReturn |
Database Type connected to. | |
HENV | m_hEnv |
HDBC | m_hDBC |
Classes | |
class | ConnectData |
This class is a multipurpose use class for storing parameters when initiating connection to DataSource. More... | |
class | Field |
class | Row |
This class functions as a simple wrapper of the PODBCStmt class to fetch/Save data to the Datasource. More... | |
class | Table |
PODBC::Table This is the main Class to access Data returned by a Select Query. More... |
This Class should be used in the there is not a preconfigured DSN setup in the MDAC. This class will use the applicable ODBC drivers to connect to a compliant Datasource. It Supports a wide variety of Datasources but others can added by simply creating your custom connection string and then calling PODBC::Connect. For Defined sources the PODBC::DataSource function should be used.
enum PODBC::DataSources |
Datasources that are supported by this implementation used in the PODBC::DataSource Function.
enum PODBC::FieldTypes |
Raw SQL data type codes Refer <sql.h> SQL_* This list is not inclusive.
If an item is not listed or Unknown it is treated as a character string.
enum PODBC::PwType |
Converted Pwlib Field Types.
Data is stored as a PString and the pwType enumerator indicates the conversion required on the PODBC::Field.
PODBC::PODBC | ( | ) |
Constructor.
PODBC::~PODBC | ( | ) |
Deconstructor.
General Connect Function Custom connection strings should call this to connect Don't ask why its LPCTSTR!
PBoolean PODBC::Connect_DBASE | ( | PDirectory | DBPath | ) |
Connect to a DBase DataStore.
PBoolean PODBC::Connect_FOX | ( | PFilePath | DBPath, | |
PString | User = "" , |
|||
PString | Pass = "" , |
|||
PString | Type = "DBF" , |
|||
PBoolean | Exclusive = false | |||
) |
Connect to a Foxpro dataSource.
PBoolean PODBC::Connect_MDB | ( | PFilePath | MDBPath, | |
PString | User = "" , |
|||
PString | Pass = "" , |
|||
PBoolean | Exclusive = false | |||
) |
Connect to a MS Access *.mdb DataSource.
PBoolean PODBC::Connect_MSSQL | ( | PString | User = "" , |
|
PString | Pass = "" , |
|||
PString | Host = "(local)" , |
|||
PBoolean | Trusted = true , |
|||
MSSQLProtocols | Proto = MSSQLNamedPipes | |||
) |
Connect to a MS SQL Server.
PBoolean PODBC::Connect_mySQL | ( | PString | User = "" , |
|
PString | Pass = "" , |
|||
PString | Host = "localhost" , |
|||
int | Port = 3306 , |
|||
int | Option = 0 | |||
) |
Connect to a mySQL Server.
Connect to an Oracle Datasource.
PBoolean PODBC::Connect_PDOX | ( | PDirectory | DBPath, | |
PDirectory | DefaultDir, | |||
int | version = 5 | |||
) |
Connect to a paradox database datastore.
PBoolean PODBC::Connect_postgreSQL | ( | PString | DB, | |
PString | User, | |||
PString | Pass, | |||
PString | Host, | |||
int | Port = 5432 , |
|||
int | Option = 0 | |||
) |
Connect to a postgreSQL Server.
Connect to MS Office excel spreadsheet.
PBoolean PODBC::ConnectDB_mySQL | ( | PString | DB, | |
PString | User = "" , |
|||
PString | Pass = "" , |
|||
PString | Host = "localhost" , |
|||
int | Port = 3306 , |
|||
int | Option = 0 | |||
) |
Connect to a mySQL Server's specified DataBase.
PBoolean PODBC::DataSource | ( | DataSources | Source, | |
ConnectData | Data | |||
) |
DataSource This is the main function to call to contact a DataSource.
Source specifies the Type of DataSource to contact and the Data parameter contain the relevent connection information. You can choose to call this function or use the specific Connection function.
void PODBC::Disconnect | ( | ) |
General Disconnect from DataSource.
Load a specified Table/Stored Query or General 'SELECT' SQL Query.
This function will return a PODBC::Table for further analysis. Do Not Use this Function for any other SQL statements other than SELECT.
PBoolean PODBC::NeedLongDataLen | ( | ) |
Check whether their is a limit to Datalength when obtaining Long Data.
OnSQL Error.
PODBC::operator HDBC | ( | ) | [inline] |
Operator Handle DataBase Connection.
Added Information to the DataSource.
Use this function if you just want to use a SQL statement to add data to a datasource without retreiving the data itself. ie "UPDATE" "APPEND" "INSERT" queries.
void PODBC::SetPrecision | ( | int | Digit | ) |
Set the Number of Decimal places to round to By Default it is 4.
However if the field decimal places is less then Precision Value the field rounding will be used. This must be set prior to calling LoadTable()
void PODBC::SetTimeFormat | ( | PTime::TimeFormat | tformat | ) |
Set the Time Display Format.
PStringArray PODBC::TableList | ( | PString | option = "" |
) |
Retrieve a List of Tables in the Datasource use the option field to specify the type of data to access.
ie "TABLE" or "VIEW" (further dev req'd)
HDBC PODBC::m_hDBC [protected] |
HENV PODBC::m_hEnv [protected] |
SQLRETURN PODBC::m_nReturn [protected] |
Database Type connected to.