wxSQLite3 3.3.0

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | Friends | List of all members
wxSQLite3NamedCollection Class Reference

Represents a named collection. More...

`#include <wxsqlite3.h>`

Inheritance diagram for wxSQLite3NamedCollection:

## Public Member Functions
| wxSQLite3NamedCollection ()
| Constructor. More...
| wxSQLite3NamedCollection (const wxSQLite3NamedCollection &collection)
| Copy constructor. More...
wxSQLite3NamedCollection & | operator= (const wxSQLite3NamedCollection &collection)
| Assignement constructor. More...
| wxSQLite3NamedCollection (const wxString &collectionName, void *collectionData)
| Constructor (internal use only) More...
virtual | ~wxSQLite3NamedCollection ()
| Destructor. More...
const wxString & | GetName ()
| Get the name of the collection. More...

## Protected Attributes
wxString | m_name
| Name of the collection. More...
void * | m_data
| Reference to the actual array of values representing the collection. More...

## Friends
class | wxSQLite3Database

## Detailed Description

Represents a named collection.

A named collection is designed to facilitate using an array of integers or strings as the right-hand side of an IN operator. So instead of doing a prepared statement like this:

    SELECT * FROM table WHERE x IN (?,?,?,...,?);

And then binding indivdual integers to each of ? slots, an application can create a named collection object (named "ex1" in the following example), prepare a statement like this:

    SELECT * FROM table WHERE x IN ex1;

Then bind an array of integer or string values to the ex1 object to run the statement.

USAGE:

One or more named collection objects can be created as follows:

     wxSQLite3IntegerCollection p1, p2, p3;
     p1 = db.CreateIntegerCollection("ex1");
     p2 = db.CreateIntegerCollection("ex2");
     p3 = db.CreateIntegerCollection("ex3");

Each call to CreateIntegerCollection generates a new virtual table module and a singleton of that virtual table module in the TEMP database. Both the module and the virtual table instance use the name given by the second parameter. The virtual tables can then be used in prepared statements:

     SELECT * FROM t1, t2, t3
      WHERE t1.x IN ex1
        AND t2.y IN ex2
        AND t3.z IN ex3;

Each integer array is initially empty. New arrays can be bound to an integer array as follows:

    int a1[] = { 1, 2, 3, 4 };
    int a2[] = { 5, 6, 7, 8, 9, 10, 11 };
    wxArrayInt a3;
    // Fill a3
    p1.Bind(4, a1);
    p2.Bind(7, a2);
    p3.Bind(a3);

A single named collection object can be rebound multiple times. But do not attempt to change the bindings of a named collection while it is in the middle of a query.

The array that holds the integer or string values is automatically allocated by the Bind method.

The named collection object is automatically destroyed when its corresponding virtual table is dropped. Since the virtual tables are created in the TEMP database, they are automatically dropped when the database connection closes so the application does not normally need to take any special action to free the named collection objects.

## Constructor & Destructor Documentation

wxSQLite3NamedCollection::wxSQLite3NamedCollection | ( |  | ) |

Constructor.

wxSQLite3NamedCollection::wxSQLite3NamedCollection | ( | const wxSQLite3NamedCollection & | collection | ) |

Copy constructor.

wxSQLite3NamedCollection::wxSQLite3NamedCollection | ( | const wxString & | collectionName,
|  | void * | collectionData
| ) |  |

Constructor (internal use only)

wxSQLite3NamedCollection::~wxSQLite3NamedCollection | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

const wxString& wxSQLite3NamedCollection::GetName | ( |  | ) |
| inline

Get the name of the collection.

Returns
  the name of the collection

wxSQLite3NamedCollection & wxSQLite3NamedCollection::operator= | ( | const wxSQLite3NamedCollection & | collection | ) |

Assignement constructor.

## Friends And Related Function Documentation

friend class wxSQLite3Database
| friend

## Member Data Documentation

void* wxSQLite3NamedCollection::m_data
| protected

Reference to the actual array of values representing the collection.

wxString wxSQLite3NamedCollection::m_name
| protected

Name of the collection.

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

- wxsqlite3.h
- wxsqlite3.cpp