dm_db_select_json_nodes Interface

public interface dm_db_select_json_nodes

Generic JSON nodes select function.


Module Procedures

private function db_select_json_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_select_json_nodes_iter(db, db_stmt, json, limit) result(rc)

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.

Arguments

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

Return Value integer