dm_db_json_select_nodes Interface

public interface dm_db_json_select_nodes

Generic JSON nodes select function.


Module Procedures

private function db_json_select_nodes_array(db, strings, limit, nnodes) result(rc)

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.

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 nodes.

integer(kind=i8), intent(out), optional :: nnodes

Number of nodes.

Return Value integer

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

Iterator function that returns nodes in JSON format in allocatable string json. The statement dbs 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_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 nodes.

logical, intent(in), optional :: validate

Validate column types.

Return Value integer