dm_db_pragma Module

SQLite PRAGMA access functions.

Get and set the SQLite foreign keys PRAGMA value:

character(len=:), allocatable :: value
integer :: rc

rc = dm_db_pragma_get(db, 'foreign_keys', value)
rc = dm_db_pragma_set(db, 'foreign_keys', 'ON')

Uses

  • module~~dm_db_pragma~~UsesGraph module~dm_db_pragma dm_db_pragma module~dm_db dm_db module~dm_db_pragma->module~dm_db module~dm_error dm_error module~dm_db_pragma->module~dm_error module~dm_kind dm_kind module~dm_db_pragma->module~dm_kind module~dm_db->module~dm_error module~dm_db->module~dm_kind iso_c_binding iso_c_binding module~dm_db->iso_c_binding module~dm_db_query dm_db_query module~dm_db->module~dm_db_query module~dm_util dm_util module~dm_db->module~dm_util sqlite3 sqlite3 module~dm_db->sqlite3 module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env module~dm_db_query->module~dm_error module~dm_db_query->module~dm_kind module~dm_util->module~dm_error module~dm_util->module~dm_kind

Used by

  • module~~dm_db_pragma~~UsedByGraph module~dm_db_pragma dm_db_pragma module~dm_db_api dm_db_api module~dm_db_api->module~dm_db_pragma module~dmpack dmpack module~dmpack->module~dm_db_pragma module~dmpack->module~dm_db_api

Interfaces

public interface dm_db_pragma_get

Generic PRAGMA get function.

  • private function db_pragma_get_int32(db, name, value) result(rc)

    Returns PRAGMA value as 4-byte integer.

    The function returns the following error codes:

    • E_DB_PREPARE if statement preparation failed.
    • E_DB_STEP if step execution failed.
    • E_DB_TYPE if query result is of unexpected type.

    Arguments

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

    Database type.

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

    PRAGMA name.

    integer(kind=i4), intent(out) :: value

    PRAGMA value.

    Return Value integer

  • private function db_pragma_get_int64(db, name, value) result(rc)

    Returns PRAGMA value as 8-byte integer.

    The function returns the following error codes:

    • E_DB_PREPARE if statement preparation failed.
    • E_DB_STEP if step execution failed.
    • E_DB_TYPE if query result is of unexpected type.

    Arguments

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

    Database type.

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

    PRAGMA name.

    integer(kind=i8), intent(out) :: value

    PRAGMA value.

    Return Value integer

  • private function db_pragma_get_string(db, name, value) result(rc)

    Returns PRAGMA value as allocatable string. On error, the string is allocated but empty.

    The function returns the following error codes:

    • E_DB_PREPARE if statement preparation failed.
    • E_DB_STEP if step execution failed.
    • E_DB_TYPE if query result is of unexpected type.

    Arguments

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

    Database type.

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

    PRAGMA name.

    character(len=:), intent(out), allocatable :: value

    PRAGMA value.

    Return Value integer

public interface dm_db_pragma_set

Generic PRAGMA set function.

  • private function db_pragma_set(db, name) result(rc)

    Executes PRAGMA of name.

    The function returns the following error codes:

    • E_DB_PREPARE if statement preparation failed.
    • E_DB_STEP if step execution failed or no write permission.
    • E_READ_ONLY if database is opened read-only.

    Arguments

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

    Database type.

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

    PRAGMA name.

    Return Value integer

  • private function db_pragma_set_int32(db, name, value) result(rc)

    Sets PRAGMA of name to 4-byte integer value.

    The function returns the following error codes:

    • E_DB_PREPARE if statement preparation failed.
    • E_DB_STEP if step execution failed or no write permission.
    • E_READ_ONLY if database is opened read-only.

    Arguments

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

    Database type.

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

    PRAGMA name.

    integer(kind=i4), intent(in) :: value

    PRAGMA value.

    Return Value integer

  • private function db_pragma_set_int64(db, name, value) result(rc)

    Sets PRAGMA of name to 8-byte integer value.

    The function returns the following error codes:

    • E_DB_PREPARE if statement preparation failed.
    • E_DB_STEP if step execution failed or no write permission.
    • E_READ_ONLY if database is opened read-only.

    Arguments

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

    Database type.

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

    PRAGMA name.

    integer(kind=i8), intent(in) :: value

    PRAGMA value.

    Return Value integer

  • private function db_pragma_set_string(db, name, value) result(rc)

    Sets PRAGMA of name to string value.

    The function returns the following error codes:

    • E_DB_PREPARE if statement preparation failed.
    • E_DB_STEP if step execution failed or no write permission.

    Arguments

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

    Database type.

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

    PRAGMA name.

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

    PRAGMA value.

    Return Value integer