wxSQLite3StatementBuffer Class Reference

SQL statment 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.

## Detailed Description

SQL statment buffer for use with SQLite3's printf method.

## Constructor & Destructor Documentation

## wxSQLite3StatementBuffer()

wxSQLite3StatementBuffer::wxSQLite3StatementBuffer | ( |  | ) |

Constructor.

## ~wxSQLite3StatementBuffer()

wxSQLite3StatementBuffer::~wxSQLite3StatementBuffer | ( |  | ) |

Destructor.

## Member Function Documentation

## Clear()

void wxSQLite3StatementBuffer::Clear | ( |  | ) |

Clear the internal buffer.

## Format()

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!')

Parameters

  format | SQL statement string with formatting options
  ... | list of statement parameters

Returns
  const char pointer to the resulting statement buffer

## FormatV()

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.

Parameters

  format | SQL statement string with formatting options
  va | va_list of statement parameters

Returns
  const char pointer to the resulting statement buffer

## operator const char *()

wxSQLite3StatementBuffer::operator const char * | ( |  | ) | const

inline

Dereference the internal buffer.

Returns
  const char pointer to the resulting statement buffer

The documentation for this class was generated from the following files:

- wxsqlite3.h
- wxsqlite3.cpp