Main Page   Class Hierarchy   Compound List   Compound Members  

sqloco::dbi Class Reference

#include <dbi.h>

List of all members.

Public Methods

 dbi (databases)
 ~dbi ()
bool open (const char *username, const char *password, const char *db=0, const char *hostname="localhost", unsigned int port=0)
 Open a database connection. More...

void close ()
 Close the database connection.

bool error ()
 Check for an error. More...

const char * errstr ()
 Get the last error string. More...

statement * prepare (const char *query)
 Prepare a query for execution. More...

statement * prepare (const std::string &query)
 Prepare a query for execution. More...

long execute (const char *statement)
 Execute a statement without reading the respone. More...

long executequery (const char *st, std::string &value)
 Execute a query and get its response. More...

long executequery (const char *st, Hash &hash)
 Execute a query and get its response. More...

long executequery (const char *st, const std::string &parameter, std::string &value)
 Execute a query and get its response. More...

long executequery (const char *st, const std::string &parameter, Hash &hash)
 Execute a query and get its response. More...

 operator bool () const
 Check if connected to the server. More...

bool operator! () const
 Check if not connected to the server. More...

databases gettype () const
 Get the type of this database instance. More...

const char * version ()
 Get library version number string. More...


Friends

class statement


Detailed Description

The main database interface class.

@except dbi::exception


Constructor & Destructor Documentation

sqloco::dbi::dbi databases    db
 

Construct a DBI instance for the specified database.

sqloco::dbi::~dbi  
 

Release resources used by this DBI instance


Member Function Documentation

bool sqloco::dbi::error  
 

Check for an error.

Check for an error condition.

Parameters:
none 
Returns:
true if error; false if no error.

const char * sqloco::dbi::errstr  
 

Get the last error string.

Get the current error string.

Parameters:
none 
Returns:
pointer to string containing error message;

long sqloco::dbi::execute const char *    st
 

Execute a statement without reading the respone.

Immediately execute the given statement without generating a new statement handle.

Parameters:
statement  Statement to execute.
Returns:
Number of rows affected; -1 on error.

long sqloco::dbi::executequery const char *    st,
const std::string &    parameter,
Hash &    hash
 

Execute a query and get its response.

Immediately execute the given statement, given a single parameter, and retrieve a result row.

Note: Do not use this function to fetch binary data. The Hash is constructed with strings. Fetching binary data into a hash has undefined results.

Parameters:
statement  Statement to execute.
parameter  Parameter for SQL statement.
hash  Reference to hash that will hold result row.
Returns:
Number of rows affected; -1 on error.

long sqloco::dbi::executequery const char *    st,
const std::string &    parameter,
std::string &    value
 

Execute a query and get its response.

Immediately execute the given statement, given a single parameter, retrieving a single value

Parameters:
statement  Statement to execute.
parameter  Parameter for SQL statement.
value  Destination variable for fetched value.
Returns:
Number of rows affected; -1 on error.

long sqloco::dbi::executequery const char *    st,
Hash &    hash
 

Execute a query and get its response.

Immediately execute the given statement, and retrieve a result row.

Note: Do not use this function to fetch binary data. The Hash is constructed with strings. Fetching binary data into a hash has undefined results.

Parameters:
statement  Statement to execute.
parameter  Parameter for SQL statement.
hash  Reference to hash that will hold result row.
Returns:
Number of rows affected; -1 on error.

long sqloco::dbi::executequery const char *    st,
std::string &    value
 

Execute a query and get its response.

Immediately execute the given statement, retrieving a single value

Parameters:
statement  Statement to execute.
value  Destination variable for fetched value.
Returns:
Number of rows affected; -1 on error.

databases sqloco::dbi::gettype   const
 

Get the type of this database instance.

Get the current type of database instance.

Parameters:
none 
Returns:
Database type constant.

bool sqloco::dbi::open const char *    username,
const char *    password,
const char *    db = 0,
const char *    hostname = "localhost",
unsigned int    port = 0
 

Open a database connection.

Open a connection to the specified database.

sqloco::dbi::operator bool   const
 

Check if connected to the server.

Check if a connection is open to the server.

Parameters:
none 
Returns:
true if connected; false if not connected.

bool sqloco::dbi::operator!   const
 

Check if not connected to the server.

Check that a connection is not open to the server.

Parameters:
none 
Returns:
true if not connected; false if connected.

statement * sqloco::dbi::prepare const std::string &    statement
 

Prepare a query for execution.

Prepare a statement handle for execution.

Parameters:
SQL  Statement string.
Returns:
Pointer to newly created statement handle.

statement * sqloco::dbi::prepare const char *    statement
 

Prepare a query for execution.

Prepare a statement handle for execution.

Parameters:
SQL  Statement string.
Returns:
Pointer to newly created statement handle.

const char * sqloco::dbi::version  
 

Get library version number string.

Get the SQLoco version number string.

Parameters:
none 
Returns:
Pointer to version number string.


The documentation for this class was generated from the following files:
Generated on Fri Aug 30 21:35:12 2002 for SQLoco by doxygen1.2.13 written by Dimitri van Heesch, © 1997-2001