95 #endif // _MSC_VER > 1000
98 #if defined(P_ODBC) && !defined(_WIN32_WCE)
100 #include <odbcinst.h>
106 #pragma comment(lib,"odbc32.lib")
107 #pragma comment(lib,"odbcCP32.lib")
125 #define MAX_DATA_LEN 1024
713 int Port=3306,
int Option=0);
719 int Port=3306,
int Option=0);
840 SQLINTEGER * dataLen=NULL,
841 int Type=SQL_C_DEFAULT
869 USHORT Column,LPVOID pBuffer,
871 LONG * pReturnedBufferSize=NULL,
872 USHORT nType=SQL_C_TCHAR
943 #endif // PTLIB_PODBC_H
CHAR TCHAR
ODBC Support for PWLIB.
Definition: podbc.h:116
PBoolean Connect_postgreSQL(PString DB, PString User, PString Pass, PString Host, int Port=5432, int Option=0)
Connect to a postgreSQL Server.
void SetPrecision(int Digit)
Set the Number of Decimal places to round to By Default it is 4.
HSTMT m_hStmt
Definition: podbc.h:242
PBoolean Connect_DBASE(PDirectory DBPath)
Connect to a DBase DataStore.
PBoolean PostNew(PODBC::Row &rec)
Post the new record back to the RecordSet;.
PwType Type
Data Field to ODBC Bind to.
Definition: podbc.h:448
PBoolean Post()
Post the Changes back to the Database.
virtual PBoolean Connect(LPCTSTR svSource)
General Connect Function Custom connection strings should call this to connect Don't ask why its LPC...
virtual void OnSQLError(PString RetCode, PString RetString)
OnSQL Error.
Definition: podbc.h:746
PInt64 sbint
Unsigned char SQLCHAR *.
Definition: podbc.h:410
SQLLEN dataLen
GUID Structure (not Fully Supported)
Definition: podbc.h:415
PODBCStmt stmt
Definition: podbc.h:626
PODBC::DataSources dbase
Statement Class.
Definition: podbc.h:935
PBoolean isNullable
Is Field Readonly.
Definition: podbc.h:457
Row * RowHandler
Name of the Fetched Table (if used in Constructor)
Definition: podbc.h:628
PString tableName
ODBC Fetched Statement Info.
Definition: podbc.h:627
PBoolean Post()
Post the Row back to the Database.
PBoolean FetchFirst()
FetchFirst Fetch the First row in the RecordSet.
PArray< Field > Fields
Number of Rows.
Definition: podbc.h:544
PBoolean DeleteRow(PINDEX row=0)
Delete Row 0 indicates Current Row.
Structure.
Definition: podbc.h:306
DWORD GetChangedRowCount(void)
GetChangedRowCount retreives the number of rows updated/altered by UPDATE/INSERT statements...
Field & Column(PINDEX col)
Retrieve Field Data given the specifed column.
Field & operator[](PINDEX col)
Retrieve Field Data given specified column.
PwType
Converted Pwlib Field Types.
Definition: podbc.h:314
HSTMT m_hStmt
Time Format.
Definition: podbc.h:933
PString sbinlong
Strings & Binary Data.
Definition: podbc.h:404
PODBC Class The Main ODBC class.
Definition: podbc.h:259
PBoolean IsValid()
IsValid Checks to ensure a Handle has been allocated and is effective.
HDBC m_hDBC
Definition: podbc.h:771
PBoolean Excl_Trust
Password.
Definition: podbc.h:377
int dbase
Reference to the PODBC Class.
Definition: podbc.h:244
PBoolean Connect_mySQL(PString User="", PString Pass="", PString Host="localhost", int Port=3306, int Option=0)
Connect to a mySQL Server.
This class is a multipurpose use class for storing parameters when initiating connection to DataSour...
Definition: podbc.h:370
DSN (Data Source Name) Connection.
Definition: podbc.h:781
PBoolean isAutoInc
Allows Nulls.
Definition: podbc.h:458
This class describes a full description for a file on the particular platform.
Definition: filepath.h:65
PStringArray TableList(PString option="")
Retrieve a List of Tables in the Datasource use the option field to specify the type of data to acce...
PString GetLongData(PINDEX Column)
TIMESTAMP_STRUCT timestamp
Time Structure.
Definition: podbc.h:413
HENV m_hEnv
Definition: podbc.h:770
PBoolean IsColumnUpdatable(PINDEX Column)
IsColumn Updateable ie is not ReadOnly.
int opt
Port to connect to mySQL.
Definition: podbc.h:380
SQLGUID guid
TimeStamp Structure.
Definition: podbc.h:414
PBoolean InternalGetData(USHORT Column, LPVOID pBuffer, ULONG pBufLen, SQLINTEGER *dataLen=NULL, int Type=SQL_C_DEFAULT)
InternalGetData is call when retrieving string or large binary data where the size is indetermined...
PBoolean DataFragment(PString &Buffer, PINDEX &fragment, SQLINTEGER &size)
DataFragment Data is broken into fragment to be passed to the Database
Table(PODBC *odbc, PString Query)
Constructor Using the HDBC and TableName/Select SQL Query creates a virtual Table in the OBDC driver...
Structure.
Definition: podbc.h:305
PStringArray ColumnNames()
Retrieve the Column Names.
PODBC::FieldTypes ColumnType(PINDEX Column)
ColumnTypes.
void GetLastError()
Get the Last Error This returns the Error ID & String to PODBC::OnSQLError
PODBC * GetLink() const
Definition: podbc.h:237
This is an array collection class of PString objects.
Definition: pstring.h:2024
PString DefDir
Database file Path (not Oracle,xxSQL)
Definition: podbc.h:374
PBoolean FetchPrevious()
FetchPrevious Fetch the previous Row from current row.
PString Pass
UserName.
Definition: podbc.h:376
Field & operator()(PINDEX row, PINDEX col)
Returns the Field data at a predetermined position in the Resultant RecordSet.
PBoolean Connect(PString Source, PString Username, PString Password)
Connect to the MDAC using a pre-existing MDAC Defined DataSource This is different than calling PODB...
~PODBCStmt()
Deconstructor.
PODBC * odbclink
Definition: podbc.h:243
int Decimals
Field AutoIncrements.
Definition: podbc.h:459
TimeFormat
Standard time formats for string representations of a time and date.
Definition: ptime.h:399
Field & Column(PINDEX col)
Returns the indicated Column Holder for the RecordSet, This can be used for iterative Row calls...
DataSources
Datasources that are supported by this implementation used in the PODBC::DataSource Function...
Definition: podbc.h:333
Row(PODBCStmt *stmt)
Constructor Create a Dummy row of data to act as a Record Marker.
PStringArray ColumnNames()
ColumnNames.
BOOL PBoolean
Definition: object.h:102
Class to represent a directory in the operating system file system.
Definition: pdirect.h:182
PINDEX Rows()
Rows The Number of Rows.
int GetDBase() const
Definition: podbc.h:238
PINDEX CurRow
Record Structure.
Definition: podbc.h:539
unsigned char sbit
Double SQLDOUBLE.
Definition: podbc.h:408
PBoolean Connect_Oracle(PString Server, PString User="", PString Pass="")
Connect to an Oracle Datasource.
unsigned char * suchar
Bit SQLCHAR.
Definition: podbc.h:409
FieldTypes
Raw SQL data type codes Refer <sql.h> SQL_* This list is not inclusive.
Definition: podbc.h:283
void SetNewRow()
SetNewRow Set New Row for input.
PFilePath DBPath
Definition: podbc.h:373
long int slint
Short Integer SQLSMALLINT.
Definition: podbc.h:406
PBoolean Fetch()
Fetch General call to retreive the next row of data.
DWORD ColumnSize(PINDEX Column)
Column Size.
PBoolean Connect_FOX(PFilePath DBPath, PString User="", PString Pass="", PString Type="DBF", PBoolean Exclusive=false)
Connect to a Foxpro dataSource.
PBoolean IsColumnNullable(PINDEX Column)
IsColumn Nullable.
PBoolean Query(PString strSQL)
Query function is the Main function to pass SQL statements to retreive/ add/Modify database data...
PBoolean Connect_MDB(PFilePath MDBPath, PString User="", PString Pass="", PBoolean Exclusive=false)
Connect to a MS Access *.mdb DataSource.
PBoolean Delete(PINDEX row=0)
Delete the Current Record from the RecordSet
PBoolean DataSource(DataSources Source, ConnectData Data)
DataSource This is the main function to call to contact a DataSource.
PBoolean Cancel()
Cancel the Current Statement.
PString operator=(const PString &str)
Returns a String representation of the field.
LPCSTR LPCTSTR
Definition: podbc.h:118
PBoolean NewRow
Current Row.
Definition: podbc.h:540
unsigned int ColumnPrecision(PINDEX Column)
ColumnPrecision Get the Number of Decimal places if Precision is set the precision is set to the les...
void SetTimeFormat(PTime::TimeFormat tformat)
Set the Time Display Format.
PODBCRecord(PODBCStmt *hStmt)
Constructor.
PBoolean LongData
Number of decimal places to Round.
Definition: podbc.h:460
PODBC::Table This is the main Class to access Data returned by a Select Query.
Definition: podbc.h:553
PString ColumnName(PINDEX Column)
Column Name.
SQLRETURN m_nReturn
Database Type connected to.
Definition: podbc.h:769
void Data(PINDEX Column, PODBC::Field &field)
Data: Main Call to retrieve and convert Field Data and return the information in the PODBC::Field s...
Row & RecordHandler()
Obtain the Record Handler.
The character string class.
Definition: pstring.h:108
PBoolean PostDelete(PINDEX row=1)
Post a Delete command to the RecordSet; Default 1 Row is deleted.
PBoolean Connect_DB2(PFilePath DBPath)
Connect to IBM DB2 DataSource.
PBoolean InternalSaveLongData(SQLRETURN nRet, PODBC::Row &rec)
Check for and Save Long Data.
PBoolean Query(PString Query)
Added Information to the DataSource.
LPSTR LPTSTR
Definition: podbc.h:117
PODBCRecord This Class is used to analyse the fetched data and handles Data Conversion/Read Write ope...
Definition: podbc.h:809
PBoolean Post()
Post Update back to Database.
SQL compliant Bound DataTypes.
Definition: podbc.h:400
PBoolean InternalBindColumn(USHORT Column, LPVOID pBuffer, ULONG pBufferSize, LONG *pReturnedBufferSize=NULL, USHORT nType=SQL_C_TCHAR)
InternalBindColumn for Data input.
PString User
Used with Paradox/DBase/Excel (& mySQL db)
Definition: podbc.h:375
Bind Data
Settings.
Definition: podbc.h:447
static PTime::TimeFormat TimeFormat
Long Data Limit KBytes def = 56; (56 Kbytes)
Definition: podbc.h:929
PBoolean PostUpdate(PODBC::Row &rec)
Post the Updated record back to the RecordSet;.
Boolean.
Definition: podbc.h:292
Row & operator[](PINDEX row)
Row return the fetched row in the Cached RecordSet.
~PODBCRecord()
Deconstructor.
Definition: podbc.h:822
PString AsString()
Display the Field Data as String.
Row * row
LongData Length is Required.
Definition: podbc.h:463
PINDEX ColumnCount()
ColumnCount No of columns.
MSSQLProtocols
MSSQL protocols.If your interested?
Definition: podbc.h:350
This class functions as a simple wrapper of the PODBCStmt class to fetch/Save data to the Datasourc...
Definition: podbc.h:476
PBoolean FetchLast()
FetchLast Fetch the Last row in the RecordSet.
DWORD ColumnScale(PINDEX Column)
Column Scale.
PBoolean IsColumnAutoIndex(PINDEX Column)
IsColumnAutoIndex (ie don't give default Value)
void Disconnect()
General Disconnect from DataSource.
PODBCRecord * rec
Definition: podbc.h:537
PString Name
ODBC Type (For saving/Conversion)
Definition: podbc.h:452
PBoolean Navigate(PINDEX row)
Navigate to Specified Row.
PINDEX RowCount
Flag to Indicate New Row (requires either Post or Delete)
Definition: podbc.h:541
PBoolean NeedLongDataLen()
Check whether their is a limit to Datalength when obtaining Long Data
static int MaxCharSize
Double Real Float Decimal digit rounding def= 4;.
Definition: podbc.h:928
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.
This template class maps the PArrayObjects to a specific object type.
Definition: array.h:1024
PString Host
Whether Datasource is locked or Trusted.
Definition: podbc.h:378
PBoolean Connect_XLS(PFilePath XLSPath, PString DefDir="")
Connect to MS Office excel spreadsheet.
PBoolean FetchNext()
FetchNext: Fetch the Next row.
FieldTypes ODBCType
pwlib Type for conversion
Definition: podbc.h:449
PBoolean FetchRow(PINDEX nRow, PBoolean Absolute=1)
FetchRow More detailed fetching of Rows.
short int ssint
Long Data.
Definition: podbc.h:405
TIME_STRUCT time
Date Structure.
Definition: podbc.h:412
PBoolean SQL_OK(SQLRETURN res)
Is the SQL Instruction OK If an Error is detected then GetLastError is called to Retrieve the SQL Er...
PODBCStmt(PODBC *odbc)
Constructor PODBC (Datasources call) or thro' DSNConnection (Connection call).
int Port
URL for Host Datasouce xxSQL.
Definition: podbc.h:379
PString sbin
Definition: podbc.h:403
PODBCStmt * Stmt
Definition: podbc.h:934
PBoolean Connect_TXT(PFilePath TXTPath)
Connect to an ascii text or cvs file.
double sdoub
Integer SQLINTEGER.
Definition: podbc.h:407
PODBC::DataSources dbase
Definition: podbc.h:763
PINDEX col
Column Name.
Definition: podbc.h:453
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
Table LoadTable(PString table)
Load a specified Table/Stored Query or General 'SELECT' SQL Query.
PStringArray TableList(PString option="")
Retreive the List of Tables from the current Datasource The option field can be used to specify the ...
PBoolean isReadOnly
Column Number (For Saving/Conversion)
Definition: podbc.h:456
DATE_STRUCT date
Bit Integer SQLBIGINT.
Definition: podbc.h:411
void SetDefaultValues()
Set the Value.
PBoolean Connect_PDOX(PDirectory DBPath, PDirectory DefaultDir, int version=5)
Connect to a paradox database datastore.
PINDEX ColumnByName(PString Column)
ColumnByName returns the column number of the column name If not found returns column value of 0; ...
static unsigned int Precision
Conversion Settings.
Definition: podbc.h:927
void SetValue(PString value)
Set the Field Data.
PBoolean Connect_MSSQL(PString User="", PString Pass="", PString Host="(local)", PBoolean Trusted=true, MSSQLProtocols Proto=MSSQLNamedPipes)
Connect to a MS SQL Server.