theSq3Lite 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard - theLib - theATL
c - tcl - atl - cs - py - rb - jv - cc
Loading...
Searching...
No Matches
Sq3StmtC_Sql_C_API

Sq3StmtC - Retrieving Statement SQL … More...

+ Collaboration diagram for Sq3StmtC_Sql_C_API:

Functions

static MK_STR Sq3StmtExpandedSql (SQ3_STMT pStmt)
 Retrieving Statement SQL …
 
static MK_STRN Sq3StmtSql (SQ3_STMT pStmt)
 Retrieving Statement SQL …
 
static MK_STRN Sq3StmtGetPzTail (SQ3_STMT sq3stmt)
 return the non compiled sql-statement from Sq3StmtPrepareV2 and Sq3StmtPrepareV3
 

Sq3StmtC - Sq3StmtC_Sql_C_API - function

MK_STR Sq3StmtExpandedSqlP (SQ3_STMT pStmt)
 Non-inline replacement for Sq3StmtExpandedSql
 
MK_STRN Sq3StmtGetPzTailP (SQ3_STMT sq3stmt)
 Non-inline replacement for Sq3StmtGetPzTail
 
MK_STRN Sq3StmtSqlP (SQ3_STMT pStmt)
 Non-inline replacement for Sq3StmtSql
 

Detailed Description

Sq3StmtC - Retrieving Statement SQL …

Function Documentation

◆ Sq3StmtExpandedSql()

static MK_STR Sq3StmtExpandedSql ( SQ3_STMT pStmt)
inlinestatic

Retrieving Statement SQL …

The Sq3StmtSql(P) interface returns a pointer to a copy of the UTF-8 SQL text used to create prepared statement P if P was created by Sq3StmtPrepareV2 (), Sq3StmtPrepareV3 (), sqlite3_prepare16_v2 (), or sqlite3_prepare16_v3 (). The Sq3StmtExpandedSql(P) interface returns a pointer to a UTF-8 string containing the SQL text of prepared statement P with bound parameters expanded. The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8 string containing the normalized SQL text of prepared statement P. The semantics used to normalize a SQL statement are unspecified and subject to change. At a minimum, literal values will be replaced with suitable placeholders.

For example, if a prepared statement is created using the SQL text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 and parameter :xyz is unbound, then Sq3StmtSql() will return the original string, "SELECT $abc,:xyz" but Sq3StmtExpandedSql() will return "SELECT 2345,NULL".

The Sq3StmtExpandedSql() interface returns NULL if insufficient memory is available to hold the result, or if the result would exceed the the maximum string length determined by the SQ3_LIMIT_LENGTH.

The SQLITE_TRACE_SIZE_LIMIT compile-time option limits the size of bound parameter expansions. The SQLITE_OMIT_TRACE compile-time option causes Sq3StmtExpandedSql() to always return NULL.

The strings returned by Sq3StmtSql(P) and sqlite3_normalized_sql(P) are managed by SQLite and are automatically freed when the prepared statement is finalized. The string returned by Sq3StmtExpandedSql(P), on the other hand, is obtained from Sq3Malloc () and must be freed by the application by passing it to Sq3Free ().

The sqlite3_normalized_sql() interface is only available if the SQLITE_ENABLE_NORMALIZE compile-time option is defined.

Reference code from sqlite3:

SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
#ifdef SQLITE_ENABLE_NORMALIZE
SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
#endif
#define SQLITE_API
SQLITE_API const char * sqlite3_sql(sqlite3_stmt *pStmt)
SQLITE_API char * sqlite3_expanded_sql(sqlite3_stmt *pStmt)
struct sqlite3_stmt sqlite3_stmt

Definition at line 410 of file Sq3StmtC_sq3.h.

410 {
411 SQ3_INSTANCE_HDL(pStmt);
412 MK_STR __retVal__L = sqlite3_expanded_sql(pStmt->nat);
413 return __retVal__L;
414 }
MK_STRB * MK_STR
#define SQ3_INSTANCE_HDL(x)
sqlite3_stmt * nat
internal - link between Sq3StmtS and native library
+ Here is the caller graph for this function:

◆ Sq3StmtExpandedSqlP()

MK_STR Sq3StmtExpandedSqlP ( SQ3_STMT pStmt)

Non-inline replacement for Sq3StmtExpandedSql

◆ Sq3StmtGetPzTail()

static MK_STRN Sq3StmtGetPzTail ( SQ3_STMT sq3stmt)
inlinestatic

return the non compiled sql-statement from Sq3StmtPrepareV2 and Sq3StmtPrepareV3

Return the pzTail from Sq3StmtPrepareV2 and Sq3StmtPrepareV3. if None than a MK_NULL_STR is returned.

If pzTail is not NULL then *pzTail is made to point to the first byte past the end of the first SQL statement in zSql. These routines only compile the first statement in zSql, so *pzTail is left pointing to what remains uncompiled.

Parameters
[in]sq3stmtthe Sq3StmtC instance to work on a statement
Returns
the pzTail or MK_NULL_STR

Definition at line 545 of file Sq3StmtC_sq3.h.

547 {
548 SQ3_INSTANCE_HDL(sq3stmt);
549 return sq3stmt->pzTail ? sq3stmt->pzTail : MK_NULL_STR;
550}
#define MK_NULL_STR
MK_STRN pzTail
The non compiled sql-statement from Sq3StmtPrepareV2 and Sq3StmtPrepareV3 …
+ Here is the caller graph for this function:

◆ Sq3StmtGetPzTailP()

MK_STRN Sq3StmtGetPzTailP ( SQ3_STMT sq3stmt)

Non-inline replacement for Sq3StmtGetPzTail

◆ Sq3StmtSql()

static MK_STRN Sq3StmtSql ( SQ3_STMT pStmt)
inlinestatic

Retrieving Statement SQL …

read more at 'Sq3StmtExpandedSql'

Definition at line 417 of file Sq3StmtC_sq3.h.

417 {
418 SQ3_INSTANCE_HDL(pStmt);
419 MK_STRN __retVal__L = sqlite3_sql(pStmt->nat);
420 return __retVal__L;
421 }
const MK_STRB * MK_STRN
+ Here is the caller graph for this function:

◆ Sq3StmtSqlP()

MK_STRN Sq3StmtSqlP ( SQ3_STMT pStmt)

Non-inline replacement for Sq3StmtSql