odissey: always set default client options

This commit is contained in:
Dmitry Simonenko 2017-09-01 17:07:28 +03:00
parent 70ac93378f
commit 1603e84ae3
4 changed files with 45 additions and 33 deletions

View File

@ -54,9 +54,6 @@ database "console" {
authentication "none"
pool "session"
storage "local"
client_encoding "UTF8"
datestyle "ISO"
timezone "UTC"
}
}
@ -81,8 +78,8 @@ database default
pool_rollback yes
#client_max 100
client_encoding "UTF8"
datestyle "ISO"
timezone "UTC"
#client_encoding "UTF8"
#datestyle "ISO"
#timezone "UTC"
}
}

View File

@ -54,9 +54,6 @@ database "console" {
authentication "none"
pool "session"
storage "local"
client_encoding "UTF8"
datestyle "ISO"
timezone "UTC"
}
}
@ -81,8 +78,8 @@ database default
pool_rollback yes
#client_max 100
client_encoding "UTF8"
datestyle "ISO"
timezone "UTC"
#client_encoding "UTF8"
#datestyle "ISO"
#timezone "UTC"
}
}

View File

@ -204,29 +204,23 @@ od_frontend_setup(od_client_t *client)
if (rc == -1)
return -1;
/* client_encoding */
if (client->scheme->client_encoding) {
rc = shapito_be_write_parameter_status(stream, "client_encoding", 16,
client->scheme->client_encoding,
client->scheme->client_encoding_len + 1);
if (rc == -1)
return -1;
}
rc = shapito_be_write_parameter_status(stream, "client_encoding", 16,
client->scheme->client_encoding,
client->scheme->client_encoding_len + 1);
if (rc == -1)
return -1;
/* datestyle */
if (client->scheme->datestyle) {
rc = shapito_be_write_parameter_status(stream, "datestyle", 10,
client->scheme->datestyle,
client->scheme->datestyle_len + 1);
if (rc == -1)
return -1;
}
rc = shapito_be_write_parameter_status(stream, "datestyle", 10,
client->scheme->datestyle,
client->scheme->datestyle_len + 1);
if (rc == -1)
return -1;
/* timezone */
if (client->scheme->timezone) {
rc = shapito_be_write_parameter_status(stream, "timezone", 9,
client->scheme->timezone,
client->scheme->timezone_len + 1);
if (rc == -1)
return -1;
}
rc = shapito_be_write_parameter_status(stream, "timezone", 9,
client->scheme->timezone,
client->scheme->timezone_len + 1);
if (rc == -1)
return -1;
rc = od_write(client->io, stream);
if (rc == -1) {
od_error_client(&instance->logger, &client->id, "setup",

View File

@ -753,6 +753,30 @@ int od_scheme_validate(od_scheme_t *scheme, od_logger_t *logger)
route->db_name, route->user_name);
return -1;
}
/* client_encoding */
if (route->client_encoding == NULL) {
route->client_encoding = strdup("UTF8");
if (route->client_encoding == NULL)
return -1;
route->client_encoding_len = strlen(route->client_encoding);
}
/* datestyle */
if (route->datestyle == NULL) {
route->datestyle = strdup("ISO");
if (route->datestyle == NULL)
return -1;
route->datestyle_len = strlen(route->datestyle);
}
/* timezone */
if (route->timezone == NULL) {
route->timezone = strdup("UTC");
if (route->timezone == NULL)
return -1;
route->timezone_len = strlen(route->timezone);
}
}
if (! route_default_default) {