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_Info_C_API

Sq3StmtC - get type-informationMore...

+ Collaboration diagram for Sq3StmtC_Info_C_API:

Functions

static SQ3_LITE Sq3StmtDbHandle (SQ3_STMT sq3stmt)
 Find The Database Handle Of A Prepared Statement …
 
static enum MkErrorE Sq3StmtBusy (SQ3_STMT sq3stmt)
 Determine If A Prepared Statement Has Been Reset …
 
static enum MkErrorE Sq3StmtDataCount (SQ3_STMT pStmt)
 Number of columns in a result set …
 
static enum MkErrorE Sq3StmtIsExplain (SQ3_STMT pStmt)
 Query The EXPLAIN Setting For A Prepared Statement …
 
static enum MkErrorE Sq3StmtReadonly (SQ3_STMT pStmt)
 Determine If An SQL Statement Writes The Database …
 
static enum MkErrorE Sq3StmtStatus (SQ3_STMT sq3stmt, enum Sq3StmtStatusE op, MK_BOOL resetFlg)
 Prepared Statement Status …
 
void Sq3StmtLog_RT (MK_RT mkrt, SQ3_STMT const stmt, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
 log the val
 

Sq3StmtC - Sq3StmtC_Info_C_API - function

SQ3_LITE Sq3StmtDbHandleP (SQ3_STMT sq3stmt)
 Non-inline replacement for Sq3StmtDbHandle
 
enum MkErrorE Sq3StmtBusyP (SQ3_STMT sq3stmt)
 Non-inline replacement for Sq3StmtBusy
 
enum MkErrorE Sq3StmtDataCountP (SQ3_STMT pStmt)
 Non-inline replacement for Sq3StmtDataCount
 
enum MkErrorE Sq3StmtIsExplainP (SQ3_STMT pStmt)
 Non-inline replacement for Sq3StmtIsExplain
 
enum MkErrorE Sq3StmtReadonlyP (SQ3_STMT pStmt)
 Non-inline replacement for Sq3StmtReadonly
 
enum MkErrorE Sq3StmtStatusP (SQ3_STMT sq3stmt, enum Sq3StmtStatusE op, MK_BOOL resetFlg)
 Non-inline replacement for Sq3StmtStatus
 

Sq3StmtC - Sq3StmtC_Info_C_API - overload

#define Sq3StmtBusy_E(...)
 
#define Sq3StmtBusy_C(...)
 
#define Sq3StmtDataCount_E(...)
 
#define Sq3StmtDataCount_C(...)
 
#define Sq3StmtIsExplain_E(...)
 
#define Sq3StmtIsExplain_C(...)
 
#define Sq3StmtLog_NULL(...)
 
#define Sq3StmtLog(...)
 
#define Sq3StmtLog_4(stmt, fmtobj, debug, callfunc)
 
#define Sq3StmtLog_3(stmt, fmtobj, debug)
 
#define Sq3StmtLog_2(stmt, fmtobj)
 
#define Sq3StmtLog_1(stmt)
 
#define Sq3StmtReadonly_E(...)
 
#define Sq3StmtReadonly_C(...)
 
#define Sq3StmtStatus_E(...)
 
#define Sq3StmtStatus_C(...)
 

Detailed Description

Sq3StmtC - get type-information

Macro Definition Documentation

◆ Sq3StmtBusy_C

#define Sq3StmtBusy_C ( ...)
Value:
if (MkErrorCheckI(Sq3StmtBusy(__VA_ARGS__)))
static enum MkErrorE Sq3StmtBusy(SQ3_STMT sq3stmt)
Determine If A Prepared Statement Has Been Reset …

Definition at line 604 of file sqlite3_overload_sq3.h.

◆ Sq3StmtBusy_E

#define Sq3StmtBusy_E ( ...)
Value:
MkErrorCheck(Sq3StmtBusy(__VA_ARGS__))

Definition at line 603 of file sqlite3_overload_sq3.h.

◆ Sq3StmtDataCount_C

#define Sq3StmtDataCount_C ( ...)
Value:
if (MkErrorCheckI(Sq3StmtDataCount(__VA_ARGS__)))
static enum MkErrorE Sq3StmtDataCount(SQ3_STMT pStmt)
Number of columns in a result set …

Definition at line 606 of file sqlite3_overload_sq3.h.

◆ Sq3StmtDataCount_E

#define Sq3StmtDataCount_E ( ...)
Value:
MkErrorCheck(Sq3StmtDataCount(__VA_ARGS__))

Definition at line 605 of file sqlite3_overload_sq3.h.

◆ Sq3StmtIsExplain_C

#define Sq3StmtIsExplain_C ( ...)
Value:
if (MkErrorCheckI(Sq3StmtIsExplain(__VA_ARGS__)))
static enum MkErrorE Sq3StmtIsExplain(SQ3_STMT pStmt)
Query The EXPLAIN Setting For A Prepared Statement …

Definition at line 608 of file sqlite3_overload_sq3.h.

◆ Sq3StmtIsExplain_E

#define Sq3StmtIsExplain_E ( ...)
Value:
MkErrorCheck(Sq3StmtIsExplain(__VA_ARGS__))

Definition at line 607 of file sqlite3_overload_sq3.h.

◆ Sq3StmtLog

#define Sq3StmtLog ( ...)
Value:
#define MK_RT_CALL
void Sq3StmtLog_RT(MK_RT mkrt, SQ3_STMT const stmt, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
log the val …

Definition at line 610 of file sqlite3_overload_sq3.h.

◆ Sq3StmtLog_1

#define Sq3StmtLog_1 ( stmt)
Value:
Sq3StmtLog(stmt,NULL,0,__func__,0)
#define Sq3StmtLog(...)

Definition at line 614 of file sqlite3_overload_sq3.h.

◆ Sq3StmtLog_2

#define Sq3StmtLog_2 ( stmt,
fmtobj )
Value:
Sq3StmtLog(stmt,fmtobj,0,__func__,0)

Definition at line 613 of file sqlite3_overload_sq3.h.

◆ Sq3StmtLog_3

#define Sq3StmtLog_3 ( stmt,
fmtobj,
debug )
Value:
Sq3StmtLog(stmt,fmtobj,debug,__func__,0)

Definition at line 612 of file sqlite3_overload_sq3.h.

◆ Sq3StmtLog_4

#define Sq3StmtLog_4 ( stmt,
fmtobj,
debug,
callfunc )
Value:
Sq3StmtLog(stmt,fmtobj,debug,callfunc,0)

Definition at line 611 of file sqlite3_overload_sq3.h.

◆ Sq3StmtLog_NULL

#define Sq3StmtLog_NULL ( ...)
Value:
#define MK_RT_CALL_NULL

Definition at line 609 of file sqlite3_overload_sq3.h.

◆ Sq3StmtReadonly_C

#define Sq3StmtReadonly_C ( ...)
Value:
if (MkErrorCheckI(Sq3StmtReadonly(__VA_ARGS__)))
static enum MkErrorE Sq3StmtReadonly(SQ3_STMT pStmt)
Determine If An SQL Statement Writes The Database …

Definition at line 616 of file sqlite3_overload_sq3.h.

◆ Sq3StmtReadonly_E

#define Sq3StmtReadonly_E ( ...)
Value:
MkErrorCheck(Sq3StmtReadonly(__VA_ARGS__))

Definition at line 615 of file sqlite3_overload_sq3.h.

◆ Sq3StmtStatus_C

#define Sq3StmtStatus_C ( ...)
Value:
if (MkErrorCheckI(Sq3StmtStatus(__VA_ARGS__)))
static enum MkErrorE Sq3StmtStatus(SQ3_STMT sq3stmt, enum Sq3StmtStatusE op, MK_BOOL resetFlg)
Prepared Statement Status …

Definition at line 618 of file sqlite3_overload_sq3.h.

◆ Sq3StmtStatus_E

#define Sq3StmtStatus_E ( ...)
Value:
MkErrorCheck(Sq3StmtStatus(__VA_ARGS__))

Definition at line 617 of file sqlite3_overload_sq3.h.

Function Documentation

◆ Sq3StmtBusy()

static enum MkErrorE Sq3StmtBusy ( SQ3_STMT sq3stmt)
inlinestatic

Determine If A Prepared Statement Has Been Reset …

The Sq3StmtBusy(S) interface returns true (non-zero) if the prepared statement S has been stepped at least once using Sq3StmtStep (S) but has neither run to completion (returned SQ3_RESULT_DONE from Sq3StmtStep (S)) nor been reset using Sq3StmtReset (S). The Sq3StmtBusy(S) interface returns false if S is a NULL pointer. If S is not a NULL pointer and is not a pointer to a valid prepared statement object, then the behavior is undefined and probably undesirable.

This interface can be used in combination Sq3StmtNextStmt () to locate all prepared statements associated with a database connection that are in need of being reset. This can be used, for example, in diagnostic routines to search for prepared statements that are holding a transaction open.

Reference code from sqlite3:

#define SQLITE_API
SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *)
struct sqlite3_stmt sqlite3_stmt

Definition at line 306 of file Sq3StmtC_sq3.h.

306 {
307 SQ3_INSTANCE_HDL(sq3stmt);
308 enum Sq3ErrorE errVal = (enum Sq3ErrorE)sqlite3_stmt_busy(sq3stmt->nat);
309 Sq3ErrorE_Check(sq3stmt, errVal);
310 return MK_OK;
311 error:
312 return MK_ERROR;
313 }
MK_ERROR
MK_OK
Sq3ErrorE
Result Codes.
#define Sq3ErrorE_Check(sq3_hdl, PROC)
check on a tclsq3lite error and convert into a tclsq3lite error …
#define SQ3_INSTANCE_HDL(x)
sqlite3_stmt * nat
internal - link between Sq3StmtS and native library
+ Here is the caller graph for this function:

◆ Sq3StmtBusyP()

enum MkErrorE Sq3StmtBusyP ( SQ3_STMT sq3stmt)

Non-inline replacement for Sq3StmtBusy

◆ Sq3StmtDataCount()

static enum MkErrorE Sq3StmtDataCount ( SQ3_STMT pStmt)
inlinestatic

Number of columns in a result set …

The Sq3StmtDataCount(P) interface returns the number of columns in the current row of the result set of prepared statement P. If prepared statement P does not have results ready to return (via calls to the sqlite3_column() family of interfaces) then Sq3StmtDataCount(P) returns 0. The Sq3StmtDataCount(P) routine also returns 0 if P is a NULL pointer. The Sq3StmtDataCount(P) routine returns 0 if the previous call to Sq3StmtStep(P) returned SQ3_RESULT_DONE. The Sq3StmtDataCount(P) will return non-zero if previous call to Sq3StmtStep(P) returned SQ3_RESULT_ROW, except in the case of the PRAGMA incremental_vacuum where it always returns zero since each step of that multi-step pragma returns 0 columns of data.

See also: Sq3StmtColumnCount ()

Reference code from sqlite3:

SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt)

Definition at line 316 of file Sq3StmtC_sq3.h.

316 {
317 SQ3_INSTANCE_HDL(pStmt);
318 enum Sq3ErrorE errVal = (enum Sq3ErrorE)sqlite3_data_count(pStmt->nat);
319 Sq3ErrorE_Check(pStmt, errVal);
320 return MK_OK;
321 error:
322 return MK_ERROR;
323 }
+ Here is the caller graph for this function:

◆ Sq3StmtDataCountP()

enum MkErrorE Sq3StmtDataCountP ( SQ3_STMT pStmt)

Non-inline replacement for Sq3StmtDataCount

◆ Sq3StmtDbHandle()

static SQ3_LITE Sq3StmtDbHandle ( SQ3_STMT sq3stmt)
inlinestatic

Find The Database Handle Of A Prepared Statement …

The Sq3StmtDbHandle interface returns the database connection handle to which a prepared statement belongs. The database connection returned by Sq3StmtDbHandle is the same database connection that was the first argument to the Sq3StmtPrepareV2 () call (or its variants) that was used to create the statement in the first place.

Reference code from sqlite3:

SQLITE_API sqlite3 * sqlite3_db_handle(sqlite3_stmt *)
struct sqlite3 sqlite3

Definition at line 298 of file Sq3StmtC_sq3.h.

298 {
299 SQ3_INSTANCE_HDL(sq3stmt);
300 return Sq3LiteC_ObjNew(sqlite3_db_handle(sq3stmt->nat));
301 }
static MK_ARTIFICIAL SQ3_LITE Sq3LiteC_ObjNew(sqlite3 *hdl)
return Programming-Language-Micro-Kernel (PLMK) instance from native hdl …
+ Here is the caller graph for this function:

◆ Sq3StmtDbHandleP()

SQ3_LITE Sq3StmtDbHandleP ( SQ3_STMT sq3stmt)

Non-inline replacement for Sq3StmtDbHandle

◆ Sq3StmtIsExplain()

static enum MkErrorE Sq3StmtIsExplain ( SQ3_STMT pStmt)
inlinestatic

Query The EXPLAIN Setting For A Prepared Statement …

The Sq3StmtIsExplain(S) interface returns 1 if the prepared statement S is an EXPLAIN statement, or 2 if the statement S is an EXPLAIN QUERY PLAN. The Sq3StmtIsExplain(S) interface returns 0 if S is an ordinary statement or a NULL pointer.

Reference code from sqlite3:

SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt)

Definition at line 326 of file Sq3StmtC_sq3.h.

326 {
327 SQ3_INSTANCE_HDL(pStmt);
328 enum Sq3ErrorE errVal = (enum Sq3ErrorE)sqlite3_stmt_isexplain(pStmt->nat);
329 Sq3ErrorE_Check(pStmt, errVal);
330 return MK_OK;
331 error:
332 return MK_ERROR;
333 }
+ Here is the caller graph for this function:

◆ Sq3StmtIsExplainP()

enum MkErrorE Sq3StmtIsExplainP ( SQ3_STMT pStmt)

Non-inline replacement for Sq3StmtIsExplain

◆ Sq3StmtLog_RT()

void Sq3StmtLog_RT ( MK_RT mkrt,
SQ3_STMT const stmt,
MK_OBJN fmtobj,
MK_DBG const debug,
MK_STRN const callfunc,
MK_I32 const lvl )

log the val

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]stmtProgramming-Language-Micro-Kernel (PLMK) instance from sqlite3_stmt
[in]fmtobjmanaged object used to format the log-message (default="MK_NULL" → use default-format)
[in]debugthe debug level from MkRuntimeS::debug, use 0 <= debug <= 9 (default=0)
[in]callfunca user-defined postfix to identify the calling function or the environment (default=name-of-function)
[in]lvla user-defined prefix starting with "" for lvl=0 and increase with " " for lvl+1 (default=0)

◆ Sq3StmtReadonly()

static enum MkErrorE Sq3StmtReadonly ( SQ3_STMT pStmt)
inlinestatic

Determine If An SQL Statement Writes The Database …

The Sq3StmtReadonly(X) interface returns true (non-zero) if and only if the prepared statement X makes no direct changes to the content of the database file.

Note that application-defined SQL functions or virtual tables might change the database indirectly as a side effect. For example, if an application defines a function "eval()" that calls Sq3LiteExec (), then the following SQL statement would change the database file through side-effects:

SELECT eval('DELETE FROM t1') FROM t2;

But because the SELECT statement does not change the database file directly, Sq3StmtReadonly() would still return true.

Transaction control statements such as BEGIN, COMMIT, ROLLBACK, SAVEPOINT, and RELEASE cause Sq3StmtReadonly() to return true, since the statements themselves do not actually modify the database but rather they control the timing of when other statements modify the database. The ATTACH and DETACH statements also cause Sq3StmtReadonly() to return true since, while those statements change the configuration of a database connection, they do not make changes to the content of the database files on disk. The Sq3StmtReadonly() interface returns true for BEGIN since BEGIN merely sets internal flags, but the BEGIN IMMEDIATE and BEGIN EXCLUSIVE commands do touch the database and so Sq3StmtReadonly() returns false for those commands.

This routine returns false if there is any possibility that the statement might change the database file. A false return does not guarantee that the statement will change the database file. For example, an UPDATE statement might have a WHERE clause that makes it a no-op, but the Sq3StmtReadonly() result would still be false. Similarly, a CREATE TABLE IF NOT EXISTS statement is a read-only no-op if the table already exists, but Sq3StmtReadonly() still returns false for such a statement.

If prepared statement X is an EXPLAIN or EXPLAIN QUERY PLAN statement, then Sq3StmtReadonly(X) returns the same value as if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted.

Reference code from sqlite3:

SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt)

Definition at line 336 of file Sq3StmtC_sq3.h.

336 {
337 SQ3_INSTANCE_HDL(pStmt);
338 enum Sq3ErrorE errVal = (enum Sq3ErrorE)sqlite3_stmt_readonly(pStmt->nat);
339 Sq3ErrorE_Check(pStmt, errVal);
340 return MK_OK;
341 error:
342 return MK_ERROR;
343 }
+ Here is the caller graph for this function:

◆ Sq3StmtReadonlyP()

enum MkErrorE Sq3StmtReadonlyP ( SQ3_STMT pStmt)

Non-inline replacement for Sq3StmtReadonly

◆ Sq3StmtStatus()

static enum MkErrorE Sq3StmtStatus ( SQ3_STMT sq3stmt,
enum Sq3StmtStatusE op,
MK_BOOL resetFlg )
inlinestatic

Prepared Statement Status …

Each prepared statement maintains various SQ3_STMTSTATUS counters that measure the number of times it has performed specific operations. These counters can be used to monitor the performance characteristics of the prepared statements. For example, if the number of table steps greatly exceeds the number of table searches or result rows, that would tend to indicate that the prepared statement is using a full table scan rather than an index.

This interface is used to retrieve and reset counter values from a prepared statement. The first argument is the prepared statement object to be interrogated. The second argument is an integer code for a specific SQ3_STMTSTATUS counter to be interrogated. The current value of the requested counter is returned. If the resetFlg is true, then the counter is reset to zero after this interface call returns.

See also: Sq3Status () and Sq3LiteDbStatus ().

Reference code from sqlite3:

SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *, int op, int resetFlg)

Definition at line 346 of file Sq3StmtC_sq3.h.

346 {
347 SQ3_INSTANCE_HDL(sq3stmt);
348 enum Sq3ErrorE errVal = (enum Sq3ErrorE)sqlite3_stmt_status(sq3stmt->nat, op, resetFlg);
349 Sq3ErrorE_Check(sq3stmt, errVal);
350 return MK_OK;
351 error:
352 return MK_ERROR;
353 }
+ Here is the caller graph for this function:

◆ Sq3StmtStatusP()

enum MkErrorE Sq3StmtStatusP ( SQ3_STMT sq3stmt,
enum Sq3StmtStatusE op,
MK_BOOL resetFlg )

Non-inline replacement for Sq3StmtStatus