clist->append() 10000 rows from sqlite - how to speed it up
| From: | q11 at gala dot net | Date: | Fri, 03 Nov 2006 14:50:08 +0000 |
| Subject: | clist->append() 10000 rows from sqlite - how to speed it up | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-7436@lists.php.net to get a copy of this message | ||
Hello!
I`m writing a database viewer with searching abilieties, based on SQLite
engine, under win2k, DB itself isn`t big - approx 10000 rows.
Here is code sample:
function getdata(){
global $list, $db;
$list -> freeze();
sqlite_query( $db, "BEGIN TRANSACTION" );
$result = sqlite_query( $db, "SELECT * FROM Enterprises" );
while( $row = sqlite_fetch_array($result) ){
while( gtk::events_pending() ) gtk::main_iteration();
$list -> append( array( $row['n'], $row['Code'], $row['Name'],
$row['Phone'], $row['Region'], $row['Town'], $row['Street'],
$row['House'],
$row['Office'], $row['Email'] ) );
}
sqlite_query( $db, "COMMIT" );
$list -> thaw();
}
This loop takes about 2 seconds to fill GtkCList, I think it`s kinda slow.
The reason I`m asking is that: if user wishes to find all enterprises having
"a" letter in the Name, my program should make this query
"SELECT * FROM Enterprises WHERE Name LIKE '%a%'"
and again, lots of $list->append(...) will be execuded slowly.
Is there a way to speed up appending?
May be some tricks exist?
P.S. Чуть не забыл, тут интересная вакансия для тебя: http://www.rabota.com.ua/?ito=1017
____________________________________________________________
Бесплатная почтовая служба Gala Mail - http://mail.gala.net/
WEB, WAP и POP3 доступ, мощные фильтры и защита от спама.