![]() |
mksqlite
2.5
A MATLAB interface to SQLite
|
SQL builtin functions, automatically attached to each database. More...
#include "typed_blobs.hpp"
#include "number_compressor.hpp"
#include "serialize.hpp"
#include "deelx/deelx.h"
#include "md5/md5.h"
Go to the source code of this file.
Functions | |
void | pow_func (sqlite3_context *ctx, int argc, sqlite3_value **argv) |
Power function implementation. More... | |
void | lg_func (sqlite3_context *ctx, int argc, sqlite3_value **argv) |
Logarithm function to base 10 implementation. More... | |
void | ln_func (sqlite3_context *ctx, int argc, sqlite3_value **argv) |
Natural logarithm function implementation. More... | |
void | exp_func (sqlite3_context *ctx, int argc, sqlite3_value **argv) |
Exponential function implementation. More... | |
void | regex_func (sqlite3_context *ctx, int argc, sqlite3_value **argv) |
Regular expression function implementation. More... | |
void | BDC_ratio_func (sqlite3_context *ctx, int argc, sqlite3_value **argv) |
BDCRatio function implementation. More... | |
void | BDC_pack_time_func (sqlite3_context *ctx, int argc, sqlite3_value **argv) |
BDCPackTime function implementation. More... | |
void | BDC_unpack_time_func (sqlite3_context *ctx, int argc, sqlite3_value **argv) |
BDCUnpackTime function implementation. More... | |
void | MD5_func (sqlite3_context *ctx, int argc, sqlite3_value **argv) |
MD5 hashing implementation. More... | |
int | blob_pack (const mxArray *pcItem, bool bStreamable, void **ppBlob, size_t *pBlob_size, double *pdProcess_time, double *pdRatio, const char *compressor, int level) |
create a compressed typed blob from a Matlab item (deep copy) More... | |
int | blob_unpack (const void *pBlob, size_t blob_size, bool bStreamable, mxArray **ppItem, double *pdProcess_time, double *pdRatio) |
uncompress a typed blob and return as MATLAB array More... | |
void | blob_free (void **ppBlob) |
Free memory allocated for a BLOB. | |
SQL builtin functions, automatically attached to each database.
Additional functions in SQL statements (MD5, regex, pow, and packing ratio/time)
Definition in file sql_builtin_functions.hpp.
void BDC_pack_time_func | ( | sqlite3_context * | ctx, |
int | argc, | ||
sqlite3_value ** | argv | ||
) |
BDCPackTime function implementation.
BDCPackTime(value) calculates the compression time on a blob, where value is argv[0]
[in] | ctx | SQL context parameter |
[in] | argc | Argument count |
[in] | argv | SQL argument values |
Definition at line 553 of file sql_builtin_functions.hpp.
References blob_pack(), blob_unpack(), can_serialize(), and utils_destroy_array().
Referenced by SQLstackitem::attachBuiltinFunctions().
void BDC_ratio_func | ( | sqlite3_context * | ctx, |
int | argc, | ||
sqlite3_value ** | argv | ||
) |
BDCRatio function implementation.
BDCRatio(value) calculates the compression ratio for a blob, where value is argv[0]
[in] | ctx | SQL context parameter |
[in] | argc | Argument count |
[in] | argv | SQL argument values |
Definition at line 497 of file sql_builtin_functions.hpp.
References blob_unpack(), can_serialize(), and utils_destroy_array().
Referenced by SQLstackitem::attachBuiltinFunctions().
void BDC_unpack_time_func | ( | sqlite3_context * | ctx, |
int | argc, | ||
sqlite3_value ** | argv | ||
) |
BDCUnpackTime function implementation.
BDCUnpackTime(value) calculates the uncompression time on a blob, where value is argv[0]
[in] | ctx | SQL context parameter |
[in] | argc | Argument count |
[in] | argv | SQL argument values |
Definition at line 619 of file sql_builtin_functions.hpp.
References blob_unpack(), can_serialize(), and utils_destroy_array().
Referenced by SQLstackitem::attachBuiltinFunctions().
int blob_pack | ( | const mxArray * | pcItem, |
bool | bStreamable, | ||
void ** | ppBlob, | ||
size_t * | pBlob_size, | ||
double * | pdProcess_time, | ||
double * | pdRatio, | ||
const char * | compressor, | ||
int | level | ||
) |
create a compressed typed blob from a Matlab item (deep copy)
[in] | pcItem | MATLAB array to compress |
[in] | bStreamable | if true, streaming preprocess is intended |
[out] | ppBlob | Created BLOB, allocated by sqlite3_malloc |
[out] | pBlob_size | Size of BLOB in bytes |
[out] | pdProcess_time | Processing time in seconds |
[out] | pdRatio | Realized compression ratio |
[in] | compressor | name of compressor to use (optional). Default is global setting g_compression_type |
[in] | level | compression level (optional). Default is global setting g_compression_level |
Definition at line 699 of file sql_builtin_functions.hpp.
References ValueMex::Complexity(), serialize(), Err::set(), and ValueMex::TC_COMPLEX.
Referenced by BDC_pack_time_func().
int blob_unpack | ( | const void * | pBlob, |
size_t | blob_size, | ||
bool | bStreamable, | ||
mxArray ** | ppItem, | ||
double * | pdProcess_time, | ||
double * | pdRatio | ||
) |
uncompress a typed blob and return as MATLAB array
[out] | pBlob | BLOB to decompress |
[out] | blob_size | Size of BLOB in bytes |
[in] | bStreamable | if true, streaming preprocess is intended |
[in] | ppItem | MATLAB array to compress |
[out] | pdProcess_time | Processing time in seconds |
[out] | pdRatio | Realized compression ratio |
Definition at line 899 of file sql_builtin_functions.hpp.
References getLocaleMsg().
Referenced by BDC_pack_time_func(), BDC_ratio_func(), BDC_unpack_time_func(), and MD5_func().
void exp_func | ( | sqlite3_context * | ctx, |
int | argc, | ||
sqlite3_value ** | argv | ||
) |
Exponential function implementation.
Computes the equation result = exp( value )
where value is argv[0]
[in] | ctx | SQL context parameter |
[in] | argc | Argument count |
[in] | argv | SQL argument values |
Definition at line 200 of file sql_builtin_functions.hpp.
Referenced by SQLstackitem::attachBuiltinFunctions().
void lg_func | ( | sqlite3_context * | ctx, |
int | argc, | ||
sqlite3_value ** | argv | ||
) |
Logarithm function to base 10 implementation.
Computes the equation result = log10( value )
where value is argv[0]
[in] | ctx | SQL context parameter |
[in] | argc | Argument count |
[in] | argv | SQL argument values |
Definition at line 124 of file sql_builtin_functions.hpp.
Referenced by SQLstackitem::attachBuiltinFunctions().
void ln_func | ( | sqlite3_context * | ctx, |
int | argc, | ||
sqlite3_value ** | argv | ||
) |
Natural logarithm function implementation.
Computes the equation result = ln( value )
where value is argv[0]
[in] | ctx | SQL context parameter |
[in] | argc | Argument count |
[in] | argv | SQL argument values |
Definition at line 162 of file sql_builtin_functions.hpp.
Referenced by SQLstackitem::attachBuiltinFunctions().
void MD5_func | ( | sqlite3_context * | ctx, |
int | argc, | ||
sqlite3_value ** | argv | ||
) |
MD5 hashing implementation.
md5(value) calculates the md5 hash (RSA), where value is argv[0]
[in] | ctx | SQL context parameter |
[in] | argc | Argument count |
[in] | argv | SQL argument values |
Definition at line 357 of file sql_builtin_functions.hpp.
References blob_unpack(), can_serialize(), g_convertUTF8, TypedBLOBHeaderBase::getDataSize(), HC_NOTES, MEM_ALLOC, TBH_endian, utils_destroy_array(), utils_free_ptr(), and utils_strnewdup().
Referenced by SQLstackitem::attachBuiltinFunctions().
void pow_func | ( | sqlite3_context * | ctx, |
int | argc, | ||
sqlite3_value ** | argv | ||
) |
Power function implementation.
Computes the equation result = pow( base, exponent )
where base is argv[0] and exponent is argv[1]
[in] | ctx | SQL context parameter |
[in] | argc | Argument count |
[in] | argv | SQL argument values |
Definition at line 74 of file sql_builtin_functions.hpp.
Referenced by SQLstackitem::attachBuiltinFunctions().
void regex_func | ( | sqlite3_context * | ctx, |
int | argc, | ||
sqlite3_value ** | argv | ||
) |
Regular expression function implementation.
Regular expression function ( with replace option, then argc > 2 )
regex(str,pattern) returns the matching substring of str, which matches against pattern, where str is argv[0] and pattern is argv[1].
If 3 arguments passed regex(str,pattern,replacement) the substring will be modified regarding replacement parameter before returned.
[in] | ctx | SQL context parameter |
[in] | argc | Argument count |
[in] | argv | SQL argument values |
Definition at line 242 of file sql_builtin_functions.hpp.
References g_convertUTF8, HC_NOTES, MEM_ALLOC, utils_free_ptr(), utils_latin2utf(), and utils_strnewdup().
Referenced by SQLstackitem::attachBuiltinFunctions().