Subversion Repository Public Repository

litesoft

Diff Revisions 49 vs 151 for /trunk/Java/core/Server/src/org/litesoft/sql/SQLProductSpecificAbstractHelper.java

Diff revisions: vs.
  @@ -1,6 +1,9 @@
1 1 // This Source Code is in the Public Domain per: http://litesoft.org/License.txt
2 2 package org.litesoft.sql;
3 3
4 + import java.sql.*;
5 + import java.util.*;
6 +
4 7 import org.litesoft.bo.*;
5 8 import org.litesoft.bo.attributes.*;
6 9 import org.litesoft.db.*;
  @@ -8,11 +11,7 @@
8 11 import org.litesoft.orsup.lazyeval.*;
9 12 import org.litesoft.util.*;
10 13
11 - import java.sql.*;
12 - import java.util.*;
13 -
14 - public abstract class SQLProductSpecificAbstractHelper extends SQL_OR_Helper
15 - implements SQLProductSpecificHelper
14 + public abstract class SQLProductSpecificAbstractHelper extends SQL_OR_Helper implements SQLProductSpecificHelper
16 15 {
17 16 // boolean storesLowerCaseIdentifiers()
18 17 // Retrieves whether this database treats mixed case unquoted SQL identifiers as case insensitive and stores them in lower case.
  @@ -40,8 +39,7 @@
40 39 }
41 40
42 41 @Override
43 - public void initializeDB( Connection pConnection, DBinfo pDBinfo,
44 - SQLIndexColumnsLocator pIndexColumnsLocator )
42 + public void initializeDB( Connection pConnection, DBinfo pDBinfo, SQLIndexColumnsLocator pIndexColumnsLocator )
45 43 throws SQLException
46 44 {
47 45 mIndexColumnsLocator = pIndexColumnsLocator;
  @@ -156,13 +154,11 @@
156 154 }
157 155 }
158 156 }
159 - return zMatches.isEmpty() ? Utils.EMPTY_STRING_ARRAY :
160 - zMatches.toArray( new String[zMatches.size()] );
157 + return zMatches.isEmpty() ? Utils.EMPTY_STRING_ARRAY : zMatches.toArray( new String[zMatches.size()] );
161 158 }
162 159
163 160 @Override
164 - public Map<String, DBtableColumn[]> getColumns( Connection pConnection, DBinfo pDBinfo,
165 - String pTableNamePattern )
161 + public Map<String, DBtableColumn[]> getColumns( Connection pConnection, DBinfo pDBinfo, String pTableNamePattern )
166 162 throws SQLException
167 163 {
168 164 Map<String, DBtableColumn[]> zMatches = SQLHelper.getAllTableColumns( pConnection, //
  @@ -193,8 +189,7 @@
193 189 {
194 190 Map<String, DBtableIndex[]> zFounds = new HashMap<String, DBtableIndex[]>();
195 191
196 - String[] zTableNames =
197 - getTablesFor( pConnection, pDBinfo, SQLHelper.escapeTableNamePattern( pTableName ) );
192 + String[] zTableNames = getTablesFor( pConnection, pDBinfo, SQLHelper.escapeTableNamePattern( pTableName ) );
198 193 for ( String zTableName : zTableNames )
199 194 {
200 195 List<DBtableIndex> zMatches = SQLHelper.getAllTableIndexes( pConnection, zTableName );
  @@ -204,11 +199,9 @@
204 199 }
205 200
206 201 private static final String SQL_STATE_CONSTRAINT_VIOLATION = "23000";
207 - private static final String SQL_STATE_CONSTRAINT_VIOLATION_STARTSWITH =
208 - SQL_STATE_CONSTRAINT_VIOLATION.substring( 0, 3 );
202 + private static final String SQL_STATE_CONSTRAINT_VIOLATION_STARTSWITH = SQL_STATE_CONSTRAINT_VIOLATION.substring( 0, 3 );
209 203
210 - @SuppressWarnings({"ThrowableInstanceNeverThrown"})
211 - @Override
204 + @SuppressWarnings({"ThrowableInstanceNeverThrown"}) @Override
212 205 public WrappedSQLException wrapSQLException( SQLException pException )
213 206 {
214 207 if ( isConstraintViolation( pException ) )
  @@ -352,12 +345,10 @@
352 345 }
353 346 }
354 347
355 - protected boolean LLtableExists( Connection pConnection, DBinfo pDBinfo, String pTableName,
356 - String pExistsOnSuccessSQL )
348 + protected boolean LLtableExists( Connection pConnection, DBinfo pDBinfo, String pTableName, String pExistsOnSuccessSQL )
357 349 throws SQLException, MultipleTablesException
358 350 {
359 - String[] zTableNames =
360 - getTablesFor( pConnection, pDBinfo, SQLHelper.escapeTableNamePattern( pTableName ) );
351 + String[] zTableNames = getTablesFor( pConnection, pDBinfo, SQLHelper.escapeTableNamePattern( pTableName ) );
361 352 if ( Utils.isNullOrEmpty( zTableNames ) )
362 353 {
363 354 return false;
  @@ -369,12 +360,10 @@
369 360 return execNoResultSQL( pConnection, pExistsOnSuccessSQL );
370 361 }
371 362
372 - protected boolean LLcolumnExists( Connection pConnection, DBinfo pDBinfo, String pTableName,
373 - String pColumnName, String pExistsOnSuccessSQL )
363 + protected boolean LLcolumnExists( Connection pConnection, DBinfo pDBinfo, String pTableName, String pColumnName, String pExistsOnSuccessSQL )
374 364 throws SQLException, MultipleTablesException
375 365 {
376 - Map<String, DBtableColumn[]> zFound =
377 - getColumns( pConnection, pDBinfo, SQLHelper.escapeTableNamePattern( pTableName ) );
366 + Map<String, DBtableColumn[]> zFound = getColumns( pConnection, pDBinfo, SQLHelper.escapeTableNamePattern( pTableName ) );
378 367 if ( zFound.isEmpty() )
379 368 {
380 369 return false;
  @@ -383,8 +372,7 @@
383 372 {
384 373 throw MultipleTablesException.createFrom( pTableName, zFound.keySet() );
385 374 }
386 - return columnIn( pColumnName, zFound.values().iterator().next() ) &&
387 - execNoResultSQL( pConnection, pExistsOnSuccessSQL );
375 + return columnIn( pColumnName, zFound.values().iterator().next() ) && execNoResultSQL( pConnection, pExistsOnSuccessSQL );
388 376 }
389 377
390 378 private boolean columnIn( String pColumnName, DBtableColumn[] pColumns )