Skip to content

Commit

Permalink
new version 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prrvchr committed Jun 18, 2024
1 parent 6d98fff commit 160e51b
Show file tree
Hide file tree
Showing 15 changed files with 473 additions and 250 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ Clients using the jdbcDriverOOo driver can access features of the underlying JDB
- Changed the implementation of the UNO interface [com.sun.star.sdbc.XGeneratedResultSet][87]. This new implementation supports drivers that do not follow the JDBC API but offer a specific implementation (ie: MariaDB and Derby). To be activated when using odb files created with a previous version, if present, it is necessary to modify the parameter: `Query of generated values` accessible by the menu: **Edit -> Database -> Advanced Settings... -> Generated Values** by the value: `SELECT * FROM %s WHERE %s`.
- Added new settings supported by the [Drivers.xcu][91] configuration file. These new parameters allow you to modify the values ​​returned by the drivers regarding the visibility of modifications in the ResultSet (ie: insertion, update and deletion). They also allow you to force SQL mode for the desired modifications in the ResultSet.
- Finalized the emulation implementation making any ResultSet modifiable, if the record is unique in this ResultSet. This implementation, using bookmarks, allows the editing of ResultSet coming from **Base Queries**, this simply makes **LibreOffice Base Queries editable**. Queries joining multiple tables are not yet supported and I am open to any technical proposals regarding a possible implementation.
- In order to make the ResultSet returned by the **Trino** driver modifiable and to precede [feature request #22408][120], a search for the primary key will be launched in order to find the first column, of result set, having no duplicates.
- To work around [issue #368][120] the HsqlDB driver uses SQL mode updates in ResultSet.
- Many fixes and improvements...

Expand Down Expand Up @@ -640,4 +641,5 @@ Clients using the jdbcDriverOOo driver can access features of the underlying JDB
[117]: <https://trino.io/>
[118]: <https://github.com/trinodb/trino/issues/22306>
[119]: <https://github.com/prrvchr/jdbcDriverOOo/issues/7>
[120]: <https://sourceforge.net/p/hsqldb/feature-requests/368/>
[120]: <https://github.com/trinodb/trino/issues/22408>
[121]: <https://sourceforge.net/p/hsqldb/feature-requests/368/>
6 changes: 4 additions & 2 deletions README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ Les clients utilisant le pilote jdbcDriverOOo peuvent accéder aux fonctionnalit
- Modification de l'implémentation de l'interface UNO [com.sun.star.sdbc.XGeneratedResultSet][87]. Cette nouvelle implémentation prend en charge les pilotes qui ne suivent pas l'API JDBC mais proposent une implémentation spécifique (ie: MariaDB et Derby). Pour être activé lors de l'utilisation de fichiers odb créés avec une version précédente, s'il est présent, il est nécessaire de modifier le paramètre : `Requête des valeurs générées` accessible par le menu : **Edition -> Base de données -> Paramètres avancés... -> Valeurs générées** par la valeur : `SELECT * FROM %s WHERE %s`.
- Ajout de nouveaux paramètres pris en charge par le fichier de configuration [Drivers.xcu][91]. Ces nouveaux paramètres permettent de modifier les valeurs renvoyées par les pilotes concernant la visibilité des modifications dans les jeux de résultats (ie: insertion, mise à jour et suppression). Ils permettent également de forcer le mode SQL pour les modifications souhaitées dans les jeux de résultats.
- Finalisation de l'implémentation de l'émulation rendant tout jeu de résultats modifiable, si l'enregistrement est unique dans ce jeu de résultats. Cette implémentation, utilisant les signets (ie: bookmark), permet l'édition de jeu de résultats provenant de **Requêtes Base**, cela rend tout simplement les **Requêtes LibreOffice Base éditables**. Les requêtes joignant plusieurs tables ne sont pas encore supportées et je suis ouvert à toute proposition technique concernant une éventuelle implémentation.
- Afin de contourner le [dysfonctionnement #368][120] le driver HsqlDB utilise des mises à jour en mode SQL dans les jeux de résultats.
- Afin de rendre modifiables les jeux de résultats retournés par le driver **Trino** et de précéder la [demande d'amélioration #22408][120], une recherche de la clé primaire sera lancée afin de retrouver la première colonne, du jeu de résultats, ayant pas de doublons.
- Afin de contourner le [dysfonctionnement #368][121] le driver HsqlDB utilise des mises à jour en mode SQL dans les jeux de résultats.
- De nombreuses corrections et améliorations...

### Que reste-t-il à faire pour la version 1.4.0:
Expand Down Expand Up @@ -640,4 +641,5 @@ Les clients utilisant le pilote jdbcDriverOOo peuvent accéder aux fonctionnalit
[117]: <https://trino.io/>
[118]: <https://github.com/trinodb/trino/issues/22306>
[119]: <https://github.com/prrvchr/jdbcDriverOOo/issues/7>
[120]: <https://sourceforge.net/p/hsqldb/feature-requests/368/>
[120]: <https://github.com/trinodb/trino/issues/22408>
[121]: <https://sourceforge.net/p/hsqldb/feature-requests/368/>
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import com.sun.star.uno.XInterface;

import io.github.prrvchr.jdbcdriver.rowset.Row;
import io.github.prrvchr.jdbcdriver.rowset.RowCatalog;
import io.github.prrvchr.jdbcdriver.rowset.RowTable;
import io.github.prrvchr.uno.helper.ResourceBasedEventLogger;
import io.github.prrvchr.uno.sdbc.ConnectionBase;
Expand Down Expand Up @@ -92,7 +91,6 @@ public String getConnectionUrl(String location,
public boolean useSQLUpdate();

public void setGeneratedKeys(Statement statement,
RowCatalog catalog,
RowTable table,
Row row) throws java.sql.SQLException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import io.github.prrvchr.jdbcdriver.metadata.TypeInfoResultSet;
import io.github.prrvchr.jdbcdriver.metadata.TypeInfoRows;
import io.github.prrvchr.jdbcdriver.rowset.Row;
import io.github.prrvchr.jdbcdriver.rowset.RowCatalog;
import io.github.prrvchr.jdbcdriver.rowset.RowColumn;
import io.github.prrvchr.jdbcdriver.rowset.RowHelper;
import io.github.prrvchr.jdbcdriver.rowset.RowTable;
Expand Down Expand Up @@ -244,7 +243,6 @@ public boolean useSQLUpdate()
}

public void setGeneratedKeys(Statement statement,
RowCatalog catalog,
RowTable table,
Row row)
throws java.sql.SQLException
Expand All @@ -254,12 +252,12 @@ public void setGeneratedKeys(Statement statement,
return;
}
java.sql.ResultSet result = null;
Map<String, RowColumn> columns = catalog.getColumnNames(table);
Map<String, RowColumn> columns = table.getColumnNames();
if (command.isBlank()) {
result = statement.getGeneratedKeys();
}
else {
result = DBGeneratedKeys.getGeneratedResult(this, statement, catalog, table, row, columns, command);
result = DBGeneratedKeys.getGeneratedResult(this, statement, table, row, columns, command);
}
if (result != null) {
ResultSetMetaData metadata = result.getMetaData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,23 @@ public final static java.sql.ResultSet getGeneratedResult(DriverProvider provide
throws SQLException
{
RowTable table = catalog.getMainTable();
return getGeneratedKeys(provider, statement, catalog, table, catalog.getColumnNames(table), command);
return getGeneratedKeys(provider, statement, table, table.getColumnNames(), command);
}

// XXX: Method called from DriverProviderMain.setGeneratedKeys()
public final static java.sql.ResultSet getGeneratedResult(DriverProvider provider,
java.sql.Statement statement,
RowCatalog catalog,
RowTable table,
Row row,
Map<String, RowColumn> columns,
String command)
throws SQLException
{
return getGeneratedKeys(provider, statement, catalog, table, columns, command);
return getGeneratedKeys(provider, statement, table, columns, command);
}

private static ResultSet getGeneratedKeys(DriverProvider provider,
Statement statement,
RowCatalog catalog,
RowTable table,
Map<String, RowColumn> columns,
String command)
Expand All @@ -98,7 +96,7 @@ private static ResultSet getGeneratedKeys(DriverProvider provider,
// XXX: If it exists, the first auto-increment column of the table concerned by the insertion
// XXX: will be attached to the unique value returned by getGeneratedKeys().
else {
column = catalog.getAutoIncrementColumn(table);
column = table.getRowIdentifierColumn();
if (column != null) {
// XXX: It is important to preserve the type of the original ResultSet/Table columns
keys.put(column, RowHelper.getResultSetValue(result, i, column.getType()));
Expand All @@ -110,7 +108,7 @@ private static ResultSet getGeneratedKeys(DriverProvider provider,
}
if (!keys.isEmpty()) {
// XXX: If we want to follow the UNO API we must return all the columns of the table
String query = String.format(command, table.getComposedName(provider, true), getPredicates(catalog, keys));
String query = String.format(command, table.getComposedName(true), getPredicates(table.getCatalog(), keys));
PreparedStatement prepared = provider.getConnection().prepareStatement(query);
setPredicates(prepared, keys);
// XXX: The statement will be wrapped in order to be closed correctly when closing the ResultSet.
Expand Down
Loading

0 comments on commit 160e51b

Please sign in to comment.