Hello,
I am having issues with the DBI plugin for the template toolkit.
My problem is that I need to use two connections to the same database, which
DBD::ODBC doesn't support with SQL Server. Using DBI I can get around this
by opening two handles to the same database and use those:
my $ro1 = DBI->connect($foo, $bar, $baz) or die $DBI::errstr;
my $ro2 = DBI->connect($foo, $bar, $baz) or die $DBI::errstr;
However, the same trick doesn't work with Template::Plugin::DBI:
USE one = DBI(rodsn, rouid, ropwd);
USE two = DBI(rodsn, rouid, ropwd);
query = one.prepare(sql);
trans = two.prepare(sql2);
FOREACH item = query.execute(id)
FOREACH tl = trans.execute(item.blah);
...
END;
END;
because it dies with error SQL-HY000 "handle already in use". Is there any
way to make this return two different handles?
* * *
Failing that, I have tried using a SELECT statement that joins two tables,
but have found myself unable to access any value that required
qualification:
q = DBI.prepare("SELECT t1.id, a, b FROM t1 LEFT JOIN t2 ON t1.id = t2.id
WHERE t1.id=?");
FOREACH item = q.execute('blah');
item.id;
END
...and item.id is empty. item.t1.id doesn't work either. I then tried this:
q = DBI.prepare("SELECT t1.id AS t1id ...");
...and using item.t1id also doesn't work. Any way I can access that?
Thank you,
Gunther
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates