Difference between revisions of "PostgreSQL Adapter-nexj/schema-init"
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Admon/obsolete}} | ||
+ | |||
<big><big> PostgreSQL Adapter for NexJ - Working Inside Schema 'test' </big></big> | <big><big> PostgreSQL Adapter for NexJ - Working Inside Schema 'test' </big></big> | ||
− | |||
== Initializing the SQL environment== | == Initializing the SQL environment== | ||
− | * ''PostgreSQLAdapter.java'' | + | * '''''PostgreSQLAdapter.java''''' |
: When a connection is first established, this initial SQL statement should execute in MySQL, which is not the case for PostgreSQL, so the implementation was removed from PostgreSQLAdapter.java: | : When a connection is first established, this initial SQL statement should execute in MySQL, which is not the case for PostgreSQL, so the implementation was removed from PostgreSQLAdapter.java: | ||
:: | :: | ||
Line 20: | Line 21: | ||
} | } | ||
</source> | </source> | ||
− | * ''postgresql_create.sql'' | + | * '''''postgresql_create.sql''''' |
: This file was just created as a copy of mysql_create.sql, which was not the case for PostgreSQL again. So the line in the file is removed for now. The file itself may be deleted later, if there was no need for it. Name of the script file is being returned in '''''getCreateEtcScriptName()'''''' in '''PostgreSQLSchemaManager.java''' | : This file was just created as a copy of mysql_create.sql, which was not the case for PostgreSQL again. So the line in the file is removed for now. The file itself may be deleted later, if there was no need for it. Name of the script file is being returned in '''''getCreateEtcScriptName()'''''' in '''PostgreSQLSchemaManager.java''' | ||
:: | :: |
Latest revision as of 19:49, 26 January 2014
PostgreSQL Adapter for NexJ - Working Inside Schema 'test'
Initializing the SQL environment
- PostgreSQLAdapter.java
- When a connection is first established, this initial SQL statement should execute in MySQL, which is not the case for PostgreSQL, so the implementation was removed from PostgreSQLAdapter.java:
/* MySQLAdapter.java */
public String getInitialSQL()
{
StringBuffer buf = new StringBuffer();
buf.append("set sql_mode = concat(@@sql_mode, ',ANSI_QUOTES')"); // allow using doublequote when quoting column names in "CREATE TABLE" statements
buf.append(";set optimizer_search_depth = 0"); // let DB automatically decide on how long it takes to examine plans, improves long planning sessions
buf.append(";set max_sort_length = ").append
(Math.max(MAX_VARCHAR_PRECISION, MAX_VARBINARY_PRECISION)); // set TEXT/BLOB minimum sorting length to be same as cutoff between varchar/text
return buf.toString();
}
- postgresql_create.sql
- This file was just created as a copy of mysql_create.sql, which was not the case for PostgreSQL again. So the line in the file is removed for now. The file itself may be deleted later, if there was no need for it. Name of the script file is being returned in getCreateEtcScriptName()' in PostgreSQLSchemaManager.java
/* nexj/core/persistence/sql/etc/postgresql_create.sql */
set sql_mode = concat(@@sql_mode, ',ANSI_QUOTES');
- After activating the connection, the database is locked.