Skip to content

Commit

Permalink
Added Environment Options
Browse files Browse the repository at this point in the history
  • Loading branch information
rahim-kanji committed Oct 28, 2024
1 parent 5206747 commit 4faeb16
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions include/PgSQL_Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ enum PgSQL_Param_Name {
PG_SERVICE, // Service name to use for additional parameters
PG_TARGET_SESSION_ATTRS, // Determines whether the session must have certain properties to be acceptable
PG_LOAD_BALANCE_HOSTS, // Controls the order in which the client tries to connect to the available hosts and addresses
// Environment Options
PG_DATESTYLE, // Sets the value of the DateStyle parameter
PG_TIMEZONE, // Sets the value of the TimeZone parameter
PG_GEQO, // Enables or disables the use of the GEQO query optimizer

PG_PARAM_SIZE
};
Expand Down Expand Up @@ -114,7 +118,11 @@ static const char* PgSQL_Param_Name_Str[] = {
"gssdelegation",
"service",
"target_session_attrs",
"load_balance_hosts"
"load_balance_hosts",
// Environment Options
"datestyle",
"timezone",
"geqo"
};

struct Param_Name_Validation {
Expand Down Expand Up @@ -172,7 +180,10 @@ static const Param_Name_Validation* PgSQL_Param_Name_Accepted_Values[PG_PARAM_SI
nullptr,
nullptr,
&target_session_attrs,
&load_balance_hosts
&load_balance_hosts,
nullptr,
nullptr,
nullptr
};

#define PG_EVENT_NONE 0x00
Expand Down Expand Up @@ -211,6 +222,7 @@ class PgSQL_Conn_Param {
}

bool set_value(PgSQL_Param_Name key, const char* val) {
if (key == -1) return false;
if (validate(key, val)) {
if (param_value[key]) {
free(param_value[key]);
Expand Down Expand Up @@ -249,8 +261,9 @@ class PgSQL_Conn_Param {
break;
}
}

assert(key != -1);
if (key == -1) {
proxy_warning("Unrecognized connection option. Please report this as a bug for future enhancements:%s\n", name);
}
return key;
}

Expand Down

0 comments on commit 4faeb16

Please sign in to comment.