wxSQLite3 3.3.0

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
wxSQLite3StatementBuffer Class Reference

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

`#include <wxsqlite3.h>`

## Public Member Functions
| wxSQLite3StatementBuffer ()
| Constructor. More...
| ~wxSQLite3StatementBuffer ()
| Destructor. More...
const char * | Format (const char *format,...)
| Format a SQL statement using SQLite3's printf method. More...
const char * | FormatV (const char *format, va_list va)
| Format a SQL statement using SQLite3's printf method. More...
| operator const char * () const
| Dereference the internal buffer. More...
void | Clear ()
| Clear the internal buffer. More...

## Detailed Description

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

## Constructor & Destructor Documentation

wxSQLite3StatementBuffer::wxSQLite3StatementBuffer | ( |  | ) |

Constructor.

wxSQLite3StatementBuffer::~wxSQLite3StatementBuffer | ( |  | ) |

Destructor.

## Member Function Documentation

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

Parameters

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

Returns
  const char pointer to the resulting statement buffer

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

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