/opensource.apple.com/source/apache_mod_php/apache_mod_php-44.2/php/ext/sqlite/sqlite.php
PHP | 61 lines | 52 code | 9 blank | 0 comment | 4 complexity | 2a8597ad5cfe669ae2496203d1660192 MD5 | raw file
Possible License(s): LGPL-2.0, MPL-2.0, GPL-2.0, ISC, LGPL-2.1, Apache-2.0, MPL-2.0-no-copyleft-exception, BSD-3-Clause, WTFPL, MIT, AGPL-1.0, AGPL-3.0
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <title>sqlite.php</title>
- <style type="text/css">
- .enscript-comment { font-style: italic; color: rgb(178,34,34); }
- .enscript-function-name { font-weight: bold; color: rgb(0,0,255); }
- .enscript-variable-name { font-weight: bold; color: rgb(184,134,11); }
- .enscript-keyword { font-weight: bold; color: rgb(160,32,240); }
- .enscript-reference { font-weight: bold; color: rgb(95,158,160); }
- .enscript-string { font-weight: bold; color: rgb(188,143,143); }
- .enscript-builtin { font-weight: bold; color: rgb(218,112,214); }
- .enscript-type { font-weight: bold; color: rgb(34,139,34); }
- .enscript-highlight { text-decoration: underline; color: 0; }
- </style>
- </head>
- <body id="top">
- <h1 style="margin:8px;" id="f1">sqlite.php <span style="font-weight: normal; font-size: 0.5em;">[<a href="?txt">plain text</a>]</span></h1>
- <hr/>
- <div></div>
- <pre>
- <?php
- if (!extension_loaded("sqlite")) {
- dl("sqlite.so");
- if (!extension_loaded("sqlite")) {
- exit("Please enable SQLite support\n");
- }
- }
- debug_zval_dump(sqlite_libversion());
- debug_zval_dump(sqlite_libencoding());
- $s = sqlite_open("weztest.sqlite", 0666, $err);
- debug_zval_dump($err);
- debug_zval_dump($s);
- $r = sqlite_query("create table foo (a INTEGER PRIMARY KEY, b INTEGER )", $s);
- debug_zval_dump(sqlite_last_error($s));
- debug_zval_dump(sqlite_error_string(sqlite_last_error($s)));
- $r = sqlite_query("select *, php('md5', sql) as o from sqlite_master", $s);
- debug_zval_dump($r);
- debug_zval_dump(sqlite_num_rows($r));
- debug_zval_dump(sqlite_num_fields($r));
- for ($j = 0; $j < sqlite_num_fields($r); $j++) {
- echo "Field $j is " . sqlite_field_name($r, $j) . "\n";
- }
- while ($row = sqlite_fetch_array($r, SQLITE_ASSOC)) {
- print_r($row);
- }
- sqlite_close($s);
- ?>
- </pre>
- <hr />
- </body></html>