96 #endif // _MSC_VER > 1000
149 Field &
operator=(
const PVarType & other) { PVarType::operator=(other);
return *
this; }
152 virtual bool SetType(BasicType type, PINDEX options = 0);
303 bool Move(
int offset);
351 void operator=(
const Row &) { }
395 bool descending =
false
604 bool exclusive =
false
613 bool exclusive =
false
642 const PString & host =
"(local)",
652 const PString & host =
"localhost",
662 const PString & host =
"localhost",
693 bool withAttributes =
true
702 bool withDescription =
true
732 static PString GetFieldType(DriverType driver, PVarType::BasicType type,
unsigned size = 0);
777 bool DataSource(DriverType driver, ConnectData Data);
806 #endif // PTLIB_PODBC_H
int GetLastError() const
Get last error.
Definition: podbc.h:762
PODBC()
Constructs ODBC connection.
bool IsNULL() const
Is curreently NULL value.
bool Connect(const ConnectData &connectInfo)
Connect to database using ConnectData This is the main function to call to contact a DataSource...
bool First()
First record.
Definition: podbc.h:430
RowIndex Rows(bool forceCount=true)
Returns the Number of Rows in the Resultant RecordSet.
static const char * GetDriverName(DriverType type)
Row & m_row
Definition: podbc.h:191
Field(Row &row, PINDEX column)
PDirectory m_directory
Used with Paradox/DBase/Excel (& mySQL db)
Definition: podbc.h:539
PStringList GetDrivers(bool withAttributes=true) const
Get a list of driver descriptions and attributes.
PINDEX Columns()
Columns.
Definition: podbc.h:406
void SetPrecision(unsigned precision)
Set the Number of Decimal places to round to By Default it is 4.
bool m_isNullable
Definition: podbc.h:197
~PODBC()
Destroys ODBC connection.
unsigned GetPrecision() const
Definition: podbc.h:178
PODBC::Row POBDCRecord
Definition: podbc.h:800
unsigned ColumnScale(PINDEX column) const
Column Scale.
Definition: podbc.h:272
int m_options
General Option Value.mySQL & Paradox.
Definition: podbc.h:546
PINDEX GetColumn() const
Get column index number, 1 up.
Definition: podbc.h:166
bool Navigate(RowIndex row)
Definition: podbc.h:342
bool IsConnected() const
Return true if connected.
bool ConnectDB_mySQL(const PString &db, const PString &user=PString::Empty(), const PString &pass=PString::Empty(), const PString &host="localhost", int port=3306)
Connect to a mySQL Server's specified DataBase.
virtual void OnSQLError(int native, const PString &code, const PString &message)
OnSQL Error.
unsigned m_decimals
Definition: podbc.h:200
bool Previous()
Previous record.
PStringArray ColumnNames() const
Retrieve the Column Names.
bool IsColumnAutoIndex(PINDEX column) const
IsColumnAutoIndex (ie don't give default Value)
Definition: podbc.h:290
__inline bool Query(const PString &sql)
Definition: podbc.h:723
bool m_trusted
Whether Datasource is trusted.
Definition: podbc.h:545
Row & NewRow()
Add New Row.
void SetNULL()
Set value to NULL.
ODBC Support for PWLIB.
Definition: podbc.h:114
bool Move(int offset)
Move to row relative to current position.
Definition: podbc.h:426
bool MoveTo(RowIndex row)
Move to Specified Row.
Definition: podbc.h:422
bool IsColumnNullable(PINDEX column) const
IsColumn Nullable.
Definition: podbc.h:282
bool IsReadOnly() const
Definition: podbc.h:174
PINDEX ColumnByName(const PCaselessString &columnName) const
ColumnByName returns the column number of the column name If not found returns column value of 0; ...
This class describes a full description for a file on the particular platform.
Definition: filepath.h:61
PArray< Field > m_fields
Current row number, starting at 1, 0 == new.
Definition: podbc.h:347
virtual void OnConnected()
Call back on successful connection.
RecordSet & m_recordSet
Definition: podbc.h:345
bool Connect_DB2(const PFilePath &dbPath)
Connect to IBM DB2 DataSource.
PODBC PDSNConnection
Definition: podbc.h:801
PString m_username
UID.
Definition: podbc.h:540
PODBC::RecordSet This is the main Class to access Data returned by a Select Query.
Definition: podbc.h:362
bool Connect_FOX(const PFilePath &dbPath, const PString &user=PString::Empty(), const PString &pass=PString::Empty(), const PString &type="DBF", bool exclusive=false)
Connect to a Foxpro dataSource.
This class is a variation of a string that ignores case.
Definition: pstring.h:2012
bool IsColumnUpdatable(PINDEX column) const
IsColumn Updateable ie is not ReadOnly.
Definition: podbc.h:286
int GetDataType() const
Definition: podbc.h:171
RowIndex GetRowIndex() const
Definition: podbc.h:334
PINDEX Columns() const
Columns.
Definition: podbc.h:230
PStringArray TableList(const PString &options=PString::Empty())
Retrieve a List of Tables in the Datasource use the option field to specify the type of data to acce...
virtual bool SetType(BasicType type, PINDEX options=0)
bool IsUpdatable() const
Definition: podbc.h:175
This is an array collection class of PString objects.
Definition: pstring.h:2365
bool m_isReadOnly
Definition: podbc.h:198
Row m_cursor
Definition: podbc.h:479
bool Connect_TXT(const PFilePath &txtPath)
Connect to an ascii text or cvs file.
bool m_exclusive
Whether Datasource is locked.
Definition: podbc.h:544
unsigned ColumnPrecision(PINDEX column) const
ColumnPrecision Get the Number of Decimal places if Precision is set the precision is set to the les...
Definition: podbc.h:278
PINDEX ColumnCount()
Definition: podbc.h:338
PString m_password
Password.
Definition: podbc.h:541
PODBC::Statement PODBCStmt
Definition: podbc.h:799
TimeFormat
Standard time formats for string representations of a time and date.
Definition: ptime.h:433
Field & operator=(const PVarType &other)
Definition: podbc.h:149
bool Previous()
Previous record.
Definition: podbc.h:438
PString m_host
Host name to connect to source.
Definition: podbc.h:542
virtual void InternalCopy(const PVarType &other)
Class to represent a directory in the operating system file system.
Definition: pdirect.h:173
bool Query(const PString &query)
Set the SQL query for this record set.
Field & Column(PINDEX column) const
Retrieve Field Data given the specifed column.
PString ColumnName(PINDEX column) const
Column Name.
Definition: podbc.h:260
void SetNewRow()
Make this row a new one.
PINDEX ColumnSize(PINDEX column) const
Column Size.
Definition: podbc.h:268
void SetDateTimeFormat(PTime::TimeFormat fmt)
Definition: podbc.h:751
PTime::TimeFormat m_timeFormat
Double Real Float Decimal digit rounding def= 4;.
Definition: podbc.h:786
int m_lastError
Definition: podbc.h:783
unsigned RowIndex
Type for row index, may become 64 bit one day.
Definition: podbc.h:130
bool PostUpdate()
Definition: podbc.h:340
DriverType m_driver
Driver type.
Definition: podbc.h:537
bool First()
First record.
This class is a multipurpose use class for storing parameters when initiating connection to DataSour...
Definition: podbc.h:533
Class for Field Data.
Definition: podbc.h:142
Link * m_link
Definition: podbc.h:780
Field & operator()(RowIndex row, PINDEX col)
Returns the Field data at a predetermined position in the Resultant RecordSet.
PINDEX m_column
Back Reference to the Row.
Definition: podbc.h:192
PINDEX GetMaxChunkSize() const
Maximum size of an individual chunk of data.
Definition: podbc.h:759
bool Commit()
Post the Row back to the Database.
static PString GetFieldType(DriverType driver, PVarType::BasicType type, unsigned size=0)
Get valid field type for PVarType enumeration.
bool Post()
Definition: podbc.h:474
RecordSet Table
Definition: podbc.h:489
bool Execute(const PString &sql)
Added Information to the DataSource.
FieldExtra * m_extra
Number of decimal places to Round.
Definition: podbc.h:202
PTime::TimeFormat GetDateFormat() const
Definition: podbc.h:747
#define P_MAX_INDEX
Definition: object.h:80
virtual void OnValueChanged()
const PString GetName() const
Get column name.
Definition: podbc.h:169
void SetDateFormat(PTime::TimeFormat fmt)
Definition: podbc.h:748
Field & Column(PINDEX column)
Returns the indicated Column Holder for the RecordSet, This can be used for iterative Row calls...
Definition: podbc.h:462
bool Connect_PDOX(const PDirectory &dbPath, const PDirectory &defaultDir, int version=5)
Connect to a paradox database datastore.
The character string class.
Definition: pstring.h:108
unsigned GetPrecision() const
Definition: podbc.h:742
unsigned m_port
Port to connect to source.
Definition: podbc.h:543
bool IsNullable() const
Definition: podbc.h:173
Field & operator[](PINDEX column) const
Retrieve Field Data given specified column.
Definition: podbc.h:252
bool IsAutoIncrement() const
Definition: podbc.h:176
bool DataSource(DriverType driver, ConnectData Data)
bool Connect_mySQL(const PString &user=PString::Empty(), const PString &pass=PString::Empty(), const PString &host="localhost", int port=3306)
Connect to a mySQL Server.
RowIndex m_totalRows
Definition: podbc.h:478
bool Move(int offset)
Move to row relative to current position.
virtual void OnGetValue()
P_REMOVE_VIRTUAL_VOID(OnSQLError(const PString &, const PString &))
bool Connect_Oracle(const PString &server, const PString &user=PString::Empty(), const PString &pass=PString::Empty())
Connect to an Oracle Datasource.
bool DeleteRow(RowIndex row=0)
Delete Row 0 indicates Current Row.
MSSQLProtocols
MSSQL protocols.If your interested?
Definition: podbc.h:517
This is a list collection class of PString objects.
Definition: pstring.h:2562
unsigned m_scale
Definition: podbc.h:196
Database Row Class This class functions as a simple wrapper of the Statement class to fetch/Save data...
Definition: podbc.h:219
PTime::TimeFormat GetTimeFormat() const
Definition: podbc.h:744
void SetTimeFormat(PTime::TimeFormat fmt)
Definition: podbc.h:745
PStringArray ColumnNames()
ColumnNames.
Definition: podbc.h:414
bool Connect_MSSQL(const PString &user=PString::Empty(), const PString &pass=PString::Empty(), const PString &host="(local)", bool trusted=true, MSSQLProtocols Proto=MSSQLNamedPipes)
Connect to a MS SQL Server.
static const PString & Empty()
Return an empty string.
void Disconnect()
General Disconnect from DataSource.
PTime::TimeFormat GetDateTimeFormat() const
Definition: podbc.h:750
bool m_isAutoIncrement
Definition: podbc.h:199
bool Connect_MDB(const PFilePath &mdbPath, const PString &user=PString::Empty(), const PString &pass=PString::Empty(), bool exclusive=false)
Connect to a MS Access *.mdb DataSource.
bool IsAutoIndex()
Definition: podbc.h:177
RecordSet(PODBC &odbc, const PString &query=PString::Empty())
Constructor Using the HDBC and TableName/Select SQL Query creates a virtual table in the OBDC driver...
RowIndex m_rowIndex
Definition: podbc.h:346
PTime::TimeFormat m_dateFormat
Definition: podbc.h:787
P_DECLARE_ENUM(DriverType, DSN, mySQL, postgreSQL, Oracle, IBM_DB2, MSSQL, MSAccess, Paradox, Foxpro, dBase, Excel, Ascii, ConnectionString)
Driver types that are supported by this implementation.
friend class Statement
Definition: podbc.h:794
Row(RecordSet &recordSet)
Constructor.
This template class maps the PArrayObjects to a specific object type.
Definition: array.h:925
bool Next()
Next record.
Definition: podbc.h:434
unsigned GetScale() const
Definition: podbc.h:172
bool Connect_postgreSQL(const PString &db, const PString &user, const PString &pass, const PString &host, int port=5432)
Connect to a postgreSQL Server.
PString ColumnName(PINDEX column)
Column Name.
Definition: podbc.h:410
Field & Column(const PString &name)
Returns the indicated Column Holder Name for the RecordSet,.
Definition: podbc.h:466
PString m_database
Database name or file Path (not Oracle,xxSQL)
Definition: podbc.h:538
bool Commit()
Commit data to record set.
Definition: podbc.h:470
bool MoveTo(RowIndex row)
Move to Specified Row.
bool Select(const PString &table, const PString &whereClause=PString::Empty(), const PString &fields=PString::Empty(), const PString &orderedBy=PString::Empty(), bool descending=false)
Set the SQL query to a SELECT for this record set.
bool Connect_DBASE(const PDirectory &dbPath)
Connect to a DBase DataStore.
unsigned ColumnType(PINDEX column) const
ColumnTypes.
Definition: podbc.h:264
Field & operator[](const PString &columnName) const
Retrieve Field Data given the column Name.
Definition: podbc.h:256
friend std::ostream & operator<<(std::ostream &strm, DriverType type)
Definition: podbc.h:512
bool m_needChunking
Definition: podbc.h:789
PTime::TimeFormat m_dateTimeFormat
Definition: podbc.h:788
int m_odbcType
Column Name.
Definition: podbc.h:195
~RecordSet()
Destroy the record set and free resources used.
PString GetLastErrorText() const
Get last error text.
Definition: podbc.h:765
PString m_lastErrorText
Definition: podbc.h:784
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
bool Connect_XLS(const PFilePath &xlsPath, const PString &defDir=PString::Empty())
Connect to MS Office excel spreadsheet.
bool PostNew()
Definition: podbc.h:339
bool Post()
Definition: podbc.h:341
Statement * m_statement
Definition: podbc.h:477
void SetDefaultValues()
Initialise/Set the Default values for Field of New Record.
PStringList GetSources(bool system=false, bool withDescription=true) const
Get a list of known data sources and their descriptions The returned strings when withDescription tru...
unsigned m_precision
Definition: podbc.h:785
Row & operator[](PINDEX row)
Row return the fetched row in the Cached RecordSet.
bool Last()
Last record.
Definition: podbc.h:442
PINDEX m_maxChunkSize
Definition: podbc.h:790
bool Delete(RowIndex rowIndex=0)
Delete the Current Record from the RecordSet
PString m_name
Column number.
Definition: podbc.h:194
Field & operator=(const Field &other)
Definition: podbc.h:148
ConnectData()
Definition: podbc.h:535