本文整理匯總了PHP中eZ\Publish\Core\Persistence\Database\DatabaseHandler::exec方法的典型用法代碼示例。如果您正苦於以下問題:PHP DatabaseHandler::exec方法的具體用法?PHP DatabaseHandler::exec怎麽用?PHP DatabaseHandler::exec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZ\Publish\Core\Persistence\Database\DatabaseHandler
的用法示例。
在下文中一共展示了DatabaseHandler::exec方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createMigrationsTable
public function createMigrationsTable()
{
/** @var \Doctrine\DBAL\Schema\AbstractSchemaManager $sm */
$sm = $this->dbHandler->getConnection()->getSchemaManager();
$dbPlatform = $sm->getDatabasePlatform();
$schema = new Schema();
$t = $schema->createTable($this->migrationsTableName);
$t->addColumn('migration', 'string', array('length' => 255));
$t->addColumn('path', 'string', array('length' => 4000));
$t->addColumn('md5', 'string', array('length' => 32));
$t->addColumn('execution_date', 'integer', array('notnull' => false));
$t->addColumn('status', 'integer', array('default ' => Migration::STATUS_TODO));
$t->addColumn('execution_error', 'string', array('length' => 4000, 'notnull' => false));
$t->setPrimaryKey(array('migration'));
// in case users want to look up migrations by their full path
// NB: disabled for the moment, as it causes problems on some versions of mysql which limit index length to 767 bytes,
// and 767 bytes can be either 255 chars or 191 chars depending on charset utf8 or utf8mb4...
//$t->addIndex(array('path'));
foreach ($schema->toSql($dbPlatform) as $sql) {
$this->dbHandler->exec($sql);
}
}