PHP and SQLite Marcus Brger Linux Tag Marcus
PHP and SQLite Marcus Börger Linux. Tag Marcus Börger 2004 Karlsruhe PHP and SQLite
SQLite þ Started in 2000 by D. Richard Hipp Single file database Subselects, Triggers, Transactions, Views Very fast, 2 -3 times faster than My. SQL, Postgre. SQL for many common operations 2 TB data storage limit ý ý ý Views are read-only No foreign keys Locks whole file for writing þ þ Marcus Börger PHP and SQLite
PHP with SQLite þ þ þ þ SQLite library integrated with PHP extension available via PECL for PHP 4. 3 Bundled with PHP 5 API designed to be logical, easy to use High performance Convenient migration from other PHP database extensions Call PHP code from within SQL Marcus Börger PHP and SQLite
Dedicated Host Internet Browser Apache Browser Browser mod_php ext/sqlite SQL Marcus Börger PHP and SQLite
ISP/Shared Host Internet Apache Browser Browser mod_php ext/sqlite SQL Marcus Börger PHP and SQLite
Embedded GTK / ? ? ? CLI / EMBED ext/sqlite SQL Marcus Börger PHP and SQLite
Array Interface array sqlite_fetch_array (resource result [, int result_type [, bool decode_binary ]]) þ Flexible ý Slow for large result sets array sqlite_fetch_all (resource result [, int result_type [, bool decode_binary ]]) þ Flexible ý Slow for large result sets; better use sqlite_array_query () Marcus Börger PHP and SQLite
Single Column Interface mixed sqlite_single_query (resource db, string sql [, bool first_row_only [, bool decode_binary ]]) þ Fast ý Only returns the first column string sqlite_fetch_single (resource result [, bool decode_binary ]) þ Fast ý Slower than sqlite_single_query mixed sqlite_fetch_column (resource result, mixed index_or_name [, bool decode_binary ]) þ Flexible, Faster than array functions ý Slower than other single functions Marcus Börger PHP and SQLite
Iterator Interface <? php $db = sqlite_open("…"); for ($res = sqlite_query("SELECT…", $db); sqlite_has_more($res); sqlite_next($res)) { print_r (sqlite_current($res)); } ? > Marcus Börger PHP and SQLite
Calling PHP from SQL <? php function md 5_and_reverse($string) { return strrev(md 5($string)); } sqlite_create_function($db, 'md 5 rev', 'md 5_and_reverse'); $rows = sqlite_array_query($db, 'SELECT md 5 rev(filename) from files'); ? > Marcus Börger PHP and SQLite
Resources þ This Slides http: //marcus-boerger. de/talks þ Documentation at http: //docs. php. net/? q=ref. sqlite þ SQLite Webpage http: //sqlite. org Marcus Börger PHP and SQLite
- Slides: 11