mksqlite  2.5
A MATLAB interface to SQLite
Classes | Namespaces | Macros | Typedefs | Functions | Variables
typed_blobs.hpp File Reference

Packing MATLAB data in a memory block with type information for storing as SQL BLOB. More...

#include "utils.hpp"
+ Include dependency graph for typed_blobs.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TypedBLOBHeaderBase
 1st (base) version of typed BLOB header with ability of storing multidimensional MATLAB arrays. More...
 
struct  TypedBLOBHeaderCompressed
 2nd version of typed blobs with additional compression feature. More...
 
struct  TBHData< HeaderBaseType >
 Template class extending base class uniquely. More...
 
struct  old_version::TypedBLOBHeader
 typed BLOB header (deprecated) More...
 

Namespaces

 old_version
 

Macros

#define TBH_DATA(tbh)   ((void*)&tbh->sizeDims[tbh->sizeDims[0]+1])
 Get pointer to hosted data (deprecated)
 
#define TBH_DATA_OFFSET(nDims)   ((ptrdiff_t)&((TypedBLOBHeader*) 0)->sizeDims[nDims+1])
 Get offset from header start to hosted data (deprecated)
 
Header field limits

Length definitions for typed header fields (max lengths).

#define TBH_MAGIC_MAXLEN   14
 
#define TBH_PLATFORM_MAXLEN   11
 
#define TBH_COMPRID_MAXLEN   12
 
#define TBH_ENDIAN_MAXLEN   2
 

Typedefs

typedef TBHData< TypedBLOBHeaderBaseTypedBLOBHeaderV1
 typed blob header for MATLAB arrays
 
typedef TBHData< TypedBLOBHeaderCompressedTypedBLOBHeaderV2
 typed blob header for MATLAB arrays with compression feature
 

Functions

int old_version::check_compatibility ()
 Checks for valid header size, platform name, endian type and magic (deprecated)
 
void typed_blobs_init ()
 Initialization. More...
 
void typed_blobs_mode_set (int mode)
 Set mode of typed blob usage.
 
int typed_blobs_mode_on ()
 Get mode of typed blob usage.
 

Variables

static int typed_blobs_mode = 0
 typed blobs are off by default
 
static const char old_version::TBH_MAGIC [] = "mkSQLite.tbh"
 identifying string (magic) (deprecated)
 
static char old_version::TBH_platform [11] = {0}
 platform name (i.e. "PCWIN") (deprecated)
 
static char old_version::TBH_endian [2] = {0}
 endian used ('L'ittle or 'B'ig) (deprecated)
 
Text fields for integrity check (platform and magic)
const char TBH_MAGIC [] = "mkSQLite.tbh\0"
 identify string More...
 
char TBH_platform [] = {0}
 platform name
 
char TBH_endian [] = {0}
 endian (little or big)
 

Detailed Description

Packing MATLAB data in a memory block with type information for storing as SQL BLOB.

Authors
Martin Kortmann mail@.nosp@m.kort.nosp@m.mann..nosp@m.de, Andreas Martin andim.nosp@m.arti.nosp@m.n@use.nosp@m.rs.s.nosp@m.ource.nosp@m.forg.nosp@m.e.net
Version
2.5
Date
2008-2017
Precondition
Warning
Bug:

Size of blob-header identifies type 1 or type 2 (with compression feature).

BLOBs of type mxUNKNOWN_CLASS reflects serialized (streamed) data and should be handled as mxCHAR_CLASS thus. Before packing data into a typed blob the caller is responsible to ensure not to deal with mxUNKNOWN_CLASS data.

In this module it's countless if the data is serialized or not, since it's a simple char array in that case.

Store type and dimensions of MATLAB vectors/arrays in BLOBs native and free of matlab types, to provide data sharing with other applications.
Switched with the command mksqlite('typedBLOBs', <integer value>), where <integer value> is 0 for "off" and 1 for "on".

Definition in file typed_blobs.hpp.


Class Documentation

◆ old_version::TypedBLOBHeader

struct old_version::TypedBLOBHeader

typed BLOB header (deprecated)

Definition at line 484 of file typed_blobs.hpp.

Class Members
int32_t clsid Matlab ClassID of variable (see mxClassID)
char endian Byte order: 'L'ittle endian or 'B'ig endian.
char magic[sizeof(TBH_MAGIC)] small fail-safe header check
char platform[11] Computer architecture: PCWIN, PCWIN64, GLNX86, GLNXA64, MACI, MACI64, SOL64.
int32_t sizeDims[1]

Number of dimensions, followed by sizes of each dimension First byte after header at &tbh->sizeDims[tbh->sizeDims[0]+1]

int16_t ver Struct size as kind of header version number for later backwards compatibility (may increase only!)

Function Documentation

◆ typed_blobs_init()

void typed_blobs_init ( )

Initialization.

Get platform information. Data stored in the database may be dependent and will be checked.
(Compatibility test in debug mode)

Definition at line 121 of file typed_blobs.hpp.

References old_version::check_compatibility(), and old_version::TBH_platform.

Variable Documentation

◆ TBH_MAGIC

const char TBH_MAGIC = "mkSQLite.tbh\0"

identify string

identifying string

Definition at line 154 of file typed_blobs.hpp.