wxSQLite3 4.9.12
|
SQL statement buffer for use with SQLite3's printf method. More...
#include <wxsqlite3.h>
Public Member Functions | |
wxSQLite3StatementBuffer () | |
Constructor. | |
~wxSQLite3StatementBuffer () | |
Destructor. | |
const char * | Format (const char *format,...) |
Format a SQL statement using SQLite3's printf method. | |
const char * | FormatV (const char *format, va_list va) |
Format a SQL statement using SQLite3's printf method. | |
operator const char * () const | |
Dereference the internal buffer. | |
void | Clear () |
Clear the internal buffer. | |
SQL statement buffer for use with SQLite3's printf method.
wxSQLite3StatementBuffer::wxSQLite3StatementBuffer | ( | ) |
Constructor.
wxSQLite3StatementBuffer::~wxSQLite3StatementBuffer | ( | ) |
Destructor.
void wxSQLite3StatementBuffer::Clear | ( | ) |
Clear the internal buffer.
const char * wxSQLite3StatementBuffer::Format | ( | const char * | format, |
... ) |
Format a SQL statement using SQLite3's printf method.
This method is a variant of the "sprintf()" from the standard C library. All of the usual printf formatting options apply. In addition, there is a "%q" option. q works like s in that it substitutes a null-terminated string from the argument list. But q also doubles every '\'' character. q is designed for use inside a string literal. By doubling each '\'' character it escapes that character and allows it to be inserted into the string.
For example, so some string variable contains text as follows:
char *zText = "It's a happy day!";
One can use this text in an SQL statement as follows:
wxSQLite3StatementBuffer stmtBuffer; stmtBuffer.Format("INSERT INTO table VALUES('%q')", zText);
Because the q format string is used, the '\'' character in zText is escaped and the SQL generated is as follows:
INSERT INTO table1 VALUES('It''s a happy day!')
format | SQL statement string with formatting options |
... | list of statement parameters |
const char * wxSQLite3StatementBuffer::FormatV | ( | const char * | format, |
va_list | va ) |
Format a SQL statement using SQLite3's printf method.
This method is like method Format but takes a va_list argument to pass the statement parameters.
format | SQL statement string with formatting options |
va | va_list of statement parameters |
|
inline |
Dereference the internal buffer.