Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

Statement Class Reference

#include <tntdb/bits/statement.h>

List of all members.
Statementset (const std::string &col, bool data)
Statementset (const std::string &col, int data)
Statementset (const std::string &col, unsigned data)
Statementset (const std::string &col, float data)
Statementset (const std::string &col, double data)
Statementset (const std::string &col, char data)
Statementset (const std::string &col, const char *data)
Statementset (const std::string &col, const std::string &data)
Statementset (const std::string &col, const Date &data)
Statementset (const std::string &col, const Time &data)
Statementset (const std::string &col, const Datetime &data)
Statementset (const std::string &col, const Decimal &data)
Statementset (const std::string &col, const Blob &data)

Public Types

typedef IStatement::size_type size_type

Public Member Functions

 Statement (IStatement *stmt_=0)
Statementclear ()
StatementsetNull (const std::string &col)
StatementsetBool (const std::string &col, bool data)
StatementsetInt (const std::string &col, int data)
StatementsetUnsigned (const std::string &col, unsigned data)
StatementsetInt32 (const std::string &col, int32_t data)
StatementsetUnsigned32 (const std::string &col, uint32_t data)
StatementsetInt64 (const std::string &col, int64_t data)
StatementsetUnsigned64 (const std::string &col, uint64_t data)
StatementsetDecimal (const std::string &col, const Decimal &data)
StatementsetFloat (const std::string &col, float data)
StatementsetDouble (const std::string &col, double data)
StatementsetChar (const std::string &col, char data)
StatementsetString (const std::string &col, const std::string &data)
StatementsetString (const std::string &col, const char *data)
StatementsetBlob (const std::string &col, const Blob &data)
StatementsetDate (const std::string &col, const Date &data)
StatementsetTime (const std::string &col, const Time &data)
StatementsetDatetime (const std::string &col, const Datetime &data)
size_type execute ()
 statement-execution-methods
Result select ()
Row selectRow ()
Value selectValue ()
const_iterator begin (unsigned fetchsize=100) const
const_iterator end () const
bool operator! () const
const IStatement * getImpl () const

Classes

class  const_iterator


Detailed Description

This class represents a sql-statement. A statement can have parameters, which are referenced by name, called hostvariables. They are prefixed with a colon followed by a name. A name starts with a letter followed by alphanumeric characters or underscore. Hostvariables are not searched in strings (between apostrophes, quotation marks or backticks). The backslash prevents the interpretation of a special meaning of the following character.


Member Function Documentation

Statement& clear (  ) 

Sets all hostvariables to NULL.

Statement& setNull ( const std::string &  col  ) 

Sets the hostvariable with the given name to NULL.

Statement& setBool ( const std::string &  col,
bool  data 
)

Sets the hostvariable with the given name to a boolean value.

Statement& setInt ( const std::string &  col,
int  data 
)

Sets the hostvariable with the given name to a int value.

Statement& setUnsigned ( const std::string &  col,
unsigned  data 
)

Sets the hostvariable with the given name to a unsigned value.

Statement& setInt32 ( const std::string &  col,
int32_t  data 
)

Sets the hostvariable with the given name to a int32_t value.

Statement& setUnsigned32 ( const std::string &  col,
uint32_t  data 
)

Sets the hostvariable with the given name to a uint32_t value.

Statement& setInt64 ( const std::string &  col,
int64_t  data 
)

Sets the hostvariable with the given name to a int64_t value.

Statement& setUnsigned64 ( const std::string &  col,
uint64_t  data 
)

Sets the hostvariable with the given name to a uint64_t value.

Statement& setDecimal ( const std::string &  col,
const Decimal data 
)

Sets the hostvariable with the given name to a Decimal.

Statement& setFloat ( const std::string &  col,
float  data 
)

Sets the hostvariable with the given name to a float value.

Statement& setDouble ( const std::string &  col,
double  data 
)

Sets the hostvariable with the given name to a double value.

Statement& setChar ( const std::string &  col,
char  data 
)

Sets the hostvariable with the given name to a char value.

Statement& setString ( const std::string &  col,
const std::string &  data 
)

Sets the hostvariable with the given name to a string value.

Statement& setString ( const std::string &  col,
const char *  data 
)

Sets the hostvariable with the given name to a string value or null, if passing null-pointer.

Statement& setDate ( const std::string &  col,
const Date data 
)

Sets the hostvariable with the given name to a date value.

Statement& setTime ( const std::string &  col,
const Time data 
)

Sets the hostvariable with the given name to a time value.

Statement& setDatetime ( const std::string &  col,
const Datetime data 
)

Sets the hostvariable with the given name to a datetime value.

Statement& set ( const std::string &  col,
bool  data 
)

Set the hostvariable with the given name to the passed value. These set-methods choose the right bound type by parametertype.

size_type execute (  ) 

Executes a query with the current parameters. The query should not return results. This method is normally used with INSERT-, UPDATE- or DELETE-statements.

Result select (  ) 

Executes a query, which returns a resultset, with the current parameters. The query is normally a SELECT-statement.

Row selectRow (  ) 

Executes a query, which returns a row, with the current parameters. If the query return no rows, a exception of type tntdb::NotFound is thrown. When the query returns more than one row, additional rows are discarded.

Value selectValue (  ) 

Executes a query, which returns a single value, with the current parameters. If the query return no rows, a exception of type tntdb::NotFound is thrown. Only the first value of the first row is returned.

const_iterator begin ( unsigned  fetchsize = 100  )  const

This methods creates a cursor and fetches the first row.

const_iterator end (  )  const

A empty iterator is returned. Every const_iterator, which reaches the end is equal with this.

bool operator! (  )  const

Returns true, if this class is not connected to a actual statement.

const IStatement* getImpl (  )  const

Returns the actual implementation-class.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6