PC SOFT
DEPOT EN LIGNE
POUR WINDEVWEBDEV ET WINDEV MOBILE

StarQ component.- Structure / Queue / Componente mapped Database
Publié par Boller
dans la catégorie Outils
Nouveautés



Description
StarQ component.- Structure / Queue / Componente mapped Database

Helper for easily integrating LightningDB into WINDEV projects.

https://en.wikipedia.org/wiki/Lightning_Memory-Mapped_Database

Component In/Out:

List of Procedures

The StarQ component proposes the following sets of procedures:

Set of Procedures 'lmdb'

LmdbErrorCheck
BinaryData
CompData
DbSerialize
DbDeserialize
lmdb_dll_init
AllocSpace
TransferSpace
GetPageSize <specify the procedure action>
StandardSize <specify the procedure action>

Set of Procedures 'index'

Ascending
Descending
Composite
Using


List of Classes

The StarQ component proposes the following classes:


List of Constants

The StarQ component proposes the following constants:

Set of Procedures 'lmdb'

MDB_FIXEDMAP mmap at a fixed address (experimental)
MDB_NOSUBDIR no environment directory
MDB_NOSYNC don't fsync after commit
MDB_RDONLY read only
MDB_NOMETASYNC don't fsync metapage after commit
MDB_WRITEMAP use writable mmap
MDB_MAPASYNC use asynchronous msync when #MDB_WRITEMAP is used
MDB_NOTLS tie reader locktable slots to #MDB_txn objects instead of to threads
MDB_NOLOCK don't do any locking, caller must manage their own locks
MDB_NORDAHEAD don't do readahead (no effect on Windows)
MDB_NOMEMINIT don't initialize malloc'd memory before writing to datafile
MDB_REVERSEKEY use reverse string keys
MDB_DUPSORT use sorted duplicates
MDB_INTEGERKEY numeric keys in native byte order.
MDB_DUPFIXED with #MDB_DUPSORT, sorted dup items have fixed size
MDB_INTEGERDUP with #MDB_DUPSORT, dups are numeric (28,10) in native byte order
MDB_REVERSEDUP with #MDB_DUPSORT, use reverse string dups
MDB_CREATE create DB if not already existing
MDB_NOOVERWRITE For put: Don't write if the key already exists.
MDB_NODUPDATA Only for #MDB_DUPSORT<br>
MDB_CURRENT For mdb_cursor_put: overwrite the current key/data pair
MDB_RESERVE For put: Just reserve space for data, don't copy it. Return a
MDB_APPEND Data is being appended, don't split full pages.
MDB_APPENDDUP Duplicate data is being appended, don't split full pages.
MDB_MULTIPLE Store multiple data items in one call. Only for #MDB_DUPFIXED.
MDB_FIRST < Position at first key/data item
MDB_FIRST_DUP < Position at first data item of current key.
MDB_GET_BOTH < Position at key/data pair. Only for #MDB_DUPSORT
MDB_GET_BOTH_RANGE < position at key, nearest data. Only for #MDB_DUPSORT
MDB_GET_CURRENT < Return key/data at current cursor position
MDB_GET_MULTIPLE < Return all the duplicate data items at the current
MDB_LAST < Position at last key/data item
MDB_LAST_DUP < Position at last data item of current key.
MDB_NEXT < Position at next data item
MDB_NEXT_DUP < Position at next data item of current key.
MDB_NEXT_MULTIPLE < Return all duplicate data items at the next
MDB_NEXT_NODUP < Position at first data item of next key
MDB_PREV < Position at previous data item
MDB_PREV_DUP < Position at previous data item of current key.
MDB_PREV_NODUP < Position at last data item of previous key
MDB_SET < Position at specified key
MDB_SET_KEY < Position at specified key, return key + data
MDB_SET_RANGE < Position at first key greater than or equal to specified key.
MDB_SUCCESS Successful result
MDB_KEYEXIST key/data pair already exists
MDB_NOTFOUND key/data pair not found = EOF
MDB_PAGE_NOTFOUND Requested page not found - this usually indicates corruption
MDB_CORRUPTED Located page was wrong type
MDB_PANIC Update of meta page failed, probably I/O error
MDB_VERSION_MISMATCH Environment version mismatch
MDB_INVALID File is not a valid MDB file
MDB_MAP_FULL Environment mapsize reached
MDB_DBS_FULL Environment maxdbs reached
MDB_READERS_FULL Environment maxreaders reached
MDB_TLS_FULL Too many TLS keys in use - Windows only
MDB_TXN_FULL Txn has too many dirty pages
MDB_CURSOR_FULL Cursor stack too deep - internal error
MDB_PAGE_FULL Page has not enough space - internal error
MDB_MAP_RESIZED Database contents grew beyond environment mapsize
MDB_INCOMPATIBLE MDB_INCOMPATIBLE: Operation and DB incompatible, or DB flags changed
MDB_BAD_RSLOT Invalid reuse of reader locktable slot
MDB_BAD_TXN Transaction cannot recover - it must be aborted
MDB_BAD_VALSIZE Too big key/data, key is empty, or wrong DUPFIXED size
MDB_LAST_ERRCODE
MDB_MB
MDB_GB
LMDB_64_DLL
LMDB_32_DLL


List of Global Variables

The StarQ component proposes the following global variables:

Set of Procedures 'lmdb'

mdb_version
mdb_strerror
mdb_env_create
mdb_env_open
mdb_env_copy
mdb_env_copyfd
mdb_env_stat
mdb_env_info
mdb_env_sync
mdb_env_close
mdb_env_set_flags
mdb_env_get_flags
mdb_env_get_path
mdb_env_get_fd
mdb_env_set_mapsize
mdb_env_set_maxreaders
mdb_env_get_maxreaders
mdb_env_set_maxdbs
mdb_env_get_maxkeysize
mdb_env_set_userctx
mdb_env_get_userctx
mdb_env_set_assert
mdb_txn_begin
mdb_txn_env
mdb_txn_commit
mdb_txn_abort
mdb_txn_reset
mdb_txn_renew
mdb_dbi_open
mdb_stat
mdb_dbi_flags
mdb_dbi_close
mdb_drop
mdb_set_compare
mdb_set_dupsort
mdb_set_relfunc
mdb_set_relctx
mdb_get
mdb_put
mdb_del
mdb_cursor_open
mdb_cursor_close
mdb_cursor_renew
mdb_cursor_txn
mdb_cursor_dbi
mdb_cursor_get
mdb_cursor_put
mdb_cursor_del
mdb_cursor_count
mdb_cmp
mdb_dcmp
mdb_reader_list
mdb_reader_check
LMDB_DLL_INSTANCE

Set of Procedures 'index'

gnProcedureIndex


List of Structures

The StarQ component proposes the following structures:

Set of Procedures 'lmdb'

SYSTEM_INFO
STMDB_stat
STMDB_envinfo
STMDB_val


1 - Accessible Sets of Procedures

1.1 - Set of Procedures 'lmdb'
1.1.1 - Procedure 'LmdbErrorCheck'

Summary: Verify an error and throws an exception
1.1.2 - Procedure 'BinaryData'

Summary: Returns a binary data
1.1.3 - Procedure 'CompData'

Summary: Composite key data
1.1.4 - Procedure 'DbSerialize'

Summary: Serialize data
1.1.5 - Procedure 'DbDeserialize'

Summary: Serialize data
1.1.6 - Procedure 'lmdb_dll_init'

Summary: Inicializar LMDB
1.1.7 - Procedure 'AllocSpace'

Summary: Allocate space
1.1.8 - Procedure 'TransferSpace'

Summary: Transferir memoria
1.1.9 - Procedure 'GetPageSize'

Summary: <specify the procedure action>
Syntax:
[ <Result> = ] GetPageSize ()

Parameters:
None
Return Value:
real: <specify the possible values as well as their interpretation>

For instance:
Indicate an example.

1.1.10 - Procedure 'StandardSize'

Summary: <specify the procedure action>
Syntax:
[ <Result> = ] StandardSize (<Size>)

Parameters:
Size: <specify the role of Size>
Return Value:
8-byte int: <specify the possible values as well as their interpretation>

For instance:
Indicate an example.



1.2 - Set of Procedures 'index'
1.2.1 - Procedure 'Ascending'

Summary: Generates the binary representation of a value for Ascending order
1.2.2 - Procedure 'Descending'

Summary: Generates the binary representation of a value for Descending order
1.2.3 - Procedure 'Composite'

Summary: Generates a Composite representation of a value using several values
1.2.4 - Procedure 'Using'

Summary: Generates a Build Index procedure based on a single or several field names. Prefix with '-' on a field to specify descending order.

1 - Sets of Accessible Browser Procedures

<No browser procedure available in this component>

2 - Accessible Classes

2.1 - Class 'StarQEnv'
2.1.1 - Method 'Constructor'

Summary: Declare a shared environment. By default a temporal file and volatile (files will be deleted when closed).
2.1.2 - Method 'Destructor'

Summary: <specify the procedure action>
Syntax:
Destructor ()

Parameters:
None
Return Value:
None

For instance:
Indicate an example.

2.1.3 - Method 'Open'

Summary: Opens an environment or creates it if it does not exist, then open all related tables.
2.1.4 - Method 'Close'

Summary: Close an environment and all related tables.
2.1.5 - Method 'Create'

Summary: Create a new environment and declare all tables.
2.1.6 - Method 'GetFileName'

Summary: Get the file name for the database.



2.2 - Class 'StarQ'
2.2.1 - Method 'Constructor'

Summary: Declares a table with the primary key build procedure.
2.2.2 - Method 'Destructor'

Summary: <specify the procedure action>
Syntax:
Destructor ()

Parameters:
None
Return Value:
None

For instance:
Indicate an example.

2.2.3 - Method 'Put'

Summary: Insert or modify a record.
2.2.4 - Method 'RemoveInternal'

Summary: <specify the procedure action>
Syntax:
RemoveInternal (<Record> [, <IsChecked>])

Parameters:
Record: <specify the role of Record>
IsChecked (default value=0): <specify the role of IsChecked>
Return Value:
None

For instance:
Indicate an example.

2.2.5 - Method 'Index'

Summary: Declare a new Index.
2.2.6 - Method 'PutIndex'

Summary: <specify the procedure action>
Syntax:
PutIndex (<nIdx> is int, <Record>, <PkValue>)

Parameters:
nIdx (int): <specify the role of nIdx>
Record: <specify the role of Record>
PkValue: <specify the role of PkValue>
Return Value:
None

For instance:
Indicate an example.

2.2.7 - Method 'Get'

Summary: Find a record on the primary key, and fetch it.
2.2.8 - Method 'FirstPK'

Summary: Locate the cursor at the beginning the primary key, and fetch the record.
2.2.9 - Method 'Exist'

Summary: Check the existence of a record on the primary key.
2.2.10 - Method 'PkValue'

Summary: <specify the procedure action>
Syntax:
[ <Result> = ] PkValue (<Record>)

Parameters:
Record: <specify the role of Record>
Return Value:
Unspecified Type: <specify the possible values as well as their interpretation>

For instance:
Indicate an example.

2.2.11 - Method 'RemoveIndex'

Summary: <specify the procedure action>
Syntax:
RemoveIndex (<nIdx> is int, <Record>, <PkValue>)

Parameters:
nIdx (int): <specify the role of nIdx>
Record: <specify the role of Record>
PkValue: <specify the role of PkValue>
Return Value:
None

For instance:
Indicate an example.

2.2.12 - Method 'Open'

Summary: Opens the table.
2.2.13 - Method 'Close'

Summary: Close the table.
2.2.14 - Method 'CloseIndex'

Summary: <specify the procedure action>
Syntax:
CloseIndex (<nIdx> is int)

Parameters:
nIdx (int): <specify the role of nIdx>
Return Value:
None

For instance:
Indicate an example.

2.2.15 - Method 'OpenIndex'

Summary: <specify the procedure action>
Syntax:
OpenIndex (<nIdx> is int)

Parameters:
nIdx (int): <specify the role of nIdx>
Return Value:
None

For instance:
Indicate an example.

2.2.16 - Method 'CheckOpened'

Summary: <specify the procedure action>
Syntax:
CheckOpened ( [<IsNot> is boolean])

Parameters:
IsNot (boolean - default value=0): <specify the role of IsNot>
Return Value:
None

For instance:
Indicate an example.

2.2.17 - Method 'CursorGet'

Summary: <specify the procedure action>
Syntax:
[ <Result> = ] CursorGet (<nIdx> is int, <Record> [, <nFlags> is int])

Parameters:
nIdx (int): <specify the role of nIdx>
Record: <specify the role of Record>
nFlags (int - default value=0): <specify the role of nFlags>
Return Value:
boolean: <specify the possible values as well as their interpretation>

For instance:
Indicate an example.

2.2.18 - Method 'Next'

Summary: Move the cursor to the next record, and fetch it.
2.2.19 - Method 'Previous'

Summary: Moves the cursor to the previous record and fetches it.
2.2.20 - Method 'Last'

Summary: Locate the cursor at the ending of an index, and fetch the record.
2.2.21 - Method 'Set'

Summary: Seeks for the closest next record based on an index and fetches it.
2.2.22 - Method 'NewScanIndex'

Summary: <specify the procedure action>
Syntax:
NewScanIndex (<nIdx> is int)

Parameters:
nIdx (int): <specify the role of nIdx>
Return Value:
None

For instance:
Indicate an example.

2.2.23 - Method 'CloseScanIndex'

Summary: <specify the procedure action>
Syntax:
CloseScanIndex ()

Parameters:
None
Return Value:
None

For instance:
Indicate an example.

2.2.24 - Method 'First'

Summary: Locate the cursor at the beginning of an index, and fetch the record.
2.2.25 - Method 'LastPK'

Summary: Locate the cursor at the ending of the primary key, and fetch the record.
2.2.26 - Method 'SetPK'

Summary: Seeks for the closest next record based on the primary key.
2.2.27 - Method 'IndexCount'

Summary: Count the number of indexes in the table, including the primary key.
2.2.28 - Method 'Count'

Summary: Number of rows in the table.
2.2.29 - Method 'Create'

Summary: Create a new table.
2.2.30 - Method 'Remove'

Summary: Removes a Record.


3 - Accessible Pages

<No page available in this component>

3 - Accessible Windows

<No window is available in this component>

4 - Accessible Reports

<No report available in this component>

5 - Manipulation of Accessible Elements

To handle a component element (window, etc.) by programming, the element must be handled as any other project element:

- to call a procedure: use the usual syntax:
ComponentProcedure(Param1,Param2)

- to use a class: declare a class type variable:
MyVariable is object ComponentClass
Then, the variable can be used as any other usual object variable.

- to open a window: use the Open function and specify the required parameters.
Open(ComponentWindow [, Param1, Param2])

- to print a report: use the iPrintReport function and specify the required parameters.
iPrintReport(ComponentReport [, Param1, Param2])



//CODE
// Our record definition
RecordType is Structure
Key is int
Description is string
END

// Our StarQ database handler, using our primary key field 'Key'
RecordQ is StarQ(index.Using("Key"))

// Declare an Index named 'Description'
IdxName is int = RecordQ.Index(index.Using("Description"))


// Initialize LMDB.DLL
lmdb.lmdb_dll_init()

// Creates and Open the database
RecordQ.Create()

Record is RecordType

// Create sample 1000 rows
FOR i = 1 _TO_ 1000
Record.Key = i
Record.Description = "This is a description for " + i
RecordQ.Put(Record)
END

// The data will be displayed in Description order
RecordQ.First(IdxName, Record)

// Add the first record to the table
TableAddLine(Table, Record.Key, Record.Description)

Illustrations, copies d'écran
none
none
Avis des utilisateurs
(Pour noter la ressource, cliquez sur Ecrire un avis)
Aucun avis ou commentaire ? Soyez le premier !
A PROPOS
EVALUATION :
00Aucune évaluation
TELECHARGEMENTS :
17
PUBLIÉE :
05 août 2020
VERSION :
25
CONCERNE :
WINDEV
Version minimale : 25
TAILLE :
1,4 Mo