当前位置: 首页>>代码示例>>PHP>>正文


PHP QuickBuilder::getSQL方法代码示例

本文整理汇总了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();
    }
开发者ID:disider,项目名称:Propel2,代码行数:16,代码来源:ArchivableBehaviorTest.php

示例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());
    }
开发者ID:rouffj,项目名称:Propel2,代码行数:30,代码来源:I18nBehaviorTest.php

示例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());
    }
开发者ID:disider,项目名称:Propel2,代码行数:25,代码来源:I18nBehaviorTest.php

示例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());
    }
开发者ID:naldz,项目名称:cyberden,代码行数:27,代码来源:VersionableBehaviorTest.php

示例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());
    }
开发者ID:robin850,项目名称:Propel2,代码行数:15,代码来源:VersionableBehaviorTest.php

示例6: testGeneratedSqlWithTablePrefix

 /**
  * @dataProvider tablePrefixDataProvider
  */
 public function testGeneratedSqlWithTablePrefix($schema, $expectSQL, $expectClasses)
 {
     $builder = new QuickBuilder();
     $builder->setSchema($schema);
     $actualSQL = $builder->getSQL();
     $this->assertEquals($expectSQL, $actualSQL);
 }
开发者ID:naldz,项目名称:cyberden,代码行数:10,代码来源:ArchivableBehaviorTest.php

示例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());
    }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:32,代码来源:I18nBehaviorTest.php

示例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());
    }
开发者ID:norfil,项目名称:Propel2,代码行数:33,代码来源:VersionableBehaviorTest.php


注:本文中的Propel\Generator\Util\QuickBuilder::getSQL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。