/framework/core/db/DbSchema.php

http://zoop.googlecode.com/ · PHP · 31 lines · 27 code · 4 blank · 0 comment · 1 complexity · f12077daa08601c340b9af052e6bb6c8 MD5 · raw file

  1. <?php
  2. class DbSchema extends Object
  3. {
  4. private $conn;
  5. private $tables;
  6. function __construct($conn)
  7. {
  8. $this->conn = $conn;
  9. $this->addGetter('tables');
  10. }
  11. public function tableExists($tableName)
  12. {
  13. return $this->conn->tableExists($tableName);
  14. }
  15. public function getTables()
  16. {
  17. if(!$this->tables)
  18. {
  19. $this->tables = array();
  20. foreach($this->conn->getTableNames() as $thisTableName)
  21. {
  22. $this->tables[$thisTableName] = new DbTable($this->conn, $thisTableName);
  23. }
  24. }
  25. return $this->tables;
  26. }
  27. }