sqliteobjectAdapter.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 sqliteobjectAdapter 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 sqliteobjectAdapter($d)
  27. {
  28. parent::RecordSetAdapter($d);
  29. // grab all of the rows
  30. $fieldcount = $d->numFields();
  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[] = $d->fieldName($i);
  36. }
  37. if($d->numRows() > 0)
  38. {
  39. $this->rows = $d->fetchAll(SQLITE_NUM);
  40. }
  41. }
  42. }
  43. ?>