Posted on 2006-12-28 00:53:58-08 by jcasadonte in response to 3913
Re: full_column_names pragma problem

One of the nice folks on the SQLite mailing list pointed this out to me. It seems like it is the cause of the problems....

See "drop table name from field name" below...

SV * sqlite_st_FETCH_attrib (SV *sth, imp_sth_t *imp_sth, SV *keysv) { char *key = SvPV_nolen(keysv); SV *retsv = NULL; int i,n; if (!DBIc_ACTIVE(imp_sth)) { return NULL; } /* warn("fetch: %s\n", key); */ i = DBIc_NUM_FIELDS(imp_sth); if (strEQ(key, "NAME")) { AV *av = newAV(); /* warn("Fetch NAME fields: %d\n", i); */ av_extend(av, i); retsv = sv_2mortal(newRV(sv_2mortal((SV*)av))); for (n = 0; n < i; n++) { /* warn("Fetch col name %d\n", n); */ const char *fieldname = sqlite3_column_name(imp_sth->stmt, n); if (fieldname) { /* warn("Name [%d]: %s\n", n, fieldname); */ char *dot = instr(fieldname, "."); if (dot) /* drop table name from field name */ fieldname = ++dot;

The correct behavior would, I think, be to pass along whatever SQLite passes back, and let end-user control it via the aforementioned pragmas. More information on the pragmas can be had at:

http://www.sqlite.org/pragma.html

joe
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.