PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/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
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <title>sqlite.php</title>
  6. <style type="text/css">
  7. .enscript-comment { font-style: italic; color: rgb(178,34,34); }
  8. .enscript-function-name { font-weight: bold; color: rgb(0,0,255); }
  9. .enscript-variable-name { font-weight: bold; color: rgb(184,134,11); }
  10. .enscript-keyword { font-weight: bold; color: rgb(160,32,240); }
  11. .enscript-reference { font-weight: bold; color: rgb(95,158,160); }
  12. .enscript-string { font-weight: bold; color: rgb(188,143,143); }
  13. .enscript-builtin { font-weight: bold; color: rgb(218,112,214); }
  14. .enscript-type { font-weight: bold; color: rgb(34,139,34); }
  15. .enscript-highlight { text-decoration: underline; color: 0; }
  16. </style>
  17. </head>
  18. <body id="top">
  19. <h1 style="margin:8px;" id="f1">sqlite.php&nbsp;&nbsp;&nbsp;<span style="font-weight: normal; font-size: 0.5em;">[<a href="?txt">plain text</a>]</span></h1>
  20. <hr/>
  21. <div></div>
  22. <pre>
  23. &lt;?php
  24. if (!extension_loaded(&quot;sqlite&quot;)) {
  25. dl(&quot;sqlite.so&quot;);
  26. if (!extension_loaded(&quot;sqlite&quot;)) {
  27. exit(&quot;Please enable SQLite support\n&quot;);
  28. }
  29. }
  30. debug_zval_dump(sqlite_libversion());
  31. debug_zval_dump(sqlite_libencoding());
  32. $s = sqlite_open(&quot;weztest.sqlite&quot;, 0666, $err);
  33. debug_zval_dump($err);
  34. debug_zval_dump($s);
  35. $r = sqlite_query(&quot;create table foo (a INTEGER PRIMARY KEY, b INTEGER )&quot;, $s);
  36. debug_zval_dump(sqlite_last_error($s));
  37. debug_zval_dump(sqlite_error_string(sqlite_last_error($s)));
  38. $r = sqlite_query(&quot;select *, php('md5', sql) as o from sqlite_master&quot;, $s);
  39. debug_zval_dump($r);
  40. debug_zval_dump(sqlite_num_rows($r));
  41. debug_zval_dump(sqlite_num_fields($r));
  42. for ($j = 0; $j &lt; sqlite_num_fields($r); $j++) {
  43. echo &quot;Field $j is &quot; . sqlite_field_name($r, $j) . &quot;\n&quot;;
  44. }
  45. while ($row = sqlite_fetch_array($r, SQLITE_ASSOC)) {
  46. print_r($row);
  47. }
  48. sqlite_close($s);
  49. ?&gt;
  50. </pre>
  51. <hr />
  52. </body></html>