本文整理汇总了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);
}
}