Database abstraction layer over SQLite 3. The SQL statements are stored in
module dm_sql
.
Load the last 10 observations into allocatable array observs
:
integer :: rc
type(db_type) :: db
type(observ_type), allocatable :: observs(:)
rc = dm_db_open(db, '/var/dmpack/observ.sqlite')
rc = dm_db_select_observs(db, observs, desc=.true., limit=10)
rc = dm_db_close(db)
Using the iterator interface instead:
integer :: rc ! Return code.
type(db_type) :: db ! Database handle.
type(db_stmt_type) :: db_stmt ! Database statement.
type(observ_type) :: observ ! Returned observation.
rc = dm_db_open(db, '/var/dmpack/observ.sqlite')
do while (dm_is_ok(rc))
rc = dm_db_select_observs(db, db_stmt, observ, desc=.true., limit=10)
if (dm_is_ok(rc)) print '(a)', trim(observ%name)
end do
rc = dm_db_finalize(db_stmt)
rc = dm_db_close(db)
The database functions return E_NONE
if the respective operation was
successful.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | DB_JOURNAL_OFF | = | 0 |
No rollback journals. |
integer, | public, | parameter | :: | DB_JOURNAL_DELETE | = | 1 |
Delete journal (default). |
integer, | public, | parameter | :: | DB_JOURNAL_TRUNCATE | = | 2 |
Delete journal by truncating (may be faster than |
integer, | public, | parameter | :: | DB_JOURNAL_PERSIST | = | 3 |
Overwrite journal instead of deleting (may be faster than deleting or truncating). |
integer, | public, | parameter | :: | DB_JOURNAL_MEMORY | = | 4 |
Store journal in memory (fast, volatile). |
integer, | public, | parameter | :: | DB_JOURNAL_WAL | = | 5 |
Use Write-Ahead Log (WAL) journal. |
integer, | public, | parameter | :: | DB_AUTO_VACUUM_NONE | = | 0 |
No auto-vacuum (default). |
integer, | public, | parameter | :: | DB_AUTO_VACUUM_FULL | = | 1 |
Enable auto-vacuum. |
integer, | public, | parameter | :: | DB_AUTO_VACUUM_INCREMENTAL | = | 2 |
Vacuum requires additional PRAGMA. |
integer, | public, | parameter | :: | DB_TRANS_DEFERRED | = | 0 |
Deferred transaction (default). |
integer, | public, | parameter | :: | DB_TRANS_IMMEDIATE | = | 1 |
Start a new write immediately (may fail with |
integer, | public, | parameter | :: | DB_TRANS_EXCLUSIVE | = | 2 |
No reading while transactions are underway. |
integer, | public, | parameter | :: | DB_APPLICATION_ID | = | int(z'444D31') |
Application id of DMPACK databases ( |
integer, | public, | parameter | :: | DB_USER_VERSION | = | 1 |
Database schema version, increased on updates. |
integer, | public, | parameter | :: | DB_TIMEOUT_DEFAULT | = | 1000 |
Default SQLite 3 busy timeout in mseconds. |
Starts a transaction. Public alias for db_begin()
.
Optional argument mode
may be one of:
DB_TRANS_DEFERRED
DB_TRANS_IMMEDIATE
DB_TRANS_EXCLUSIVE
The default mode is DB_TRANS_DEFERRED
.
Starts a transactions in IMMEDIATE mode. Mode shall be either
DB_TRANS_DEFERRED
, DB_TRANS_IMMEDIATE
, or DB_TRANS_EXLCUSIVE
.
Default is DB_TRANS_IMMEDIATE
.
The function returns the following error codes:
E_DB_TRANSACTION
if the transaction failed.E_INVALID
if the transaction mode is invalid.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(in), | optional | :: | mode |
Transaction mode. |
Generic database insert function.
Adds the given heartbeat to database. The beat data is validated by default.
The function returns the following error codes:
E_DB
if statement reset failed.E_DB_BIND
if value binding failed.E_DB_PREPARE
if statement preparation failed.E_DB_STEP
if step execution failed or no write permission.E_INVALID
if argument beat
is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(beat_type), | intent(inout) | :: | beat |
Beat to insert. |
||
type(db_stmt_type), | intent(inout), | optional | :: | db_stmt |
Database statement type. |
|
logical, | intent(in), | optional | :: | validate |
Validate beat. |
Adds array of beats to database. A transaction is used unless
transaction
is .false.
. The beat data is validated by default.
The function returns the following error codes:
E_DB
if statement reset failed.E_DB_BIND
if value binding failed.E_DB_EXEC
if execution of transaction statement failed.E_DB_PREPARE
if statement preparation failed.E_DB_ROLLBACK
if transaction rollback failed.E_DB_STEP
if step execution failed or no write permission.E_DB_TRANSACTION
if transaction failed.E_EMPTY
if array beats
is empty.E_INVALID
if an element in beats
is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(beat_type), | intent(inout) | :: | beats(:) |
Beat type array. |
||
logical, | intent(in), | optional | :: | transaction |
Use SQL transaction. |
|
logical, | intent(in), | optional | :: | validate |
Validate beats. |
Adds the given log to database. The log data is validated by default.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_PREPARE
if statement preparation failed.E_DB_STEP
if step execution failed or no write permission.E_INVALID
if argument log
is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(log_type), | intent(inout) | :: | log |
Log message to insert. |
||
logical, | intent(in), | optional | :: | validate |
Validate log. |
Adds the given node to database. The node data is validated by default.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_PREPARE
if statement preparation failed.E_DB_STEP
if step execution failed or no write permission.E_INVALID
if argument node
is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(node_type), | intent(inout) | :: | node |
Node to insert. |
||
logical, | intent(in), | optional | :: | validate |
Validate node. |
Adds single observation to database, including receivers, requests, and responses. If the insert query fails, the transaction will be rolled back, i.e., no part of the observation is written to the database on error. The observation data is validated by default.
The function returns the following error codes:
E_DB
if statement reset failed.E_DB_BIND
if value binding failed.E_DB_EXEC
if execution of transaction statement failed.E_DB_PREPARE
if statement preparation failed.E_DB_ROLLBACK
if transaction rollback failed.E_DB_STEP
if step execution failed or no write permission.E_DB_TRANSACTION
if transaction failed.E_INVALID
if argument observ
is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_type), | intent(inout) | :: | observ |
Observation type. |
||
type(db_stmt_type), | intent(inout), | optional | :: | db_stmt |
Database statement type. |
|
logical, | intent(in), | optional | :: | validate |
Validate observation. |
Adds array of observations to database. A transaction is used unless
transaction
is .false.
. The observation data is validated by
default.
The function returns the following error codes:
E_DB
if statement reset failed.E_DB_BIND
if value binding failed.E_DB_EXEC
if execution of transaction statement failed.E_DB_PREPARE
if statement preparation failed.E_DB_ROLLBACK
if transaction rollback failed.E_DB_STEP
if step execution failed or no write permission.E_DB_TRANSACTION
if transaction failed.E_EMPTY
if array observs
is empty.E_INVALID
if an element in observs
is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_type), | intent(inout) | :: | observs(:) |
Observation type array. |
||
logical, | intent(in), | optional | :: | transaction |
Use SQL transaction. |
|
logical, | intent(in), | optional | :: | validate |
Validate observations. |
Adds given sensor to database. The sensor data is validated by default.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_PREPARE
if statement preparation failed.E_DB_STEP
if step execution failed or no write permission.E_INVALID
if argument sensor
is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sensor_type), | intent(inout) | :: | sensor |
Sensor to insert. |
||
logical, | intent(in), | optional | :: | validate |
Validate sensor. |
Adds given target to database. The target data is validated by default.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_PREPARE
if statement preparation failed.E_DB_STEP
if step execution failed or no write permission.E_INVALID
if argument target
is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(target_type), | intent(inout) | :: | target |
Target to insert. |
||
logical, | intent(in), | optional | :: | validate |
Validate target. |
Generic database select function.
Returns heartbeat associated with given node id in beat
.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(beat_type), | intent(out) | :: | beat |
Returned beat type. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns log associated with given id in log
.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(log_type), | intent(out) | :: | log |
Returned log data. |
||
character(len=*), | intent(in) | :: | log_id |
Log id. |
Returns node data associated with given id in node
.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(node_type), | intent(out) | :: | node |
Returned node data. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns observation referenced by the given id from database.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_FINALIZE
if statement finalisation failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_type), | intent(out) | :: | observ |
Selected observation. |
||
character(len=*), | intent(in) | :: | observ_id |
Observation id (UUID). |
Returns sensor data associated with given sensor id from database.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sensor_type), | intent(out) | :: | sensor |
Returned sensor data. |
||
character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
Returns target data associated with given target id from database.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(target_type), | intent(out) | :: | target |
Returned target data. |
||
character(len=*), | intent(in) | :: | target_id |
Target id. |
Generic beats select function.
Returns heatbeats from database in array beats
. An optional limit
may be passed in limit
.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(beat_type), | intent(out), | allocatable | :: | beats(:) |
Returned beat types. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of beats. |
|
integer(kind=i8), | intent(out), | optional | :: | nbeats |
Total number of beats in database. |
Iterator function that returns heatbeats from database in beat
. An
optional limit may be passed in limit
. The statement db_stmt
must be finalised once finished.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no more rows are available.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
type(beat_type), | intent(out) | :: | beat |
Returned beat type. |
||
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of beats. |
Generic data points select function.
Returns data points from observations database in dps
. This
function selects only responses of error E_NONE
, unless argument
error
is passed, then only of the given error code.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_BIND
if value binding failed.E_DB_FINALIZE
if statement finalisation failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(dp_type), | intent(out), | allocatable | :: | dps(:) |
Returned data points. |
|
character(len=*), | intent(in) | :: | node_id |
Node id. |
||
character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
||
character(len=*), | intent(in) | :: | target_id |
Target id. |
||
character(len=*), | intent(in) | :: | response_name |
Response name. |
||
character(len=*), | intent(in) | :: | from |
Beginning of time span. |
||
character(len=*), | intent(in) | :: | to |
End of time span. |
||
integer, | intent(in), | optional | :: | error |
Response error code. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of data points. |
|
integer(kind=i8), | intent(out), | optional | :: | npoints |
Number of data points. |
Iterator function that returns data points from observations
database in dp
. This function selects only responses of error
E_NONE
, unless argument error
is passed, then only of the given
error code. The statement db_stmt
must be finalised once finished.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no more rows are available.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
type(dp_type), | intent(out) | :: | dp |
Returned data point. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
||
character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
||
character(len=*), | intent(in) | :: | target_id |
Target id. |
||
character(len=*), | intent(in) | :: | response_name |
Response name. |
||
character(len=*), | intent(in) | :: | from |
Beginning of time span. |
||
character(len=*), | intent(in) | :: | to |
End of time span. |
||
integer, | intent(in), | optional | :: | error |
Response error code. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of data points. |
Generic JSON logs select function.
Returns beats in JSON format in allocatable string type array
strings
.
If no beats have been found, the array will be empty, and the
function returns E_DB_NO_ROWS
.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(string_type), | intent(out), | allocatable | :: | strings(:) |
Returned JSON array. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of beats. |
|
integer(kind=i8), | intent(out), | optional | :: | nbeats |
Number of beats. |
Iterator function that returns beats in JSON format in allocatable
string json
. The statement db_stmt
must be finalised once
finished.
If no beats have been found, the string will be empty, and the
function returns E_DB_NO_ROWS
.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
character(len=:), | intent(out), | allocatable | :: | json |
Returned JSON. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of beats. |
Generic JSON logs select function.
Returns logs in JSON format in allocatable string type array
strings
.
If no logs have been found, the array will be empty, and the
function returns E_DB_NO_ROWS
.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_BIND
if value binding failed.E_DB_FINALIZE
if statement finalisation failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(string_type), | intent(out), | allocatable | :: | strings(:) |
Returned JSON array. |
|
character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
character(len=*), | intent(in), | optional | :: | sensor_id |
Sensor id. |
|
character(len=*), | intent(in), | optional | :: | target_id |
Target id. |
|
character(len=*), | intent(in), | optional | :: | source |
Source name. |
|
character(len=*), | intent(in), | optional | :: | from |
Begin of time range. |
|
character(len=*), | intent(in), | optional | :: | to |
End of time range. |
|
integer, | intent(in), | optional | :: | min_level |
Minimum log level. |
|
integer, | intent(in), | optional | :: | max_level |
Maximum log level. |
|
integer, | intent(in), | optional | :: | error |
Error code. |
|
logical, | intent(in), | optional | :: | desc |
Descending order. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. numbers of logs. |
|
integer(kind=i8), | intent(out), | optional | :: | nlogs |
Number of logs. |
Iterator function that returns logs in JSON format in allocatable
character json
. The statement db_stmt
must be finalised once
finished.
If no logs have been found, the string will be empty, and the
function returns E_DB_NO_ROWS
.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
character(len=:), | intent(out), | allocatable | :: | json |
Returned JSON. |
|
character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
character(len=*), | intent(in), | optional | :: | sensor_id |
Sensor id. |
|
character(len=*), | intent(in), | optional | :: | target_id |
Target id. |
|
character(len=*), | intent(in), | optional | :: | source |
Source name. |
|
character(len=*), | intent(in), | optional | :: | from |
Begin of time range. |
|
character(len=*), | intent(in), | optional | :: | to |
End of time range. |
|
integer, | intent(in), | optional | :: | min_level |
Minimum log level. |
|
integer, | intent(in), | optional | :: | max_level |
Maximum log level. |
|
integer, | intent(in), | optional | :: | error |
Error code. |
|
logical, | intent(in), | optional | :: | desc |
Descending order. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. numbers of logs. |
Generic JSON nodes select function.
Returns nodes in JSON format in allocatable string type array
strings
.
If no nodes have been found, the array will be empty, and the
function returns E_DB_NO_ROWS
.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(string_type), | intent(out), | allocatable | :: | strings(:) |
Returned JSON array. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of nodes. |
|
integer(kind=i8), | intent(out), | optional | :: | nnodes |
Number of nodes. |
Iterator function that returns nodes in JSON format in allocatable
string json
. The statement db_stmt
must be finalised once
finished.
If no nodes have been found, the string will be empty, and the
function returns E_DB_NO_ROWS
.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
character(len=:), | intent(out), | allocatable | :: | json |
Returned JSON. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of nodes. |
Generic logs select function.
Returns logs in allocatable array logs
.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_BIND
if value binding failed.E_DB_FINALIZE
if statement finalisation failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(log_type), | intent(out), | allocatable | :: | logs(:) |
Returned log data array. |
|
character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
character(len=*), | intent(in), | optional | :: | sensor_id |
Sensor id. |
|
character(len=*), | intent(in), | optional | :: | target_id |
Target id. |
|
character(len=*), | intent(in), | optional | :: | source |
Source name. |
|
character(len=*), | intent(in), | optional | :: | from |
Begin of time range. |
|
character(len=*), | intent(in), | optional | :: | to |
End of time range. |
|
integer, | intent(in), | optional | :: | min_level |
Minimum log level. |
|
integer, | intent(in), | optional | :: | max_level |
Maximum log level. |
|
integer, | intent(in), | optional | :: | error |
Error code. |
|
logical, | intent(in), | optional | :: | desc |
Descending order. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. numbers of logs. |
|
integer(kind=i8), | intent(out), | optional | :: | nlogs |
Total number of logs. |
Iterator function that returns logs in logs
. The statement
db_stmt
must be finalised once finished.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
type(log_type), | intent(out) | :: | log |
Returned log type. |
||
character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
character(len=*), | intent(in), | optional | :: | sensor_id |
Sensor id. |
|
character(len=*), | intent(in), | optional | :: | target_id |
Target id. |
|
character(len=*), | intent(in), | optional | :: | source |
Source name. |
|
character(len=*), | intent(in), | optional | :: | from |
Begin of time range. |
|
character(len=*), | intent(in), | optional | :: | to |
End of time range. |
|
integer, | intent(in), | optional | :: | min_level |
Minimum log level. |
|
integer, | intent(in), | optional | :: | max_level |
Maximum log level. |
|
integer, | intent(in), | optional | :: | error |
Error code. |
|
logical, | intent(in), | optional | :: | desc |
Descending order. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. numbers of logs. |
Generic nodes select function.
Returns all sensor nodes in allocatable array nodes
.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(node_type), | intent(out), | allocatable | :: | nodes(:) |
Returned node data array. |
|
integer(kind=i8), | intent(out), | optional | :: | nnodes |
Number of nodes. |
Iterator function that returns all sensor nodes in node
. The
statement db_stmt
must be finalised once finished.
The function returns the following error codes:
E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
type(node_type), | intent(out) | :: | node |
Returned node data. |
Generic observations select function.
Returns observations in observs
, with optional node id, sensor id,
target id, from, to. By default, observations are returned in
ascending order, unless desc
is passed and .true.
. The maximum
number of observations may be passed in limit
.
The stub
is .true.
, neither receivers nor requests are read from
database.
The total number of observations is returned in optional argument
nobservs
.
Calling this function is usually slower than
db_select_observs_by_id()
or db_select_observs_by_time()
.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_BIND
if value binding failed.E_DB_FINALIZE
if statement finalisation failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_type), | intent(out), | allocatable | :: | observs(:) |
Returned observation data. |
|
character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
character(len=*), | intent(in), | optional | :: | sensor_id |
Sensor id. |
|
character(len=*), | intent(in), | optional | :: | target_id |
Target id. |
|
character(len=*), | intent(in), | optional | :: | from |
Beginning of time span. |
|
character(len=*), | intent(in), | optional | :: | to |
End of time span. |
|
logical, | intent(in), | optional | :: | desc |
Descending order. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of observations. |
|
logical, | intent(in), | optional | :: | stub |
Without receivers, requests, responses. |
|
integer(kind=i8), | intent(out), | optional | :: | nobservs |
Total number of observations (may be greater than limit). |
Iterator function that returns observations in observ
, with
optional node id, sensor id, target id, from, to. By default,
observations are returned in ascending order, unless desc
is
passed and .true.
. The maximum number of observations may be
passed in limit
. The statement db_stmt
must be finalised once
finished.
The stub
is .true.
, neither receivers nor requests are read from
database.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
type(observ_type), | intent(out) | :: | observ |
Returned observation type. |
||
character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
character(len=*), | intent(in), | optional | :: | sensor_id |
Sensor id. |
|
character(len=*), | intent(in), | optional | :: | target_id |
Target id. |
|
character(len=*), | intent(in), | optional | :: | from |
Beginning of time span. |
|
character(len=*), | intent(in), | optional | :: | to |
End of time span. |
|
logical, | intent(in), | optional | :: | desc |
Descending order. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of observations. |
|
logical, | intent(in), | optional | :: | stub |
Without receivers, requests, responses. |
Generic sensors select function.
Returns all sensors in allocatable array sensors
.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sensor_type), | intent(out), | allocatable | :: | sensors(:) |
Returned sensor data array. |
|
integer(kind=i8), | intent(out), | optional | :: | nsensors |
Number of returned sensors. |
Iterator function that returns all sensors in sensor
. The
statement db_stmt
must be finalised once finished.
The function returns the following error codes:
E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
type(sensor_type), | intent(out) | :: | sensor |
Returned sensor data. |
Returns all sensors of node node_id
in allocatable array sensors
.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_INVALID
if node id is empty.E_DB_BIND
if value binding failed.E_DB_FINALIZE
if statement finalisation failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
||
type(sensor_type), | intent(out), | allocatable | :: | sensors(:) |
Returned sensor data array. |
|
integer(kind=i8), | intent(out), | optional | :: | nsensors |
Number of returned sensors. |
Iterator function that returns all sensors of node node_id
in
sensor
. The statement db_stmt
must be finalised once finished.
The function returns the following error codes:
E_INVALID
if node id is empty.E_DB_BIND
if value binding failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
||
type(sensor_type), | intent(out) | :: | sensor |
Returned sensor data. |
Generic targets select function.
Returns number of targets and array of target data in allocatable
array targets
, if query was successful.
The function returns the following error codes:
E_ALLOC
if memory allocation failed.E_DB_NO_ROWS
if no rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(target_type), | intent(out), | allocatable | :: | targets(:) |
Target data array. |
|
integer(kind=i8), | intent(out), | optional | :: | ntargets |
Number of selected targets. |
Iterator function that returns all targets in target
. The
statement db_stmt
must be finalised once finished.
The function returns the following error codes:
E_DB_NO_ROWS
if no more rows are returned.E_DB_PREPARE
if statement preparation failed.E_DB_TYPE
if returned columns are unexpected.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
||
type(target_type), | intent(out) | :: | target |
Target data. |
Generic database update function.
Updates the given node in database. The node data is validated by default.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_PREPARE
if statement preparation failed.E_DB_STEP
if step execution failed or no write permission.E_INVALID
if node is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(node_type), | intent(inout) | :: | node |
Node to update. |
||
logical, | intent(in), | optional | :: | validate |
Validate node. |
Updates given sensor in database. The sensor data is validated by default.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_PREPARE
if statement preparation failed.E_DB_STEP
if step execution failed or no write permission.E_INVALID
if sensor is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sensor_type), | intent(inout) | :: | sensor |
Sensor to update. |
||
logical, | intent(in), | optional | :: | validate |
Validate sensor. |
Updates the given target in database. The target data is validated by default.
The function returns the following error codes:
E_DB_BIND
if value binding failed.E_DB_PREPARE
if statement preparation failed.E_DB_STEP
if step execution failed or no write permission.E_INVALID
if target is invalid.E_READ_ONLY
if database is opened read-only.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(target_type), | intent(inout) | :: | target |
Target to update. |
||
logical, | intent(in), | optional | :: | validate |
Validate target. |
C-interoperable callback function that is invoked on error
SQL_BUSY
. May return 0 to signal that no more invocations are
desired.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(c_ptr), | intent(in), | value | :: | client_data |
Client data. |
|
integer(kind=c_int), | intent(in), | value | :: | n |
Number of times the busy callback has been invoked previously. |
Returns value.
Callback routine that is invoked if passed to dm_db_backup()
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | remaining |
Remaining pages. |
||
integer, | intent(in) | :: | page_count |
Total number of pages. |
C-interoperable callback routine that is invoked for each created SQLite log.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(c_ptr), | intent(in), | value | :: | client_data |
Client data. |
|
integer(kind=c_int), | intent(in), | value | :: | err_code |
SQLite error code. |
|
type(c_ptr), | intent(in), | value | :: | err_msg_ptr |
SQLite error message. |
C-interoperable callback routine that is invoked on database updates.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(c_ptr), | intent(in), | value | :: | client_data |
Client data. |
|
integer(kind=c_int), | intent(in), | value | :: | type |
Database operation. |
|
type(c_ptr), | intent(in), | value | :: | db_name |
Database name. |
|
type(c_ptr), | intent(in), | value | :: | table_name |
Table name. |
|
integer(kind=c_int64_t), | intent(in), | value | :: | row_id |
Row id. |
Opaque SQLite database connectivity type.
Opaque SQLite database statement type.
Attaches the database at path
to the current connection. If no name
is passed for the attached database, the name will be set to
attached
. The function trims the given path and name strings.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | path |
Path of database to attach. |
||
character(len=*), | intent(in), | optional | :: | name |
Name of attached database. |
Creates online backup of given database. The functions assumes 500 steps and a sleep time of 250 msec by default, if the arguments are not passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | path |
File path of backup database to be created. |
||
logical, | intent(in), | optional | :: | wal |
Enable WAL mode for backup. |
|
procedure(dm_db_backup_callback), | optional | :: | callback |
Progress callback routine. |
||
integer, | intent(in), | optional | :: | nsteps |
Number of steps per iteration (default: 500). |
|
integer, | intent(in), | optional | :: | sleep_time |
Sleep time per iteration in msec (default: 250 msec). |
Closes connection to SQLite database. Optimises the database if
optimize
is .true.
. Returns E_DB
on error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
logical, | intent(in), | optional | :: | optimize |
Optimise on close. |
Ends transaction and commits changes to database. On error, does a
rollback automatically. Returns E_DB_ROLLBACK
if the rollback
failed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
Returns number of rows in table beats
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table logs
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table nodes
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table observs
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table receivers
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table requests
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table responses
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table sensors
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table sensors
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table sync_logs
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table sync_nodes
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table sync_observs
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table sync_sensors
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Returns number of rows in table sync_sensors
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer(kind=i8), | intent(out) | :: | n |
Number of rows in table. |
Creates logs table in given database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
Creates logs table in given database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
logical, | intent(in), | optional | :: | sync |
Create synchronisation tables. |
Initialises a connected SQLite 3 database by creating all necessary tables if they do not exist already. The function also creates additional indices and triggers on the tables.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
logical, | intent(in), | optional | :: | sync |
Create synchronisation tables. |
Deletes heartbeat from database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
Deletes log from database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | log_id |
Log id. |
Deletes node from database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
Deletes observation from database. The function expects the SQLite
trigger delete_observ_trigger
as defined in module dm_sql
to be
present in the database, in order to delete receivers, requests, and
responses automatically.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | observ_id |
Observation id. |
Deletes sensor of given id from database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
Deletes target from database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | target_id |
Target id. |
Detaches database from the current connection. If no name is passed
for the attached database, the name is assumed to be attached
. The
function trims the given name string. Returns E_DB_DETACH
on error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in), | optional | :: | name |
Name of attached database. |
Returns last database error as DMPACK error code, optionally the
SQLite error code in argument sqlite_error
. This function matches
an SQLite error code to the corresponding DMPACK error code. For
example, if the last SQLite error is SQLITE_OK
, the function
returns E_NONE
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(out), | optional | :: | sqlite_error |
SQLite error code. |
Returns last SQLite error message.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
Error message.
Finalises given database statement. Returns E_DB_FINALIZE
on
error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Database statement type. |
Returns application id of database in id
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(out) | :: | id |
Database application id. |
Returns data version in version
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(out) | :: | version |
Data version. |
Returns status of foreign keys contraint in enabled
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
logical, | intent(out) | :: | enabled |
Foreign keys constraint is enabled. |
Returns journal mode of database in mode
. The name of the mode is
optionally passed in name
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(out) | :: | mode |
Journal mode. |
||
character(len=:), | intent(out), | optional, | allocatable | :: | name |
Journal mode name. |
Returns status of query-only pragma in enabled
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
logical, | intent(out) | :: | enabled |
Query-only mode is enabled. |
Returns user version of database in version
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(out) | :: | version |
Database user version. |
Returns .true.
if log id exists.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | log_id |
Log id (UUID). |
Returns .true.
if node id exists.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns .true.
if observation id exists.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | observ_id |
Observation id (UUID). |
Returns .true.
if given table exists in database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(in) | :: | table |
Table enumerator. |
Returns .true.
if target id exists.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | target_id |
Target id. |
Initialises SQLite backend. Returns E_DB
on error.
Adds the given heartbeat to database. The beat data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(beat_type), | intent(inout) | :: | beat |
Beat to insert. |
||
type(db_stmt_type), | intent(inout), | optional | :: | db_stmt |
Database statement type. |
|
logical, | intent(in), | optional | :: | validate |
Validate beat. |
Adds array of beats to database. A transaction is used unless
transaction
is .false.
. The beat data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(beat_type), | intent(inout) | :: | beats(:) |
Beat type array. |
||
logical, | intent(in), | optional | :: | transaction |
Use SQL transaction. |
|
logical, | intent(in), | optional | :: | validate |
Validate beats. |
Adds the given log to database. The log data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(log_type), | intent(inout) | :: | log |
Log message to insert. |
||
logical, | intent(in), | optional | :: | validate |
Validate log. |
Adds the given node to database. The node data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(node_type), | intent(inout) | :: | node |
Node to insert. |
||
logical, | intent(in), | optional | :: | validate |
Validate node. |
Adds single observation to database, including receivers, requests, and responses. If the insert query fails, the transaction will be rolled back, i.e., no part of the observation is written to the database on error. The observation data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_type), | intent(inout) | :: | observ |
Observation type. |
||
type(db_stmt_type), | intent(inout), | optional | :: | db_stmt |
Database statement type. |
|
logical, | intent(in), | optional | :: | validate |
Validate observation. |
Adds array of observations to database. A transaction is used unless
transaction
is .false.
. The observation data is validated by
default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_type), | intent(inout) | :: | observs(:) |
Observation type array. |
||
logical, | intent(in), | optional | :: | transaction |
Use SQL transaction. |
|
logical, | intent(in), | optional | :: | validate |
Validate observations. |
Adds given sensor to database. The sensor data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sensor_type), | intent(inout) | :: | sensor |
Sensor to insert. |
||
logical, | intent(in), | optional | :: | validate |
Validate sensor. |
Wrapper function that inserts or replaces given sync data into database. Sync data must have a valid type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or replaces given log sync data into database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or replaces given node sync data into database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or replaces given observation sync data into database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or replaces given sensor sync data into database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or replaces given target sync data into database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Adds given target to database. The target data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(target_type), | intent(inout) | :: | target |
Target to insert. |
||
logical, | intent(in), | optional | :: | validate |
Validate target. |
Returns .true.
if database type has associated pointer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
Returns .true.
if database is in read-only mode. This function
checks only the opaque database type for the read-only flag. It is
still possible to enable ready-only access by calling
dm_db_set_query_only()
. The function dm_db_get_query_only()
returns the status of the query_only
pragma.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
Returns true if SQLite 3 was compiled threadsafe.
Opens connection to the SQLite database at path
, or creates a new
database with given file path if create
is passed and .true.
.
The foreign key constraint is enabled unless foreign_keys
is
.false.
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | path |
File path of database. |
||
logical, | intent(in), | optional | :: | create |
Create flag (off by default). |
|
logical, | intent(in), | optional | :: | foreign_keys |
Foreign keys contraint flag (on by default). |
|
logical, | intent(in), | optional | :: | read_only |
Read-only mode (off by default). |
|
logical, | intent(in), | optional | :: | threaded |
Threaded access flag (off by default). |
|
integer, | intent(in), | optional | :: | timeout |
Busy timeout in mseconds (0 by default). |
|
logical, | intent(in), | optional | :: | validate |
Validate application id (off by default). |
|
logical, | intent(in), | optional | :: | wal |
WAL journal mode flag (off by default). |
Attempts to optimise the database. All schemas are optimised.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
Returns .true.
if given statement has been prepared.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_stmt_type), | intent(inout) | :: | db_stmt |
Rolls a transaction back. Returns E_DB_ROLLBACK
on error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
Returns heartbeat associated with given node id in beat
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(beat_type), | intent(out) | :: | beat |
Returned beat type. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns heartbeat associated with given node id as allocatable
character json
in JSON format.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=:), | intent(out), | allocatable | :: | json |
Returned JSON. |
|
character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns log associated with given id as allocatable character in
JSON format in json
. If no log has been found, the string will
be empty and the function returns E_DB_NO_ROWS
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=:), | intent(out), | allocatable | :: | json |
Returned JSON. |
|
character(len=*), | intent(in) | :: | log_id |
Log id. |
Returns nodes associated with given node id as allocatable character
json
in JSON format.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=:), | intent(out), | allocatable | :: | json |
Returned JSON. |
|
character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns log associated with given id in log
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(log_type), | intent(out) | :: | log |
Returned log data. |
||
character(len=*), | intent(in) | :: | log_id |
Log id. |
Returns logs by observation id in allocatable array logs
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(log_type), | intent(out), | allocatable | :: | logs(:) |
Returned log data array. |
|
character(len=*), | intent(in) | :: | observ_id |
Observation id. |
||
integer(kind=i8), | intent(out), | optional | :: | nlogs |
Number of logs. |
Returns node data associated with given id in node
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(node_type), | intent(out) | :: | node |
Returned node data. |
||
character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns observation referenced by the given id from database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_type), | intent(out) | :: | observ |
Selected observation. |
||
character(len=*), | intent(in) | :: | observ_id |
Observation id (UUID). |
Returns observation ids in ids
, with optional node id, sensor id,
target id, from, to. By default, ids are returned ordered by
ascending observation timestamp, unless desc
is passed and
.true.
. The maximum number of ids may be passed in limit
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=ID_LEN), | intent(out), | allocatable | :: | ids(:) |
Returned observation ids. |
|
character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
character(len=*), | intent(in), | optional | :: | sensor_id |
Sensor id. |
|
character(len=*), | intent(in), | optional | :: | target_id |
Target id. |
|
character(len=*), | intent(in), | optional | :: | from |
Beginning of time span. |
|
character(len=*), | intent(in), | optional | :: | to |
End of time span. |
|
logical, | intent(in), | optional | :: | desc |
Descending order. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of observations. |
|
integer(kind=i8), | intent(out), | optional | :: | nids |
Total number of observation ids (may be greater than limit). |
Returns observation views of the given time range from database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_view_type), | intent(out), | allocatable | :: | views(:) |
Returned observation views. |
|
character(len=*), | intent(in) | :: | node_id |
Node id. |
||
character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
||
character(len=*), | intent(in) | :: | target_id |
Target id. |
||
character(len=*), | intent(in) | :: | response_name |
Response name. |
||
character(len=*), | intent(in) | :: | from |
Beginning of time span. |
||
character(len=*), | intent(in) | :: | to |
End of time span. |
||
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of views. |
|
integer(kind=i8), | intent(out), | optional | :: | nviews |
Total number of views (may be greater than limit). |
Returns observations of a given id range in observs
. The argument
after
is the id of the observation after which the range starts,
before
the id of the observation that limits the range.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_type), | intent(out), | allocatable | :: | observs(:) |
Returned observation data. |
|
character(len=*), | intent(in) | :: | after |
Id of observation with timestamp before first of range. |
||
character(len=*), | intent(in), | optional | :: | before |
Id of observation with timestamp after last of range. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of observations. |
|
logical, | intent(in), | optional | :: | stub |
Without receivers, requests, responses. |
|
integer(kind=i8), | intent(out), | optional | :: | nobservs |
Total number of observations (may be greater than limit). |
Returns observations of a given time span in observs
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(observ_type), | intent(out), | allocatable | :: | observs(:) |
Returned observation data. |
|
character(len=*), | intent(in) | :: | node_id |
Node id. |
||
character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
||
character(len=*), | intent(in) | :: | target_id |
Target id. |
||
character(len=*), | intent(in) | :: | from |
Beginning of time span. |
||
character(len=*), | intent(in) | :: | to |
End of time span. |
||
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of observations. |
|
logical, | intent(in), | optional | :: | stub |
No receivers, requests, responses. |
|
integer(kind=i8), | intent(out), | optional | :: | nobservs |
Total number of observations (may be greater than limit). |
Returns sensor data associated with given sensor id from database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sensor_type), | intent(out) | :: | sensor |
Returned sensor data. |
||
character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
Returns log synchronisation data (oldest not transmitted log).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out) | :: | sync |
Returned sync data. |
Returns log synchronisation data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out), | allocatable | :: | syncs(:) |
Returned sync data. |
|
integer(kind=i8), | intent(out), | optional | :: | nsyncs |
Array size. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of sync data to fetch. |
Returns node synchronisation data (oldest not transmitted node).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out) | :: | sync |
Returned sync data. |
Returns node synchronisation data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out), | allocatable | :: | syncs(:) |
Returned sync data. |
|
integer(kind=i8), | intent(out), | optional | :: | nsyncs |
Array size. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of sync data to fetch. |
Returns observation synchronisation data (oldest not transmitted observation).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out) | :: | sync |
Returned sync data. |
Returns observation synchronisation data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out), | allocatable | :: | syncs(:) |
Returned sync data. |
|
integer(kind=i8), | intent(out), | optional | :: | nsyncs |
Array size. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of sync data to fetch. |
Returns sensor synchronisation data (oldest not transmitted sensor).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out) | :: | sync |
Returned sync data. |
Returns sensor synchronisation data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out), | allocatable | :: | syncs(:) |
Returned sync data. |
|
integer(kind=i8), | intent(out), | optional | :: | nsyncs |
Array size. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of sync data to fetch. |
Returns target synchronisation data (oldest not transmitted target).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out) | :: | sync |
Returned sync data. |
Returns sensor synchronisation data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sync_type), | intent(out), | allocatable | :: | syncs(:) |
Returned sync data. |
|
integer(kind=i8), | intent(out), | optional | :: | nsyncs |
Array size. |
|
integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of sync data to fetch. |
Returns an array containing the names of all tables in the given database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=SQL_TABLE_NAME_LEN), | intent(out), | allocatable | :: | tables(:) |
Array of tables. |
Returns target data associated with given target id from database.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(target_type), | intent(out) | :: | target |
Returned target data. |
||
character(len=*), | intent(in) | :: | target_id |
Target id. |
Returns .true.
if sensor id exists.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
Set the 32-bit signed big-endian “Application ID” integer located at offset 68 into the database header.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(in) | :: | id |
Application id. |
Auto-vacuuming is only possible if the database stores some additional information that allows each database page to be traced backwards to its referrer. Therefore, auto-vacuuming must be turned on before any tables are created. It is not possible to enable or disable auto-vacuum after a table has been created.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(in) | :: | mode |
Database auto vacuum mode. |
Sets SQLite busy callback that is invoked whenever the database is busy.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
procedure(dm_db_busy_callback) | :: | callback |
Callback function. |
|||
type(c_ptr), | intent(in) | :: | client_data |
C pointer to client data. |
Sets SQLite busy timeout in msec. Returns E_DB
on error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(in) | :: | msec |
Timeout in mseconds. |
Sets foreign keys constraint.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
logical, | intent(in) | :: | enabled |
Enable foreign keys constraint. |
Sets journal mode.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(in) | :: | mode |
Journal mode. |
Sets SQLite error log callback. The dummy argument client_data
is
passed to the callback routine. The function returns E_DB
on error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
procedure(dm_db_log_callback) | :: | callback |
Callback routine. |
|||
type(c_ptr), | intent(in), | optional | :: | client_data |
C pointer to client data. |
Sets query-only pragma.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
logical, | intent(in) | :: | enabled |
Enable query-only mode. |
Sets SQLite error log callback. The dummy argument client_data
is
passed to the callback routine. The function returns E_DB
on error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
procedure(dm_db_update_callback) | :: | callback |
Callback routine. |
|||
type(c_ptr), | intent(in), | optional | :: | client_data |
C pointer to client data. |
Sets database user version.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
integer, | intent(in) | :: | version |
Database user version. |
Finalises SQLite handle. Returns E_DB
on error.
Updates the given node in database. The node data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(node_type), | intent(inout) | :: | node |
Node to update. |
||
logical, | intent(in), | optional | :: | validate |
Validate node. |
Updates given sensor in database. The sensor data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(sensor_type), | intent(inout) | :: | sensor |
Sensor to update. |
||
logical, | intent(in), | optional | :: | validate |
Validate sensor. |
Updates the given target in database. The target data is validated by default.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
type(target_type), | intent(inout) | :: | target |
Target to update. |
||
logical, | intent(in), | optional | :: | validate |
Validate target. |
Vacuums database schema main
, or, if into
is passed, vacuums
it into new database at given path.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
||
character(len=*), | intent(in), | optional | :: | into |
File path to vacuum database. |
Validates an opened DMPACK database. The application id must match
the constant DB_APPLICATION_ID
, and the user version must be equal
to DB_USER_VERSION
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(db_type), | intent(inout) | :: | db |
Database type. |
Returns SQLite 3 library version as allocatable string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in), | optional | :: | name |
Add prefix `libsqlite/'. |
Sends log message to SQLite error log handler. The callback has to
be set through dm_db_set_log_callback()
initially.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | err_code |
Error code. |
||
character(len=*), | intent(in) | :: | err_msg |
Error message. |
Delays execution for given duration in msec.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | msec |
Time in [msec]. |