[Schmitzm-commits] r1681 - trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Aug 20 18:59:24 CEST 2011


Author: alfonx
Date: 2011-08-20 18:59:23 +0200 (Sat, 20 Aug 2011)
New Revision: 1681

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres/PGUtil.java
Log:
Indexe sollen werden jetzt im Tablespace "indexspace" erstellt.

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres/PGUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres/PGUtil.java	2011-08-19 11:00:26 UTC (rev 1680)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/geotools/postgres/PGUtil.java	2011-08-20 16:59:23 UTC (rev 1681)
@@ -282,12 +282,29 @@
 	 */
 	public static void addIndex(Connection c, final String tableName, final String columns, String idxPostfix,
 			final boolean unique) throws SQLException {
+
+	}
+
+	/**
+	 * @param tableName
+	 *            e.g. 'inseratabfragen_kvps'
+	 * @param columns
+	 *            e.g. 'inseratabfrage_id'
+	 * @param idxNamePostfix
+	 *            e.g. 'idx1'
+	 * @param unique
+	 *            <code>true</code> if the columns are unique. A UNIQUE INDEX will be created.
+	 * @param tablespace
+	 *            <code>null</code> oder der name des tablespace in dem der Index liegen soll.
+	 */
+	public static void addIndex(Connection c, final String tableName, final String columns, String idxPostfix,
+			final boolean unique, String tablespace) throws SQLException {
 		final String idxName = (tableName + "_" + idxPostfix).replace(".", "_");
 
 		Statement s = c.createStatement();
 		// TODO DROP FIRST?
 		final String queryString = "CREATE " + (unique ? "UNIQUE " : "") + "INDEX " + idxName + " ON " + tableName
-				+ " (" + columns + ");";
+				+ " (" + columns + ") "+(tablespace == null? "" : " TABLESPACE "+tablespace);
 		try {
 			s.execute(queryString);
 			c.commit();



More information about the Schmitzm-commits mailing list