dm_db_json_select_beats Interface

public interface dm_db_json_select_beats

Generic JSON logs select function.


Module Procedures

private function db_json_select_beats_array(db, strings, limit, nbeats) result(rc)

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.

Arguments

Type IntentOptional 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.

Return Value integer

private function db_json_select_beats_iter(db, dbs, json, limit, validate) result(rc)

Iterator function that returns beats in JSON format in allocatable string json. The statement dbs 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_DONE if statement finished.
  • E_DB_PREPARE if statement preparation failed.
  • E_DB_TYPE if returned columns are unexpected.

Arguments

Type IntentOptional Attributes Name
type(db_type), intent(inout) :: db

Database type.

type(db_stmt_type), intent(inout) :: dbs

Database statement type.

character(len=:), intent(out), allocatable :: json

Returned JSON.

integer(kind=i8), intent(in), optional :: limit

Max. number of beats.

logical, intent(in), optional :: validate

Validate column types.

Return Value integer