dm_db_select_targets Interface

public interface dm_db_select_targets

Generic targets select function.


Module Procedures

private function db_select_targets_array(db, targets, ntargets) result(rc)

Returns number of targets and array of target data in allocatable array targets, if query was successful.

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(target_type), intent(out), allocatable :: targets(:)

Target data array.

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

Number of selected targets.

Return Value integer

private function db_select_targets_iter(db, db_stmt, target) result(rc)

Iterator function that returns all targets in target. The statement db_stmt must be finalised once finished.

The function returns the following error codes:

  • E_DB_NO_ROWS if no more 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(target_type), intent(out) :: target

Target data.

Return Value integer