Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ NOTES:
if your Oracle is not using UTF-8, in which case a value of 2 should
work for any ISO-8859 character set.

EnvCharset: integer defaulting to 0
Client-side character set id that will be used for the
environment handle created upon connecting to the
database. Corresponds to the charset argument of the
OCIEnvNlsCreate function. Useful when the database uses a
different encoding than NaviServer.

EnvNCharset: integer defaulting to 0
Client-side national character set id that will be used for
the environment handle created upon connecting to the
database. Corresponds to the ncharset argument of the
OCIEnvNlsCreate function. Useful when the database uses a
different encoding than NaviServer.

ns_ora clob_dml SQL is logged when verbose=on in the pool's configuration
section.

Expand Down
33 changes: 25 additions & 8 deletions nsoracle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2693,6 +2693,20 @@ Ns_DbDriverInit (const char *hdriver, const char *config_path)
}
Ns_Log(Notice, "%s driver LobBufferSize = %d", hdriver, lob_buffer_size);

if (Ns_ConfigGetInt(config_path, "EnvCharset", &config_value)) {
env_charset = (ub4)config_value;
} else {
env_charset = 0;
}
Ns_Log(Notice, "%s driver EnvCharset = %d", hdriver, env_charset);

if (Ns_ConfigGetInt(config_path, "EnvNCharset", &config_value)) {
env_ncharset = (ub4)config_value;
} else {
env_ncharset = 0;
}
Ns_Log(Notice, "%s driver EnvNCharset = %d", hdriver, env_ncharset);

if (!Ns_ConfigGetInt(config_path, "PrefetchRows", &prefetch_rows))
prefetch_rows = 0;
Ns_Log(Notice, "%s driver PrefetchRows = %d", hdriver, prefetch_rows);
Expand Down Expand Up @@ -2849,14 +2863,17 @@ Ns_OracleOpenDb (Ns_DbHandle *dbh)
*/
dbh->connection = connection;

oci_status = OCIEnvCreate(&connection->env,
OCI_THREADED|OCI_ENV_NO_MUTEX,
NULL,
Ns_OracleMalloc,
Ns_OracleRealloc,
Ns_OracleFree,
0, 0);
if (oci_error_p(lexpos(), NULL, "OCIEnvCreate", 0, oci_status))
oci_status = OCIEnvNlsCreate(&connection->env,
OCI_THREADED|OCI_ENV_NO_MUTEX,
NULL,
Ns_OracleMalloc,
Ns_OracleRealloc,
Ns_OracleFree,
0,
0,
env_charset,
env_ncharset);
if (oci_error_p(lexpos(), NULL, "OCIEnvNlsCreate", 0, oci_status))
return NS_ERROR;


Expand Down
2 changes: 2 additions & 0 deletions nsoracle.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ static bool debug_p = NS_FALSE;
static int max_string_log_length = 0;
static unsigned int lob_buffer_size = 16384;
static int char_expansion;
static ub2 env_charset;
static ub2 env_ncharset;

/* Prefetch parameters, if zero leave defaults */
static int prefetch_rows = 0;
Expand Down