/Server/SWXPHP/Prior Releases/1.02/php/core/shared/adapters/sqliteAdapter.php

http://swx-format.googlecode.com/ · PHP · 50 lines · 18 code · 7 blank · 25 comment · 2 complexity · dd17209287c8f29529407483ba36520b MD5 · raw file

  1. <?php
  2. /**
  3. * This Adapter translates the specific Database type links to the data and pulls the data into very
  4. * specific local variables to later be retrieved by the gateway and returned to the client.
  5. *
  6. * Adapted from Adam Schroeder's implementation on Flash-db.com boards
  7. *
  8. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  9. * @copyright (c) 2003 amfphp.org
  10. * @package flashservices
  11. * @subpackage adapters
  12. * @version $Id: sqliteAdapter.php,v 1.1 2005/07/05 07:56:29 pmineault Exp $
  13. */
  14. /**
  15. * Required classes
  16. */
  17. require_once(AMFPHP_BASE . "shared/adapters/RecordSetAdapter.php");
  18. class sqliteAdapter extends RecordSetAdapter
  19. {
  20. /**
  21. * Constructor method for the adapter. This constructor implements the setting of the
  22. * 3 required properties for the object.
  23. *
  24. * @param resource $d The datasource resource
  25. */
  26. function sqliteAdapter($d)
  27. {
  28. parent::RecordSetAdapter($d);
  29. // grab all of the rows
  30. $fieldcount = sqlite_num_fields($d);
  31. // loop over all of the fields
  32. for($i=0; $i<$fieldcount; $i++) {
  33. // decode each field name ready for encoding when it goes through serialization
  34. // and save each field name into the array
  35. $this->columns[] = sqlite_field_name($d, $i);
  36. }
  37. if(sqlite_num_rows($d) > 0)
  38. {
  39. $this->rows = sqlite_fetch_all($d, SQLITE_NUM);
  40. }
  41. }
  42. }
  43. ?>