Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MCSqlStatement Class Reference

Representation of a single SQL statement. More...

#include <mcllib/db/MCSqlStatement.h>

Inheritance diagram for MCSqlStatement:

MCBase List of all members.

Public Member Functions

mcllib::MCString escape (const mcllib::MCString &str) const
 Escape a string which needs to be appended to the statement.
bool execute (const mcllib::MCString &sql)
 Execute a query or update statement.
MCDBResultSet executeQuery (const mcllib::MCString &sql)
 Execute a query, obtaining a result set.
mcllib::mcint64 executeUpdate (const mcllib::MCString &sql)
 Execute an update statement, returning the number of rows affected.
MCDBResultSet getResultSet ()
 Get the result set from the previous query statement The result of calling this against a statement which was not a query is undefined.
mcllib::mcint64 getUpdateCount ()
 Get the number of rows affected from the previous update statement.
 ~MCSqlStatement ()
 Free any resources.

Friends

class MCDBConnection

Detailed Description

Representation of a single SQL statement.

Use execute() to execute a SQL statement where you do not know if it is a query or an update. Otherwise use executeUpdate() or executeQuery() as appropriate. Whichever of the execute methods is called, getUpdateCount() and getResultSet() may be called to get the results of the update or query


Member Function Documentation

mcllib::MCString escape const mcllib::MCString str  )  const
 

Escape a string which needs to be appended to the statement.

This uses the string escape logic for the database connection.

bool execute const mcllib::MCString sql  ) 
 

Execute a query or update statement.

Returns true if a result set is available for the statement.

mcllib::mcint64 executeUpdate const mcllib::MCString sql  ) 
 

Execute an update statement, returning the number of rows affected.

If the statement does not affect rows (e.g. a DDL statement) returns -1

mcllib::mcint64 getUpdateCount  ) 
 

Get the number of rows affected from the previous update statement.

The result of calling this against a statement which was not an update is undefined.


Generated on Wed Jan 12 19:05:51 2005 for MCLLIB by  doxygen 1.3.9.1