Subject: Re: big long strings and biggest query solved
From: Arthur Corliss (arthur@corlissfamily.org)
Date: Mon Jun 03 2002 - 13:25:58 AKDT
> My current solution is to write what I want in order to a separate
> file, the load that file into one giant string.
>
> "INSERT INTO song (ID, title, mpeg) VALUES
> (\'1\',\'abc\',\'"+binary_mpeg_data_here+"\')"
A more efficient method would to use a parameter query:
"INSERT INTO song (ID, title, mpeg) values(?, ?, ?)"
Then, when you execute the query, you'd hand it a list of arguments to
satisfy the parameters. This allows you multiple benefits:
--Only one query to manage
--No more composing massive strings and forcing the SQL engine
to compile and execute it
--Parameter queries can reused by compiling once, cached, and
executed multiple times (with different arguments, of course)
and so on. You'll find a *huge* performance improvement when doing mass
imports into your music library.
----Arthur Corliss Bolverk's Lair -- http://arthur.corlissfamily.org/ Digital Mages -- http://www.digitalmages.com/ "Live Free or Die, the Only Way to Live" -- NH State Motto
--------- To unsubscribe, send email to <aklug-request@aklug.org> with 'unsubscribe' in the message body.
This archive was generated by hypermail 2a23 : Tue Jun 04 2002 - 07:17:20 AKDT