-
|
How to obtain the SQL code behind a saved query? |
Beta Was this translation helpful? Give feedback.
Answered by
spannm
Oct 30, 2024
Replies: 1 comment
-
|
This code sample illustrates how Jackcess can help you obtain the SQL code behind a saved query: import io.github.spannm.jackcess.Database;
import io.github.spannm.jackcess.DatabaseBuilder;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
public final class ReadQueries {
private ReadQueries() {
}
public static void main(String[] _args) {
File dbFile = new File("yourDatabse.accdb");
try (Database db = new DatabaseBuilder()
.withFile(dbFile)
.withReadOnly(true)
.open()) {
for (Query q : db.getQueries()) {
System.out.printf("++ SQL of query %s:%n%s%n", q.getName(), q.toSQLString());
}
} catch (IOException _ex) {
throw new UncheckedIOException("Failed to read queries from " + dbFile, _ex);
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
spannm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code sample illustrates how Jackcess can help you obtain the SQL code behind a saved query: