[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Filling perl hashes with [query] and searching the hash for product display restriction
On Thu, Jan 25, 2001 at 10:26:03PM -0500, Mike Heins wrote:
> Quoting Kaare Rasmussen (kar@webline.dk):
> > >Also, as of 4.6.2 (CVS at this point), you can create an arbitrary array
> > >in the form created by $db->query();
> >
> > Reminds me of the one problem I have with that:
> >
> > If the query is empty, Interchange doesn't create an array. That's not good
> > because then you don't have the field names.
> >
> > Any chance of changing that, Mike?
>
> Perhaps. The only problem with that is it will depend on the SQL --
> some DBI drivers don't return field names unless there is at least one
> row returned. I will not get into parsing field names from the select,
> so it is probably best to manage that part yourself -- you presumably
> know what fields you queried, and can save them to a pointer hash.
>
> I will keep it in mind and not make any promises.
Learn to love the null. Embrace the void.
I'm a pretty mild mannered kind of guy, but return
instead qw(array of field names) would suck big time.
In my experience, if the return is empty, not creating an array
at all but returning undef is the perlish thing to do. There is,
after all, no return.
I've not done my research on exactly how, but do know that mv
caches db information. Dump a session and take a look. Perhaps
something that gives one a "handle" on whatever I imagine this is:
$Sql{$_} = $db->[$Vend::Table::DBI::DBI]
might be a useful alternative. (grep DBI * and that looks interesting)
Basic database query 101 says:
query SELECT * and map it to a DESCRIBE
else
SELECT field,by,name.
>From left field,
cfm
--
Christopher F. Miller, Publisher cfm@maine.com
MaineStreet Communications, Inc 208 Portland Road, Gray, ME 04039
1.207.657.5078 http://www.maine.com/
Content management, electronic commerce, internet integration, Debian linux
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users