public function setUp()
    {
        dbsteward::set_sql_format('mysql5');
        dbsteward::$quote_schema_names = TRUE;
        dbsteward::$quote_table_names = TRUE;
        dbsteward::$quote_column_names = TRUE;
        dbsteward::$quote_function_names = TRUE;
        dbsteward::$quote_object_names = TRUE;
        mysql5::$use_auto_increment_table_options = FALSE;
        mysql5::$use_schema_name_prefix = FALSE;
        $xml = <<<XML
<dbsteward>
  <database>
    <host>db-host</host>
    <name>dbsteward</name>
    <role>
      <application>dbsteward_phpunit_app</application>
      <owner>deployment</owner>
      <replication/>
      <readonly/>
    </role>
  </database>
</dbsteward>
XML;
        $this->dbdoc = new SimpleXMLElement($xml);
    }
    public function setUp()
    {
        dbsteward::set_sql_format('pgsql8');
        dbsteward::$quote_schema_names = TRUE;
        dbsteward::$quote_table_names = TRUE;
        dbsteward::$quote_column_names = TRUE;
        dbsteward::$quote_function_names = TRUE;
        dbsteward::$quote_object_names = TRUE;
        $xml = <<<XML
<dbsteward>
  <database>
    <host>db-host</host>
    <name>dbsteward</name>
    <role>
      <application>dbsteward_phpunit_app</application>
      <owner>deployment</owner>
      <replication/>
      <readonly/>
    </role>
  </database>
</dbsteward>
XML;
        $db = new SimpleXMLElement($xml);
        dbsteward::$new_database = $db;
        dbsteward::$old_database = $db;
    }
    public function setUp()
    {
        $this->testHandler = new Monolog\Handler\TestHandler();
        dbsteward::get_logger()->pushHandler($this->testHandler);
        // format doesn't really matter
        dbsteward::set_sql_format('pgsql8');
        dbsteward::$quote_schema_names = TRUE;
        dbsteward::$quote_table_names = TRUE;
        dbsteward::$quote_column_names = TRUE;
        dbsteward::$quote_function_names = TRUE;
        dbsteward::$quote_object_names = TRUE;
        $xml = <<<XML
<dbsteward>
  <database>
    <host>db-host</host>
    <name>dbsteward</name>
    <role>
      <application>dbsteward_phpunit_app</application>
      <owner>deployment</owner>
      <replication/>
      <readonly/>
      <customRole>custom</customRole>
    </role>
  </database>
</dbsteward>
XML;
        $this->dbdoc = new SimpleXMLElement($xml);
    }
 public function setUp()
 {
     dbsteward::$quote_schema_names = TRUE;
     dbsteward::$quote_table_names = TRUE;
     dbsteward::$quote_column_names = TRUE;
     dbsteward::$quote_function_names = TRUE;
     dbsteward::$quote_object_names = TRUE;
 }
 public function setUp()
 {
     dbsteward::set_sql_format('pgsql8');
     dbsteward::$quote_schema_names = TRUE;
     dbsteward::$quote_table_names = TRUE;
     dbsteward::$quote_column_names = TRUE;
     dbsteward::$quote_function_names = TRUE;
     dbsteward::$quote_object_names = TRUE;
 }
 public function setUp()
 {
     dbsteward::set_sql_format('mysql5');
     dbsteward::$quote_schema_names = TRUE;
     dbsteward::$quote_table_names = TRUE;
     dbsteward::$quote_column_names = TRUE;
     dbsteward::$quote_function_names = TRUE;
     dbsteward::$quote_object_names = TRUE;
     mysql5::$use_auto_increment_table_options = FALSE;
     mysql5::$use_schema_name_prefix = FALSE;
 }
Ejemplo n.º 7
0
 public function setUp()
 {
     dbsteward::$quote_all_names = FALSE;
     dbsteward::$quote_schema_names = FALSE;
     dbsteward::$quote_table_names = FALSE;
     dbsteward::$quote_column_names = FALSE;
     dbsteward::$quote_function_names = FALSE;
     dbsteward::$quote_object_names = FALSE;
     dbsteward::$quote_illegal_identifiers = FALSE;
     dbsteward::$quote_reserved_identifiers = FALSE;
 }
Ejemplo n.º 8
0
    public function setUp()
    {
        dbsteward::set_sql_format('mysql5');
        dbsteward::$quote_schema_names = TRUE;
        dbsteward::$quote_table_names = TRUE;
        dbsteward::$quote_column_names = TRUE;
        dbsteward::$quote_function_names = TRUE;
        dbsteward::$quote_object_names = TRUE;
        mysql5::$use_auto_increment_table_options = FALSE;
        mysql5::$use_schema_name_prefix = FALSE;
        $db_doc_xml = <<<XML
<dbsteward>
  <database>
    <role>
      <owner>the_owner</owner>
      <customRole>SOMEBODY</customRole>
    </role>
  </database>
</dbsteward>
XML;
        dbsteward::$new_database = new SimpleXMLElement($db_doc_xml);
    }
Ejemplo n.º 9
0
    public function testCompositeForeignKeyReferentialConstraints()
    {
        dbsteward::$quote_all_names = false;
        dbsteward::$quote_schema_names = false;
        dbsteward::$quote_table_names = false;
        dbsteward::$quote_column_names = false;
        dbsteward::$quote_function_names = false;
        dbsteward::$quote_object_names = false;
        $sql = <<<SQL
CREATE TABLE dummy (foo int, bar varchar(32), PRIMARY KEY (foo, bar));
CREATE TABLE test (
  id int PRIMARY KEY,
  foo int,
  bar varchar(32),
  FOREIGN KEY (foo, bar) REFERENCES dummy (foo, bar)
    ON UPDATE NO ACTION
    ON DELETE SET NULL
);
SQL;
        $schemaname = __CLASS__;
        $expected = <<<XML
<foreignKey
  columns="foo, bar"
  foreignSchema="{$schemaname}"
  foreignTable="dummy"
  foreignColumns="foo, bar"
  constraintName="test_foo_fkey"
  onUpdate="NO_ACTION"
  onDelete="SET_NULL"/>
XML;
        $schema = $this->extract($sql);
        foreach ($schema->table as $table) {
            if ((string) $table['name'] == 'test') {
                $this->assertEquals(simplexml_load_string($expected), $table->foreignKey);
                return;
            }
        }
    }
 protected function apply_options_mssql10()
 {
     dbsteward::set_sql_format('mssql10');
     dbsteward::$quote_table_names = TRUE;
     dbsteward::$quote_column_names = TRUE;
     dbsteward::$quote_object_names = TRUE;
 }