Database API module for CRUD operations, based on the core module
dm_db. 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)
call dm_db_close(db)
Using the iterator interface instead:
integer :: rc ! Return code.
type(db_type) :: db ! Database handle.
type(db_stmt_type) :: dbs ! Database statement.
type(observ_type) :: observ ! Returned observation.
rc = dm_db_open(db, '/var/dmpack/observ.sqlite')
call dm_error_out(rc, fatal=.true.)
do
rc = dm_db_select_observs(db, dbs, observ, desc=.true., limit=10)
if (rc /= E_NONE) exit
print '(a)', trim(observ%name)
end do
call dm_db_finalize(dbs)
call dm_db_close(db)
The database select function returns E_DONE once finished.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| 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_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_JOURNAL_WAL2 | = | 6 |
Use Write-Ahead Log 2 (WAL2) journal. |
| integer, | public, | parameter | :: | DB_JOURNAL_LAST | = | 6 |
Never use this. |
| integer, | public, | parameter | :: | DB_LOCKING_MODE_NORMAL | = | 0 |
Normal locking mode. |
| integer, | public, | parameter | :: | DB_LOCKING_MODE_EXCLUSIVE | = | 1 |
Exclusive locking mode. |
| integer, | public, | parameter | :: | DB_SYNCHRONOUS_OFF | = | 0 |
SQLite continues without syncing as soon as it has handed data off to the operating system. |
| integer, | public, | parameter | :: | DB_SYNCHRONOUS_NORMAL | = | 1 |
SQLite will still sync at the most critical moments, but less often than in FULL mode. |
| integer, | public, | parameter | :: | DB_SYNCHRONOUS_FULL | = | 2 |
Default mode, SQLite will use the xSync method of the VFS to ensure that all content is safely written to the disk surface prior to continuing. |
| integer, | public, | parameter | :: | DB_SYNCHRONOUS_EXTRA | = | 3 |
Like FULL with the addition that the directory containing a rollback journal is synced after that journal is unlinked to commit a transaction in DELETE mode. |
| integer, | public, | parameter | :: | DB_TEMP_STORE_DEFAULT | = | 0 |
Default temp store. |
| integer, | public, | parameter | :: | DB_TEMP_STORE_FILE | = | 1 |
File temp store. |
| integer, | public, | parameter | :: | DB_TEMP_STORE_MEMORY | = | 2 |
Memory temp store. |
| integer, | public, | parameter | :: | DB_APPLICATION_ID | = | int(z'444D31') |
Application id of DMPACK databases ( |
| integer, | public, | parameter | :: | DB_SCHEMA_VERSION | = | 3 |
Database schema version, increased on updates. |
| integer, | public, | parameter | :: | DB_TIMEOUT_DEFAULT | = | 1000 |
Default SQLite 3 busy timeout [msec]. |
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(beat_type), | intent(inout) | :: | beat |
Beat to insert. |
||
| type(db_stmt_type), | intent(inout), | optional | :: | dbs |
Database statement. |
|
| 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(beat_type), | intent(inout) | :: | beats(:) |
Beat type array. |
||
| logical, | intent(in), | optional | :: | transaction |
Use SQL transaction. |
|
| logical, | intent(in), | optional | :: | validate |
Validate beats. |
Adds given image to database. The image 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 image is invalid.E_READ_ONLY if database is opened read-only.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(image_type), | intent(inout) | :: | image |
Image to insert. |
||
| logical, | intent(in), | optional | :: | validate |
Validate image. |
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(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(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(observ_type), | intent(inout) | :: | observ |
Observation. |
||
| type(db_stmt_type), | intent(inout), | optional | :: | dbs |
Database statement. |
|
| 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(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(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(target_type), | intent(inout) | :: | target |
Target to insert. |
||
| logical, | intent(in), | optional | :: | validate |
Validate target. |
Adds given transfer to database. The transfer 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 transfer is invalid.E_READ_ONLY if database is opened read-only.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(transfer_type), | intent(inout) | :: | transfer |
Transfer to insert. |
||
| logical, | intent(in), | optional | :: | validate |
Validate transfer. |
Generic database 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(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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(beat_type), | intent(out) | :: | beat |
Returned beat. |
||
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of beats. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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_STEP if step execution failed.E_DB_TYPE if returned columns are unexpected.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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), | optional | :: | from |
Beginning of time span. |
|
| character(len=*), | intent(in), | optional | :: | to |
End of time span. |
|
| integer, | intent(in), | optional | :: | error |
Response error code. |
|
| logical, | intent(in), | optional | :: | desc |
Descending order. |
|
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of data points. |
|
| integer(kind=i8), | intent(out), | optional | :: | ndps |
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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| 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), | optional | :: | from |
Beginning of time span. |
|
| character(len=*), | intent(in), | optional | :: | to |
End of time span. |
|
| integer, | intent(in), | optional | :: | error |
Response error code. |
|
| logical, | intent(in), | optional | :: | desc |
Descending order. |
|
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of data points. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
Returns images in allocatable array images.
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(image_type), | intent(out), | allocatable | :: | images(:) |
Returned image 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 | :: | from |
Begin of time range. |
|
| character(len=*), | intent(in), | optional | :: | to |
End of time range. |
|
| logical, | intent(in), | optional | :: | desc |
Descending order. |
|
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. numbers of images. |
|
| integer(kind=i8), | intent(out), | optional | :: | nimages |
Total number of images. |
Iterator function that returns images in images. 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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(image_type), | intent(out) | :: | image |
Returned image. |
||
| 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 |
Begin of time range. |
|
| character(len=*), | intent(in), | optional | :: | to |
End of time range. |
|
| logical, | intent(in), | optional | :: | desc |
Descending order. |
|
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. numbers of images. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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(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 | :: | observ_id |
Observation 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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(log_type), | intent(out) | :: | log |
Returned log. |
||
| 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 | :: | observ_id |
Observation 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. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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(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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(node_type), | intent(out) | :: | node |
Returned node data. |
||
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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.
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(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 |
Number of observations. |
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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(observ_type), | intent(out) | :: | observ |
Returned observation. |
||
| 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. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
Returns all sensors in allocatable array sensors. If argument
node_id is passed, returns only sensors of this node.
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.E_INVALID if node id is empty.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(sensor_type), | intent(out), | allocatable | :: | sensors(:) |
Returned sensor data array. |
|
| character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
| 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_DONE if statement finished.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if node id is empty.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(sensor_type), | intent(out) | :: | sensor |
Returned sensor data. |
||
| character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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(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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(target_type), | intent(out) | :: | target |
Target data. |
||
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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 beat does not exist.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if id is invalid.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(beat_type), | intent(out) | :: | beat |
Returned beat. |
||
| character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns image data associated with given image id from images table.
The function returns the following error codes:
E_DB_BIND if value binding failed.E_DB_NO_ROWS if image does not exist.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if image id or type id is not passed or invalid.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(image_type), | intent(out) | :: | image |
Returned image data. |
||
| character(len=*), | intent(in) | :: | image_id |
Image 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 log does not exist.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if id is invalid.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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 node does not exist.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if id is invalid.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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_NO_ROWS if observation does not exist.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if id is invalid.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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 sensor does not exist.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if id is invalid.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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 target does not exist.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if id is invalid.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(target_type), | intent(out) | :: | target |
Returned target data. |
||
| character(len=*), | intent(in) | :: | target_id |
Target id. |
Returns transfer data associated with given transfer id and/or type_id from transfer database.
The function returns the following error codes:
E_DB_BIND if value binding failed.E_DB_NO_ROWS if transfer does not exist.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if transfer id or type id is not passed or invalid.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(transfer_type), | intent(out) | :: | transfer |
Returned transfer data. |
||
| character(len=*), | intent(in), | optional | :: | transfer_id |
Transfer id. |
|
| character(len=*), | intent(in), | optional | :: | type_id |
Transfer type 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(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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(beat_type), | intent(out) | :: | beat |
Returned beat. |
||
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of beats. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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_STEP if step execution failed.E_DB_TYPE if returned columns are unexpected.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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), | optional | :: | from |
Beginning of time span. |
|
| character(len=*), | intent(in), | optional | :: | to |
End of time span. |
|
| integer, | intent(in), | optional | :: | error |
Response error code. |
|
| logical, | intent(in), | optional | :: | desc |
Descending order. |
|
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of data points. |
|
| integer(kind=i8), | intent(out), | optional | :: | ndps |
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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| 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), | optional | :: | from |
Beginning of time span. |
|
| character(len=*), | intent(in), | optional | :: | to |
End of time span. |
|
| integer, | intent(in), | optional | :: | error |
Response error code. |
|
| logical, | intent(in), | optional | :: | desc |
Descending order. |
|
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. number of data points. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
Generic images select function.
Returns images in allocatable array images.
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(image_type), | intent(out), | allocatable | :: | images(:) |
Returned image 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 | :: | from |
Begin of time range. |
|
| character(len=*), | intent(in), | optional | :: | to |
End of time range. |
|
| logical, | intent(in), | optional | :: | desc |
Descending order. |
|
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. numbers of images. |
|
| integer(kind=i8), | intent(out), | optional | :: | nimages |
Total number of images. |
Iterator function that returns images in images. 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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(image_type), | intent(out) | :: | image |
Returned image. |
||
| 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 |
Begin of time range. |
|
| character(len=*), | intent(in), | optional | :: | to |
End of time range. |
|
| logical, | intent(in), | optional | :: | desc |
Descending order. |
|
| integer(kind=i8), | intent(in), | optional | :: | limit |
Max. numbers of images. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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(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 | :: | observ_id |
Observation 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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(log_type), | intent(out) | :: | log |
Returned log. |
||
| 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 | :: | observ_id |
Observation 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. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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(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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(node_type), | intent(out) | :: | node |
Returned node data. |
||
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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.
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(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 |
Number of observations. |
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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(observ_type), | intent(out) | :: | observ |
Returned observation. |
||
| 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. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
Generic sensors select function.
Returns all sensors in allocatable array sensors. If argument
node_id is passed, returns only sensors of this node.
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.E_INVALID if node id is empty.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(sensor_type), | intent(out), | allocatable | :: | sensors(:) |
Returned sensor data array. |
|
| character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
| 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_DONE if statement finished.E_DB_PREPARE if statement preparation failed.E_DB_TYPE if returned columns are unexpected.E_INVALID if node id is empty.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(sensor_type), | intent(out) | :: | sensor |
Returned sensor data. |
||
| character(len=*), | intent(in), | optional | :: | node_id |
Node id. |
|
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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(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_DONE if statement finished.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(db_stmt_type), | intent(inout) | :: | dbs |
Database statement. |
||
| type(target_type), | intent(out) | :: | target |
Target data. |
||
| logical, | intent(in), | optional | :: | validate |
Validate column types. |
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(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(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(target_type), | intent(inout) | :: | target |
Target to update. |
||
| logical, | intent(in), | optional | :: | validate |
Validate target. |
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. |
||
| 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). |
Deletes heartbeat from database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | node_id |
Node id. |
Deletes image from database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | image_id |
Image id. |
Deletes log from database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | log_id |
Log id. |
Deletes node from database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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. |
||
| 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. |
||
| character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
Deletes target from database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | target_id |
Target id. |
Deletes transfer from database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | transfer_id |
Transfer id. |
Returns application id of database in id.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer, | intent(out) | :: | id |
Database application id. |
Returns cache size of database in size.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer(kind=i8), | intent(out) | :: | size |
Database cache size [byte]. |
Returns data version in version.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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. |
||
| 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. |
||
| integer, | intent(out) | :: | mode |
Journal mode enumerator. |
||
| character(len=:), | intent(out), | optional, | allocatable | :: | name |
Journal mode name. |
Returns locking 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. |
||
| integer, | intent(out) | :: | mode |
Journal mode enumerator. |
||
| 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. |
||
| 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. |
||
| integer, | intent(out) | :: | version |
Database user version. |
Returns synchronous mode enumerator of database in mode.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer, | intent(out) | :: | mode |
Database synchronous mode. |
Returns temp store enumerator of database in store.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer, | intent(out) | :: | store |
Database temp store. |
Returns .true. if log of passed id exists.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | log_id |
Log id (UUID). |
Returns .true. if node of passed id exists.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns .true. if observation of passed id exists.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | observ_id |
Observation id (UUID). |
Returns .true. if sensor of passed id exists.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
Returns .true. if target of passed id exists.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | target_id |
Target id. |
Returns .true. if transfer of passed id exists.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | transfer_id |
Transfer id. |
Returns .true. if transfer of passed type id exists.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | type_id |
Type id. |
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(beat_type), | intent(inout) | :: | beat |
Beat to insert. |
||
| type(db_stmt_type), | intent(inout), | optional | :: | dbs |
Database statement. |
|
| 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(beat_type), | intent(inout) | :: | beats(:) |
Beat type array. |
||
| logical, | intent(in), | optional | :: | transaction |
Use SQL transaction. |
|
| logical, | intent(in), | optional | :: | validate |
Validate beats. |
Adds given image to database. The image data is validated by default.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(image_type), | intent(inout) | :: | image |
Image to insert. |
||
| logical, | intent(in), | optional | :: | validate |
Validate image. |
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(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(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(observ_type), | intent(inout) | :: | observ |
Observation. |
||
| type(db_stmt_type), | intent(inout), | optional | :: | dbs |
Database statement. |
|
| 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(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(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(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or updates given image sync data into database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or updates given log sync data into database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or updates given node sync data into database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or updates given observation sync data into database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or updates given sensor sync data into database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(sync_type), | intent(inout) | :: | sync |
Sync data to insert. |
Inserts or updates given target sync data into database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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(target_type), | intent(inout) | :: | target |
Target to insert. |
||
| logical, | intent(in), | optional | :: | validate |
Validate target. |
Adds given transfer to database. The transfer data is validated by default.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(transfer_type), | intent(inout) | :: | transfer |
Transfer to insert. |
||
| logical, | intent(in), | optional | :: | validate |
Validate transfer. |
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.. The cache size must be given in number of bytes. By
default, it is set to 20 MiB.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | path |
File path of database. |
||
| integer(kind=i8), | intent(in), | optional | :: | cache_size |
Cache size [byte]. |
|
| 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. |
Returns heartbeat associated with given node id in beat.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(beat_type), | intent(out) | :: | beat |
Returned beat. |
||
| character(len=*), | intent(in) | :: | node_id |
Node id. |
Returns image data associated with given image id from images table.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(image_type), | intent(out) | :: | image |
Returned image data. |
||
| character(len=*), | intent(in) | :: | image_id |
Image id. |
Returns log associated with given id in log.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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(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. |
||
| character(len=OBSERV_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 |
Number of observation ids. |
Returns observation views of the given time range from database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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 |
Number of views. |
Returns observations of a given id range in observs. The argument
after_id is the id of the observation after which the range
starts, before_id the id of the observation that limits the range.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(observ_type), | intent(out), | allocatable | :: | observs(:) |
Returned observation data. |
|
| character(len=*), | intent(in) | :: | after_id |
Id of observation with timestamp before first of range. |
||
| character(len=*), | intent(in), | optional | :: | before_id |
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 |
Number of observations. |
Returns observations of a given id range in observs. The argument
from_id is the id of the observation of which the range starts,
to_id the id of the observation last of the range.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(observ_type), | intent(out), | allocatable | :: | observs(:) |
Returned observation data. |
|
| character(len=*), | intent(in) | :: | from_id |
Id of observation with timestamp of first of range. |
||
| character(len=*), | intent(in), | optional | :: | to_id |
Id of observation with timestamp of 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 |
Number of observations. |
Returns sensor data associated with given sensor id from database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(sensor_type), | intent(out) | :: | sensor |
Returned sensor data. |
||
| character(len=*), | intent(in) | :: | sensor_id |
Sensor id. |
Returns image synchronisation data (oldest not transmitted image).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(sync_type), | intent(out) | :: | sync |
Returned sync data. |
||
| integer(kind=i8), | intent(out), | optional | :: | nsyncs |
Total number of images pending. |
Returns image synchronisation data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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 log synchronisation data (oldest not transmitted log).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| 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(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(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(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(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(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(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(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(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(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 data associated with given target id from database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(target_type), | intent(out) | :: | target |
Returned target data. |
||
| character(len=*), | intent(in) | :: | target_id |
Target id. |
Returns transfer data associated with given transfer id and/or type_id from transfer database.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| type(transfer_type), | intent(out) | :: | transfer |
Returned transfer data. |
||
| character(len=*), | intent(in), | optional | :: | transfer_id |
Transfer id. |
|
| character(len=*), | intent(in), | optional | :: | type_id |
Transfer type 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. |
||
| 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. |
||
| integer, | intent(in) | :: | mode |
Database auto vacuum mode. |
Sets database cache size PRAGMA and changes the suggested maximum
number of database disk pages that SQLite will hold in memory at once
per open database file. Whether or not this suggestion is honored is
at the discretion of the Application Defined Page Cache. The default
page cache that is built into SQLite honors the request, however
alternative application-defined page cache implementations may choose
to interpret the suggested cache size in different ways or to ignore
it altogether. The default suggested cache size is -2000, which
means the cache size is limited to 2048000 bytes of memory. The
default suggested cache size can be altered using the
SQLITE_DEFAULT_CACHE_SIZE compile-time options. The TEMP database
has a default suggested cache size of 0 pages.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer(kind=i8), | intent(in) | :: | pages |
Disk pages [none] or size if negative [byte]. |
Sets foreign keys constraint PRAGMA.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| logical, | intent(in) | :: | enabled |
Enable foreign keys constraint. |
Sets journal mode PRAGMA. Argument mode has to be one of:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer, | intent(in) | :: | mode |
Journal mode. |
Sets locking mode PRAGMA. Argument mode has to be one of:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer, | intent(in) | :: | mode |
Database journal mode. |
Sets query-only PRAGMA.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| logical, | intent(in) | :: | enabled |
Enable query-only mode. |
Sets database schema version.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer, | intent(in) | :: | version |
Database user version. |
Sets synchronous mode PRAGMA. Argument mode has to be one of:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer, | intent(in) | :: | mode |
Database synchronous mode. |
Sets PRAGMA temp store. Argument store has to be one of:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer, | intent(in) | :: | store |
Database temp store. |
Returns SQLite database size in bytes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| integer(kind=i8), | intent(out) | :: | nbyte |
Database size [byte]. |
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(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(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(target_type), | intent(inout) | :: | target |
Target to update. |
||
| logical, | intent(in), | optional | :: | validate |
Validate target. |
Updates attributes of transfer with passed transfer id. The
arguments are validated by default. This function is not
thread-safe. If executed by multiple threads, E_NOT_FOUND may be
returned even on a successful transfer update.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| character(len=*), | intent(in) | :: | transfer_id |
Transfer id (UUIDv4). |
||
| character(len=*), | intent(in), | optional | :: | timestamp |
Transfer time stamp (ISO 8601). |
|
| integer, | intent(in), | optional | :: | state |
Transfer state ( |
|
| integer, | intent(in), | optional | :: | error |
Error code. |
|
| logical, | intent(in), | optional | :: | validate |
Validate arguments. |
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. |
||
| 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_SCHEMA_VERSION.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
Closes connection to SQLite database. Optimises the database if
argument optimize is .true..
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(db_type), | intent(inout) | :: | db |
Database. |
||
| logical, | intent(in), | optional | :: | optimize |
Optimise on close. |
|
| integer, | intent(out), | optional | :: | error |
Error code. |