Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 5b7dda9

Browse files
Cleanup
1 parent 1fa64b7 commit 5b7dda9

10 files changed

+144
-203
lines changed

src/main/java/xdev/db/hsql18/jdbc/HSQL18ConnectionInformation.java

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
*/
1818
package xdev.db.hsql18.jdbc;
1919

20-
21-
22-
2320
import com.xdev.jadoth.sqlengine.dbms.DbmsConnectionInformation;
21+
2422
import xdev.db.ConnectionInformation;
2523

24+
2625
public class HSQL18ConnectionInformation extends ConnectionInformation<HSQL18Dbms>
2726
{
2827
// /////////////////////////////////////////////////////////////////////////
@@ -31,69 +30,63 @@ public class HSQL18ConnectionInformation extends ConnectionInformation<HSQL18Dbm
3130

3231
/**
3332
* Instantiates a new hsql18 connection information.
34-
*
35-
* @param user
36-
* the user
37-
* @param password
38-
* the password
39-
* @param database
40-
* the database
41-
* @param urlExtension
42-
* the extended url properties
43-
* @param dbmsAdaptor
44-
* the dbms adaptor
33+
*
34+
* @param user the user
35+
* @param password the password
36+
* @param database the database
37+
* @param urlExtension the extended url properties
38+
* @param dbmsAdaptor the dbms adaptor
4539
*/
46-
public HSQL18ConnectionInformation(final String host, final int port, final String user,
47-
final String password, final String database, final String urlExtension,
48-
final HSQL18Dbms dbmsAdaptor)
40+
public HSQL18ConnectionInformation(
41+
final String host, final int port, final String user,
42+
final String password, final String database, final String urlExtension,
43+
final HSQL18Dbms dbmsAdaptor)
4944
{
50-
super(host,port,user,password,database,urlExtension,dbmsAdaptor);
45+
super(host, port, user, password, database, urlExtension, dbmsAdaptor);
5146
}
5247

53-
5448
// /////////////////////////////////////////////////////////////////////////
5549
// getters //
5650
// ///////////////////
51+
5752
/**
5853
* Gets the database.
59-
*
54+
*
6055
* @return the database
6156
*/
6257
public String getDatabase()
6358
{
6459
return this.getCatalog();
6560
}
6661

67-
6862
// /////////////////////////////////////////////////////////////////////////
6963
// setters //
7064
// ///////////////////
65+
7166
/**
7267
* Sets the database.
73-
*
74-
* @param database
75-
* the database to set
68+
*
69+
* @param database the database to set
7670
*/
7771
public void setDatabase(final String database)
7872
{
7973
this.setCatalog(database);
8074
}
8175

82-
8376
// /////////////////////////////////////////////////////////////////////////
8477
// override methods //
8578
// ///////////////////
79+
8680
/**
8781
* @see DbmsConnectionInformation#createJdbcConnectionUrl()
8882
*/
8983
@Override
9084
public String createJdbcConnectionUrl()
9185
{
92-
String url = "jdbc:hsqldb:hsql://" + getHost() + ":" + getPort() + "/" + getCatalog();
93-
return appendUrlExtension(url);
86+
final String url = "jdbc:hsqldb:hsql://" + this.getHost() + ":" + this.getPort() + "/" + this.getCatalog();
87+
return this.appendUrlExtension(url);
9488
}
9589

96-
9790
/**
9891
* @see DbmsConnectionInformation#getJdbcDriverClassName()
9992
*/
@@ -102,5 +95,4 @@ public String getJdbcDriverClassName()
10295
{
10396
return "org.hsqldb.jdbcDriver";
10497
}
105-
10698
}

src/main/java/xdev/db/hsql18/jdbc/HSQL18DDLMapper.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
*/
1818
package xdev.db.hsql18.jdbc;
1919

20-
21-
22-
2320
import com.xdev.jadoth.sqlengine.dbms.standard.StandardDDLMapper;
2421

2522

src/main/java/xdev/db/hsql18/jdbc/HSQL18DMLAssembler.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
*/
1818
package xdev.db.hsql18.jdbc;
1919

20-
21-
2220
import com.xdev.jadoth.sqlengine.dbms.standard.StandardDMLAssembler;
2321

2422

src/main/java/xdev/db/hsql18/jdbc/HSQL18Dbms.java

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,27 @@
1717
*/
1818
package xdev.db.hsql18.jdbc;
1919

20-
21-
2220
import com.xdev.jadoth.sqlengine.dbms.DbmsAdaptor;
2321
import com.xdev.jadoth.sqlengine.dbms.SQLExceptionParser;
2422
import com.xdev.jadoth.sqlengine.internal.DatabaseGateway;
2523
import com.xdev.jadoth.sqlengine.internal.tables.SqlTableIdentity;
2624

25+
2726
public class HSQL18Dbms
28-
extends
29-
DbmsAdaptor.Implementation<HSQL18Dbms, HSQL18DMLAssembler, HSQL18DDLMapper, HSQL18RetrospectionAccessor, HSQL18Syntax>
27+
extends
28+
DbmsAdaptor.Implementation<HSQL18Dbms, HSQL18DMLAssembler, HSQL18DDLMapper, HSQL18RetrospectionAccessor,
29+
HSQL18Syntax>
3030
{
3131
// /////////////////////////////////////////////////////////////////////////
3232
// constants //
3333
// ///////////////////
3434

35-
/** The Constant MAX_VARCHAR_LENGTH. */
36-
protected static final int MAX_VARCHAR_LENGTH = Integer.MAX_VALUE;
37-
38-
protected static final char IDENTIFIER_DELIMITER = '"';
39-
40-
public static final HSQL18Syntax SYNTAX = new HSQL18Syntax();
41-
35+
public static final HSQL18Syntax SYNTAX = new HSQL18Syntax();
36+
/**
37+
* The Constant MAX_VARCHAR_LENGTH.
38+
*/
39+
protected static final int MAX_VARCHAR_LENGTH = Integer.MAX_VALUE;
40+
protected static final char IDENTIFIER_DELIMITER = '"';
4241

4342
// /////////////////////////////////////////////////////////////////////////
4443
// constructors //
@@ -49,53 +48,46 @@ public HSQL18Dbms()
4948
this(new SQLExceptionParser.Body());
5049
}
5150

52-
5351
/**
54-
* @param sqlExceptionParser
55-
* the sql exception parser
52+
* @param sqlExceptionParser the sql exception parser
5653
*/
5754
public HSQL18Dbms(final SQLExceptionParser sqlExceptionParser)
5855
{
59-
super(sqlExceptionParser,false);
56+
super(sqlExceptionParser, false);
6057
this.setRetrospectionAccessor(new HSQL18RetrospectionAccessor(this));
6158
this.setDMLAssembler(new HSQL18DMLAssembler(this));
6259
this.setSyntax(SYNTAX);
6360
}
6461

65-
6662
/**
6763
* @see DbmsAdaptor#createConnectionInformation(String, int, String, String, String, String)
6864
*/
6965
@Override
70-
public HSQL18ConnectionInformation createConnectionInformation(final String host,
71-
final int port, final String user, final String password, final String catalog, final String properties)
66+
public HSQL18ConnectionInformation createConnectionInformation(
67+
final String host,
68+
final int port, final String user, final String password, final String catalog, final String properties)
7269
{
73-
return new HSQL18ConnectionInformation(host,port,user,password,catalog,properties, this);
70+
return new HSQL18ConnectionInformation(host, port, user, password, catalog, properties, this);
7471
}
7572

76-
7773
/**
78-
* HSQL does not support any means of calculating table columns selectivity
79-
* as far as it is known.
74+
* HSQL does not support any means of calculating table columns selectivity as far as it is known.
8075
*/
8176
@Override
8277
public Object updateSelectivity(final SqlTableIdentity table)
8378
{
8479
return null;
8580
}
8681

87-
8882
/**
89-
90-
* @see DbmsAdaptor#assembleTransformBytes(byte[],StringBuilder)
83+
* @see DbmsAdaptor#assembleTransformBytes(byte[], StringBuilder)
9184
*/
9285
@Override
9386
public StringBuilder assembleTransformBytes(final byte[] bytes, final StringBuilder sb)
9487
{
9588
return null;
9689
}
9790

98-
9991
/**
10092
* @see DbmsAdaptor.Implementation#getRetrospectionAccessor()
10193
*/
@@ -105,7 +97,6 @@ public HSQL18RetrospectionAccessor getRetrospectionAccessor()
10597
throw new RuntimeException("HSQL Retrospection not implemented yet!");
10698
}
10799

108-
109100
/**
110101
* @see DbmsAdaptor#initialize(DatabaseGateway)
111102
*/
@@ -114,7 +105,6 @@ public void initialize(final DatabaseGateway<HSQL18Dbms> dbc)
114105
{
115106
}
116107

117-
118108
/**
119109
* @see DbmsAdaptor#rebuildAllIndices(String)
120110
*/
@@ -124,14 +114,12 @@ public Object rebuildAllIndices(final String fullQualifiedTableName)
124114
return null;
125115
}
126116

127-
128117
@Override
129118
public boolean supportsOFFSET_ROWS()
130119
{
131120
return true;
132121
}
133122

134-
135123
/**
136124
* @see DbmsAdaptor#getMaxVARCHARlength()
137125
*/
@@ -141,7 +129,6 @@ public int getMaxVARCHARlength()
141129
return MAX_VARCHAR_LENGTH;
142130
}
143131

144-
145132
@Override
146133
public char getIdentifierDelimiter()
147134
{

src/main/java/xdev/db/hsql18/jdbc/HSQL18ExceptionParser.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,17 @@
1717
*/
1818
package xdev.db.hsql18.jdbc;
1919

20-
21-
22-
2320
import java.sql.SQLException;
2421

2522
import com.xdev.jadoth.sqlengine.dbms.SQLExceptionParser;
2623
import com.xdev.jadoth.sqlengine.exceptions.SQLEngineException;
2724

2825

29-
3026
public class HSQL18ExceptionParser implements SQLExceptionParser
3127
{
3228
@Override
33-
public SQLEngineException parseSQLException(SQLException e)
29+
public SQLEngineException parseSQLException(final SQLException e)
3430
{
3531
return new SQLEngineException(e);
3632
}
37-
3833
}

src/main/java/xdev/db/hsql18/jdbc/HSQL18JDBCConnection.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
*/
1818
package xdev.db.hsql18.jdbc;
1919

20-
21-
22-
2320
import java.sql.Connection;
2421
import java.sql.Statement;
2522
import java.util.Map;
@@ -34,27 +31,29 @@ public HSQL18JDBCConnection(final HSQL18JDBCDataSource dataSource)
3431
super(dataSource);
3532
}
3633

37-
3834
@Override
3935
public void createTable(
4036
final String tableName, final String primaryKey, final Map<String, String> columnMap,
41-
final boolean isAutoIncrement, final Map<String, String> foreignKeys) throws Exception
37+
final boolean isAutoIncrement, final Map<String, String> foreignKeys) throws Exception
4238
{
4339

4440
if(!columnMap.containsKey(primaryKey))
4541
{
46-
columnMap.put(primaryKey,"INTEGER"); //$NON-NLS-1$
42+
columnMap.put(primaryKey, "INTEGER"); //$NON-NLS-1$
4743
}
4844
StringBuffer createStatement = null;
4945

5046
if(isAutoIncrement)
5147
{
52-
createStatement = new StringBuffer("CREATE TABLE IF NOT EXISTS " + tableName + "(" //$NON-NLS-1$ //$NON-NLS-2$
53-
+ primaryKey + " " + columnMap.get(primaryKey) + " IDENTITY NOT NULL,"); //$NON-NLS-1$ //$NON-NLS-2$
48+
createStatement =
49+
new StringBuffer("CREATE TABLE IF NOT EXISTS " + tableName + "(" //$NON-NLS-1$ //$NON-NLS-2$
50+
+ primaryKey + " " + columnMap.get(primaryKey) + " IDENTITY NOT NULL,"); //$NON-NLS-1$
51+
// $NON-NLS-2$
5452
}
5553
else
5654
{
57-
createStatement = new StringBuffer("CREATE TABLE IF NOT EXISTS " + tableName + "(" //$NON-NLS-1$ //$NON-NLS-2$
55+
createStatement =
56+
new StringBuffer("CREATE TABLE IF NOT EXISTS " + tableName + "(" //$NON-NLS-1$ //$NON-NLS-2$
5857
+ primaryKey + " " + columnMap.get(primaryKey) + ","); //$NON-NLS-1$ //$NON-NLS-2$
5958
}
6059

@@ -70,7 +69,7 @@ public void createTable(
7069

7170
if(log.isDebugEnabled())
7271
{
73-
log.debug("SQL Statement to create a table: " + createStatement.toString()); //$NON-NLS-1$
72+
log.debug("SQL Statement to create a table: " + createStatement); //$NON-NLS-1$
7473
}
7574

7675
final Connection connection = super.getConnection();
@@ -89,5 +88,4 @@ public void createTable(
8988
connection.close();
9089
}
9190
}
92-
9391
}

0 commit comments

Comments
 (0)