En Filter Country Language info.txt

Материал из MstarProject Manual
Перейти к: навигация, поиск

SQL-scripts to convert TecDoc database into MySQL: can filter data by a specified country(with regard to product relevance by country) and/or specified language.

They need to be run as ordinary SQL-queries - for instance, through the console client mysql (mysql.exe)or any other equivalent. At the same time a database should be selected (in MySQL-client startup options or by SQL-command "USE DatabaseName;") - it is best to choose the destination database (where to the data will be recorded). The order of scripts execution must match their numbers (in the file names). The values of all the settings are set at the beginning of each script (command "SET ...").

2-Filter_Country.sql filters by country the database, with set value @DB1, into the database, with set value @DB2

3-Filter_Language.sql filters by language table within the database @DB1, using @DB2 only for temporary tables.

Note that when filtering by language, besides the selected language, all the data, related to the so-called "universal language" (code 255) is saved as well, since much of the TecDoc data is related to all the languages. Therefore, it is not recommendedt o delete the fields *_LNG_ID from the tables - otherwise there will be duplicate information in some tables (in 2 different languages), and to select necessary data using the field *_LNG_ID will not be possible.

Examples of use:

1. Only to delete *_CTM fields in all the tables, not filtering by these fields the data itself:

2-Filter_Country.sql:
@COLUMN_FILTER = '_CTM';
@ROW_FILTER = FALSE;

2. To delete *_CTM fields and filter all data by former USSR countries:

2-Filter_Country.sql:
@COU_ID = 204;
@COLUMN_FILTER = '_CTM';
@ROW_FILTER = TRUE;

3. To delete *_CTM fields, but leave *_LNG_ID fields, filter all data by Europe and German language:

2-Filter_Country.sql:
@COU_ID = 248;
@COLUMN_FILTER = '_CTM';
@ROW_FILTER = TRUE;

3-Filter_Language.sql:
@LNG_ID = 1;
@COLUMN_FILTER = NULL;
@ROW_FILTER = TRUE;