Connect to the database server with connection infomation provided as pairs of keywords
and values
arrays.
character(16) :: keywords(3), values(3)
type(c_ptr) :: conn
keywords(1) = 'host'; values(1) = 'localhost'
keywords(2) = 'user'; values(2) = 'postgres'
keywords(3) = 'dbname'; values(3) = 'postgres'
conn = PQconnectdbParams(keywords, values, 0)
! Error handling
if (PQstatus(conn) /= CONNECTION_OK) then
print *, PQerrorMessage(conn)
end if
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | keywords(:) |
Keywords, such as |
||
character(len=*), | intent(in) | :: | values(:) |
The array of each value corresponding to that keyword. |
||
integer | :: | expand_dbname |