2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A** The author disclaims copyright to this source code. In place of 2N/A** a legal notice, here is a blessing: 2N/A** May you do good and not evil. 2N/A** May you find forgiveness for yourself and forgive others. 2N/A** May you share freely, never taking more than you give. 2N/A************************************************************************* 2N/A** This file contains the sqlite_get_table() and sqlite_free_table() 2N/A** interface routines. These are just wrappers around the main 2N/A** interface routine of sqlite_exec(). 2N/A** These routines are in a separate files so that they will not be linked 2N/A** if they are not used. 2N/A** This structure is used to pass data from sqlite_get_table() through 2N/A** to the callback function is uses to build the result. 2N/A** This routine is called once for each row in the result table. Its job 2N/A** is to fill in the TabResult structure appropriately, allocating new 2N/A** memory as necessary. 2N/A /* Make sure there is enough space in p->azResult to hold everything 2N/A ** we need to remember from this invocation of the callback. 2N/A /* If this is the first row, then generate an extra row containing 2N/A ** the names of all columns. 2N/A "sqlite_get_table() called with two or more incompatible queries",
2N/A /* Copy over the row data 2N/A** Query the database. But instead of invoking a callback for each row, 2N/A** malloc() for space to hold the result and return the entire results 2N/A** at the conclusion of the call. 2N/A** The result that is written to ***pazResult is held in memory obtained 2N/A** from malloc(). But the caller cannot free this memory directly. 2N/A** Instead, the entire table should be passed to sqlite_free_table() when 2N/A** the calling procedure is finished using it. 2N/A sqlite *
db,
/* The database on which the SQL executes */ 2N/A const char *
zSql,
/* The SQL to be executed */ 2N/A int *
pnRow,
/* Write the number of rows in the result here */ 2N/A int *
pnColumn,
/* Write the number of columns of result here */ 2N/A** This routine frees the space the sqlite_get_table() malloced. 2N/A char **
azResult /* Result returned from from sqlite_get_table() */