本文整理匯總了PHP中Propel\Generator\Util\QuickBuilder::getSQL方法的典型用法代碼示例。如果您正苦於以下問題:PHP QuickBuilder::getSQL方法的具體用法?PHP QuickBuilder::getSQL怎麽用?PHP QuickBuilder::getSQL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Propel\Generator\Util\QuickBuilder
的用法示例。
在下文中一共展示了QuickBuilder::getSQL方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testDatabaseLevelBehavior
public function testDatabaseLevelBehavior()
{
$schema = <<<EOF
<database name="archivable_behavior_test_0">
<behavior name="archivable" />
<table name="archivable_test_01">
<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
<column name="title" type="VARCHAR" size="100" primaryString="true" />
<behavior name="archivable" />
</table>
</database>
EOF;
$builder = new QuickBuilder();
$builder->setSchema($schema);
$builder->getSQL();
}
示例2: testModiFyTableUsesCustomLocaleDefault
public function testModiFyTableUsesCustomLocaleDefault()
{
$schema = <<<EOF
<database name="i18n_behavior_test_0">
<table name="i18n_behavior_test_0">
<column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
<behavior name="i18n">
<parameter name="default_locale" value="fr_FR" />
</behavior>
</table>
</database>
EOF;
$builder = new QuickBuilder();
$builder->setSchema($schema);
$expected = <<<EOF
-----------------------------------------------------------------------
-- i18n_behavior_test_0_i18n
-----------------------------------------------------------------------
DROP TABLE i18n_behavior_test_0_i18n;
CREATE TABLE i18n_behavior_test_0_i18n
(
id INTEGER NOT NULL,
locale VARCHAR(5) DEFAULT 'fr_FR' NOT NULL,
PRIMARY KEY (id,locale)
);
EOF;
$this->assertContains($expected, $builder->getSQL());
}
示例3: testModifyTableRelatesI18nTableToMainTableWithCustomPk
/**
* @dataProvider customPkSchemaDataProvider
*/
public function testModifyTableRelatesI18nTableToMainTableWithCustomPk($schema)
{
$builder = new QuickBuilder();
$builder->setSchema($schema);
$expected = <<<EOF
-----------------------------------------------------------------------
-- i18n_behavior_test_custom_pk_0_i18n
-----------------------------------------------------------------------
DROP TABLE IF EXISTS i18n_behavior_test_custom_pk_0_i18n;
CREATE TABLE i18n_behavior_test_custom_pk_0_i18n
(
custom_id INTEGER NOT NULL,
locale VARCHAR(5) DEFAULT 'en_US' NOT NULL,
bar VARCHAR(100),
PRIMARY KEY (custom_id,locale),
UNIQUE (custom_id,locale),
FOREIGN KEY (custom_id) REFERENCES i18n_behavior_test_custom_pk_0 (id)
EOF;
$this->assertContains($expected, $builder->getSQL());
}
示例4: testModifyTableAddsVersionTableWithPrefix
/**
* @dataProvider tablePrefixSchemaDataProvider
*/
public function testModifyTableAddsVersionTableWithPrefix($schema)
{
$builder = new QuickBuilder();
$builder->setSchema($schema);
$expected = <<<SQL
-----------------------------------------------------------------------
-- prefix_versionable_behavior_test_0_version
-----------------------------------------------------------------------
DROP TABLE IF EXISTS prefix_versionable_behavior_test_0_version;
CREATE TABLE prefix_versionable_behavior_test_0_version
(
id INTEGER NOT NULL,
bar INTEGER,
version INTEGER DEFAULT 0 NOT NULL,
PRIMARY KEY (id,version),
UNIQUE (id,version),
FOREIGN KEY (id) REFERENCES prefix_versionable_behavior_test_0 (id)
ON DELETE CASCADE
);
SQL;
$this->assertContains($expected, $builder->getSQL());
}
示例5: testSkipSqlParameterOnParentTable
public function testSkipSqlParameterOnParentTable()
{
$schema = <<<EOF
<database name="versionable_behavior_test_0">
<table name="versionable_behavior_test_0" skipSql="true">
<column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
<column name="bar" type="INTEGER" />
<behavior name="versionable" />
</table>
</database>
EOF;
$builder = new QuickBuilder();
$builder->setSchema($schema);
$this->assertEmpty($builder->getSQL());
}
示例6: testGeneratedSqlWithTablePrefix
/**
* @dataProvider tablePrefixDataProvider
*/
public function testGeneratedSqlWithTablePrefix($schema, $expectSQL, $expectClasses)
{
$builder = new QuickBuilder();
$builder->setSchema($schema);
$actualSQL = $builder->getSQL();
$this->assertEquals($expectSQL, $actualSQL);
}
示例7: testModiFyTableUsesCustomI18nLocaleLength
public function testModiFyTableUsesCustomI18nLocaleLength()
{
$schema = <<<EOF
<database name="i18n_behavior_test_0">
<table name="i18n_behavior_test_0">
<column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
<behavior name="i18n">
<parameter name="locale_length" value="6" />
</behavior>
</table>
</database>
EOF;
$builder = new QuickBuilder();
$builder->setSchema($schema);
$expected = <<<EOF
-----------------------------------------------------------------------
-- i18n_behavior_test_0_i18n
-----------------------------------------------------------------------
DROP TABLE IF EXISTS i18n_behavior_test_0_i18n;
CREATE TABLE i18n_behavior_test_0_i18n
(
id INTEGER NOT NULL,
locale VARCHAR(6) DEFAULT 'en_US' NOT NULL,
PRIMARY KEY (id,locale),
FOREIGN KEY (id) REFERENCES i18n_behavior_test_0 (id)
ON DELETE CASCADE
);
EOF;
$this->assertContains($expected, $builder->getSQL());
}
示例8: testDatabaseLevelBehavior
public function testDatabaseLevelBehavior()
{
$schema = <<<EOF
<database name="versionable_behavior_test_0">
<behavior name="versionable" />
<table name="versionable_behavior_test_0">
<column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
<column name="bar" type="INTEGER" />
</table>
</database>
EOF;
$expected = <<<EOF
-----------------------------------------------------------------------
-- versionable_behavior_test_0_version
-----------------------------------------------------------------------
DROP TABLE versionable_behavior_test_0_version;
CREATE TABLE versionable_behavior_test_0_version
(
id INTEGER NOT NULL,
bar INTEGER,
version INTEGER DEFAULT 0 NOT NULL,
PRIMARY KEY (id,version)
);
-- SQLite does not support foreign keys; this is just for reference
-- FOREIGN KEY (id) REFERENCES versionable_behavior_test_0 (id)
EOF;
$builder = new QuickBuilder();
$builder->setSchema($schema);
$this->assertContains($expected, $builder->getSQL());
}