pgsqlAdapter.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. * This version of the postgreSQL adapter uses fast serialization
  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: pgsqlAdapter.php,v 1.2 2005/07/22 10:58:09 pmineault Exp $
  13. */
  14. /**
  15. * Required classes
  16. */
  17. require_once(AMFPHP_BASE . "shared/adapters/RecordSetAdapter.php");
  18. class pgsqlAdapter extends RecordSetAdapter {
  19. /**
  20. * Constructor method for the adapter. This constructor implements the setting of the
  21. * 3 required properties for the object.
  22. *
  23. * @param resource $d The datasource resource
  24. */
  25. function pgsqlAdapter($d) {
  26. parent::RecordSetAdapter($d);
  27. $fieldcount = pg_num_fields($d);
  28. for($i = 0; $i < $fieldcount; $i++) {
  29. $this->columns[] = pg_field_name($d, $i);
  30. }
  31. if(pg_num_rows($d) > 0)
  32. {
  33. pg_result_seek($d, 0);
  34. while($line = pg_fetch_row($d)) {
  35. $this->rows[] = $line;
  36. }
  37. }
  38. }
  39. }
  40. ?>