Re: clist->append() 10000 rows from sqlite - how to speed it up
| From: | Steph Fox | Date: | Fri, 03 Nov 2006 17:05:07 +0000 |
| Subject: | Re: clist->append() 10000 rows from sqlite - how to speed it up | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7437@lists.php.net to get a copy of this message | ||
Wouldn't it be faster to skip the events_pending while loop?
----- Original Message ----- From: <q11@gala.net>
To: <php-gtk-general@lists.php.net>
Sent: Friday, November 03, 2006 4:50 PM
Subject: [PHP-GTK] clist->append() 10000 rows from sqlite - how to speed it up
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 доступ, мощные фильтры и защита от спама.
--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php