OdbcWrapper.cpp File Reference

#include <string.h>
#include <os/OsSysLog.h>
#include <utl/UtlString.h>
#include "odbc/OdbcWrapper.h"

Functions

void extract_error (const char *fn, SQLHANDLE handle, SQLSMALLINT type)
OdbcHandle odbcConnect (const char *dbname, const char *servername, const char *username, const char *driver, const char *password)
 Tries to establish DSN-less connection to the database.
bool odbcDisconnect (OdbcHandle &handle)
 Disconnects from data source and frees all resources.
bool odbcExecute (const OdbcHandle handle, const char *sqlStatement)
 Executes an SQL statement.
int odbcResultColumns (const OdbcHandle handle)
 Returns the number of columns in a result set.
bool odbcGetNextRow (const OdbcHandle handle)
 Moves to the next row in the result set, reset by new result set.
bool odbcGetColumnStringData (const OdbcHandle handle, int columnIndex, char *data, int dataSize)
 Returns column string data from current row.
bool odbcClearResultSet (const OdbcHandle handle)


Function Documentation

void extract_error ( const char *  fn,
SQLHANDLE  handle,
SQLSMALLINT  type 
)

OdbcHandle odbcConnect ( const char *  dbname,
const char *  servername,
const char *  username,
const char *  driver,
const char *  password = NULL 
)

Tries to establish DSN-less connection to the database.

Parameters:
dbname (in) - name of the data source
servername (in) - server name
username (in) - name of the user
password (in) - password to connect to data source
driver (in) - driver name used to connect
Returns:
a handle representing the connection

bool odbcDisconnect ( OdbcHandle handle  ) 

Disconnects from data source and frees all resources.

Parameters:
handle (in) - handle returned by odbcConnect
Returns:
true if disconnected sucessfully, otherwise false

bool odbcExecute ( const OdbcHandle  handle,
const char *  sqlStatement 
)

Executes an SQL statement.

Parameters:
handle (in) - handle returned by odbcConnect
sqlStatement (in) - pointer to string containing the SQL statement
Returns:
true if connected to data source otherwise false

int odbcResultColumns ( const OdbcHandle  handle  ) 

Returns the number of columns in a result set.

Parameters:
handle (in) - handle returned by odbcConnect
Returns:
number of columns in result set

bool odbcGetNextRow ( const OdbcHandle  handle  ) 

Moves to the next row in the result set, reset by new result set.

Parameters:
handle (in) - handle returned by odbcConnect
Returns:
true while there is a next row to move to

bool odbcGetColumnStringData ( const OdbcHandle  handle,
int  columnIndex,
char *  data,
int  dataSize 
)

Returns column string data from current row.

Parameters:
handle (in) - handle returned by odbcConnect
columnIndex (in) - column index in row
data (out) - data buffer to receive string data
dataSize (in) - size of buffer
Returns:
true while there is a next row to move to

bool odbcClearResultSet ( const OdbcHandle  handle  ) 

Parameters:
handle (in) - handle returned by odbcConnect
Returns:
true if result set could be cleared


Online Library Docs

sipXecs home page

Version 4.2.1-018930 2010-07-31T01:13:23 build16 abuild