Re: Looking for a good explanation of select function in perl dbi

2007-09-18 Thread Martin Evans

Scott Mohnkern wrote:

Well, I've figured out how to put data into a sqlite database.  I can
extract data from the command line, however, for the life of me, I just
can't find any good documentation on using Select.

What I'm trying to do:

SELECT name, size FROM filelist where uid=

This works from the command line:

sqlite3 data.dbl "SELECT name, uid from filelist where UID=\"1000\""

I'd like to pop this into an array, where I could manipulate it, where each
element of the array would contain name,size.


Read about DBI's selectall_arrayref in the pod as it returns a ref to an 
array of arrays as you want. Alternatively, do the fetching yourself 
with fetchrow_arrayref.


Use bound parameters in your select SQL:
SELECT name, uid from filelist where UID=?
- see DBI's bind_param.


Are there any good web pages on using the SELECT function?  I took a look
at:

http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html

But it kind of lost me.

Scott Mohnkern



I'm not sure if you want help on use of select in SQL or obtaining 
result sets created by select in your Perl. The following link (if you 
scroll down past the ODBC stuff) does the latter:


http://www.easysoft.com/developer/languages/perl/dbd_odbc_tutorial_part_2.html

There are literally loads of SQL tutorials on the web including the 
w3schools one at http://www.w3schools.com/sql/default.asp. You may have 
to refer back to sqllite to check what syntax it supports - I don't use 
sqllite so I don't know.



Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com


Looking for a good explanation of select function in perl dbi

2007-09-17 Thread Scott Mohnkern
Well, I've figured out how to put data into a sqlite database.  I can
extract data from the command line, however, for the life of me, I just
can't find any good documentation on using Select.

What I'm trying to do:

SELECT name, size FROM filelist where uid=

This works from the command line:

sqlite3 data.dbl "SELECT name, uid from filelist where UID=\"1000\""

I'd like to pop this into an array, where I could manipulate it, where each
element of the array would contain name,size.

Are there any good web pages on using the SELECT function?  I took a look
at:

http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html

But it kind of lost me.

Scott Mohnkern