wise-coders / dbf-jdbc-driver

DBF & FoxPro JDBC Driver | DbSchema DBF Designer
https://dbschema.com/databases/dbf-management-gui.html
Other
23 stars 15 forks source link

How should DBF tables be refreshed? #3

Closed skestle closed 2 years ago

skestle commented 2 years ago

I'm wanting to simply query a DBF database for new information, but it seems that the tables are not updated (within the same application).

https://github.com/wise-coders/dbf-jdbc-driver/blob/0b2f55b1b4a99aa21ecde43db39d462765b72062/src/main/java/com/dbschema/dbf/JdbcDriver.java#L18 probably should be "When you open a connection for the first time in a JVM..." (see line 98).

It would be nice to be able to invoke https://github.com/wise-coders/dbf-jdbc-driver/blob/0b2f55b1b4a99aa21ecde43db39d462765b72062/src/main/java/com/dbschema/dbf/H2WrappedConnection.java#L56-L59 for a specific table/file at will.

wise-coders commented 2 years ago

Agree. We added a command reload The code is not yet tested. Please help us with improving the code by contributing to this repository.

skestle commented 2 years ago

I had started on a different mechanism, but this looks good. In my use case, I'd want a lazy check like on driver startup:

  1. Check the file modified date
  2. Update if newer

See my first attempt at https://github.com/wise-coders/dbf-jdbc-driver/compare/master...skestle:dbf-cache-refresh?expand=1

It's not very good because I forgot about connection pooling and so you'd need to connect manually with the URL. So I like a SQL statement, but it needs to run eagerly - this change still requires a JVM restart to refresh the table data, since that's only done once on startup.

It could almost be sufficient to just refresh the whole database, but the main table I want takes 90s by itself.