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