dm_db_select_sensors Interface

public interface dm_db_select_sensors

Generic sensors select function.


Module Procedures

private function db_select_sensors_array(db, sensors, nsensors) result(rc)

Returns all sensors in allocatable array sensors.

The function returns the following error codes:

  • E_ALLOC if memory allocation failed.
  • E_DB_NO_ROWS if no rows are returned.
  • E_DB_PREPARE if statement preparation failed.
  • E_DB_TYPE if returned columns are unexpected.

Arguments

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

Database type.

type(sensor_type), intent(out), allocatable :: sensors(:)

Returned sensor data array.

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

Number of returned sensors.

Return Value integer

private function db_select_sensors_iter(db, db_stmt, sensor) result(rc)

Iterator function that returns all sensors in sensor. The statement db_stmt must be finalised once finished.

The function returns the following error codes:

  • E_DB_NO_ROWS if no rows are returned.
  • E_DB_PREPARE if statement preparation failed.
  • E_DB_TYPE if returned columns are unexpected.

Arguments

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

Database type.

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

Database statement type.

type(sensor_type), intent(out) :: sensor

Returned sensor data.

Return Value integer

private function db_select_sensors_by_node_array(db, node_id, sensors, nsensors) result(rc)

Returns all sensors of node node_id in allocatable array sensors.

The function returns the following error codes:

  • E_ALLOC if memory allocation failed.
  • E_INVALID if node id is empty.
  • E_DB_BIND if value binding failed.
  • E_DB_FINALIZE if statement finalisation failed.
  • E_DB_NO_ROWS if no rows are returned.
  • E_DB_PREPARE if statement preparation failed.
  • E_DB_TYPE if returned columns are unexpected.

Arguments

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

Database type.

character(len=*), intent(in) :: node_id

Node id.

type(sensor_type), intent(out), allocatable :: sensors(:)

Returned sensor data array.

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

Number of returned sensors.

Return Value integer

private function db_select_sensors_by_node_iter(db, db_stmt, node_id, sensor) result(rc)

Iterator function that returns all sensors of node node_id in sensor. The statement db_stmt must be finalised once finished.

The function returns the following error codes:

  • E_INVALID if node id is empty.
  • E_DB_BIND if value binding failed.
  • E_DB_NO_ROWS if no rows are returned.
  • E_DB_PREPARE if statement preparation failed.
  • E_DB_TYPE if returned columns are unexpected.

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(in) :: node_id

Node id.

type(sensor_type), intent(out) :: sensor

Returned sensor data.

Return Value integer