diff --git a/README.md b/README.md index 6ec1a495..221072da 100644 --- a/README.md +++ b/README.md @@ -507,11 +507,11 @@ Clients using the jdbcDriverOOo driver can access features of the underlying JDB ### What has been done for version 1.3.3: -- [Modification of the handling][111] of the `JavaDriverClassPath` connection parameter. This parameter can now designate a directory and in this case all contained jar files will be added to the `Java ClassPath`. This allows dynamic loading of JDBC drivers requiring multiple archives (ie: Derby and Jaybird embedded). -- Resumed part of the implementation of `javax.sql.rowset.CachedRowSet` in ResultSet [sdbcx.RowSetSuper][112] in order to simulate the type `TYPE_SCROLL_SENSITIVE` from ResultSet of type `TYPE_FORWARD_ONLY`. This allows LibreOffice Base to use bookmarks (ie: the UNO interface [XRowLocate][104]) which allow positioned insertions, updates and deletions and therefore, for databases supporting it, the possibility of edit tables containing no primary key. This implementation progressively loading the entire ResultSet data into memory can result in a memory overflow. Implementing paging will eliminate this risk. +- [Modification of the handling][111] of the `JavaDriverClassPath` connection parameter. This parameter can now designate a directory and in this case all contained jar files will be added to the `Java ClassPath`. This allows dynamic loading of JDBC drivers requiring multiple archives (ie: Derby and Jaybird embedded). This change was made to allow the new [JaybirdOOo][112] extension to work. +- Resumed part of the implementation of `javax.sql.rowset.CachedRowSet` in ResultSet [sdbcx.RowSetSuper][113] in order to simulate the type `TYPE_SCROLL_SENSITIVE` from ResultSet of type `TYPE_FORWARD_ONLY`. This allows LibreOffice Base to use bookmarks (ie: the UNO interface [XRowLocate][104]) which allow positioned insertions, updates and deletions and therefore, for databases supporting it, the possibility of edit tables containing no primary key. This implementation progressively loading the entire ResultSet data into memory can result in a memory overflow. Implementing paging will eliminate this risk. - Added MySQL Connector/J version 8.4.0 driver. This driver does not seem to work correctly, quite surprising errors appear... I leave it in place in case people are ready to participate in its integration? Use with caution. -- Following the request from [PeterSchmidt23][113] addition of the driver [Trino][114] version 448. Not knowing Trino, which also looks amazing, no integration has yet been carried out. Use with caution. -- The implementation of `CachedRowSet` seems to have solved the problem of inserting cells from Calc, see [issue #7][115]. +- Following the request from [PeterSchmidt23][114] addition of the driver [Trino][115] version 448. Not knowing Trino, which also looks amazing, only the beginning of integration has been achieved. Use with caution. +- The implementation of `CachedRowSet` seems to have solved the problem of inserting cells from Calc, see [issue #7][116]. - Many corrections and improvements... ### What remains to be done for version 1.3.3: @@ -623,7 +623,8 @@ Clients using the jdbcDriverOOo driver can access features of the underlying JDB [109]: [110]: [111]: -[112]: -[113]: -[114]: -[115]: +[112]: +[113]: +[114]: +[115]: +[116]: diff --git a/README_fr.md b/README_fr.md index e184ce3b..a35e58da 100644 --- a/README_fr.md +++ b/README_fr.md @@ -507,11 +507,11 @@ Les clients utilisant le pilote jdbcDriverOOo peuvent accéder aux fonctionnalit ### Ce qui a été fait pour la version 1.3.3: -- [Modification de la gestion][111] du paramètre de connexion `JavaDriverClassPath`. Ce paramètre peut désormais désigner un répertoire et dans ce cas tous les fichiers jar contenus seront ajoutés au `Java ClassPath`. Cela permet le chargement dynamique des pilotes JDBC nécessitant plusieurs archives (ie: Derby et Jaybird embedded). -- Reprise d'une partie de l'implémentation de `javax.sql.rowset.CachedRowSet` dans les jeux de résultats [sdbcx.RowSetSuper][112] afin de simuler le type `TYPE_SCROLL_SENSITIVE` à partir de jeux de résultats de type `TYPE_FORWARD_ONLY`. Cela permet à LibreOffice Base d'utiliser des signets (ie: l'interface UNO [XRowLocate][104]) qui permettent des insertions, mises à jour et suppressions positionnées et donc, pour les bases de données le supportant, la possibilité d'éditer des tables ne contenant aucune clé primaire. Cette implémentation chargeant progressivement l’intégralité des données du jeu de résultats en mémoire peut entraîner un débordement de mémoire. La mise en Å“uvre d'une pagination éliminera ce risque. +- [Modification de la gestion][111] du paramètre de connexion `JavaDriverClassPath`. Ce paramètre peut désormais désigner un répertoire et dans ce cas tous les fichiers jar contenus seront ajoutés au `Java ClassPath`. Cela permet le chargement dynamique des pilotes JDBC nécessitant plusieurs archives (ie: Derby et Jaybird embedded). Cette modification a été apportée pour permettre à la nouvelle extension [JaybirdOOo][112] de fonctionner. +- Reprise d'une partie de l'implémentation de `javax.sql.rowset.CachedRowSet` dans les jeux de résultats [sdbcx.RowSetSuper][113] afin de simuler le type `TYPE_SCROLL_SENSITIVE` à partir de jeux de résultats de type `TYPE_FORWARD_ONLY`. Cela permet à LibreOffice Base d'utiliser des signets (ie: l'interface UNO [XRowLocate][104]) qui permettent des insertions, mises à jour et suppressions positionnées et donc, pour les bases de données le supportant, la possibilité d'éditer des tables ne contenant aucune clé primaire. Cette implémentation chargeant progressivement l’intégralité des données du jeu de résultats en mémoire peut entraîner un débordement de mémoire. La mise en Å“uvre d'une pagination éliminera ce risque. - Ajout du pilote MySQL Connector/J version 8.4.0. Ce driver ne semble pas fonctionner correctement, des erreurs assez surprenantes apparaissent... Je le laisse en place au cas où des gens seraient prêts à participer à son intégration? A utiliser avec précaution. -- Suite à la demande de [PeterSchmidt23][113] ajout du pilote [Trino][114] version 448. Ne connaissant pas Trino, qui a l'air étonnant par ailleur, aucune intégration n'a encore été réalisée. A utiliser avec précaution. -- L'implémentation de `CachedRowSet` semble avoir résolu le problème d'insertion de cellules depuis Calc, voir [dysfonctionnement #7][115]. +- Suite à la demande de [PeterSchmidt23][114] ajout du pilote [Trino][115] version 448. Ne connaissant pas Trino, qui a l'air étonnant par ailleur, seulement un début d'intégration a été réalisée. A utiliser avec précaution. +- L'implémentation de `CachedRowSet` semble avoir résolu le problème d'insertion de cellules depuis Calc, voir [dysfonctionnement #7][116]. - De nombreuses corrections et améliorations... ### Que reste-t-il à faire pour la version 1.3.3: @@ -623,7 +623,8 @@ Les clients utilisant le pilote jdbcDriverOOo peuvent accéder aux fonctionnalit [109]: [110]: [111]: -[112]: -[113]: -[114]: -[115]: +[112]: +[113]: +[114]: +[115]: +[116]: diff --git a/source/jdbcDriverOOo/Options.xcs b/source/jdbcDriverOOo/Options.xcs index 431f4e77..26a79244 100644 --- a/source/jdbcDriverOOo/Options.xcs +++ b/source/jdbcDriverOOo/Options.xcs @@ -35,6 +35,7 @@ + diff --git a/source/jdbcDriverOOo/Options.xcu b/source/jdbcDriverOOo/Options.xcu index dbae69cf..6533a496 100644 --- a/source/jdbcDriverOOo/Options.xcu +++ b/source/jdbcDriverOOo/Options.xcu @@ -40,6 +40,9 @@ false + + true + true diff --git a/source/jdbcDriverOOo/resource/Driver_en_US.properties b/source/jdbcDriverOOo/resource/Driver_en_US.properties index 038efc56..9225c403 100644 --- a/source/jdbcDriverOOo/resource/Driver_en_US.properties +++ b/source/jdbcDriverOOo/resource/Driver_en_US.properties @@ -59,8 +59,9 @@ 11200=%s: creating . 11201=%s: created , id: %s +11202=%s: JDBC driver version: %s -11250=%s: JDBC driver version: %s +11250=%s: executing DDL or DCL query: %s 11300=%s: creating . 11301=%s: created , id: %s diff --git a/source/jdbcDriverOOo/resource/Driver_fr_FR.properties b/source/jdbcDriverOOo/resource/Driver_fr_FR.properties index 2bdff941..8317e90b 100644 --- a/source/jdbcDriverOOo/resource/Driver_fr_FR.properties +++ b/source/jdbcDriverOOo/resource/Driver_fr_FR.properties @@ -59,8 +59,9 @@ 11200=%s: création de . 11201=%s: créé, id: %s +11202=%s: JDBC version du pilote: %s -11250=%s: JDBC version du pilote: %s +11250=%s: execute une requête DDL ou DCL: %s 11300=%s: création d'un . 11301=%s: créé, id: %s diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/DriverProvider.java b/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/DriverProvider.java index fa949136..1a4b1782 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/DriverProvider.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/DriverProvider.java @@ -283,7 +283,7 @@ public String getDropUserQuery(ConnectionBase connection, public boolean acceptsURL(String url); - public Properties getJavaConnectionProperties(PropertyValue[] infos); + public Properties getJdbcConnectionProperties(PropertyValue[] infos); public Object getConnectionProperties(PropertyValue[] infos, String name, diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/DriverProviderMain.java b/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/DriverProviderMain.java index 140d5d76..6963c973 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/DriverProviderMain.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/DriverProviderMain.java @@ -701,7 +701,7 @@ public void setConnection(XInterface source, throws SQLException { try { - System.out.println("DriverProvider.getJavaConnectionProperties() 1"); + System.out.println("DriverProvider.setConnection() 1"); m_infos = infos; // XXX: SQLCommandSuffix is needed for building query from sql command. m_SQLCommandSuffix = getDriverStringProperty(config1, "SQLCommandSuffix", m_SQLCommandSuffix); @@ -758,7 +758,8 @@ public void setConnection(XInterface source, m_usebookmark = UnoHelper.getConfigurationOption(config2, "UseBookmark", true); m_enhanced = enhanced; String url = getConnectionUrl(location, level); - java.sql.Connection connection = DriverManager.getConnection(url, getJavaConnectionProperties(infos)); + java.sql.Connection connection = DriverManager.getConnection(url, getJdbcConnectionProperties(infos)); + System.out.println("DriverProvider.setConnection() 2"); java.sql.DatabaseMetaData metadata = connection.getMetaData(); m_CatalogsInTableDefinitions = metadata.supportsCatalogsInTableDefinitions(); @@ -772,7 +773,8 @@ public void setConnection(XInterface source, m_CatalogsInPrivilegeDefinitions = metadata.supportsCatalogsInPrivilegeDefinitions(); m_SchemasInPrivilegeDefinitions = metadata.supportsSchemasInPrivilegeDefinitions(); - m_SupportsTransactions = metadata.supportsTransactions(); + boolean support = UnoHelper.getConfigurationOption(config2, "SupportTransaction", true); + m_SupportsTransactions = metadata.supportsTransactions() && support; m_IsCatalogAtStart = metadata.isCatalogAtStart(); m_CatalogSeparator = metadata.getCatalogSeparator(); m_IdentifierQuoteString = metadata.getIdentifierQuoteString(); @@ -781,7 +783,7 @@ public void setConnection(XInterface source, // XXX: We do not keep the connection but the statement // XXX: which allows us to find the connection if necessary. m_statement = connection.createStatement(); - System.out.println("DriverProvider.getJavaConnectionProperties() 3"); + System.out.println("DriverProvider.setConnection() 3"); } catch (java.sql.SQLException e) { int resource = Resources.STR_LOG_NO_SYSTEM_CONNECTION; @@ -957,68 +959,80 @@ public String getConnectionUrl(String location, } @Override - public Properties getJavaConnectionProperties(PropertyValue[] infos) + public Properties getJdbcConnectionProperties(PropertyValue[] infos) { - // XXX: These are properties used internally by LibreOffice, - // XXX: and should not be passed to the JDBC driver - // XXX: (which probably does not know anything about them anyway). - // XXX: see: connectivity/source/drivers/jdbc/tools.cxx createStringPropertyArray() Properties properties = new Properties(); for (PropertyValue info : infos) { - if (info.Name.equals("JavaDriverClass") || - info.Name.equals("JavaDriverClassPath") || - info.Name.equals("SystemProperties") || - info.Name.equals("CharSet") || - info.Name.equals("AppendTableAliasName") || - info.Name.equals("AppendTableAliasInSelect") || - info.Name.equals("DisplayVersionColumns") || - info.Name.equals("GeneratedValues") || - info.Name.equals("UseIndexDirectionKeyword") || - info.Name.equals("UseKeywordAsBeforeAlias") || - info.Name.equals("AddIndexAppendix") || - info.Name.equals("FormsCheckRequiredFields") || - info.Name.equals("GenerateASBeforeCorrelationName") || - info.Name.equals("EscapeDateTime") || - info.Name.equals("ParameterNameSubstitution") || - info.Name.equals("IsPasswordRequired") || - info.Name.equals("IsAutoRetrievingEnabled") || - info.Name.equals("AutoRetrievingStatement") || - info.Name.equals("UseCatalogInSelect") || - info.Name.equals("UseSchemaInSelect") || - info.Name.equals("AutoIncrementCreation") || - info.Name.equals("RowVersionCreation") || - info.Name.equals("Extension") || - info.Name.equals("NoNameLengthLimit") || - info.Name.equals("EnableSQL92Check") || - info.Name.equals("EnableOuterJoinEscape") || - info.Name.equals("BooleanComparisonMode") || - info.Name.equals("IgnoreCurrency") || - info.Name.equals("TypeInfoSettings") || - info.Name.equals("IgnoreDriverPrivileges") || - info.Name.equals("ImplicitCatalogRestriction") || - info.Name.equals("ImplicitSchemaRestriction") || - info.Name.equals("SupportsTableCreation") || - info.Name.equals("UseJava") || - info.Name.equals("Authentication") || - info.Name.equals("PreferDosLikeLineEnds") || - info.Name.equals("PrimaryKeySupport") || - info.Name.equals("RespectDriverResultSetType") || - info.Name.equals("TablePrivilegesSettings") || - - info.Name.equals("DriverLoggerLevel") || - info.Name.equals("InMemoryDataBase") || - info.Name.equals("Type") || - info.Name.equals("Url") || - info.Name.equals("ConnectionService")) - { + String property = info.Name; + if (isLibreOfficeProperty(property) || isInternalProperty(property)) { continue; } - System.out.println("DriverProvider.getJavaConnectionProperties() *********************: " + info.Name); - properties.setProperty(info.Name, String.format("%s", info.Value)); + System.out.println("DriverProvider.getJdbcConnectionProperties() ********************* Name: " + property); + properties.setProperty(property, String.format("%s", info.Value)); + System.out.println("DriverProvider.getJdbcConnectionProperties() ********************* Value: " + info.Value); } return properties; } + private boolean isLibreOfficeProperty(String property) + { + // XXX: These are properties used internally by LibreOffice, + // XXX: and should not be passed to the JDBC driver + // XXX: (which probably does not know anything about them anyway). + // XXX: see: connectivity/source/drivers/jdbc/tools.cxx createStringPropertyArray() + return property.equals("JavaDriverClass") || + property.equals("JavaDriverClassPath") || + property.equals("SystemProperties") || + property.equals("CharSet") || + property.equals("AppendTableAliasName") || + property.equals("AppendTableAliasInSelect") || + property.equals("DisplayVersionColumns") || + property.equals("GeneratedValues") || + property.equals("UseIndexDirectionKeyword") || + property.equals("UseKeywordAsBeforeAlias") || + property.equals("AddIndexAppendix") || + property.equals("FormsCheckRequiredFields") || + property.equals("GenerateASBeforeCorrelationName") || + property.equals("EscapeDateTime") || + property.equals("ParameterNameSubstitution") || + property.equals("IsPasswordRequired") || + property.equals("IsAutoRetrievingEnabled") || + property.equals("AutoRetrievingStatement") || + property.equals("UseCatalogInSelect") || + property.equals("UseSchemaInSelect") || + property.equals("AutoIncrementCreation") || + property.equals("Extension") || + property.equals("NoNameLengthLimit") || + property.equals("EnableSQL92Check") || + property.equals("EnableOuterJoinEscape") || + property.equals("BooleanComparisonMode") || + property.equals("IgnoreCurrency") || + property.equals("TypeInfoSettings") || + property.equals("IgnoreDriverPrivileges") || + property.equals("ImplicitCatalogRestriction") || + property.equals("ImplicitSchemaRestriction") || + property.equals("SupportsTableCreation") || + property.equals("UseJava") || + property.equals("Authentication") || + property.equals("PreferDosLikeLineEnds") || + property.equals("PrimaryKeySupport") || + property.equals("RespectDriverResultSetType"); + } + + private boolean isInternalProperty(String property) + { + // XXX: These are properties used internally by jdbcDriverOOo, + // XXX: and should not be passed to the JDBC driver + // XXX: (which probably does not know anything about them anyway). + return property.equals("TablePrivilegesSettings") || + property.equals("RowVersionCreation") || + property.equals("DriverLoggerLevel") || + property.equals("InMemoryDataBase") || + property.equals("Type") || + property.equals("Url") || + property.equals("ConnectionService"); + } + @Override public boolean supportCreateUser() { diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/Resources.java b/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/Resources.java index 8552aea0..9f7c0e18 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/Resources.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/Resources.java @@ -113,8 +113,9 @@ public class Resources { // io.github.prrvchr.uno.sdbc.ConnectionMain: public static final int STR_LOG_CREATE_DATABASE_METADATA = (STR_JDBC_LOG_MESSAGE_BASE + 200); public static final int STR_LOG_CREATED_DATABASE_METADATA_ID = (STR_JDBC_LOG_MESSAGE_BASE + 201); + public static final int STR_LOG_DATABASE_METADATA_DRIVER_VERSION = (STR_JDBC_LOG_MESSAGE_BASE + 202); - public static final int STR_LOG_DATABASE_METADATA_DRIVER_VERSION = (STR_JDBC_LOG_MESSAGE_BASE + 250); + public static final int STR_LOG_CONNECTION_EXECUTE_QUERY = (STR_JDBC_LOG_MESSAGE_BASE + 250); // io.github.prrvchr.uno.sdbc.StatementMain: public static final int STR_LOG_CREATE_STATEMENT = (STR_JDBC_LOG_MESSAGE_BASE + 300); diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/helper/DBTools.java b/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/helper/DBTools.java index 1c800b4c..24035f1f 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/helper/DBTools.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/jdbcdriver/helper/DBTools.java @@ -1034,16 +1034,16 @@ public static int getDescriptorIntegerValue(XPropertySet descriptor, } } - public static boolean executeDDLQuery(DriverProvider provider, + public static boolean executeSQLQuery(DriverProvider provider, String query) throws java.sql.SQLException { Object[] parameters = new Object[]{}; Integer[] positions = new Integer[]{}; - return executeDDLQuery(provider, query, parameters, positions); + return executeSQLQuery(provider, query, parameters, positions); } - public static boolean executeDDLQuery(DriverProvider provider, + public static boolean executeSQLQuery(DriverProvider provider, String query, Object[] parameters, Integer[] positions) @@ -1052,28 +1052,29 @@ public static boolean executeDDLQuery(DriverProvider provider, if (query.isBlank()) { return false; } - boolean autocommit = false; + boolean auto = false; boolean support = provider.supportsTransactions(); - java.sql.Connection jdbc = provider.getConnection(); + java.sql.Connection connection = provider.getConnection(); try { if (support) { - autocommit = jdbc.getAutoCommit(); - jdbc.setAutoCommit(false); + auto = connection.getAutoCommit(); + connection.setAutoCommit(false); } - try (java.sql.PreparedStatement statement = jdbc.prepareStatement(query)) { - executeDDL(statement, parameters, positions); + provider.getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_CONNECTION_EXECUTE_QUERY, query); + try (java.sql.PreparedStatement statement = connection.prepareStatement(query)) { + executeSQL(statement, parameters, positions); } if (support) { - jdbc.commit(); - jdbc.setAutoCommit(autocommit); + connection.commit(); + connection.setAutoCommit(auto); } } catch (java.sql.SQLException e) { if (support) { try { - jdbc.rollback(); - jdbc.setAutoCommit(autocommit); + connection.rollback(); + connection.setAutoCommit(auto); } catch (java.sql.SQLException ex) { e.setNextException(ex); @@ -1085,16 +1086,16 @@ public static boolean executeDDLQuery(DriverProvider provider, } - public static boolean executeDDLQueries(DriverProvider provider, + public static boolean executeSQLQueries(DriverProvider provider, List queries) throws java.sql.SQLException { Object[] parameters = new Object[]{}; List positions = new ArrayList(); - return executeDDLQueries(provider, queries, parameters, positions); + return executeSQLQueries(provider, queries, parameters, positions); } - public static boolean executeDDLQueries(DriverProvider provider, + public static boolean executeSQLQueries(DriverProvider provider, List queries, Object[] parameters, List positions) @@ -1102,13 +1103,13 @@ public static boolean executeDDLQueries(DriverProvider provider, { int count = 0; int index = 0; - boolean autocommit = false; + boolean auto = false; boolean support = provider.supportsTransactions(); System.out.println("DBTools.executeDDLQueries() Support Transaction:" + support); java.sql.Connection connection = provider.getConnection(); try { if (support) { - autocommit = connection.getAutoCommit(); + auto = connection.getAutoCommit(); connection.setAutoCommit(false); } for (String query : queries) { @@ -1116,23 +1117,25 @@ public static boolean executeDDLQueries(DriverProvider provider, index ++; continue; } + provider.getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_CONNECTION_EXECUTE_QUERY, query); try (java.sql.PreparedStatement statement = connection.prepareStatement(query)) { Integer[] position = (positions.size() > index) ? positions.get(index) : new Integer[]{}; - executeDDL(statement, parameters, position); + executeSQL(statement, parameters, position); index ++; count ++; } } if (support) { connection.commit(); - connection.setAutoCommit(autocommit); + connection.setAutoCommit(auto); } } catch (java.sql.SQLException e) { + System.out.println("DBTools.executeDDLQueries() Error :" + e.getMessage()); if (support) { try { connection.rollback(); - connection.setAutoCommit(autocommit); + connection.setAutoCommit(auto); } catch (java.sql.SQLException ex) { e.setNextException(ex); @@ -1140,10 +1143,11 @@ public static boolean executeDDLQueries(DriverProvider provider, } throw e; } + System.out.println("DBTools.executeDDLQueries() 2 Count: " + count); return count > 0; } - private static void executeDDL(java.sql.PreparedStatement statement, + private static void executeSQL(java.sql.PreparedStatement statement, Object[] parameters, Integer[] positions) throws java.sql.SQLException @@ -1202,8 +1206,6 @@ public final static java.sql.ResultSet getGeneratedResult(DriverProvider provide return result; } - - public static String getGeneratedColumnNames(java.sql.ResultSet result, int count) throws java.sql.SQLException { diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/GroupContainer.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/GroupContainer.java index 31633e61..fb1ce053 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/GroupContainer.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/GroupContainer.java @@ -109,7 +109,7 @@ protected boolean _createGroup(XPropertySet descriptor, query = DBRoleHelper.getCreateGroupQuery(m_connection.getProvider(), descriptor, name, isCaseSensitive()); System.out.println("sdbcx.GroupContainer._createGroup() SQL: " + query); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_GROUPS_CREATE_GROUP_QUERY, name, query); - return DBTools.executeDDLQuery(m_connection.getProvider(), query); + return DBTools.executeSQLQuery(m_connection.getProvider(), query); } catch (java.sql.SQLException e) { int resource = Resources.STR_LOG_GROUPS_CREATE_GROUP_QUERY_ERROR; @@ -140,7 +140,7 @@ protected void removeDataBaseElement(int index, query = DBRoleHelper.getDropGroupQuery(provider, name, isCaseSensitive()); System.out.println("sdbcx.GroupContainer.removeDataBaseElement() SQL: " + query); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_GROUPS_REMOVE_GROUP_QUERY, name, query); - if (DBTools.executeDDLQuery(provider, query)) { + if (DBTools.executeSQLQuery(provider, query)) { // XXX: A role has just been deleted, it should also be deleted from any member user... m_connection.getUsersInternal().removeRole(name); } diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/Role.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/Role.java index 61c1802a..e53dd291 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/Role.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/Role.java @@ -158,7 +158,7 @@ public void grantPrivileges(String name, Resources.STR_LOG_USER_GRANT_PRIVILEGE_QUERY; getLogger().logprb(LogLevel.INFO, resource, privileges, getName(), name, query); System.out.println("sdb.Role.grantPrivileges() Query: " + query); - DBTools.executeDDLQuery(m_connection.getProvider(), query); + DBTools.executeSQLQuery(m_connection.getProvider(), query); } catch (java.sql.SQLException e) { int resource = m_isrole ? @@ -190,7 +190,7 @@ public void revokePrivileges(String name, Resources.STR_LOG_GROUP_REVOKE_PRIVILEGE_QUERY : Resources.STR_LOG_USER_REVOKE_PRIVILEGE_QUERY; getLogger().logprb(LogLevel.INFO, resource, privileges, getName(), name, query); - DBTools.executeDDLQuery(m_provider, query); + DBTools.executeSQLQuery(m_provider, query); } } catch (java.sql.SQLException e) { diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/UserContainer.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/UserContainer.java index a26ef093..bd2f086d 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/UserContainer.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdb/UserContainer.java @@ -125,7 +125,7 @@ protected boolean _createUser(XPropertySet descriptor, query = DBRoleHelper.getCreateUserQuery(m_connection.getProvider(), descriptor, name, isCaseSensitive()); System.out.println("sdbcx.UserContainer._createUser() SQL: " + query); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_USERS_CREATE_USER_QUERY, name, query); - return DBTools.executeDDLQuery(m_connection.getProvider(), query); + return DBTools.executeSQLQuery(m_connection.getProvider(), query); } catch (java.sql.SQLException e) { int resource = Resources.STR_LOG_USERS_CREATE_USER_QUERY_ERROR; @@ -156,7 +156,7 @@ protected void removeDataBaseElement(int index, query = DBRoleHelper.getDropUserQuery(m_connection.getProvider(), name, isCaseSensitive()); System.out.println("sdbcx.UserContainer.removeDataBaseElement() SQL: " + query); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_USERS_REMOVE_USER_QUERY, name, query); - if (DBTools.executeDDLQuery(m_connection.getProvider(), query)) { + if (DBTools.executeSQLQuery(m_connection.getProvider(), query)) { // XXX: A user has just been deleted, they should also be deleted from any role they are a member of... m_connection.getGroupsInternal().removeRole(name); } diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbc/DriverBase.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbc/DriverBase.java index 60a16195..f13d4e99 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbc/DriverBase.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbc/DriverBase.java @@ -440,7 +440,8 @@ private void addDriverArchiveUrl(List urls, try { String name = file.getName(); if (name.toLowerCase().endsWith("." + m_jar)) { - urls.add(new URL(m_jar + ":" + Path.of(file.getAbsolutePath()).toUri() + "!/")); + String jar = m_jar + ":" + Path.of(file.getAbsolutePath()).toUri() + "!/"; + urls.add(new URL(jar)); m_logger.logprb(LogLevel.INFO, Resources.STR_LOG_DRIVER_ARCHIVE_LOADING, name); } } diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbc/ResultSetBase.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbc/ResultSetBase.java index 92bfe868..1dc9edba 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbc/ResultSetBase.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbc/ResultSetBase.java @@ -760,7 +760,6 @@ public XBlob getBlob(int index) throws SQLException public boolean getBoolean(int index) throws SQLException { try { - System.out.println("ResultSetBase.getBoolean() 1 Index: " + index); return m_Result.getBoolean(index); } catch (java.sql.SQLException e) { @@ -847,7 +846,6 @@ public float getFloat(int index) throws SQLException public int getInt(int index) throws SQLException { try { - System.out.println("ResultSetBase.getInt() 1 Index: " + index); return m_Result.getInt(index); } catch (java.sql.SQLException e) { @@ -858,11 +856,8 @@ public int getInt(int index) throws SQLException @Override public long getLong(int index) throws SQLException { - System.out.println("ResultSetBase.getLong() 1"); try { - long value = m_Result.getLong(index); - System.out.println("ResultSetBase.getLong() 1 Index: " + index + " - Value: " + value); - return value; + return m_Result.getLong(index); } catch (java.sql.SQLException e) { throw UnoHelper.getSQLException(e, this); @@ -873,7 +868,6 @@ public long getLong(int index) throws SQLException public Object getObject(int index, XNameAccess map) throws SQLException { try { - System.out.println("ResultSetBase.getObject() 1 Index: " + index); return DBTools.getObject(m_Result.getObject(index), map); } catch (java.sql.SQLException e) { @@ -897,7 +891,6 @@ public XRef getRef(int index) throws SQLException public short getShort(int index) throws SQLException { try { - System.out.println("ResultSetBase.getShort() 1 Index: " + index); return m_Result.getShort(index); } catch (java.sql.SQLException e) { @@ -909,13 +902,11 @@ public short getShort(int index) throws SQLException public String getString(int index) throws SQLException { try { - System.out.println("ResultSetBase.getString() 1"); String value = m_Result.getString(index); if (value == null) { value = ""; } m_logger.logprb(LogLevel.FINE, Resources.STR_LOG_RESULTSET_GET_PARAMETER, value, "getString", Integer.toString(index)); - System.out.println("ResultSetBase.getString() 1 Index: " + index + " - Value: " + value); return value; } catch (java.sql.SQLException e) { diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/ColumnContainerBase.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/ColumnContainerBase.java index 5a7dfc49..3f99edcf 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/ColumnContainerBase.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/ColumnContainerBase.java @@ -116,7 +116,7 @@ private boolean createColumn(XPropertySet descriptor, String name) if (!queries.isEmpty()) { String query = String.join("> <", queries); m_table.getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_COLUMN_ALTER_QUERY, name, table, query); - return DBTools.executeDDLQueries(provider, queries); + return DBTools.executeSQLQueries(provider, queries); } } catch (java.sql.SQLException e) { @@ -210,7 +210,7 @@ protected void removeDataBaseElement(int index, query = provider.getDropColumnQuery(table, column); table = DBTools.composeTableName(provider, m_table, ComposeRule.InTableDefinitions, false); m_table.getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_GROUPS_CREATE_GROUP_QUERY, name, table, query); - DBTools.executeDDLQuery(provider, query); + DBTools.executeSQLQuery(provider, query); } catch (java.sql.SQLException e) { int resource = Resources.STR_LOG_GROUPS_CREATE_GROUP_QUERY_ERROR; diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/IndexContainer.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/IndexContainer.java index c2c50074..a9935eb8 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/IndexContainer.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/IndexContainer.java @@ -187,7 +187,7 @@ private boolean createIndex(XPropertySet descriptor, System.out.println("sdbcx.IndexContainer.createIndex() 1 Query: " + query); table = DBTools.composeTableName(provider, m_Table, rule, false); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_INDEXES_CREATE_INDEX_QUERY, name, table, query); - return DBTools.executeDDLQuery(provider, query); + return DBTools.executeSQLQuery(provider, query); } return false; } @@ -226,7 +226,7 @@ protected void removeDataBaseElement(int index, table = DBTools.composeTableName(provider, m_Table, rule, false); System.out.println("sdbcx.IndexContainer.removeDataBaseElement() Query: " + query); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_INDEXES_REMOVE_INDEX_QUERY, name, table, query); - DBTools.executeDDLQuery(provider, query); + DBTools.executeSQLQuery(provider, query); } catch (java.sql.SQLException e) { int resource = Resources.STR_LOG_INDEXES_REMOVE_INDEX_QUERY_ERROR; diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/KeyContainer.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/KeyContainer.java index e3b3124d..f99869b0 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/KeyContainer.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/KeyContainer.java @@ -206,7 +206,7 @@ private boolean createNewKey(XPropertySet descriptor, String key) System.out.println("sdbcx.KeyContainer.createKey() Query: " + query); int resource = getCreateKeyResource(type, false); getLogger().logprb(LogLevel.INFO, resource, key, name, query); - return DBTools.executeDDLQuery(provider, query); + return DBTools.executeSQLQuery(provider, query); } catch (java.sql.SQLException e) { int resource = getCreateKeyResource(type, true); @@ -331,7 +331,7 @@ protected void removeDataBaseElement(int index, System.out.println("sdbcx.KeyContainer.removeDataBaseElement() Query: " + query); int resource = getRemoveKeyResource(type, false); getLogger().logprb(LogLevel.INFO, resource, name, table, query); - if (DBTools.executeDDLQuery(provider, query)) + if (DBTools.executeSQLQuery(provider, query)) { // XXX: If we delete a primary key we must also delete the corresponding index. if (type == KeyType.PRIMARY) { diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/RoleContainer.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/RoleContainer.java index 7f7a9820..b3f74c08 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/RoleContainer.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/RoleContainer.java @@ -357,7 +357,7 @@ protected boolean grantRole(String name) Resources.STR_LOG_USERROLES_GRANT_ROLE_QUERY; getLogger().logprb(LogLevel.INFO, resource, role1, role2, query); System.out.println("sdbcx.RoleContainer.grantRole() 1 IsRole: " + m_isrole + " - Query: " + query); - return DBTools.executeDDLQuery(getProvider(), query); + return DBTools.executeSQLQuery(getProvider(), query); } catch (java.sql.SQLException e) { int resource = m_isrole ? @@ -382,7 +382,7 @@ private boolean revokeRole(String name) Resources.STR_LOG_USERROLES_REVOKE_ROLE_QUERY; getLogger().logprb(LogLevel.INFO, resource, role1, role2, query); System.out.println("sdbcx.RoleContainer.revokeRole() 1 IsRole: " + m_isrole + " - Query: " + query); - return DBTools.executeDDLQuery(getProvider(), query); + return DBTools.executeSQLQuery(getProvider(), query); } catch (java.sql.SQLException e) { int resource = m_isrole ? diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/RowSetSuper.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/RowSetSuper.java index 9214fdc3..1dc0fafe 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/RowSetSuper.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/RowSetSuper.java @@ -349,7 +349,6 @@ private boolean deleteRow(int row) System.out.println("RowSetSuper.deleteRow() 1 Size: " + getRowCount()); if (moveAbsolute(row)) { m_Result.deleteRow(); - //int bookmark = m_CurrentRow + getDeletedRow(m_CurrentRow); System.out.println("RowSetSuper.deleteRow() 2 Bookmark: " + row); m_DeletedRows.add(row); getRowData().remove(row); diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableContainerSuper.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableContainerSuper.java index 3564a9d1..9c0f2c58 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableContainerSuper.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableContainerSuper.java @@ -100,7 +100,7 @@ protected boolean createDataBaseElement(XPropertySet descriptor, for (String query : queries) { getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_TABLES_CREATE_TABLE_QUERY, name, query); } - return DBTools.executeDDLQueries(m_Connection.getProvider(), queries); + return DBTools.executeSQLQueries(m_Connection.getProvider(), queries); } } catch (java.sql.SQLException e) { @@ -129,7 +129,9 @@ public T createElement(String name) try { NamedComponents component = DBTools.qualifiedNameComponents(m_Connection.getProvider(), name, ComposeRule.InDataManipulation); try (java.sql.ResultSet result = _getcreateElementResultSet(component)) { + System.out.println("TableContainerSuper.createElement() 1"); if (result.next()) { + System.out.println("TableContainerSuper.createElement() 2"); String type = result.getString(4); type = result.wasNull() ? "" : m_Connection.getProvider().getTableType(type); String remarks = result.getString(5); @@ -147,6 +149,7 @@ public T createElement(String name) private java.sql.ResultSet _getcreateElementResultSet(NamedComponents table) throws java.sql.SQLException { + System.out.println("TableContainerSuper._getcreateElementResultSet() 1 " + table.getCatalog() + " - " + table.getSchema() + " - " + table.getTableName()); java.sql.DatabaseMetaData metadata = m_Connection.getProvider().getConnection().getMetaData(); return metadata.getTables(table.getCatalog(), table.getSchema(), table.getTableName(), null); } @@ -174,7 +177,7 @@ public void removeDataBaseElement(int index, query = m_Connection.getProvider().getDropTableQuery(table); System.out.println("TableContainer.removeDataBaseElement() Query: " + query); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_TABLES_REMOVE_TABLE_QUERY, name, query); - DBTools.executeDDLQuery(m_Connection.getProvider(), query); + DBTools.executeSQLQuery(m_Connection.getProvider(), query); } catch (java.sql.SQLException e) { int resource = Resources.STR_LOG_TABLES_REMOVE_TABLE_QUERY_ERROR; diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableMain.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableMain.java index 8a1452af..1ad23f29 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableMain.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableMain.java @@ -175,7 +175,7 @@ protected boolean rename(NamedComponents component, if (!queries.isEmpty()) { String query = String.join("> <", queries); getLogger().logprb(LogLevel.INFO, resource, newname, query); - changed &= DBTools.executeDDLQueries(m_connection.getProvider(), queries); + changed &= DBTools.executeSQLQueries(m_connection.getProvider(), queries); skipped &= false; } } @@ -183,13 +183,13 @@ protected boolean rename(NamedComponents component, if (!multiquery || moved) { String query = queries.get(0); getLogger().logprb(LogLevel.INFO, resource, newname, query); - changed &= DBTools.executeDDLQuery(m_connection.getProvider(), query); + changed &= DBTools.executeSQLQuery(m_connection.getProvider(), query); skipped &= false; } if (multiquery && renamed) { String query = queries.get(1); getLogger().logprb(LogLevel.INFO, resource, newname, query); - changed &= DBTools.executeDDLQuery(m_connection.getProvider(), query); + changed &= DBTools.executeSQLQuery(m_connection.getProvider(), query); skipped &= false; } } diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableSuper.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableSuper.java index bc4b782c..a785d299 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableSuper.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/TableSuper.java @@ -267,7 +267,7 @@ private void alterColumn(ColumnSuper oldcolumn, XPropertySet newcolumn) if (!queries.isEmpty()) { String query = String.join("> <", queries); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_TABLE_ALTER_COLUMN_QUERY, table, query); - if (DBTools.executeDDLQueries(provider, queries)) { + if (DBTools.executeSQLQueries(provider, queries)) { // Column have changed its description value if ((result & 32) == 32) { oldcolumn.m_Description = DBTools.getDescriptorStringValue(newcolumn, PropertyIds.DESCRIPTION); @@ -420,7 +420,7 @@ public void rename(String name) getConnection().getViewsInternal().removeView(view); query = DBTools.getCreateViewQuery(provider, component, view.m_Command, rule, isCaseSensitive()); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_VIEW_RENAME_QUERY, name, query); - if (DBTools.executeDDLQuery(provider, query)) { + if (DBTools.executeSQLQuery(provider, query)) { views.rename(table, name); renamed = true; } diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/View.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/View.java index e55c323a..969f7256 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/View.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/View.java @@ -111,7 +111,7 @@ public void alterCommand(String command) if (!queries.isEmpty()) { String query = String.join("> <", queries); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_VIEW_ALTER_QUERY, name, query); - DBTools.executeDDLQueries(provider, queries); + DBTools.executeSQLQueries(provider, queries); } } catch (java.sql.SQLException e) { diff --git a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/ViewContainer.java b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/ViewContainer.java index 0d097de1..e083e91d 100644 --- a/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/ViewContainer.java +++ b/source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbcx/ViewContainer.java @@ -78,7 +78,7 @@ protected boolean createDataBaseElement(XPropertySet descriptor, String name) query = DBTools.getCreateViewQuery(provider, descriptor, isCaseSensitive()); System.out.println("sdbcx.ViewContainer.createDataBaseElement() SQL: '" + query + "'"); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_VIEWS_CREATE_VIEW_QUERY, name, query); - if (DBTools.executeDDLQuery(provider, query)) { + if (DBTools.executeSQLQuery(provider, query)) { getConnection().getTablesInternal().insertElement(name, null); return true; } @@ -172,7 +172,7 @@ protected void removeView(View view) String table = DBTools.buildName(provider, view.getNamedComponents(), rule, isCaseSensitive()); query = DBTools.getDropViewQuery(provider, table); getLogger().logprb(LogLevel.INFO, Resources.STR_LOG_VIEWS_REMOVE_VIEW_QUERY, view.getName(), query); - DBTools.executeDDLQuery(provider, query); + DBTools.executeSQLQuery(provider, query); } catch (java.sql.SQLException e) { int resource = Resources.STR_LOG_VIEWS_REMOVE_VIEW_QUERY_ERROR;