PTLib  Version 2.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
podbc.h File Reference
#include <odbcinst.h>
#include <sql.h>
#include <sqlext.h>

Go to the source code of this file.

Classes

class  PODBCStmt
class  PODBC
 PODBC Class The Main ODBC class. More...
class  PODBC::ConnectData
 
This class is a multipurpose use

class for storing parameters when initiating connection to DataSource. More...

class  PODBC::Field
class  PODBC::Field::Bind
 SQL compliant Bound DataTypes. More...
class  PODBC::Row
 
This class functions as a simple wrapper 

of the PODBCStmt class to fetch/Save data to the Datasource. More...

class  PODBC::Table
 
PODBC::Table

This is the main Class to access Data returned by a Select Query. More...

class  PDSNConnection
 DSN (Data Source Name) Connection. More...
class  PODBCRecord
 PODBCRecord This Class is used to analyse the fetched data and handles Data Conversion/Read Write operations. More...

Macros

#define _T(x)   x
#define MAX_DATA_LEN   1024

Typedefs

typedef CHAR TCHAR
 ODBC Support for PWLIB.
typedef LPSTR LPTSTR
typedef LPCSTR LPCTSTR

Macro Definition Documentation

#define _T (   x)    x
#define MAX_DATA_LEN   1024

Typedef Documentation

typedef LPCSTR LPCTSTR
typedef LPSTR LPTSTR
typedef CHAR TCHAR

ODBC Support for PWLIB.

Class Description PODBC : Main DataBase Connection Class (Derive Class for Error Handling) PODBC::ConnectData : Class used to store information for Connecting to DataSource PODBC::Table : Retrieved Data Structure (RecordSet) from Table or Select SQL Query PODBC::Row : Record Pointer Class for the PODBC::Table (PArray of Fields) PODBC::Field : Database Field Information (Field Structure & Data(Bound)) PODBC::Field:Bind : DataTypes Bound to the RecordSet (change with Record Navigation) PDSNConnection : Derived Class of PODBC for ODBC Configured Connections PODBCStmt : Wrapper for RecordSet (Internal) PODBCRecord : Handle Retrieve/Post/Bind Data from RecordSet (Internal)

Example of Use


  PODBC link;
  PODBC::ConnectData data;
  data.DBPath = "test.mdb";
  if (link.DataSource(PODBC::MSAccess,data)) {
Load a Database Table (could also be a SELECT Query)
      PODBC::Table table(&link,"FooTable");
Bind to Column 1 
      PODBC::Field & field = table.Column(1):
Display Contents
      cout << " Value " << field.AsString(); << endl;
Move to Record 2 of fooTable
      table[2];  
Display contents of Record 2 Column 1
      cout << " Value " << field.AsString(); << endl;
Set New Value for Record 2 Field 1 of FooTable
      field.SetValue("NewValue");
Send Update to Database.
      field.Post();
To Add New Record.(with Default Values)
      table.NewRow();
Alter the Value of field 1
      field.SetValue("Somethng");
Post the New Field to the Database
      field.Post();
Run General Query;
      PString SQLStmt = "INSERT foo into [FooTable] ..."
    Link.Query(SQLStmt);
  }
Disconnect from ODBC Source
  link.Disconnect();