Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexes are never created on SQLite and mysql stores #162

Open
jmfernandez opened this issue Jun 3, 2019 · 1 comment
Open

Indexes are never created on SQLite and mysql stores #162

jmfernandez opened this issue Jun 3, 2019 · 1 comment

Comments

@jmfernandez
Copy link

When a SQLite store is initialized, indexes are never created. If you see at next code fragment:

sub init {
my $self = shift;
my $dbh = $self->dbh;
my $name = $self->model_name;
$self->SUPER::init();
my $id = $self->_mysql_hash( $name );
my $table = "Statements${id}";
local($dbh->{AutoCommit}) = 0;
unless ($self->_table_exists($table)) {
$dbh->do( "CREATE INDEX idx_${name}_spog ON Statements${id} (Subject,Predicate,Object,Context);" ) || do { $dbh->rollback; return };

$self->SUPER::init(); is called before, creating the needed tables. So, check in line 134 should be the opposite, something like:

        if ($self->_table_exists($table)) {

BTW, in the case of mysql store, init method has some messed code.

@kasei
Copy link
Owner

kasei commented Jun 5, 2019

Thanks for reporting this. That does seem like an issue. I can try to commit a fix, but as you noticed, the DBI code in RDF::Trine is a bit of a mess, and not well maintained.

Development on RDF::Trine has mostly ended at this point, with most new work going on in the Attean project (which despite what seems like an accidental copy-commit, does not have a DBI storage engine). If you have any interest/ability to submit changes to this (or Attean) to improve the mysql code, I'd be more than happy to merge them.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants