Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

RdbMySQLQueryBuf Class Reference

#include <RdbMySQLQueryBuf.hh>

List of all members.

Public Member Functions

 RdbMySQLQueryBuf (RdbMySQLConn &conn)
virtual ~RdbMySQLQueryBuf ()
void reserve (size_t newSize)
 resize query buffer to held at list the specified size

const char * str () const
 return zero-terminated string with query

size_t size () const
 return current query size

void clear ()
 reset query contents

void append (const char *str, bool escape=true, bool quote=true)
 add string, quote and escape depending on the flags

void append (const char *str, size_t size, bool escape=true, bool quote=true)
void append (const char *begin, const char *end, bool escape=true, bool quote=true)
void append (const std::string &str, bool escape=true, bool quote=true)
 add string, quote and escape depending on the flags

void append (const RdbMySQLBuffer &str, bool escape=true, bool quote=true)
 add string, quote and escape depending on the flags

void append (char c, bool escape=true, bool quote=true)
 add 1-char string, quote and escape depending on the flags

void append (bool n, bool escape=true, bool quote=true)
 Add TRUE/FALSE.

void append (signed char c, bool escape=true, bool quote=true)
 add number

void append (unsigned char c, bool escape=true, bool quote=true)
void append (short n, bool escape=true, bool quote=true)
void append (unsigned short n, bool escape=true, bool quote=true)
void append (int n, bool escape=true, bool quote=true)
void append (unsigned int n, bool escape=true, bool quote=true)
void append (long n, bool escape=true, bool quote=true)
void append (unsigned long n, bool escape=true, bool quote=true)
void append (float n, bool escape=true, bool quote=true)
void append (double n, bool escape=true, bool quote=true)
void append (long double n, bool escape=true, bool quote=true)


Detailed Description

This class is a buffer for building SQL queries. It's a bit messy, but its interface is built for performance, and besides users should not see it.

This software was developed for the BaBar collaboration. If you use all or part of it, please give an appropriate acknowledgement.

Copyright (C) 2005 SLAC

See also:
RdbMySQLQuery
Version:
Id
RdbMySQLQueryBuf.hh,v 1.3 2005/04/15 17:56:07 salnikov Exp
Author:
Andy Salnikov

Definition at line 69 of file RdbMySQLQueryBuf.hh.


Constructor & Destructor Documentation

RdbMySQLQueryBuf::RdbMySQLQueryBuf RdbMySQLConn   conn
 

Constructor takes connection object

Parameters:
conn database connection object

Definition at line 67 of file RdbMySQLQueryBuf.cc.

RdbMySQLQueryBuf::~RdbMySQLQueryBuf   [virtual]
 

Definition at line 76 of file RdbMySQLQueryBuf.cc.


Member Function Documentation

void RdbMySQLQueryBuf::append long double    n,
bool    escape = true,
bool    quote = true
 

Definition at line 230 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append double    n,
bool    escape = true,
bool    quote = true
 

Definition at line 224 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append float    n,
bool    escape = true,
bool    quote = true
 

Definition at line 218 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append unsigned long    n,
bool    escape = true,
bool    quote = true
 

Definition at line 212 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append long    n,
bool    escape = true,
bool    quote = true
 

Definition at line 206 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append unsigned int    n,
bool    escape = true,
bool    quote = true
 

Definition at line 200 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append int    n,
bool    escape = true,
bool    quote = true
 

Definition at line 194 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append unsigned short    n,
bool    escape = true,
bool    quote = true
 

Definition at line 188 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append short    n,
bool    escape = true,
bool    quote = true
 

Definition at line 182 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append unsigned char    c,
bool    escape = true,
bool    quote = true
 

Definition at line 176 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append signed char    c,
bool    escape = true,
bool    quote = true
 

add number

add number, note that escape/quote flags are not used, and present only for uniformity (to make templated code happy.) Note that signed/unsigned char are formatted as numbers, while char is formatted as a 1-char string.

Definition at line 170 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append bool    n,
bool    escape = true,
bool    quote = true
 

Add TRUE/FALSE.

Definition at line 162 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append char    c,
bool    escape = true,
bool    quote = true
 

add 1-char string, quote and escape depending on the flags

add 1-char string, quote and escape depending on the flags, mysql only needed if escape is true

Definition at line 155 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append const RdbMySQLBuffer   str,
bool    escape = true,
bool    quote = true
 

add string, quote and escape depending on the flags

Definition at line 143 of file RdbMySQLQueryBuf.cc.

References append(), RdbMySQLBuffer::data(), and RdbMySQLBuffer::size().

void RdbMySQLQueryBuf::append const std::string &    str,
bool    escape = true,
bool    quote = true
 

add string, quote and escape depending on the flags

Definition at line 133 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append const char *    begin,
const char *    end,
bool    escape = true,
bool    quote = true
 

Definition at line 103 of file RdbMySQLQueryBuf.cc.

References RdbMySQLConn::client(), RdbMySQLConn::mysql(), RdbMySQLClient::mysql_real_escape_string(), and reserve().

void RdbMySQLQueryBuf::append const char *    str,
size_t    size,
bool    escape = true,
bool    quote = true
 

Definition at line 93 of file RdbMySQLQueryBuf.cc.

References append().

void RdbMySQLQueryBuf::append const char *    str,
bool    escape = true,
bool    quote = true
 

add string, quote and escape depending on the flags

Definition at line 83 of file RdbMySQLQueryBuf.cc.

Referenced by append(), RdbMySQLQuery::executePar(), and CdbMySQLConnection::translate_string_to_escaped().

void RdbMySQLQueryBuf::clear   [inline]
 

reset query contents

Definition at line 93 of file RdbMySQLQueryBuf.hh.

Referenced by RdbMySQLQuery::executePar().

void RdbMySQLQueryBuf::reserve size_t    newSize
 

resize query buffer to held at list the specified size

Definition at line 237 of file RdbMySQLQueryBuf.cc.

Referenced by append().

size_t RdbMySQLQueryBuf::size   const [inline]
 

return current query size

Definition at line 90 of file RdbMySQLQueryBuf.hh.

Referenced by RdbMySQLQuery::executePar(), and CdbMySQLConnection::translate_string_to_escaped().

const char* RdbMySQLQueryBuf::str   const [inline]
 

return zero-terminated string with query

Definition at line 87 of file RdbMySQLQueryBuf.hh.

Referenced by RdbMySQLQuery::executePar(), RdbMySQLQuery::str(), and CdbMySQLConnection::translate_string_to_escaped().


The documentation for this class was generated from the following files:
Generated on Mon Dec 5 18:22:27 2005 for CDB by doxygen1.3-rc3