hi

i'll go right to the point. my code is this:

use DBI; ... $self->connectdb(connection => "./db/nr1.db"); $self->createtable(table => $joinTable, form => $form1); my $insert = "insert into GITAXNR(gi,ID,quest) select GITAX.gi, GITAX. +ID, NRP.quest from GITAX inner join NRP on GITAX.gi = NRP.gi"; $self->do_it(argument => $insert);
up tu here everything is going fine, it connects to the database nr1.db , creates a table GITAXNR(gi,ID,quest), inserts into it all queried valeus ... ta, ta, ta,...
for(my $j = 1; $j<=4; $j++){ unless($j == 1){ my $database = "attach database './db/nr$j.db' as nrdb$j"; $self->do_it(argument => $database); my $insert = "insert into GITAXNR(gi,ID,quest) select GITAX.gi +, GITAX.ID, NRP.quest from GITAX inner join nr$j.NRP on GITAX.gi = NR +P.gi"; $self->do_it(argument => $insert); } }
here the problems start. when i use just the sqlite engine and attach databases the query :
insert into GITAXNR(gi,ID,quest) select GITAX.gi, GITAX.ID, NRP.quest +from nr1.GITAX inner join nr2.NRP on GITAX.gi = NRP.gi
works perfectly. but when i incorporate it into the code it complains that there is no nr$j (nr2) database (DBD::SQLite::db prepare failed: no such table: nr2.NRP(1) at dbdimp.c line 271 a t Lib/NRDB/NrDBI.pm line 70, <NRLOG> line 15.)

so the problem is obviously in attaching or querying the attached databases. so if anyone has an idea on how to do this...

i looked through SQLite module and i couldn't find anything useful

suggestions ... ?

thank you !


In reply to searching through multiple sqlite databases - attach problem by baxy77bax

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.