by foobarqux · 2y ago · 0 comments
@AttachDatabase("db_prefix", "your_file.db");
# Then you can query from it:
Q(..r) :- db_prefix.YourTable(..r);To use SQLite use @Engine("sqlite") imperative. And you can then connect to you database file with @AttachDatabase imperative.
For example if you have example.db file with Fruit table which has col0 column, then you can count fruits with program:
@Engine("sqlite"); @AttachDatabase("example", "example.db");
CountFruit(fruit) += 1 :- Fruit(fruit);
Then run CountFruit predicate.