コード例 #1
0
ファイル: word.php プロジェクト: DarneoStudio/bitrix
 public static function cleanUpData()
 {
     $dbConnection = Main\HttpApplication::getConnection();
     Helper::dropTable(static::getTableName());
     $binary = ToLower($dbConnection->getType()) == 'mysql' ? 'binary' : '';
     // http://bugs.mysql.com/bug.php?id=34096
     // ORACE: OK, MSSQL: OK
     Main\HttpApplication::getConnection()->query("create table " . static::getTableName() . " (\n\n\t\t\tID " . Helper::getSqlForDataType('int') . " not null " . Helper::getSqlForAutoIncrement() . " primary key,\n\t\t\tWORD " . Helper::getSqlForDataType('varchar', 50) . " " . $binary . " not null,\n\t\t\tPOSITION " . Helper::getSqlForDataType('int') . " default '0'\n\t\t)");
     Helper::addAutoIncrement(static::getTableName());
     // only for ORACLE
     Helper::createIndex(static::getTableName(), 'TMP', array('WORD'), true);
     Helper::dropTable(static::getTableNameWord2Location());
     // ORACLE: OK, MSSQL: OK
     Main\HttpApplication::getConnection()->query("create table " . static::getTableNameWord2Location() . " (\n\n\t\t\tLOCATION_ID " . Helper::getSqlForDataType('int') . " not null,\n\t\t\tWORD_ID " . Helper::getSqlForDataType('int') . " not null,\n\n\t\t\tprimary key (LOCATION_ID, WORD_ID)\n\t\t)");
     Helper::dropTable(static::getTableNamePositionTemporal());
     $dbConnection->query("create table " . static::getTableNamePositionTemporal() . " (\n\t\t\tWORD_ID " . Helper::getSqlForDataType('int') . " not null,\n\t\t\tPOSITION " . Helper::getSqlForDataType('int') . " default '0'\n\t\t)");
 }