* connectOptions1 * * Internal subroutine to set up connection parameters given an already- * created PGconn and a conninfo string. Derived settings should be * processed by calling connectOptions2 next. (We split them because * PQsetdbLogin overrides defaults in between.) * * Returns true if OK, false if trouble (in which case errorMessage is set * and so is conn->status). */
| 995 | * and so is conn->status). |
| 996 | */ |
| 997 | static bool |
| 998 | connectOptions1(PGconn *conn, const char *conninfo) |
| 999 | { |
| 1000 | PQconninfoOption *connOptions; |
| 1001 | |
| 1002 | /* |
| 1003 | * Parse the conninfo string |
| 1004 | */ |
| 1005 | connOptions = parse_connection_string(conninfo, &conn->errorMessage, true); |
| 1006 | if (connOptions == NULL) |
| 1007 | { |
| 1008 | conn->status = CONNECTION_BAD; |
| 1009 | /* errorMessage is already set */ |
| 1010 | return false; |
| 1011 | } |
| 1012 | |
| 1013 | /* |
| 1014 | * Move option values into conn structure |
| 1015 | */ |
| 1016 | if (!fillPGconn(conn, connOptions)) |
| 1017 | { |
| 1018 | conn->status = CONNECTION_BAD; |
| 1019 | PQconninfoFree(connOptions); |
| 1020 | return false; |
| 1021 | } |
| 1022 | |
| 1023 | /* |
| 1024 | * Free the option info - all is in conn now |
| 1025 | */ |
| 1026 | PQconninfoFree(connOptions); |
| 1027 | |
| 1028 | return true; |
| 1029 | } |
| 1030 | |
| 1031 | /* |
| 1032 | * Count the number of elements in a simple comma-separated list. |
no test coverage detected