@@ -72,7 +72,7 @@ public NeqSimDataBase() {
72
72
* </p>
73
73
*
74
74
* @return a Connection object
75
- * @throws java.sql.SQLException if any.
75
+ * @throws java.sql.SQLException if any.
76
76
* @throws java.lang.ClassNotFoundException if any.
77
77
*/
78
78
public Connection openConnection () throws SQLException , ClassNotFoundException {
@@ -163,7 +163,8 @@ public void setStatement(Statement statement) {
163
163
* </p>
164
164
*
165
165
* @param sqlString Query to execute.
166
- * @return True if the first result is a ResultSet object; false if it is an update count or there
166
+ * @return True if the first result is a ResultSet object; false if it is an
167
+ * update count or there
167
168
* are no results
168
169
*/
169
170
public boolean execute (String sqlString ) {
@@ -286,7 +287,7 @@ public static void setDataBaseType(String aDataBaseType) {
286
287
* Setter for the field <code>dataBaseType</code>.
287
288
* </p>
288
289
*
289
- * @param aDataBaseType a {@link java.lang.String} object
290
+ * @param aDataBaseType a {@link java.lang.String} object
290
291
* @param connectionString a {@link java.lang.String} object
291
292
*/
292
293
public static void setDataBaseType (String aDataBaseType , String connectionString ) {
@@ -402,8 +403,7 @@ public static String[] getComponentNames() {
402
403
*/
403
404
public static boolean hasComponent (String name ) {
404
405
try (neqsim .util .database .NeqSimDataBase database = new neqsim .util .database .NeqSimDataBase ();
405
- java .sql .ResultSet dataSet =
406
- database .getResultSet ("select count(*) from comp WHERE NAME='" + name + "'" )) {
406
+ java .sql .ResultSet dataSet = database .getResultSet ("select count(*) from comp WHERE NAME='" + name + "'" )) {
407
407
dataSet .next ();
408
408
int size = dataSet .getInt (1 );
409
409
if (size == 0 ) {
@@ -424,8 +424,7 @@ public static boolean hasComponent(String name) {
424
424
*/
425
425
public static boolean hasTempComponent (String name ) {
426
426
try (neqsim .util .database .NeqSimDataBase database = new neqsim .util .database .NeqSimDataBase ();
427
- java .sql .ResultSet dataSet =
428
- database .getResultSet ("select count(*) from comptemp WHERE NAME='" + name + "'" )) {
427
+ java .sql .ResultSet dataSet = database .getResultSet ("select count(*) from comptemp WHERE NAME='" + name + "'" )) {
429
428
dataSet .next ();
430
429
int size = dataSet .getInt (1 );
431
430
if (size == 0 ) {
@@ -451,7 +450,7 @@ public static void updateTable(String tableName) {
451
450
* Drops and re-creates table from contents in csv file.
452
451
*
453
452
* @param tableName Name of table to replace
454
- * @param path Path to csv file to get table data from
453
+ * @param path Path to csv file to get table data from
455
454
*/
456
455
public static void updateTable (String tableName , String path ) {
457
456
URL url = NeqSimDataBase .class .getClassLoader ().getResource (path );
@@ -461,7 +460,7 @@ public static void updateTable(String tableName, String path) {
461
460
}
462
461
try (neqsim .util .database .NeqSimDataBase database = new neqsim .util .database .NeqSimDataBase ()) {
463
462
database .execute ("DROP TABLE IF EXISTS " + tableName );
464
- String sqlString = "CREATE TABLE " + tableName + " AS SELECT * FROM CSVREAD('" + url + "')" ;
463
+ String sqlString = "CREATE TABLE " + tableName + " AS SELECT * FROM CSVREAD('file: " + url + "')" ;
465
464
database .execute (sqlString );
466
465
} catch (Exception ex ) {
467
466
logger .error ("Failed updating table " + tableName , ex );
@@ -472,7 +471,7 @@ public static void updateTable(String tableName, String path) {
472
471
* Drops and re-creates table from contents in csv file.
473
472
*
474
473
* @param tableName Name of table to replace
475
- * @param path Path to csv file to
474
+ * @param path Path to csv file to
476
475
*/
477
476
public static void replaceTable (String tableName , String path ) {
478
477
try (neqsim .util .database .NeqSimDataBase database = new neqsim .util .database .NeqSimDataBase ()) {
@@ -494,8 +493,7 @@ public static void replaceTable(String tableName, String path) {
494
493
*/
495
494
public static void initH2DatabaseFromCSVfiles () {
496
495
h2IsInitalizing = true ;
497
- neqsim .util .database .NeqSimDataBase .connectionString =
498
- "jdbc:h2:mem:neqsimthermodatabase;DB_CLOSE_DELAY=-1" ;
496
+ neqsim .util .database .NeqSimDataBase .connectionString = "jdbc:h2:mem:neqsimthermodatabase;DB_CLOSE_DELAY=-1" ;
499
497
neqsim .util .database .NeqSimDataBase .dataBaseType = "H2" ;
500
498
501
499
try {
@@ -539,8 +537,7 @@ public static void initH2DatabaseFromCSVfiles() {
539
537
// technicalrequirements, technicalrequirements_process, materialpipeproperties,
540
538
// materialplateproperties, fittings, LuciaData, Luciadata8
541
539
542
- try (neqsim .util .database .NeqSimDataBase database =
543
- new neqsim .util .database .NeqSimDataBase ()) {
540
+ try (neqsim .util .database .NeqSimDataBase database = new neqsim .util .database .NeqSimDataBase ()) {
544
541
database .execute ("CREATE TABLE comptemp AS SELECT * FROM comp" );
545
542
database .execute ("CREATE TABLE intertemp AS SELECT * FROM inter" );
546
543
}
0 commit comments