monetdb-java: embedded - Change some Java Class - BAT mappings

2022-01-27 Thread Pedro Ferreira
Changeset: 2ab2b21cf930 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java/rev/2ab2b21cf930
Modified Files:
src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
src/main/java/nl/cwi/monetdb/embedded/mapping/MonetDBEmbeddedBlob.java
src/main/java/nl/cwi/monetdb/embedded/mapping/MonetDBToJavaMapping.java

src/main/java/nl/cwi/monetdb/embedded/resultset/EmbeddedPreparedStatement.java

src/main/java/nl/cwi/monetdb/embedded/resultset/QueryResultSetColumn.java
Branch: embedded
Log Message:

Change some Java Class - BAT mappings


diffs (199 lines):

diff --git 
a/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java 
b/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
--- a/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
+++ b/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
@@ -10,7 +10,6 @@ package nl.cwi.monetdb.embedded.env;
 
 import nl.cwi.monetdb.embedded.resultset.*;
 import nl.cwi.monetdb.embedded.tables.MonetDBTable;
-import nl.cwi.monetdb.embedded.tables.MonetDBTableColumn;
 import nl.cwi.monetdb.embedded.utils.StringEscaper;
 
 import java.util.HashSet;
@@ -148,7 +147,7 @@ public class MonetDBEmbeddedConnection {
 /**
  * Creates a prepared query statement likewise the PreparedStatement in 
JDBC.
  *
- * @param query The SQL query with ? indicating the parameters to replace 
in the query
+ * @param query The SQL query with '?' indicating the parameters to 
replace in the query
  * @return An instance of EmbeddedPreparedStatement
  * @throws MonetDBEmbeddedException If an error in the database occurred
  */
@@ -162,7 +161,7 @@ public class MonetDBEmbeddedConnection {
 /**
  * Creates a prepared query statement likewise the PreparedStatement in 
JDBC asynchronously.
  *
- * @param query The SQL query with ? indicating the parameters to replace 
in the query
+ * @param query The SQL query with '?' indicating the parameters to 
replace in the query
  * @return An instance of EmbeddedPreparedStatement
  * @throws MonetDBEmbeddedException If an error in the database occurred
  */
@@ -176,37 +175,11 @@ public class MonetDBEmbeddedConnection {
  *
  * @param schemaName The schema of the table
  * @param tableName The name of the table
- * @return A MonetDBTable instance with currentColumns details
+ * @return A MonetDBTable instance with column details
  * @throws MonetDBEmbeddedException If an error in the database occurred
  */
 public MonetDBTable getMonetDBTable(String schemaName, String tableName) 
throws MonetDBEmbeddedException {
-String qschemaName = StringEscaper.SQLStringEscape(schemaName);
-String qtableName = StringEscaper.SQLStringEscape(tableName);
-String query = "SELECT currentColumns.\"name\" AS column, 
currentColumns.\"type\", currentColumns.\"type_digits\", 
currentColumns.\"type_scale\", currentColumns.\"default\", 
currentColumns.\"null\" FROM (SELECT \"id\", \"table_id\", \"name\", \"type\", 
\"type_digits\", \"type_scale\", \"default\", \"null\", \"number\" FROM 
sys.currentColumns) AS currentColumns INNER JOIN (SELECT \"id\", \"schema_id\" 
FROM sys.tables WHERE name="
-+ qtableName + ") AS tables ON 
(tables.\"id\"=currentColumns.\"table_id\") INNER JOIN (SELECT \"id\" FROM 
sys.schemas WHERE name="
-+ qschemaName + ") AS schemas ON 
(tables.\"schema_id\"=schemas.\"id\") ORDER BY currentColumns.\"number\";";
-
-QueryResultSet eqr = this.sendQuery(query);
-int numberOfRows = eqr.getNumberOfRows();
-if(numberOfRows == 0) {
-throw new MonetDBEmbeddedException("The table " + tableName + " on 
schema " + schemaName + " does not exist!");
-}
-QueryResultSetRows rows = eqr.fetchAllRowValues();
-eqr.close();
-
-MonetDBTableColumn[] array = new 
MonetDBTableColumn[numberOfRows];
-int i = 0;
-for(QueryResultSetRows.QueryResulSetRow row : rows.getAllRows()) {
-String columnName = row.getColumn(0);
-String columnType = row.getColumn(1);
-int ndigits = row.getColumn(2);
-int nscale = row.getColumn(3);
-String defaultValue = row.getColumn(4);
-boolean isNullable = row.getColumn(5);
-array[i] = new MonetDBTableColumn(i, columnName, columnType, 
ndigits, nscale, defaultValue, isNullable);
-i++;
-}
-MonetDBTable res = new MonetDBTable(this, schemaName, tableName, 
array);
+MonetDBTable res = 
this.getMonetDBTableInternal(this.connectionPointer, schemaName, tableName);
 results.add(res);
 return res;
 }
@@ -216,7 +189,7 @@ public class MonetDBEmbeddedConnection {
  *
  * @param schemaName The schema of the table
  * @param tableName The name of the table
- 

monetdb-java: embedded - Change some Java Class - BAT mappings

2016-11-09 Thread Pedro Ferreira
Changeset: 2ab2b21cf930 for monetdb-java
URL: http://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=2ab2b21cf930
Modified Files:
src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
src/main/java/nl/cwi/monetdb/embedded/mapping/MonetDBEmbeddedBlob.java
src/main/java/nl/cwi/monetdb/embedded/mapping/MonetDBToJavaMapping.java

src/main/java/nl/cwi/monetdb/embedded/resultset/EmbeddedPreparedStatement.java

src/main/java/nl/cwi/monetdb/embedded/resultset/QueryResultSetColumn.java
Branch: embedded
Log Message:

Change some Java Class - BAT mappings


diffs (199 lines):

diff --git 
a/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java 
b/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
--- a/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
+++ b/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
@@ -10,7 +10,6 @@ package nl.cwi.monetdb.embedded.env;
 
 import nl.cwi.monetdb.embedded.resultset.*;
 import nl.cwi.monetdb.embedded.tables.MonetDBTable;
-import nl.cwi.monetdb.embedded.tables.MonetDBTableColumn;
 import nl.cwi.monetdb.embedded.utils.StringEscaper;
 
 import java.util.HashSet;
@@ -148,7 +147,7 @@ public class MonetDBEmbeddedConnection {
 /**
  * Creates a prepared query statement likewise the PreparedStatement in 
JDBC.
  *
- * @param query The SQL query with ? indicating the parameters to replace 
in the query
+ * @param query The SQL query with '?' indicating the parameters to 
replace in the query
  * @return An instance of EmbeddedPreparedStatement
  * @throws MonetDBEmbeddedException If an error in the database occurred
  */
@@ -162,7 +161,7 @@ public class MonetDBEmbeddedConnection {
 /**
  * Creates a prepared query statement likewise the PreparedStatement in 
JDBC asynchronously.
  *
- * @param query The SQL query with ? indicating the parameters to replace 
in the query
+ * @param query The SQL query with '?' indicating the parameters to 
replace in the query
  * @return An instance of EmbeddedPreparedStatement
  * @throws MonetDBEmbeddedException If an error in the database occurred
  */
@@ -176,37 +175,11 @@ public class MonetDBEmbeddedConnection {
  *
  * @param schemaName The schema of the table
  * @param tableName The name of the table
- * @return A MonetDBTable instance with currentColumns details
+ * @return A MonetDBTable instance with column details
  * @throws MonetDBEmbeddedException If an error in the database occurred
  */
 public MonetDBTable getMonetDBTable(String schemaName, String tableName) 
throws MonetDBEmbeddedException {
-String qschemaName = StringEscaper.SQLStringEscape(schemaName);
-String qtableName = StringEscaper.SQLStringEscape(tableName);
-String query = "SELECT currentColumns.\"name\" AS column, 
currentColumns.\"type\", currentColumns.\"type_digits\", 
currentColumns.\"type_scale\", currentColumns.\"default\", 
currentColumns.\"null\" FROM (SELECT \"id\", \"table_id\", \"name\", \"type\", 
\"type_digits\", \"type_scale\", \"default\", \"null\", \"number\" FROM 
sys.currentColumns) AS currentColumns INNER JOIN (SELECT \"id\", \"schema_id\" 
FROM sys.tables WHERE name="
-+ qtableName + ") AS tables ON 
(tables.\"id\"=currentColumns.\"table_id\") INNER JOIN (SELECT \"id\" FROM 
sys.schemas WHERE name="
-+ qschemaName + ") AS schemas ON 
(tables.\"schema_id\"=schemas.\"id\") ORDER BY currentColumns.\"number\";";
-
-QueryResultSet eqr = this.sendQuery(query);
-int numberOfRows = eqr.getNumberOfRows();
-if(numberOfRows == 0) {
-throw new MonetDBEmbeddedException("The table " + tableName + " on 
schema " + schemaName + " does not exist!");
-}
-QueryResultSetRows rows = eqr.fetchAllRowValues();
-eqr.close();
-
-MonetDBTableColumn[] array = new 
MonetDBTableColumn[numberOfRows];
-int i = 0;
-for(QueryResultSetRows.QueryResulSetRow row : rows.getAllRows()) {
-String columnName = row.getColumn(0);
-String columnType = row.getColumn(1);
-int ndigits = row.getColumn(2);
-int nscale = row.getColumn(3);
-String defaultValue = row.getColumn(4);
-boolean isNullable = row.getColumn(5);
-array[i] = new MonetDBTableColumn(i, columnName, columnType, 
ndigits, nscale, defaultValue, isNullable);
-i++;
-}
-MonetDBTable res = new MonetDBTable(this, schemaName, tableName, 
array);
+MonetDBTable res = 
this.getMonetDBTableInternal(this.connectionPointer, schemaName, tableName);
 results.add(res);
 return res;
 }
@@ -216,7 +189,7 @@ public class MonetDBEmbeddedConnection {
  *
  * @param schemaName The schema of the table
  * @param tableName The name of