theSq3Lite 10.0
Loading...
Searching...
No Matches
Sq3BlobC_Misc_C_API

Sq3BlobC - various functions to perform misc operations … More...

+ Collaboration diagram for Sq3BlobC_Misc_C_API:

Functions

static MK_I32 libsq3lite::Sq3BlobBytes (SQ3_BLOB sq3blob)
 Return The Size Of An Open BLOB …
 
static enum MkErrorE libsq3lite::Sq3BlobReadHide (SQ3_BLOB sq3blob, MK_PTR Z, MK_I32 N, MK_I32 iOffset)
 Read Data From A BLOB Incrementally …
 
static enum MkErrorE libsq3lite::Sq3BlobReopen (SQ3_BLOB sq3blob, MK_I64 arg1)
 Move a BLOB Handle to a New Row …
 
static enum MkErrorE libsq3lite::Sq3BlobWriteHide (SQ3_BLOB sq3blob, MK_PTRN z, MK_I32 n, MK_I32 iOffset)
 Write Data Into A BLOB Incrementally …
 
static enum MkErrorE libsq3lite::Sq3BlobRead_RT (MK_RT mkrt, SQ3_BLOB sq3blob, MK_BUF *Z_inout, MK_I32 iOffset)
 Read Data From A BLOB Incrementally …
 
static enum MkErrorE libsq3lite::Sq3BlobWrite_RT (MK_RT mkrt, SQ3_BLOB sq3blob, MK_BUF z, MK_I32 iOffset)
 Write Data Into A BLOB Incrementally …
 

Sq3BlobC - Sq3BlobC_Misc_C_API - overload

#define Sq3BlobRead_NULL(...)
 
#define Sq3BlobRead(...)
 
#define Sq3BlobRead_E(...)
 
#define Sq3BlobRead_C(...)
 
#define Sq3BlobReadHide_E(...)
 
#define Sq3BlobReadHide_C(...)
 
#define Sq3BlobReopen_E(...)
 
#define Sq3BlobReopen_C(...)
 
#define Sq3BlobWrite_NULL(...)
 
#define Sq3BlobWrite(...)
 
#define Sq3BlobWrite_E(...)
 
#define Sq3BlobWrite_C(...)
 
#define Sq3BlobWriteHide_E(...)
 
#define Sq3BlobWriteHide_C(...)
 

Detailed Description

Sq3BlobC - various functions to perform misc operations …

Macro Definition Documentation

◆ Sq3BlobRead

#define Sq3BlobRead ( ...)
Value:
Sq3BlobRead_RT(MK_RT_CALL __VA_ARGS__)
#define MK_RT_CALL

Definition at line 47 of file sqlite3_overload_sq3.h.

◆ Sq3BlobRead_C

#define Sq3BlobRead_C ( ...)
Value:
if (MkErrorCheckI(Sq3BlobRead(__VA_ARGS__)))
#define Sq3BlobRead(...)

Definition at line 49 of file sqlite3_overload_sq3.h.

◆ Sq3BlobRead_E

#define Sq3BlobRead_E ( ...)
Value:
MkErrorCheck(Sq3BlobRead(__VA_ARGS__))

Definition at line 48 of file sqlite3_overload_sq3.h.

◆ Sq3BlobRead_NULL

#define Sq3BlobRead_NULL ( ...)
Value:
Sq3BlobRead_RT(MK_RT_CALL_NULL __VA_ARGS__)
#define MK_RT_CALL_NULL

Definition at line 46 of file sqlite3_overload_sq3.h.

◆ Sq3BlobReadHide_C

#define Sq3BlobReadHide_C ( ...)
Value:
if (MkErrorCheckI(Sq3BlobReadHide(__VA_ARGS__)))

Definition at line 53 of file sqlite3_overload_sq3.h.

◆ Sq3BlobReadHide_E

#define Sq3BlobReadHide_E ( ...)
Value:
MkErrorCheck(Sq3BlobReadHide(__VA_ARGS__))

Definition at line 52 of file sqlite3_overload_sq3.h.

◆ Sq3BlobReopen_C

#define Sq3BlobReopen_C ( ...)
Value:
if (MkErrorCheckI(Sq3BlobReopen(__VA_ARGS__)))

Definition at line 55 of file sqlite3_overload_sq3.h.

◆ Sq3BlobReopen_E

#define Sq3BlobReopen_E ( ...)
Value:
MkErrorCheck(Sq3BlobReopen(__VA_ARGS__))

Definition at line 54 of file sqlite3_overload_sq3.h.

◆ Sq3BlobWrite

#define Sq3BlobWrite ( ...)
Value:
Sq3BlobWrite_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 57 of file sqlite3_overload_sq3.h.

◆ Sq3BlobWrite_C

#define Sq3BlobWrite_C ( ...)
Value:
if (MkErrorCheckI(Sq3BlobWrite(__VA_ARGS__)))
#define Sq3BlobWrite(...)

Definition at line 59 of file sqlite3_overload_sq3.h.

◆ Sq3BlobWrite_E

#define Sq3BlobWrite_E ( ...)
Value:
MkErrorCheck(Sq3BlobWrite(__VA_ARGS__))

Definition at line 58 of file sqlite3_overload_sq3.h.

◆ Sq3BlobWrite_NULL

#define Sq3BlobWrite_NULL ( ...)
Value:
Sq3BlobWrite_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 56 of file sqlite3_overload_sq3.h.

◆ Sq3BlobWriteHide_C

#define Sq3BlobWriteHide_C ( ...)
Value:
if (MkErrorCheckI(Sq3BlobWriteHide(__VA_ARGS__)))

Definition at line 61 of file sqlite3_overload_sq3.h.

◆ Sq3BlobWriteHide_E

#define Sq3BlobWriteHide_E ( ...)
Value:
MkErrorCheck(Sq3BlobWriteHide(__VA_ARGS__))

Definition at line 60 of file sqlite3_overload_sq3.h.

Function Documentation

◆ Sq3BlobBytes()

static MK_I32 libsq3lite::Sq3BlobBytes ( SQ3_BLOB sq3blob)
inlinestatic

Return The Size Of An Open BLOB …

Returns the size in bytes of the BLOB accessible via the successfully opened BLOB handle in its only argument. The incremental blob I/O routines can only read or overwriting existing blob content; they cannot change the size of a blob.

This routine only works on a BLOB handle which has been created by a prior successful call to Sq3BlobOpen () and which has not been closed by Sq3BlobClose (). Passing any other pointer in to this routine results in undefined and probably undesirable behavior.

Reference code from sqlite3:

SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);

Definition at line 34 of file Sq3BlobC_sq3.h.

34 {
35 SQ3_INSTANCE_HDL(sq3blob);
36 return sqlite3_blob_bytes(sq3blob->nat);
37 }
#define SQ3_INSTANCE_HDL(x)
+ Here is the caller graph for this function:

◆ Sq3BlobRead_RT()

static enum MkErrorE libsq3lite::Sq3BlobRead_RT ( MK_RT mkrt,
SQ3_BLOB sq3blob,
MK_BUF * Z_inout,
MK_I32 iOffset )
inlinestatic

Read Data From A BLOB Incrementally …

read more at 'libsq3lite::Sq3BlobReadHide'

Definition at line 104 of file Sq3BlobC_sq3.h.

109 {
110 SQ3_INSTANCE_RT_X(sq3blob);
111
112 MkBufferCreateTLS_inout_T(MkBuffer64C,buf,Z_inout);
113 MK_I32 size = Sq3BlobBytes(sq3blob) - iOffset;
114 MkBufferSizeNew(buf,size);
115 MkBinaryR bin = MkBufferGetBIN_e(buf);
116 Sq3BlobReadHide_E(sq3blob,(MK_BIN)bin.data,(MK_I32)bin.size,iOffset);
117 *Z_inout = buf;
118 return MK_OK;
119error:
120 return MkErrorStack_1X_NULL(sq3blob);
121}
#define MkBufferGetBIN_e(...)
#define MkBufferSizeNew(...)
#define MkBufferCreateTLS_inout_T(cls, name, inout)
#define MkErrorStack_1X_NULL(...)
signed int MK_I32
#define Sq3BlobReadHide_E(...)
static MK_I32 Sq3BlobBytes(SQ3_BLOB sq3blob)
Return The Size Of An Open BLOB …
#define SQ3_INSTANCE_RT_X(x)
+ Here is the caller graph for this function:

◆ Sq3BlobReadHide()

static enum MkErrorE libsq3lite::Sq3BlobReadHide ( SQ3_BLOB sq3blob,
MK_PTR Z,
MK_I32 N,
MK_I32 iOffset )
inlinestatic

Read Data From A BLOB Incrementally …

This function is used to read data from an open BLOB handle into a caller-supplied buffer. N bytes of data are copied into buffer Z from the open BLOB, starting at offset iOffset.

If offset iOffset is less than N bytes from the end of the BLOB, SQ3_RESULT_ERROR is returned and no data is read. If N or iOffset is less than zero, SQ3_RESULT_ERROR is returned and no data is read. The size of the blob (and hence the maximum value of N+iOffset) can be determined using the Sq3BlobBytes () interface.

An attempt to read from an expired BLOB handle fails with an error code of SQ3_RESULT_ABORT.

On success, Sq3BlobRead() returns SQ3_RESULT_OK. Otherwise, an error code or an extended error code is returned.

This routine only works on a BLOB handle which has been created by a prior successful call to Sq3BlobOpen () and which has not been closed by Sq3BlobClose (). Passing any other pointer in to this routine results in undefined and probably undesirable behavior.

See also: Sq3BlobWrite ().

Reference code from sqlite3:

SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);

Definition at line 40 of file Sq3BlobC_sq3.h.

40 {
41 SQ3_INSTANCE_HDL(sq3blob);
42 enum Sq3ErrorE errVal = (enum Sq3ErrorE)sqlite3_blob_read(sq3blob->nat, (MK_PTR)(Z), N, iOffset);
43 Sq3ErrorE_Check(sq3blob, errVal);
44 return MK_OK;
45 error:
46 return MK_ERROR;
47 }
Sq3ErrorE
Result Codes.
#define Sq3ErrorE_Check(sq3_hdl, PROC)
check on a ccsq3lite error and convert into a ccsq3lite error …
+ Here is the caller graph for this function:

◆ Sq3BlobReopen()

static enum MkErrorE libsq3lite::Sq3BlobReopen ( SQ3_BLOB sq3blob,
MK_I64 arg1 )
inlinestatic

Move a BLOB Handle to a New Row …

This function is used to move an existing BLOB handle so that it points to a different row of the same database table. The new row is identified by the rowid value passed as the second argument. Only the row can be changed. The database, table and column on which the blob handle is open remain the same. Moving an existing BLOB handle to a new row is faster than closing the existing handle and opening a new one.

The new row must meet the same criteria as for Sq3BlobOpen () - it must exist and there must be either a blob or text value stored in the nominated column. If the new row is not present in the table, or if it does not contain a blob or text value, or if another error occurs, an SQLite error code is returned and the blob handle is considered aborted. All subsequent calls to Sq3BlobRead (), Sq3BlobWrite () or Sq3BlobReopen () on an aborted blob handle immediately return SQ3_RESULT_ABORT. Calling Sq3BlobBytes () on an aborted blob handle always returns zero.

This function sets the database handle error code and message.

Reference code from sqlite3:

SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);

Definition at line 50 of file Sq3BlobC_sq3.h.

50 {
51 SQ3_INSTANCE_HDL(sq3blob);
52 enum Sq3ErrorE errVal = (enum Sq3ErrorE)sqlite3_blob_reopen(sq3blob->nat, arg1);
53 Sq3ErrorE_Check(sq3blob, errVal);
54 return MK_OK;
55 error:
56 return MK_ERROR;
57 }
+ Here is the caller graph for this function:

◆ Sq3BlobWrite_RT()

static enum MkErrorE libsq3lite::Sq3BlobWrite_RT ( MK_RT mkrt,
SQ3_BLOB sq3blob,
MK_BUF z,
MK_I32 iOffset )
inlinestatic

Write Data Into A BLOB Incrementally …

read more at 'libsq3lite::Sq3BlobWriteHide'

Definition at line 126 of file Sq3BlobC_sq3.h.

131 {
132 SQ3_INSTANCE_RT_X(sq3blob);
133
134 MkBinaryR bin = MkBufferGetBIN_e(z);
135 Sq3BlobWriteHide_E(sq3blob,bin.data,(MK_I32)bin.size,iOffset);
136 return MK_OK;
137error:
138 return MkErrorStack_1X_NULL(sq3blob);
139}
#define Sq3BlobWriteHide_E(...)
+ Here is the caller graph for this function:

◆ Sq3BlobWriteHide()

static enum MkErrorE libsq3lite::Sq3BlobWriteHide ( SQ3_BLOB sq3blob,
MK_PTRN z,
MK_I32 n,
MK_I32 iOffset )
inlinestatic

Write Data Into A BLOB Incrementally …

This function is used to write data into an open BLOB handle from a caller-supplied buffer. N bytes of data are copied from the buffer Z into the open BLOB, starting at offset iOffset.

On success, Sq3BlobWrite() returns SQ3_RESULT_OK. Otherwise, an error code or an extended error code is returned. Unless SQ3_RESULT_MISUSE is returned, this function sets the database connection error code and message accessible via Sq3LiteErrCode () and Sq3LiteErrMsg () and related functions.

If the BLOB handle passed as the first argument was not opened for writing (the flags parameter to Sq3BlobOpen () was zero), this function returns SQ3_RESULT_READONLY.

This function may only modify the contents of the BLOB; it is not possible to increase the size of a BLOB using this API. If offset iOffset is less than N bytes from the end of the BLOB, SQ3_RESULT_ERROR is returned and no data is written. The size of the BLOB (and hence the maximum value of N+iOffset) can be determined using the Sq3BlobBytes () interface. If N or iOffset are less than zero SQ3_RESULT_ERROR is returned and no data is written.

An attempt to write to an expired BLOB handle fails with an error code of SQ3_RESULT_ABORT. Writes to the BLOB that occurred before the BLOB handle expired are not rolled back by the expiration of the handle, though of course those changes might have been overwritten by the statement that expired the BLOB handle or by other independent statements.

This routine only works on a BLOB handle which has been created by a prior successful call to Sq3BlobOpen () and which has not been closed by Sq3BlobClose (). Passing any other pointer in to this routine results in undefined and probably undesirable behavior.

See also: Sq3BlobRead ().

Reference code from sqlite3:

SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);

Definition at line 60 of file Sq3BlobC_sq3.h.

60 {
61 SQ3_INSTANCE_HDL(sq3blob);
62 enum Sq3ErrorE errVal = (enum Sq3ErrorE)sqlite3_blob_write(sq3blob->nat, z, n, iOffset);
63 Sq3ErrorE_Check(sq3blob, errVal);
64 return MK_OK;
65 error:
66 return MK_ERROR;
67 }
+ Here is the caller graph for this function: