Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

blobtoxy.c File Reference


Detailed Description

SQLite extension module for read-only BLOB to X/Y mapping using SQLite 3.3.x virtual table API plus some useful scalar and aggregate functions.

Id:
blobtoxy.c,v 1.27 2020/06/13 11:04:17 chw Exp chw

Copyright (c) 2007-2020 Christian Werner <chw@ch-werner.de>

See the file "license.terms" for information on usage and redistribution of this file and for a DISCLAIMER OF ALL WARRANTIES.

Usage:

Master (non-virtual) table:

CREATE TABLE t( key INTEGER PRIMARY KEY, data BLOB, scale DOUBLE, offset DOUBLE, foo TEXT, bar TEXT );

BLOB to X/Y mapping:

CREATE VIRTUAL TABLE t1 USING blobtoxy (t, key, data, short_le, x_scale, x_offset, y_scale, y_offset, "foo, bar");
CREATE VIRTUAL TABLE t2 USING blobtoxy (t, key, data, uchar, null, null, null, null, 'bar');
CREATE VIRTUAL TABLE t3 USING blobtoxy (t, key, data, int_be, 10.0, null, 10.0, null, "foo");
CREATE VIRTUAL TABLE t4 USING blobtoxy (t, key, data, float, null, -10, null, 10);

Arguments to "blobtoxy" module:

0. master table name (required).
1. key column in master table (required).
2. blob column in master table (required).
3. type code (optional), defaults to "char".
4. X scale column in master table (optional), may be specified as integer or float constant, too, to explicitely omit scale, use an empty string ('') or null.
5. X offset column in master table (optional), may be specified as integer or float constant, too, to explicitely omit offset, use an empty string ('') or null.
6. Y scale column in master table (optional), see point 4.
7. Y offset column in master table (optional), see point 5.
8. other columns of the master table to appear in the result set (optional), must be specified as a single or double quoted string with comma separated column names as a sequence of named columns as it would be written in a SELECT statement.
9. X start index (optional), specified as integer in type specific blob units, zero based.
10. X length (optional), specified as integer, number of blob units (= number of rows).

Supported data types:

"char" -> BLOB is a signed char array
"uchar" -> BLOB is an unsigned char array
"short_le" -> BLOB is a short array little endian
"short_be" -> BLOB is a short array big endian
"ushort_le" -> BLOB is an unsigned short array little endian
"ushort_be" -> BLOB is an unsigned short array big endian
"int_le" -> BLOB is a int array little endian
"int_be" -> BLOB is a int array big endian
"uint_le" -> BLOB is an unsigned int array little endian
"uint_be" -> BLOB is an unsigned int array big endian
"bigint_le" -> BLOB is an large integer array little endian
"bigint_be" -> BLOB is an large integer array big endian
"float" -> BLOB is a float array
"double" -> BLOB is a double array

Columns of "blobtoxy" mapped virtual table:

"key" Key column for JOINing with master table
"x" index within BLOB.
This value is optionally translated by the "x_scale" and "x_offset" columns i.e. x' = x * x_scale + x_offset, yielding a floating point result.
"y" BLOB's value at "x"-unscaled-index
This value is optionally translated by the "y_scale" and "y_offset" columns i.e. y' = y * y_scale + y_offset, yielding a floating point result.
... Other columns, see above

If the "key" field of the master table is an integer data type, it is used as the ROWID of the mapped virtual table. Otherwise the ROWID is a 0-based counter of the output rows.

Exported SQLite functions (svg|tk)_path[_from_blob], blt_vec_(x|y)

Scalar context:

svg_path_from_blob(data, type, x_scale, x_offset, y_scale, y_offset)
tk_path_from_blob(data, type, x_scale, x_offset, y_scale, y_offset)
blt_vec_(x|y)(data, type, x_scale, x_offset, y_scale, y_offset)
tk3d_path_from_blob(data, type, x_scale, x_offset, y_scale, y_offset, z_value, z_scale, z_offset)

Like BLOB to X/Y mapping but produces SVG or Tk Canvas path/polyline as a string, e.g.

SVG: "M 1 1 L 2 2 L 3 7 L 4 1
Tk Canvas: "1 1 2 2 3 7 4 1"
BLT Vector X: "1 2 3 4"
BLT Vector Y: "1 2 7 1"
Tk 3D Canvas: "1 1 0 2 2 0 3 7 0 4 1 0"

Arguments:

0. blob data (required); this parameter is always interpreted as blob. It must contain at least two elements, otherwise the function's result is NULL to indicate that nothing need be drawn
1. type code (optional), defaults to "char"
2. X scale (optional), see above
3. X offset (optional), see above
4. Y scale (optional), see above
5. Y offset (optional), see above
6. Z value (optional)
8. Z scale (optional)
9. Z offset (optional)

Aggregate context:

svg_path(xdata, ydata, x_scale, x_offset, y_scale, y_offset)
tk_path(xdata, ydata, x_scale, x_offset, y_scale, y_offset)
blt_vec(data, scale, offset)
tk3d_path(xdata, ydata, x_scale, x_offset, y_scale, y_offset, zdata, z_scale, z_offset)

Same behaviour except that xdata/ydata/data/zdata are interpreted directly as numeric values.

Exported SQLite function subblob

subblob(data, start, length, size, skip)

Works somewhat like substr, e.g.

select quote(subblob(X'0A0B0C0D0E0F0001',2,2,1,3))
-> X'0B0F'

Arguments:

0. blob data (required); this parameter is always interpreted as blob.
1. start offset (required) in bytes as in substr function (1-based, negative offsets count from end)
2. length (required) in bytes to be copied
3. size (optional) of items in bytes to be copied in combination with skip argument
4. skip (optional) in bytes after one item of size argument has been copied

Exported SQLite function rownumber

rownumber(any)

Returns the row number counting from 0 in simple selects. An arbitrary dummy but constant argument must be provided to this function in order to satisfy some needs of the SQLite3 C API, e.g.

rownumber(0), rownumber('foo') right
rownumber(column_name) wrong, will yield always 0

Definition in file blobtoxy.c.#include <sqlite3ext.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  b2xy_cursor
 Structure to describe a cursor in the virtual table. More...

struct  b2xy_table
 Structure to describe a virtual table. More...

struct  path_aggctx
 Internal aggregate context for path/polyline function. More...

struct  rownumber_ctx
 SQLite context structure for "rownumber" function. More...

struct  strbuf
 Internal dynamic string buffer. More...


Defines

#define TYPE_CODE(num, type)   (((num) << 8) | (sizeof (type)))
#define TYPE_SIZE(code)   ((code) & 0xFF)
#define TYPE_CHAR   TYPE_CODE( 0, char)
#define TYPE_UCHAR   TYPE_CODE( 1, char)
#define TYPE_SHORT_LE   TYPE_CODE( 2, short)
#define TYPE_USHORT_LE   TYPE_CODE( 3, short)
#define TYPE_SHORT_BE   TYPE_CODE( 4, short)
#define TYPE_USHORT_BE   TYPE_CODE( 5, short)
#define TYPE_INT_LE   TYPE_CODE( 6, int)
#define TYPE_UINT_LE   TYPE_CODE( 7, int)
#define TYPE_INT_BE   TYPE_CODE( 8, int)
#define TYPE_UINT_BE   TYPE_CODE( 9, int)
#define TYPE_BIGINT_LE   TYPE_CODE(10, sqlite_int64)
#define TYPE_BIGINT_BE   TYPE_CODE(11, sqlite_int64)
#define TYPE_FLOAT   TYPE_CODE(12, float)
#define TYPE_DOUBLE   TYPE_CODE(13, double)
#define PATH_MODE_TK   ((void *) 0)
#define PATH_MODE_SVG   ((void *) 1)
#define PATH_MODE_BLT_X   ((void *) 2)
#define PATH_MODE_BLT_Y   ((void *) 3)
#define PATH_MODE_BLT   ((void *) 4)
#define PATH_MODE_TK3D   ((void *) 5)

Typedefs

typedef b2xy_table b2xy_table
typedef b2xy_cursor b2xy_cursor

Functions

int string_to_type (const char *str)
 Map type string to type code.

int b2xy_destroy (sqlite3_vtab *vtab)
 Destroy virtual table.

int b2xy_create (sqlite3 *db, void *userdata, int argc, const char *const *argv, sqlite3_vtab **vtabret, char **errp)
 Create virtual table.

int b2xy_open (sqlite3_vtab *vtab, sqlite3_vtab_cursor **curret)
 Open virtual table and return cursor.

int b2xy_close (sqlite3_vtab_cursor *cur)
 Close virtual table cursor.

int b2xy_column (sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i)
 Return column data of virtual table.

int b2xy_rowid (sqlite3_vtab_cursor *cur, sqlite_int64 *rowidp)
 Return current rowid of virtual table cursor.

int b2xy_eof (sqlite3_vtab_cursor *cur)
 Return end of table state of virtual table cursor.

int b2xy_next (sqlite3_vtab_cursor *cur)
 Retrieve next row from virtual table cursor.

int b2xy_filter (sqlite3_vtab_cursor *cur, int idxNum, const char *idxStr, int argc, sqlite3_value **argv)
 Filter function for virtual table.

int b2xy_bestindex (sqlite3_vtab *tab, sqlite3_index_info *info)
 Determines information for filter function according to constraints.

int init_strbuf (strbuf *sb)
 Initialize dynamic string buffer with capacity 1024.

int expand_strbuf (strbuf *sb)
 Expand or initialize dynamic string buffer.

void drop_strbuf (strbuf *sb)
 Free resources of dynamic string buffer.

int print_strbuf (strbuf *sb, const char *fmt,...)
 Format printf-like into dynamic string buffer.

void common_path_func (sqlite3_context *ctx, int nargs, sqlite3_value **args)
 Make path/polyline from blob.

void common_path_step (sqlite3_context *ctx, int nargs, sqlite3_value **args)
 Path/polyline step callback for "tk_path", "svg_path", and "tk3d_path" aggregate functions.

void common_path_finalize (sqlite3_context *ctx)
 Path/polyline finalizer.

void blt_vec_step (sqlite3_context *ctx, int nargs, sqlite3_value **args)
 Path/polyline step callback for "blt_vec" aggregate functions.

void subblob_func (sqlite3_context *ctx, int nargs, sqlite3_value **args)
 "subblob" function similar to "substr".

void rownumber_func (sqlite3_context *ctx, int nargs, sqlite3_value **args)
 "rownumber" function.

int b2xy_init (sqlite3 *db)
 Module initializer creating SQLite functions and modules.

int sqlite3_extension_init (sqlite3 *db, char **errmsg, const sqlite3_api_routines *api)
 Initializer for SQLite extension load mechanism.


Variables

const sqlite3_module b2xy_module


Define Documentation

#define PATH_MODE_BLT   ((void *) 4)
 

Definition at line 1318 of file blobtoxy.c.

Referenced by b2xy_init(), blt_vec_step(), and common_path_finalize().

#define PATH_MODE_BLT_X   ((void *) 2)
 

Definition at line 1316 of file blobtoxy.c.

Referenced by b2xy_init(), and common_path_func().

#define PATH_MODE_BLT_Y   ((void *) 3)
 

Definition at line 1317 of file blobtoxy.c.

Referenced by b2xy_init(), and common_path_func().

#define PATH_MODE_SVG   ((void *) 1)
 

Definition at line 1315 of file blobtoxy.c.

Referenced by b2xy_init(), common_path_func(), and common_path_step().

#define PATH_MODE_TK   ((void *) 0)
 

Definition at line 1314 of file blobtoxy.c.

Referenced by b2xy_init().

#define PATH_MODE_TK3D   ((void *) 5)
 

Definition at line 1319 of file blobtoxy.c.

Referenced by b2xy_init(), common_path_func(), and common_path_step().

#define TYPE_BIGINT_BE   TYPE_CODE(11, sqlite_int64)
 

Definition at line 218 of file blobtoxy.c.

Referenced by b2xy_column(), and string_to_type().

#define TYPE_BIGINT_LE   TYPE_CODE(10, sqlite_int64)
 

Definition at line 217 of file blobtoxy.c.

Referenced by b2xy_column(), and string_to_type().

#define TYPE_CHAR   TYPE_CODE( 0, char)
 

Definition at line 207 of file blobtoxy.c.

Referenced by b2xy_column(), b2xy_create(), common_path_func(), and string_to_type().

#define TYPE_CODE num,
type       (((num) << 8) | (sizeof (type)))
 

Definition at line 204 of file blobtoxy.c.

#define TYPE_DOUBLE   TYPE_CODE(13, double)
 

Definition at line 220 of file blobtoxy.c.

Referenced by b2xy_column(), b2xy_create(), common_path_func(), and string_to_type().

#define TYPE_FLOAT   TYPE_CODE(12, float)
 

Definition at line 219 of file blobtoxy.c.

Referenced by b2xy_column(), b2xy_create(), common_path_func(), and string_to_type().

#define TYPE_INT_BE   TYPE_CODE( 8, int)
 

Definition at line 215 of file blobtoxy.c.

Referenced by b2xy_column(), common_path_func(), and string_to_type().

#define TYPE_INT_LE   TYPE_CODE( 6, int)
 

Definition at line 213 of file blobtoxy.c.

Referenced by b2xy_column(), common_path_func(), and string_to_type().

#define TYPE_SHORT_BE   TYPE_CODE( 4, short)
 

Definition at line 211 of file blobtoxy.c.

Referenced by b2xy_column(), common_path_func(), and string_to_type().

#define TYPE_SHORT_LE   TYPE_CODE( 2, short)
 

Definition at line 209 of file blobtoxy.c.

Referenced by b2xy_column(), common_path_func(), and string_to_type().

#define TYPE_SIZE code       ((code) & 0xFF)
 

Definition at line 205 of file blobtoxy.c.

Referenced by b2xy_column(), b2xy_next(), and common_path_func().

#define TYPE_UCHAR   TYPE_CODE( 1, char)
 

Definition at line 208 of file blobtoxy.c.

Referenced by b2xy_column(), common_path_func(), and string_to_type().

#define TYPE_UINT_BE   TYPE_CODE( 9, int)
 

Definition at line 216 of file blobtoxy.c.

Referenced by b2xy_column(), common_path_func(), and string_to_type().

#define TYPE_UINT_LE   TYPE_CODE( 7, int)
 

Definition at line 214 of file blobtoxy.c.

Referenced by b2xy_column(), common_path_func(), and string_to_type().

#define TYPE_USHORT_BE   TYPE_CODE( 5, short)
 

Definition at line 212 of file blobtoxy.c.

Referenced by b2xy_column(), common_path_func(), and string_to_type().

#define TYPE_USHORT_LE   TYPE_CODE( 3, short)
 

Definition at line 210 of file blobtoxy.c.

Referenced by b2xy_column(), common_path_func(), and string_to_type().


Typedef Documentation

typedef struct b2xy_cursor b2xy_cursor
 

typedef struct b2xy_table b2xy_table
 


Function Documentation

int b2xy_bestindex sqlite3_vtab *    tab,
sqlite3_index_info *    info
[static]
 

Determines information for filter function according to constraints.

Parameters:
tab  virtual table
info  index/constraint iinformation
Returns:
SQLite error code

Definition at line 1100 of file blobtoxy.c.

References b2xy_table::key_column.

int b2xy_close sqlite3_vtab_cursor *    cur [static]
 

Close virtual table cursor.

Parameters:
cur  cursor pointer
Returns:
SQLite error code

Definition at line 641 of file blobtoxy.c.

References b2xy_cursor::select.

int b2xy_column sqlite3_vtab_cursor *    cur,
sqlite3_context *    ctx,
int    i
[static]
 

Return column data of virtual table.

Parameters:
cur  virtual table cursor
ctx  SQLite function context
i  column index
Returns:
SQLite error code

Definition at line 659 of file blobtoxy.c.

References b2xy_cursor::do_x_scale, b2xy_cursor::do_y_scale, b2xy_cursor::fix_cols, b2xy_cursor::index, b2xy_cursor::key, b2xy_cursor::num_cols, b2xy_cursor::select, b2xy_cursor::type, TYPE_BIGINT_BE, TYPE_BIGINT_LE, TYPE_CHAR, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT_BE, TYPE_INT_LE, TYPE_SHORT_BE, TYPE_SHORT_LE, TYPE_SIZE, TYPE_UCHAR, TYPE_UINT_BE, TYPE_UINT_LE, TYPE_USHORT_BE, TYPE_USHORT_LE, b2xy_cursor::val, b2xy_cursor::val_len, b2xy_cursor::x_offset, b2xy_cursor::x_scale, b2xy_cursor::y_offset, and b2xy_cursor::y_scale.

int b2xy_create sqlite3 *    db,
void *    userdata,
int    argc,
const char *const *    argv,
sqlite3_vtab **    vtabret,
char **    errp
[static]
 

Create virtual table.

Parameters:
db  SQLite database pointer
userdata  user specific pointer (unused)
argc  argument count
argv  argument vector
vtabret  pointer receiving virtual table pointer
errp  pointer receiving error messag
Returns:
SQLite error code
Argument vector contains:

argv[0] - module name
argv[1] - database name
argv[2] - table name (virtual table)
argv[3] - master table name (required)
argv[4] - key column (required)
argv[5] - blob column (required)
argv[6] - type code (optional)
argv[7] - X scale column (optional)
argv[8] - X offset column (optional)
argv[9] - Y scale column (optional)
argv[10] - Y offset column (optional)
argv[11] - other columns (optional)
argv[12] - X start (optional)
argv[13] - X length (optional)

Definition at line 376 of file blobtoxy.c.

References b2xy_table::argc, b2xy_table::argv, b2xy_destroy(), b2xy_table::blob_column, b2xy_table::db, b2xy_table::do_x_sl, b2xy_table::fq_master_table, b2xy_table::key_column, b2xy_table::master_table, b2xy_table::other_columns, string_to_type(), b2xy_table::type, TYPE_CHAR, TYPE_DOUBLE, TYPE_FLOAT, b2xy_table::x_length, b2xy_table::x_offset_column, b2xy_table::x_scale_column, b2xy_table::x_start, b2xy_table::y_offset_column, and b2xy_table::y_scale_column.

int b2xy_destroy sqlite3_vtab *    vtab [static]
 

Destroy virtual table.

Parameters:
vtab  virtual table pointer
Returns:
always SQLITE_OK

Definition at line 339 of file blobtoxy.c.

Referenced by b2xy_create().

int b2xy_eof sqlite3_vtab_cursor *    cur [static]
 

Return end of table state of virtual table cursor.

Parameters:
cur  virtual table cursor
Returns:
true/false

Definition at line 856 of file blobtoxy.c.

References b2xy_cursor::select.

int b2xy_filter sqlite3_vtab_cursor *    cur,
int    idxNum,
const char *    idxStr,
int    argc,
sqlite3_value **    argv
[static]
 

Filter function for virtual table.

Parameters:
cur  virtual table cursor
idxNum  used for expression (<, =, >, etc.)
idxStr  optional order by clause
argc  number arguments (0 or 1)
argv  argument (nothing or RHS of filter expression)
Returns:
SQLite error code

Definition at line 966 of file blobtoxy.c.

References b2xy_next(), b2xy_table::blob_column, b2xy_table::db, b2xy_cursor::fix_cols, b2xy_table::fq_master_table, b2xy_table::key_column, b2xy_cursor::num_cols, b2xy_table::other_columns, b2xy_cursor::rowid, b2xy_cursor::rowid_from_key, b2xy_cursor::select, b2xy_cursor::table, b2xy_cursor::x_offset_col, b2xy_table::x_offset_column, b2xy_cursor::x_scale_col, b2xy_table::x_scale_column, b2xy_cursor::y_offset_col, b2xy_table::y_offset_column, b2xy_cursor::y_scale_col, and b2xy_table::y_scale_column.

int b2xy_init sqlite3 *    db [static]
 

Module initializer creating SQLite functions and modules.

Parameters:
db  SQLite database pointer
Returns:
SQLite error code

Definition at line 1857 of file blobtoxy.c.

References b2xy_module, blt_vec_step(), common_path_finalize(), common_path_func(), common_path_step(), PATH_MODE_BLT, PATH_MODE_BLT_X, PATH_MODE_BLT_Y, PATH_MODE_SVG, PATH_MODE_TK, PATH_MODE_TK3D, rownumber_func(), and subblob_func().

Referenced by sqlite3_extension_init().

int b2xy_next sqlite3_vtab_cursor *    cur [static]
 

Retrieve next row from virtual table cursor.

Parameters:
cur  virtual table cursor
Returns:
SQLite error code

Definition at line 870 of file blobtoxy.c.

References b2xy_cursor::do_x_scale, b2xy_cursor::do_x_sl, b2xy_cursor::do_y_scale, b2xy_cursor::index, b2xy_cursor::key, b2xy_cursor::rowid, b2xy_cursor::rowid_from_key, b2xy_cursor::select, b2xy_cursor::table, b2xy_cursor::type, TYPE_SIZE, b2xy_cursor::val, b2xy_cursor::val_len, b2xy_cursor::x_length, b2xy_cursor::x_offset, b2xy_cursor::x_offset_col, b2xy_table::x_offset_column, b2xy_cursor::x_scale, b2xy_cursor::x_scale_col, b2xy_table::x_scale_column, b2xy_cursor::x_start, b2xy_cursor::y_offset, b2xy_cursor::y_offset_col, b2xy_table::y_offset_column, b2xy_cursor::y_scale, b2xy_cursor::y_scale_col, and b2xy_table::y_scale_column.

Referenced by b2xy_filter().

int b2xy_open sqlite3_vtab *    vtab,
sqlite3_vtab_cursor **    curret
[static]
 

Open virtual table and return cursor.

Parameters:
vtab  virtual table pointer
curret  pointer receiving cursor pointer
Returns:
SQLite error code

Definition at line 614 of file blobtoxy.c.

References b2xy_table::do_x_sl, b2xy_cursor::do_x_sl, b2xy_cursor::table, b2xy_table::type, b2xy_cursor::type, b2xy_table::x_length, b2xy_cursor::x_length, b2xy_table::x_start, and b2xy_cursor::x_start.

int b2xy_rowid sqlite3_vtab_cursor *    cur,
sqlite_int64 *    rowidp
[static]
 

Return current rowid of virtual table cursor.

Parameters:
cur  virtual table cursor
rowidp  value buffer to receive current rowid
Returns:
SQLite error code

Definition at line 841 of file blobtoxy.c.

References b2xy_cursor::rowid.

void blt_vec_step sqlite3_context *    ctx,
int    nargs,
sqlite3_value **    args
[static]
 

Path/polyline step callback for "blt_vec" aggregate functions.

Parameters:
ctx  SQLite function context
nargs  number arguments
args  arguments
Arguments:

args[0] - value (required)
args[1] - scale (optional)
args[2] - offset (optional)

Definition at line 1678 of file blobtoxy.c.

References path_aggctx::count, drop_strbuf(), path_aggctx::init, init_strbuf(), path_aggctx::mode, PATH_MODE_BLT, print_strbuf(), and path_aggctx::sb.

Referenced by b2xy_init().

void common_path_finalize sqlite3_context *    ctx [static]
 

Path/polyline finalizer.

Parameters:
ctx  SQLite function context

Definition at line 1644 of file blobtoxy.c.

References path_aggctx::count, drop_strbuf(), strbuf::idx, path_aggctx::init, path_aggctx::mode, PATH_MODE_BLT, path_aggctx::sb, and strbuf::str.

Referenced by b2xy_init().

void common_path_func sqlite3_context *    ctx,
int    nargs,
sqlite3_value **    args
[static]
 

Make path/polyline from blob.

Parameters:
ctx  SQLite function context
nargs  number arguments
args  arguments
Arguments:

args[0] - blob data (required)
args[1] - type (optional, default "char")
args[2] - X scale (optional)
args[3] - X offset (optional)
args[4] - Y scale (optional)
args[5] - Y offset (optional)
args[6] - Z value (optional)
args[7] - Z scale (optional)
args[8] - Z offset (optional)

Definition at line 1341 of file blobtoxy.c.

References drop_strbuf(), strbuf::idx, init_strbuf(), PATH_MODE_BLT_X, PATH_MODE_BLT_Y, PATH_MODE_SVG, PATH_MODE_TK3D, print_strbuf(), strbuf::str, string_to_type(), TYPE_CHAR, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT_BE, TYPE_INT_LE, TYPE_SHORT_BE, TYPE_SHORT_LE, TYPE_SIZE, TYPE_UCHAR, TYPE_UINT_BE, TYPE_UINT_LE, TYPE_USHORT_BE, and TYPE_USHORT_LE.

Referenced by b2xy_init().

void common_path_step sqlite3_context *    ctx,
int    nargs,
sqlite3_value **    args
[static]
 

Path/polyline step callback for "tk_path", "svg_path", and "tk3d_path" aggregate functions.

Parameters:
ctx  SQLite function context
nargs  number arguments
args  arguments
Arguments:

args[0] - X value (required)
args[1] - Y value (required)
args[2] - X scale (optional)
args[3] - X offset (optional)
args[4] - Y scale (optional)
args[5] - Y offset (optional)
args[6] - Z value (optional)
args[7] - Z scale (optional)
args[8] - Z offset (optional)

Definition at line 1538 of file blobtoxy.c.

References path_aggctx::count, drop_strbuf(), strbuf::idx, path_aggctx::init, init_strbuf(), path_aggctx::linebreak, path_aggctx::mode, PATH_MODE_SVG, PATH_MODE_TK3D, print_strbuf(), and path_aggctx::sb.

Referenced by b2xy_init().

void drop_strbuf strbuf   sb [static]
 

Free resources of dynamic string buffer.

Parameters:
sb  pointer to string buffer

Definition at line 1271 of file blobtoxy.c.

References strbuf::max, and strbuf::str.

Referenced by blt_vec_step(), common_path_finalize(), common_path_func(), and common_path_step().

int expand_strbuf strbuf   sb [static]
 

Expand or initialize dynamic string buffer.

Parameters:
sb  pointer to string buffer
Returns:
SQLite error code

Definition at line 1247 of file blobtoxy.c.

References init_strbuf(), strbuf::max, and strbuf::str.

Referenced by print_strbuf().

int init_strbuf strbuf   sb [static]
 

Initialize dynamic string buffer with capacity 1024.

Parameters:
sb  pointer to string buffer
Returns:
SQLite error code

Definition at line 1225 of file blobtoxy.c.

References strbuf::idx, strbuf::max, and strbuf::str.

Referenced by blt_vec_step(), common_path_func(), common_path_step(), and expand_strbuf().

int print_strbuf strbuf   sb,
const char *    fmt,
...   
[static]
 

Format printf-like into dynamic string buffer.

Parameters:
sb  pointer to string buffer
fmt  printf-like format string
Returns:
SQLite error code

Definition at line 1288 of file blobtoxy.c.

References expand_strbuf(), strbuf::idx, strbuf::max, and strbuf::str.

Referenced by blt_vec_step(), common_path_func(), and common_path_step().

void rownumber_func sqlite3_context *    ctx,
int    nargs,
sqlite3_value **    args
[static]
 

"rownumber" function.

Parameters:
ctx  SQLite function context
nargs  number arguments
args  arguments

Definition at line 1828 of file blobtoxy.c.

References rownumber_ctx::count, rownumber_ctx::ctx, and rownumber_ctx::value.

Referenced by b2xy_init().

int sqlite3_extension_init sqlite3 *    db,
char **    errmsg,
const sqlite3_api_routines *    api
 

Initializer for SQLite extension load mechanism.

Parameters:
db  SQLite database pointer
errmsg  pointer receiving error message
api  SQLite API routines
Returns:
SQLite error code

Definition at line 1895 of file blobtoxy.c.

References b2xy_init().

int string_to_type const char *    str [static]
 

Map type string to type code.

Parameters:
str  type string, e.g. "char"
Returns:
type code, e.g. TYPE_CHAR

Definition at line 285 of file blobtoxy.c.

References TYPE_BIGINT_BE, TYPE_BIGINT_LE, TYPE_CHAR, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT_BE, TYPE_INT_LE, TYPE_SHORT_BE, TYPE_SHORT_LE, TYPE_UCHAR, TYPE_UINT_BE, TYPE_UINT_LE, TYPE_USHORT_BE, and TYPE_USHORT_LE.

Referenced by b2xy_create(), and common_path_func().

void subblob_func sqlite3_context *    ctx,
int    nargs,
sqlite3_value **    args
[static]
 

"subblob" function similar to "substr".

Parameters:
ctx  SQLite function context
nargs  number arguments
args  arguments

Definition at line 1733 of file blobtoxy.c.

Referenced by b2xy_init().


Variable Documentation

const sqlite3_module b2xy_module [static]
 

Initial value:

 {
    1,              
    b2xy_create,    
    b2xy_create,    
    b2xy_bestindex, 
    b2xy_destroy,   
    b2xy_destroy,   
    b2xy_open,      
    b2xy_close,     
    b2xy_filter,    
    b2xy_next,      
    b2xy_eof,       
    b2xy_column,    
    b2xy_rowid,     
    0,              
    0,              
    0,              
    0,              
    0,              
    0,              



}

Definition at line 1181 of file blobtoxy.c.

Referenced by b2xy_init().


Generated on 23 Oct 2023 by doxygen.
Contact: chw@ch-werner.de