示例#1
0
    $logger->error($e->getMessage());
}
try {
    EQM::nativeExecute("DROP TABLE project");
} catch (EQMException $e) {
    $logger->error($e->getMessage());
}
try {
    EQM::nativeExecute("DROP TABLE project_activity");
} catch (EQMException $e) {
    $logger->error($e->getMessage());
}
// Create all tables for 'second_db' connection
EQM::nativeExecute("CREATE TABLE company (\n    id int(11) unsigned NOT NULL AUTO_INCREMENT,\n        name varchar(512) NOT NULL DEFAULT '',\n        remark varchar(512),\n        PRIMARY KEY (id)\n    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n");
EQM::nativeExecute("\n    CREATE TABLE project (\n        id varchar(255) NOT NULL,\n        companyId int(11) unsigned NOT NULL,\n        name varchar(255) NOT NULL,\n        value decimal(10,2) DEFAULT 0,\n        PRIMARY KEY (id)\n    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n");
EQM::nativeExecute("\n    CREATE TABLE project_activity (\n        id int(11) unsigned NOT NULL,\n        projectId varchar(255) NOT NULL,\n        name varchar(255) NOT NULL,\n        PRIMARY KEY (id, projectId)\n    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n");
// Switch back to 'default' connection
EQM::activateConnection();
// Define classes
class Company
{
}
class AnotherCompany
{
    private $__table = 'Company';
}
class Project
{
}
class ProjectActivity
{