當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。