コード例 #1
0
 public function getColumns()
 {
     $columns = array();
     $stmt = $this->table->getSchema()->getDatabaseMetaData()->getConnection()->prepareStatement('SHOW INDEX FROM ' . $this->table->getSchema()->getSchemaName() . '.' . $this->table->getTableName() . ' WHERE Key_name = ?');
     $rs = $stmt->setString(0, $this->indexName)->executeQuery();
     while ($rs->next()) {
         $columns[] = new ColumnIndexEntryImpl($this, $this->table->getColumn($rs->getString('Column_name')));
     }
     $rs->close();
     $stmt->close();
     return \blaze\collections\Arrays::asList($columns);
 }
コード例 #2
0
 public function getUsers()
 {
     $this->checkClosed();
     $users = array();
     $stmt = $this->con->prepareStatement('SELECT user FROM mysql.user');
     $rs = $stmt->executeQuery();
     while ($rs->next()) {
         $users[] = new UserMetaDataImpl($this, $rs->getString(0));
     }
     $stmt->close();
     $rs->close();
     return \blaze\collections\Arrays::asList($users);
 }
コード例 #3
0
 public function getSequences()
 {
     $sequences = array();
     $stmt = $this->databaseMetaData->getConnection()->prepareStatement('SELECT col.TABLE_NAME, col.COLUMN_NAME FROM information_schema.TABLES tbl join information_schema.COLUMNS col ON tbl.TABLE_NAME = col.TABLE_NAME WHERE tbl.TABLE_SCHEMA = ? AND col.EXTRA = \'auto_increment\'');
     $stmt->setString(0, $this->schemaName);
     $rs = $stmt->executeQuery();
     while ($rs->next()) {
         $sequences[] = new SequenceMetaDataImpl($this, $rs->getString(0), $rs->getString(1));
     }
     $rs->close();
     $stmt->close();
     return \blaze\collections\Arrays::asList($sequences);
 }
コード例 #4
0
ファイル: QueryImpl.php プロジェクト: robo47/BlazeFramework
 public function getList()
 {
     $this->hydrator = new \blaze\persistence\hydration\ObjectHydrator($this->processQuery(), $this->rsd);
     return \blaze\collections\Arrays::asList($this->hydrator->hydrateAll());
 }
コード例 #5
0
 /**
  * {@inheritDoc}
  * @return \blaze\lang\String
  */
 public function toString()
 {
     return \blaze\collections\Arrays::flatToString($this);
 }
コード例 #6
0
 /**
  * @return blaze\util\ListI[blaze\ds\meta\ColumnMetaData]
  */
 public function getColumns()
 {
     if (!$this->initialized) {
         return \blaze\collections\Arrays::asList($this->notInitializedColumns);
     }
     $stmt = null;
     $rs = null;
     $columns = array();
     try {
         $stmt = $this->schema->getDatabaseMetaData()->getConnection()->prepareStatement('SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?');
         $stmt->setString(0, $this->schema->getSchemaName());
         $stmt->setString(1, $this->tableName);
         $stmt->execute();
         $rs = $stmt->getResultSet();
         while ($rs->next()) {
             $columns[] = new ColumnMetaDataImpl($this, $rs->getString('COLUMN_NAME'));
         }
     } catch (\blaze\ds\DataSourceException $e) {
     }
     if ($stmt != null) {
         $stmt->close();
     }
     if ($rs != null) {
         $rs->close();
     }
     return $columns;
 }