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, node_id, nsensors) result(rc)

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.

Arguments

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

Database type.

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.

Return Value integer

private function db_select_sensors_iter(db, db_stmt, sensor, node_id) 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.
  • E_INVALID if node id is empty.

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.

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

Node id.

Return Value integer