|
Multiverse
Social.
com
|
|
|
Binary
Query
Language
Binary SQL encapsulation - By Tony Swain. Originally Dec 2013 — C style update 2026
|
|
|
// bql_constants.h
// Pure #define style — no enums, no indexed arrays
// Binary Query Language constants — C version
#ifndef BQL_CONSTANTS_H
#define BQL_CONSTANTS_H
/* DEFAULTS & GENERAL LIMITS */
#define DEFAULT_RECORD_FILENAME "default.rec"
#define DEFAULT_RECORD_TYPE "account"
#define MAX_RECORD_TYPES 255
#define MAX_RECORDS 1024
#define DATA_SUFFIX ".dat"
/* DATABASE / RECORD FEATURE FLAGS */
#define DB_MONOLITHIC 0x00000001UL
#define DB_RAM_RECORD 0x00000002UL
#define DB_FILE_JOURNAL 0x00000004UL
#define DB_TIMESTAMP 0x00000008UL
#define RECORD_JOINED 0x00000010UL
#define RECORD_BACKUP 0x00000020UL
#define RECORD_TIMEOUT 0x00000040UL
/* 8-BIT COMMAND / QUERY BITS */
#define BQL_GET 0x01
#define BQL_PUT 0xFE /* ~BQL_GET */
#define BQL_ALL 0x02
#define BQL_GT 0x04
#define BQL_LT 0x08
#define BQL_EQU 0x10
#define BQL_ORDER_BY1 0x20 /* 0=name 1=date */
#define BQL_ORDER_BY2 0x40 /* 2=size 3=type */
#define BQL_EXTENDED_ENABLE 0x80
/* EXTENDED / ALTERNATE COMMANDS */
#define BQL_JOIN 0x0001
#define BQL_SPLIT 0x0002
/* BRANCH / INDEX BLOCK SIZE CODING */
#define BRANCH_8 0x01 /* 256 entries → 1 byte */
#define BRANCH_16 0x02 /* 64 Ki → 2 byte */
#define BRANCH_24 0x03 /* 16 Mi → 3 byte */
#define BRANCH_32 0x04 /* 4 Gi → 4 byte */
/* SERIALIZATION / TYPE ENCODING */
#define EXTERNALIZER_BUFFER_SIZE (512UL * 1024UL)
#define INTERNALIZER_BUFFER_SIZE (512UL * 1024UL)
#define ENCRYPTION_ENA 0x80
#define ADDRESSING_MASK 0x60
#define ADDRESS_SHIFT 5
#define BYTE_ADDRESSING (0x00 << ADDRESS_SHIFT)
#define SHORT_ADDRESSING (0x01 << ADDRESS_SHIFT)
#define INT_ADDRESSING (0x02 << ADDRESS_SHIFT)
#define LONG_ADDRESSING (0x03 << ADDRESS_SHIFT)
#define TYPE_MASK 0x1F
#define ADDRESS_MASK 0xE0
#define TYPE_BYTE 0
#define TYPE_SHORT 1
#define TYPE_CHAR 2
#define TYPE_INT 3
#define TYPE_LONG 4
#define TYPE_FLOAT 5
#define TYPE_DOUBLE 6
#define TYPE_OBJECT 7
#define TYPE_BYTE_ARRAY 8
#define TYPE_SHORT_ARRAY 9
#define TYPE_CHAR_ARRAY 10
#define TYPE_INT_ARRAY 11
#define TYPE_LONG_ARRAY 12
#define TYPE_FLOAT_ARRAY 13
#define TYPE_DOUBLE_ARRAY 14
#define TYPE_OBJECT_ARRAY 15
#define TYPE_BYTE_2D_ARRAY 16
#define TYPE_SHORT_2D_ARRAY 17
#define TYPE_CHAR_2D_ARRAY 18
#define TYPE_INT_2D_ARRAY 19
#define TYPE_LONG_2D_ARRAY 20
#define TYPE_FLOAT_2D_ARRAY 21
#define TYPE_DOUBLE_2D_ARRAY 22
#define TYPE_OBJECT_2D_ARRAY 23
#define TYPE_BYTE_3D_ARRAY 24
#define TYPE_SHORT_3D_ARRAY 25
#define TYPE_CHAR_3D_ARRAY 26
#define TYPE_INT_3D_ARRAY 27
#define TYPE_LONG_3D_ARRAY 28
#define TYPE_FLOAT_3D_ARRAY 29
#define TYPE_DOUBLE_3D_ARRAY 30
#define TYPE_OBJECT_3D_ARRAY 31
#define TOTAL_DATA_TYPES 32
#define SIZEOF_BYTE 1
#define SIZEOF_SHORT 2
#define SIZEOF_CHAR 2
#define SIZEOF_INT 4
#define SIZEOF_LONG 8
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define DEFAULT_BUFFER_SIZE 0x0000FFFFUL
#endif /* BQL_CONSTANTS_H */
|
|
|
Binary encapsulation — hardware portable, compact, journaled.
|
|
|