text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
-- 2021-09-23T14:32:15.811Z -- URL zum Konzept INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,579915,0,TO_TIMESTAMP('2021-09-23 17:32:14','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Vertragsperiode','Vertragsperiode',TO_TIMESTAMP('2021-09-23 17:32:14','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-09-23T14:32:15.890Z -- URL zum Konzept INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,IsActive) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,'Y' FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=579915 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2021-09-23T14:33:14.421Z -- URL zum Konzept UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Contract', PrintName='Contract',Updated=TO_TIMESTAMP('2021-09-23 17:33:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579915 AND AD_Language='en_US' ; -- 2021-09-23T14:33:14.490Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(579915,'en_US') ; -- 2021-09-23T14:34:05.637Z -- URL zum Konzept UPDATE AD_Window SET AD_Element_ID=579915, Description=NULL, Help=NULL, Name='Vertragsperiode',Updated=TO_TIMESTAMP('2021-09-23 17:34:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=540359 ; -- 2021-09-23T14:34:05.890Z -- URL zum Konzept UPDATE AD_Menu SET Description=NULL, IsActive='Y', Name='Vertragsperiode',Updated=TO_TIMESTAMP('2021-09-23 17:34:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=540951 ; -- 2021-09-23T14:34:06.195Z -- URL zum Konzept /* DDL */ select update_window_translation_from_ad_element(579915) ; -- 2021-09-23T14:34:06.275Z -- URL zum Konzept DELETE FROM AD_Element_Link WHERE AD_Window_ID=540359 ; -- 2021-09-23T14:34:06.367Z -- URL zum Konzept /* DDL */ select AD_Element_Link_Create_Missing_Window(540359) ; -- 2021-09-28T15:40:46.235Z -- URL zum Konzept UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-09-28 18:40:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579915 AND AD_Language='de_CH' ; -- 2021-09-28T15:40:46.340Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(579915,'de_CH') ; -- 2021-09-28T15:40:52.862Z -- URL zum Konzept UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-09-28 18:40:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579915 AND AD_Language='de_DE' ; -- 2021-09-28T15:40:52.941Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(579915,'de_DE') ; -- 2021-09-28T15:40:53.083Z -- URL zum Konzept /* DDL */ select update_ad_element_on_ad_element_trl_update(579915,'de_DE') ; -- 2021-09-28T15:41:10.679Z -- URL zum Konzept UPDATE AD_Element_Trl SET Name='Vertragsperiode1', PrintName='Vertragsperiode1',Updated=TO_TIMESTAMP('2021-09-28 18:41:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579915 AND AD_Language='de_CH' ; -- 2021-09-28T15:41:10.792Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(579915,'de_CH') ; -- 2021-09-28T15:41:16.056Z -- URL zum Konzept UPDATE AD_Element_Trl SET Name='Vertragsperiode', PrintName='Vertragsperiode',Updated=TO_TIMESTAMP('2021-09-28 18:41:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579915 AND AD_Language='de_CH' ; -- 2021-09-28T15:41:16.135Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(579915,'de_CH') ; -- 2021-09-28T15:43:13.705Z -- URL zum Konzept UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Vertragsperiode', PrintName='Vertragsperiode',Updated=TO_TIMESTAMP('2021-09-28 18:43:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=574563 AND AD_Language='de_CH' ; -- 2021-09-28T15:43:13.768Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(574563,'de_CH') ; -- 2021-09-28T15:43:22.719Z -- URL zum Konzept UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Vertragsperiode', PrintName='Vertragsperiode',Updated=TO_TIMESTAMP('2021-09-28 18:43:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=574563 AND AD_Language='de_DE' ; -- 2021-09-28T15:43:22.798Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(574563,'de_DE') ; -- 2021-09-28T15:43:22.953Z -- URL zum Konzept /* DDL */ select update_ad_element_on_ad_element_trl_update(574563,'de_DE') ; -- 2021-09-28T15:43:23.047Z -- URL zum Konzept UPDATE AD_Column SET ColumnName=NULL, Name='Vertragsperiode', Description=NULL, Help=NULL WHERE AD_Element_ID=574563 ; -- 2021-09-28T15:43:23.125Z -- URL zum Konzept UPDATE AD_Process_Para SET ColumnName=NULL, Name='Vertragsperiode', Description=NULL, Help=NULL WHERE AD_Element_ID=574563 AND IsCentrallyMaintained='Y' ; -- 2021-09-28T15:43:23.188Z -- URL zum Konzept UPDATE AD_Field SET Name='Vertragsperiode', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=574563) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 574563) ; -- 2021-09-28T15:43:23.298Z -- URL zum Konzept UPDATE AD_PrintFormatItem pi SET PrintName='Vertragsperiode', Name='Vertragsperiode' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=574563) ; -- 2021-09-28T15:43:23.376Z -- URL zum Konzept UPDATE AD_Tab SET Name='Vertragsperiode', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 574563 ; -- 2021-09-28T15:43:23.437Z -- URL zum Konzept UPDATE AD_WINDOW SET Name='Vertragsperiode', Description=NULL, Help=NULL WHERE AD_Element_ID = 574563 ; -- 2021-09-28T15:43:23.529Z -- URL zum Konzept UPDATE AD_Menu SET Name = 'Vertragsperiode', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 574563 ; -- 2021-09-28T16:21:22.433Z -- URL zum Konzept INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,550488,0,540340,540796,591810,'F',TO_TIMESTAMP('2021-09-28 19:21:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',0,'Vertrags-Status',430,0,0,TO_TIMESTAMP('2021-09-28 19:21:21','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-09-28T16:22:49.765Z -- URL zum Konzept UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2021-09-28 19:22:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=591810 ; -- 2021-09-28T16:23:24.062Z -- URL zum Konzept UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2021-09-28 19:23:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=591810 ; -- 2021-09-28T16:23:24.390Z -- URL zum Konzept UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2021-09-28 19:23:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546379 ; -- 2021-09-28T16:23:24.674Z -- URL zum Konzept UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2021-09-28 19:23:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546375 ; -- 2021-09-28T16:23:25.002Z -- URL zum Konzept UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2021-09-28 19:23:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546393 ; -- 2021-09-28T16:23:25.300Z -- URL zum Konzept UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2021-09-28 19:23:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546403 ; -- 2021-09-28T17:06:22.082Z -- URL zum Konzept UPDATE AD_Tab SET TabLevel=1,Updated=TO_TIMESTAMP('2021-09-28 20:06:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=544582 ; -- 2021-09-29T15:20:58.681Z -- URL zum Konzept UPDATE AD_Element_Trl SET Name='Contract Period', PrintName='Contract Period',Updated=TO_TIMESTAMP('2021-09-29 18:20:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=579915 AND AD_Language='en_US' ; -- 2021-09-29T15:20:58.761Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(579915,'en_US') ; -- 2021-09-29T15:22:27.973Z -- URL zum Konzept UPDATE AD_Element_Trl SET Name='Contract Period', PrintName='Contract Period', WEBUI_NameBrowse='Contract Period',Updated=TO_TIMESTAMP('2021-09-29 18:22:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=574563 AND AD_Language='en_US' ; -- 2021-09-29T15:22:28.084Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(574563,'en_US') ; -- 2021-09-29T15:22:38.425Z -- URL zum Konzept UPDATE AD_Element_Trl SET WEBUI_NameBrowse='Vertragsperiode',Updated=TO_TIMESTAMP('2021-09-29 18:22:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=574563 AND AD_Language='de_CH' ; -- 2021-09-29T15:22:38.517Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(574563,'de_CH') ; -- 2021-09-29T15:22:47.321Z -- URL zum Konzept UPDATE AD_Element_Trl SET WEBUI_NameBrowse='Vertragsperiode',Updated=TO_TIMESTAMP('2021-09-29 18:22:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=574563 AND AD_Language='de_DE' ; -- 2021-09-29T15:22:47.414Z -- URL zum Konzept /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(574563,'de_DE') ; -- 2021-09-29T15:22:47.600Z -- URL zum Konzept /* DDL */ select update_ad_element_on_ad_element_trl_update(574563,'de_DE') ; -- 2021-09-29T15:22:47.693Z -- URL zum Konzept UPDATE AD_Menu SET Name = 'Vertragsperiode', Description = NULL, WEBUI_NameBrowse = 'Vertragsperiode', WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 574563 ;
the_stack
-- 2019-11-21T08:03:06.840Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='WITH exportedLines AS ( SELECT -- -- fields which appear in the UI l.seqno, (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) product_value, l.m_product_id m_product_id, (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_value, l.m_product_category_id m_product_category_id, (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_value, l.c_bpartner_id c_bpartner_id, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) c_taxcategory_id, l.std_addamt, l.std_rounding, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) c_taxcategory_target_id FROM m_discountschemaline l WHERE l.m_discountschema_id = @M_DiscountSchema_ID@ -- WHERE l.m_discountschema_id = 1000000 ) SELECT -- -- fields which appear in the UI l.seqno::text seqno, l.product_value ProductValue, l.m_product_id m_product_id, l.m_product_category_value ProductCategory_Value, l.m_product_category_id m_product_category_id, l.c_bpartner_value BPartnerValue, l.c_bpartner_id c_bpartner_id, l.c_taxcategory_id c_taxcategory_id, l.std_addamt std_addamt, l.std_rounding std_rounding, l.c_taxcategory_target_id c_taxcategory_target_id FROM exportedLines l UNION ALL SELECT -- -- fields which appear in the UI ((SELECT max(exportedLines.seqno) FROM exportedLines) + (row_number() OVER ()) * 10)::text seqno, -- this select is needed since seqno must be unique p.value ProductValue, p.m_product_id m_product_id, NULL ProductCategory_Value, NULL m_product_category_id, NULL BPartnerValue, NULL c_bpartner_id, NULL c_taxcategory_id, 0 std_addamt, ''C'' std_rounding, -- this is the default value NULL c_taxcategory_target_id FROM M_Product p WHERE 1 = 1 AND p.m_product_id NOT IN (SELECT COALESCE(m_product_id, 0) FROM exportedLines) AND p.IsActive = ''Y'' AND p.IsSold = ''Y'' AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@)) AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@) -- AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = 1000000)) -- AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = 1000000) ORDER BY seqno ',Updated=TO_TIMESTAMP('2019-11-21 10:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-21T08:12:16.295Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='WITH exportedLines AS ( SELECT -- -- fields which appear in the UI l.seqno, (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) product_value, l.m_product_id m_product_id, (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_value, l.m_product_category_id m_product_category_id, (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_value, l.c_bpartner_id c_bpartner_id, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) c_taxcategory_id, l.std_addamt, l.std_rounding, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) c_taxcategory_target_id FROM m_discountschemaline l WHERE l.m_discountschema_id = @M_DiscountSchema_ID@ -- WHERE l.m_discountschema_id = 1000000 ) SELECT -- -- fields which appear in the UI l.seqno::text seqno, l.product_value ProductValue, l.m_product_id m_product_id, l.m_product_category_value ProductValue, l.m_product_category_id m_product_category_id, l.c_bpartner_value BPartnerValue, l.c_bpartner_id c_bpartner_id, l.c_taxcategory_id c_taxcategory_id, l.std_addamt std_addamt, l.std_rounding std_rounding, l.c_taxcategory_target_id c_taxcategory_target_id FROM exportedLines l UNION ALL SELECT -- -- fields which appear in the UI ((SELECT max(exportedLines.seqno) FROM exportedLines) + (row_number() OVER ()) * 10)::text seqno, -- this select is needed since seqno must be unique p.value ProductValue, p.m_product_id m_product_id, NULL ProductValue, NULL m_product_category_id, NULL BPartnerValue, NULL c_bpartner_id, NULL c_taxcategory_id, 0 std_addamt, ''C'' std_rounding, -- this is the default value NULL c_taxcategory_target_id FROM M_Product p WHERE 1 = 1 AND p.m_product_id NOT IN (SELECT COALESCE(m_product_id, 0) FROM exportedLines) AND p.IsActive = ''Y'' AND p.IsSold = ''Y'' AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@)) AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@) -- AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = 1000000)) -- AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = 1000000) ORDER BY seqno ',Updated=TO_TIMESTAMP('2019-11-21 10:12:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-21T08:13:48.522Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='WITH exportedLines AS ( SELECT -- -- fields which appear in the UI l.seqno, (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) product_value, l.m_product_id m_product_id, (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_value, l.m_product_category_id m_product_category_id, (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_value, l.c_bpartner_id c_bpartner_id, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) c_taxcategory_id, l.std_addamt, l.std_rounding, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) c_taxcategory_target_id FROM m_discountschemaline l WHERE l.m_discountschema_id = @M_DiscountSchema_ID@ -- WHERE l.m_discountschema_id = 1000000 ) SELECT -- -- fields which appear in the UI l.seqno::text seqno, l.product_value ProductValue, l.m_product_id m_product_id, l.m_product_category_value ProductValue, l.m_product_category_id m_product_category_id, l.c_bpartner_value BPartnerValue, l.c_bpartner_id c_bpartner_id, l.c_taxcategory_id c_taxcategory_id, l.std_addamt std_addamt, l.std_rounding std_rounding, l.c_taxcategory_target_id c_taxcategory_target_id FROM exportedLines l UNION ALL SELECT -- -- fields which appear in the UI ((SELECT max(exportedLines.seqno) FROM exportedLines) + (row_number() OVER ()) * 10)::text seqno, -- this select is needed since seqno must be unique p.value ProductValue, p.m_product_id m_product_id, NULL ProductValue, NULL m_product_category_id, NULL BPartnerValue, NULL c_bpartner_id, NULL c_taxcategory_id, 0 std_addamt, ''C'' std_rounding, -- this is the default value NULL c_taxcategory_target_id FROM M_Product p WHERE 1 = 1 AND p.m_product_id NOT IN (SELECT COALESCE(m_product_id, 0) FROM exportedLines) AND p.IsActive = ''Y'' AND p.IsSold = ''Y'' AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@)) AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@) -- AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = 1000000)) -- AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = 1000000) ORDER BY seqno::numeric ',Updated=TO_TIMESTAMP('2019-11-21 10:13:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-21T08:24:45.978Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,IsActive,Created,CreatedBy,AD_Org_ID,Updated,UpdatedBy,AD_Element_ID,ColumnName,PrintName,Name,EntityType) VALUES (0,'Y',TO_TIMESTAMP('2019-11-21 10:24:45','YYYY-MM-DD HH24:MI:SS'),100,0,TO_TIMESTAMP('2019-11-21 10:24:45','YYYY-MM-DD HH24:MI:SS'),100,577367,'M_Product_Category_Value','Product Category Value','Product Category Value','D') ; -- 2019-11-21T08:24:45.981Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,PO_PrintName,CommitWarning,WEBUI_NameBrowse,WEBUI_NameNew,Help,PrintName,PO_Description,PO_Help,PO_Name,WEBUI_NameNewBreadcrumb,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.Description,t.PO_PrintName,t.CommitWarning,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.Help,t.PrintName,t.PO_Description,t.PO_Help,t.PO_Name,t.WEBUI_NameNewBreadcrumb,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577367 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2019-11-21T08:28:55.152Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='WITH exportedLines AS ( SELECT -- -- fields which appear in the UI l.seqno seqno, (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) product_value, l.m_product_id m_product_id, (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_value, l.m_product_category_id m_product_category_id, (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_value, l.c_bpartner_id c_bpartner_id, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) c_taxcategory_id, l.std_addamt, l.std_rounding, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) c_taxcategory_target_id FROM m_discountschemaline l WHERE l.m_discountschema_id = @M_DiscountSchema_ID@ -- WHERE l.m_discountschema_id = 1000000 ) SELECT selectedRecords.seqno::text seqno, selectedRecords.ProductValue ProductValue, selectedRecords.m_product_id m_product_id, selectedRecords.M_Product_Category_Value M_Product_Category_Value, selectedRecords.m_product_category_id m_product_category_id, selectedRecords.BPartnerValue BPartnerValue, selectedRecords.c_bpartner_id c_bpartner_id, selectedRecords.c_taxcategory_id c_taxcategory_id, selectedRecords.std_addamt std_addamt, selectedRecords.std_rounding std_rounding, selectedRecords.c_taxcategory_target_id c_taxcategory_target_id FROM ( SELECT -- -- fields which appear in the UI l.seqno seqno, l.product_value ProductValue, l.m_product_id m_product_id, l.m_product_category_value M_Product_Category_Value, l.m_product_category_id m_product_category_id, l.c_bpartner_value BPartnerValue, l.c_bpartner_id c_bpartner_id, l.c_taxcategory_id c_taxcategory_id, l.std_addamt std_addamt, l.std_rounding std_rounding, l.c_taxcategory_target_id c_taxcategory_target_id FROM exportedLines l UNION ALL SELECT -- -- fields which appear in the UI ((SELECT max(exportedLines.seqno) FROM exportedLines) + (row_number() OVER ()) * 10) seqno, -- this select is needed since seqno must be unique p.value ProductValue, p.m_product_id m_product_id, NULL M_Product_Category_Value, NULL m_product_category_id, NULL BPartnerValue, NULL c_bpartner_id, NULL c_taxcategory_id, 0 std_addamt, ''C'' std_rounding, -- this is the default value NULL c_taxcategory_target_id FROM M_Product p WHERE 1 = 1 AND p.m_product_id NOT IN (SELECT COALESCE(m_product_id, 0) FROM exportedLines) AND p.IsActive = ''Y'' AND p.IsSold = ''Y'' AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@)) AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@) -- AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = 1000000)) -- AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = 1000000) ) selectedRecords ORDER BY cast(seqno AS numeric)',Updated=TO_TIMESTAMP('2019-11-21 10:28:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-21T08:31:34.598Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='WITH exportedLines AS ( SELECT -- -- fields which appear in the UI l.seqno seqno, (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) product_value, (SELECT p.name FROM m_product p WHERE p.m_product_id = l.m_product_id) m_product_id, (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_value, (SELECT pc.name FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_id, (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_value, (SELECT bp.name FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_id, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) c_taxcategory_id, l.std_addamt, l.std_rounding, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) c_taxcategory_target_id FROM m_discountschemaline l WHERE l.m_discountschema_id = @M_DiscountSchema_ID@ -- WHERE l.m_discountschema_id = 1000000 ) SELECT selectedRecords.seqno::text seqno, selectedRecords.ProductValue ProductValue, selectedRecords.m_product_id m_product_id, selectedRecords.M_Product_Category_Value M_Product_Category_Value, selectedRecords.m_product_category_id m_product_category_id, selectedRecords.BPartnerValue BPartnerValue, selectedRecords.c_bpartner_id c_bpartner_id, selectedRecords.c_taxcategory_id c_taxcategory_id, selectedRecords.std_addamt std_addamt, selectedRecords.std_rounding std_rounding, selectedRecords.c_taxcategory_target_id c_taxcategory_target_id FROM ( SELECT -- -- fields which appear in the UI l.seqno seqno, l.product_value ProductValue, l.m_product_id m_product_id, l.m_product_category_value M_Product_Category_Value, l.m_product_category_id m_product_category_id, l.c_bpartner_value BPartnerValue, l.c_bpartner_id c_bpartner_id, l.c_taxcategory_id c_taxcategory_id, l.std_addamt std_addamt, l.std_rounding std_rounding, l.c_taxcategory_target_id c_taxcategory_target_id FROM exportedLines l UNION ALL SELECT -- -- fields which appear in the UI ((SELECT max(exportedLines.seqno) FROM exportedLines) + (row_number() OVER ()) * 10) seqno, -- this select is needed since seqno must be unique p.value ProductValue, p.name m_product_id, NULL M_Product_Category_Value, NULL m_product_category_id, NULL BPartnerValue, NULL c_bpartner_id, NULL c_taxcategory_id, 0 std_addamt, ''C'' std_rounding, -- this is the default value NULL c_taxcategory_target_id FROM M_Product p WHERE 1 = 1 AND p.m_product_id NOT IN (SELECT COALESCE(m_product_id, 0) FROM exportedLines) AND p.IsActive = ''Y'' AND p.IsSold = ''Y'' AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@)) AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@) -- AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = 1000000)) -- AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = 1000000) ) selectedRecords ORDER BY cast(seqno AS numeric) ',Updated=TO_TIMESTAMP('2019-11-21 10:31:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-21T08:47:48.878Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='WITH exportedLines AS ( SELECT -- -- fields which appear in the UI l.seqno seqno, (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) product_value, (SELECT p.name FROM m_product p WHERE p.m_product_id = l.m_product_id) product_name, l.m_product_id m_product_id, (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_value, (SELECT pc.name FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_id, (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_value, (SELECT bp.name FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_id, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) c_taxcategory_id, l.std_addamt, l.std_rounding, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) c_taxcategory_target_id FROM m_discountschemaline l WHERE l.m_discountschema_id = @M_DiscountSchema_ID@ -- WHERE l.m_discountschema_id = 1000000 ) SELECT selectedRecords.seqno::text seqno, selectedRecords.ProductValue ProductValue, selectedRecords.product_name m_product_id, selectedRecords.M_Product_Category_Value M_Product_Category_Value, selectedRecords.m_product_category_id m_product_category_id, selectedRecords.BPartnerValue BPartnerValue, selectedRecords.c_bpartner_id c_bpartner_id, selectedRecords.c_taxcategory_id c_taxcategory_id, selectedRecords.std_addamt std_addamt, selectedRecords.std_rounding std_rounding, selectedRecords.c_taxcategory_target_id c_taxcategory_target_id FROM ( SELECT -- -- fields which appear in the UI l.seqno seqno, l.product_value ProductValue, l.product_name product_name, l.m_product_category_value M_Product_Category_Value, l.m_product_category_id m_product_category_id, l.c_bpartner_value BPartnerValue, l.c_bpartner_id c_bpartner_id, l.c_taxcategory_id c_taxcategory_id, l.std_addamt std_addamt, l.std_rounding std_rounding, l.c_taxcategory_target_id c_taxcategory_target_id FROM exportedLines l UNION ALL SELECT -- -- fields which appear in the UI ((SELECT max(exportedLines.seqno) FROM exportedLines) + (row_number() OVER ()) * 10) seqno, -- this select is needed since seqno must be unique p.value ProductValue, p.name product_name, NULL M_Product_Category_Value, NULL m_product_category_id, NULL BPartnerValue, NULL c_bpartner_id, NULL c_taxcategory_id, 0 std_addamt, ''C'' std_rounding, -- this is the default value NULL c_taxcategory_target_id FROM M_Product p WHERE 1 = 1 AND p.m_product_id NOT IN (SELECT COALESCE(m_product_id, 0) FROM exportedLines) AND p.IsActive = ''Y'' AND p.IsSold = ''Y'' AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@)) AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = @M_DiscountSchema_ID@) -- AND p.AD_Org_ID IN (0, (SELECT ad_org_id FROM m_discountschema WHERE m_discountschema_id = 1000000)) -- AND p.AD_Client_ID = (SELECT ad_client_id FROM m_discountschema WHERE m_discountschema_id = 1000000) ) selectedRecords ORDER BY cast(seqno AS numeric)',Updated=TO_TIMESTAMP('2019-11-21 10:47:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-21T08:54:52.408Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET IsActive='N',Updated=TO_TIMESTAMP('2019-11-21 10:54:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=405 ; -- 2019-11-21T08:55:01.940Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET AD_Reference_ID=30, AD_Reference_Value_ID=540152,Updated=TO_TIMESTAMP('2019-11-21 10:55:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=591817 ; -- 2019-11-21T08:59:58.094Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET PrintName='Produktkategorie Nummer', IsTranslated='Y', Name='Produktkategorie Nummer',Updated=TO_TIMESTAMP('2019-11-21 10:59:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Element_ID=577367 ; -- 2019-11-21T08:59:58.141Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577367,'de_CH') ; -- 2019-11-21T09:00:03Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET PrintName='Produktkategorie Nummer', IsTranslated='Y', Name='Produktkategorie Nummer',Updated=TO_TIMESTAMP('2019-11-21 11:00:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Element_ID=577367 ; -- 2019-11-21T09:00:03.003Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577367,'de_DE') ; -- 2019-11-21T09:00:03.010Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577367,'de_DE') ; -- 2019-11-21T09:00:03.020Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='M_Product_Category_Value', Name='Produktkategorie Nummer', Description=NULL, Help=NULL WHERE AD_Element_ID=577367 ; -- 2019-11-21T09:00:03.022Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='M_Product_Category_Value', Name='Produktkategorie Nummer', Description=NULL, Help=NULL, AD_Element_ID=577367 WHERE UPPER(ColumnName)='M_PRODUCT_CATEGORY_VALUE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2019-11-21T09:00:03.024Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='M_Product_Category_Value', Name='Produktkategorie Nummer', Description=NULL, Help=NULL WHERE AD_Element_ID=577367 AND IsCentrallyMaintained='Y' ; -- 2019-11-21T09:00:03.025Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Produktkategorie Nummer', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577367) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577367) ; -- 2019-11-21T09:00:03.036Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Produktkategorie Nummer', Name='Produktkategorie Nummer' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577367) ; -- 2019-11-21T09:00:03.039Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Produktkategorie Nummer', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577367 ; -- 2019-11-21T09:00:03.042Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Produktkategorie Nummer', Description=NULL, Help=NULL WHERE AD_Element_ID = 577367 ; -- 2019-11-21T09:00:03.044Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Produktkategorie Nummer', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577367 ; -- 2019-11-21T09:00:05.209Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-11-21 11:00:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Element_ID=577367 ; -- 2019-11-21T09:00:05.211Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577367,'en_US') ; -- 2019-11-21T09:02:03.263Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Reference (AD_Client_ID,IsActive,Created,CreatedBy,IsOrderByValue,Updated,UpdatedBy,AD_Reference_ID,ValidationType,Name,AD_Org_ID,EntityType) VALUES (0,'Y',TO_TIMESTAMP('2019-11-21 11:02:03','YYYY-MM-DD HH24:MI:SS'),100,'N',TO_TIMESTAMP('2019-11-21 11:02:03','YYYY-MM-DD HH24:MI:SS'),100,541076,'T','M_PriceListSchema',0,'D') ; -- 2019-11-21T09:02:03.265Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Reference_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Reference_ID=541076 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 2019-11-21T09:02:43.869Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Ref_Table (AD_Reference_ID,AD_Key,AD_Client_ID,IsActive,Created,CreatedBy,Updated,IsValueDisplayed,AD_Window_ID,UpdatedBy,AD_Table_ID,AD_Org_ID,EntityType) VALUES (541076,6581,0,'Y',TO_TIMESTAMP('2019-11-21 11:02:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-11-21 11:02:43','YYYY-MM-DD HH24:MI:SS'),'N',337,100,475,0,'D') ; -- 2019-11-21T09:07:33.951Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Reference (AD_Client_ID,IsActive,Created,CreatedBy,IsOrderByValue,Updated,UpdatedBy,AD_Reference_ID,ValidationType,Name,AD_Org_ID,EntityType) VALUES (0,'Y',TO_TIMESTAMP('2019-11-21 11:07:33','YYYY-MM-DD HH24:MI:SS'),100,'N',TO_TIMESTAMP('2019-11-21 11:07:33','YYYY-MM-DD HH24:MI:SS'),100,541077,'T','M_PriceListSchemaLine -> M_PriceListSchema',0,'D') ; -- 2019-11-21T09:07:33.953Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Reference_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Reference_ID=541077 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 2019-11-21T09:09:02.677Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Ref_Table (AD_Reference_ID,AD_Key,WhereClause,AD_Client_ID,IsActive,Created,CreatedBy,Updated,IsValueDisplayed,AD_Window_ID,UpdatedBy,AD_Table_ID,AD_Org_ID,EntityType) VALUES (541077,6620,'M_DiscountSchema_ID=@M_DiscountSchema_ID/-1@',0,'Y',TO_TIMESTAMP('2019-11-21 11:09:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-11-21 11:09:02','YYYY-MM-DD HH24:MI:SS'),'N',540756,100,477,0,'D') ; -- 2019-11-21T09:09:25.958Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_RelationType (Created,CreatedBy,IsActive,AD_Client_ID,Updated,UpdatedBy,AD_RelationType_ID,IsTableRecordIdTarget,IsDirected,AD_Reference_Source_ID,Name,AD_Org_ID,EntityType) VALUES (TO_TIMESTAMP('2019-11-21 11:09:25','YYYY-MM-DD HH24:MI:SS'),100,'Y',0,TO_TIMESTAMP('2019-11-21 11:09:25','YYYY-MM-DD HH24:MI:SS'),100,540232,'N','N',541076,'PriceListSchema -> PriceListSchemaLine',0,'D') ; -- 2019-11-21T09:09:48.732Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_RelationType SET AD_Reference_Target_ID=541077, Name='M_PriceListSchema -> M_PriceListSchemaLine',Updated=TO_TIMESTAMP('2019-11-21 11:09:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_RelationType_ID=540232 ;
the_stack
-- 2021-03-09T17:53:33.414Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AD_Client_ID,IsActive,Created,CreatedBy,Updated,IsReport,IsDirectPrint,AccessLevel,ShowHelp,IsBetaFunctionality,CopyFromProcess,UpdatedBy,AD_Process_ID,Value,AllowProcessReRun,IsUseBPartnerLanguage,IsApplySecuritySettings,RefreshAllAfterExecution,IsOneInstanceOnly,LockWaitTimeout,Type,IsTranslateExcelHeaders,IsNotifyUserAfterExecution,PostgrestResponseFormat,AD_Org_ID,Name,Classname,EntityType) VALUES (0,'Y',TO_TIMESTAMP('2021-03-09 19:53:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-03-09 19:53:33','YYYY-MM-DD HH24:MI:SS'),'N','N','3','N','N','N',100,584810,'C_BPartner_MoveToAnotherOrg','Y','Y','N','N','N',0,'Java','Y','N','json',0,'Sektionswechsel','de.metas.bpartner.process.C_BPartner_MoveToAnotherOrg','D') ; -- 2021-03-09T17:53:33.451Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_ID=584810 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 2021-03-09T17:53:50.430Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Table_ID,AD_Table_Process_ID,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,WEBUI_DocumentAction,WEBUI_IncludedTabTopAction,WEBUI_ViewAction,WEBUI_ViewQuickAction,WEBUI_ViewQuickAction_Default) VALUES (0,0,584810,291,540918,TO_TIMESTAMP('2021-03-09 19:53:50','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2021-03-09 19:53:50','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N') ; -- 2021-03-09T17:56:27.225Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,541275,TO_TIMESTAMP('2021-03-09 19:56:27','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','AD_Org different from current and 0',TO_TIMESTAMP('2021-03-09 19:56:27','YYYY-MM-DD HH24:MI:SS'),100,'T') ; -- 2021-03-09T17:56:27.229Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Reference_ID=541275 AND NOT EXISTS (SELECT 1 FROM AD_Reference_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Reference_ID=t.AD_Reference_ID) ; -- 2021-03-09T17:57:39.949Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,ShowInactiveValues,Updated,UpdatedBy,WhereClause) VALUES (0,528,528,0,541275,155,TO_TIMESTAMP('2021-03-09 19:57:39','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Y','N',TO_TIMESTAMP('2021-03-09 19:57:39','YYYY-MM-DD HH24:MI:SS'),100,'AD_Org.AD_Org_ID NOT IN ( @AD_Org_ID/-1@ , 0)') ; -- 2021-03-09T17:58:07.192Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Reference_Value_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,542976,0,584810,541946,30,541275,'AD_Org_Target_ID',TO_TIMESTAMP('2021-03-09 19:58:07','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.product',0,'Y','N','Y','N','N','N','AD_Org_Target_ID',10,TO_TIMESTAMP('2021-03-09 19:58:07','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-03-09T17:58:07.194Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541946 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-03-09T17:58:15.521Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Reference SET Name='AD_Org Different from Current and 0',Updated=TO_TIMESTAMP('2021-03-09 19:58:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=541275 ; -- 2021-03-09T17:58:37.987Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET IsMandatory='Y',Updated=TO_TIMESTAMP('2021-03-09 19:58:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541946 ; -- 2021-03-09T17:59:39.186Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,454,0,584810,541947,30,'M_Product_ID',TO_TIMESTAMP('2021-03-09 19:59:39','YYYY-MM-DD HH24:MI:SS'),100,'Produkt, Leistung, Artikel','D',0,'Bezeichnet eine Einheit, die in dieser Organisation gekauft oder verkauft wird.','Y','N','Y','N','N','N','Produkt',20,TO_TIMESTAMP('2021-03-09 19:59:39','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-03-09T17:59:39.187Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541947 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-03-09T18:00:17.802Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,540535,TO_TIMESTAMP('2021-03-09 20:00:17','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','M_Product from M_Product_Cagetory = Membership','S',TO_TIMESTAMP('2021-03-09 20:00:17','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-03-09T18:08:56.673Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Val_Rule SET Code='M_Product.AD_Org_ID = 0 AND M_Product.M_Product_Category_ID = (Select pc.M_Product_Category_ID from M_Product_Category pc where pc.AD_Org_ID = 0 and pc.Value = ''Membership'')',Updated=TO_TIMESTAMP('2021-03-09 20:08:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=540535 ; -- 2021-03-09T18:09:24.135Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Val_Rule_ID=540535,Updated=TO_TIMESTAMP('2021-03-09 20:09:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541947 ; -- 2021-03-09T18:14:25.134Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,1581,0,584810,541948,15,'DateFrom',TO_TIMESTAMP('2021-03-09 20:14:24','YYYY-MM-DD HH24:MI:SS'),100,'@#Date@ + INTERVAL ''1 day''','Startdatum eines Abschnittes','D',0,'Datum von bezeichnet das Startdatum eines Abschnittes','Y','N','Y','N','N','N','Datum von',30,TO_TIMESTAMP('2021-03-09 20:14:24','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-03-09T18:14:25.136Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541948 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-03-09T18:33:02.027Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,578813,0,'showMembershipParameter',TO_TIMESTAMP('2021-03-09 20:33:01','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','showMembershipParameter','showMembershipParameter',TO_TIMESTAMP('2021-03-09 20:33:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-03-09T18:33:02.030Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=578813 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2021-03-09T18:33:28.486Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='IsShowMembershipParameter', Name='IsShowMembershipParameter', PrintName='IsShowMembershipParameter',Updated=TO_TIMESTAMP('2021-03-09 20:33:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578813 ; -- 2021-03-09T18:33:28.496Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='IsShowMembershipParameter', Name='IsShowMembershipParameter', Description=NULL, Help=NULL WHERE AD_Element_ID=578813 ; -- 2021-03-09T18:33:28.498Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsShowMembershipParameter', Name='IsShowMembershipParameter', Description=NULL, Help=NULL, AD_Element_ID=578813 WHERE UPPER(ColumnName)='ISSHOWMEMBERSHIPPARAMETER' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2021-03-09T18:33:28.500Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsShowMembershipParameter', Name='IsShowMembershipParameter', Description=NULL, Help=NULL WHERE AD_Element_ID=578813 AND IsCentrallyMaintained='Y' ; -- 2021-03-09T18:33:28.502Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='IsShowMembershipParameter', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=578813) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 578813) ; -- 2021-03-09T18:33:28.513Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='IsShowMembershipParameter', Name='IsShowMembershipParameter' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=578813) ; -- 2021-03-09T18:33:28.515Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='IsShowMembershipParameter', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 578813 ; -- 2021-03-09T18:33:28.518Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='IsShowMembershipParameter', Description=NULL, Help=NULL WHERE AD_Element_ID = 578813 ; -- 2021-03-09T18:33:28.521Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'IsShowMembershipParameter', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 578813 ; -- 2021-03-09T18:33:32.539Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='IsShowMembershipParameter', PrintName='IsShowMembershipParameter',Updated=TO_TIMESTAMP('2021-03-09 20:33:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578813 AND AD_Language='de_CH' ; -- 2021-03-09T18:33:32.564Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578813,'de_CH') ; -- 2021-03-09T18:33:36.732Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='IsShowMembershipParameter', PrintName='IsShowMembershipParameter',Updated=TO_TIMESTAMP('2021-03-09 20:33:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578813 AND AD_Language='de_DE' ; -- 2021-03-09T18:33:36.734Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578813,'de_DE') ; -- 2021-03-09T18:33:36.747Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(578813,'de_DE') ; -- 2021-03-09T18:33:36.749Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='IsShowMembershipParameter', Name='IsShowMembershipParameter', Description=NULL, Help=NULL WHERE AD_Element_ID=578813 ; -- 2021-03-09T18:33:36.751Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsShowMembershipParameter', Name='IsShowMembershipParameter', Description=NULL, Help=NULL, AD_Element_ID=578813 WHERE UPPER(ColumnName)='ISSHOWMEMBERSHIPPARAMETER' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2021-03-09T18:33:36.753Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsShowMembershipParameter', Name='IsShowMembershipParameter', Description=NULL, Help=NULL WHERE AD_Element_ID=578813 AND IsCentrallyMaintained='Y' ; -- 2021-03-09T18:33:36.754Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='IsShowMembershipParameter', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=578813) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 578813) ; -- 2021-03-09T18:33:36.762Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='IsShowMembershipParameter', Name='IsShowMembershipParameter' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=578813) ; -- 2021-03-09T18:33:36.764Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='IsShowMembershipParameter', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 578813 ; -- 2021-03-09T18:33:36.767Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='IsShowMembershipParameter', Description=NULL, Help=NULL WHERE AD_Element_ID = 578813 ; -- 2021-03-09T18:33:36.768Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'IsShowMembershipParameter', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 578813 ; -- 2021-03-09T18:33:40.080Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='IsShowMembershipParameter', PrintName='IsShowMembershipParameter',Updated=TO_TIMESTAMP('2021-03-09 20:33:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578813 AND AD_Language='en_US' ; -- 2021-03-09T18:33:40.082Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578813,'en_US') ; -- 2021-03-09T18:33:44.109Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='IsShowMembershipParameter', PrintName='IsShowMembershipParameter',Updated=TO_TIMESTAMP('2021-03-09 20:33:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=578813 AND AD_Language='nl_NL' ; -- 2021-03-09T18:33:44.112Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(578813,'nl_NL') ; -- 2021-03-09T18:34:26.865Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,DefaultValue,DisplayLogic,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,578813,0,584810,541949,20,'showMembershipParameter',TO_TIMESTAMP('2021-03-09 20:34:26','YYYY-MM-DD HH24:MI:SS'),100,'N','1=0','D',0,'Y','N','Y','N','N','N','showMembershipParameter',40,TO_TIMESTAMP('2021-03-09 20:34:26','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-03-09T18:34:26.868Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541949 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-03-09T18:34:28.952Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET IsMandatory='Y',Updated=TO_TIMESTAMP('2021-03-09 20:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541949 ; -- 2021-03-09T18:34:51.584Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsShowMembershipParameter', EntityType='de.metas.printing', Name='IsShowMembershipParameter',Updated=TO_TIMESTAMP('2021-03-09 20:34:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541949 ; -- 2021-03-09T18:35:06.303Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Element_ID=NULL,Updated=TO_TIMESTAMP('2021-03-09 20:35:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541949 ; -- 2021-03-09T18:35:16.968Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Element_ID=578813,Updated=TO_TIMESTAMP('2021-03-09 20:35:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541949 ; -- 2021-03-09T18:35:26.128Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Element_ID=NULL,Updated=TO_TIMESTAMP('2021-03-09 20:35:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541949 ; -- 2021-03-09T18:35:32.743Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Element_ID=578813,Updated=TO_TIMESTAMP('2021-03-09 20:35:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541949 ; -- 2021-03-09T19:22:13.177Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Classname='de.metas.contracts.bpartner.process.C_BPartner_MoveToAnotherOrg',Updated=TO_TIMESTAMP('2021-03-09 21:22:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584810 ; -- 2021-03-11T12:18:13.871Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Val_Rule SET Code='M_Product.AD_Org_ID = 0 AND M_Product.M_Product_Category_ID = (SELECT pc.M_Product_Category_ID FROM M_Product_Category pc WHERE pc.AD_Org_ID = 0 AND pc.Value = ''Membership'') AND M_Product.M_Product_Mapping_ID IN (SELECT p2.M_Product_Mapping_ID FROM M_Product p2 WHERE p2.M_Product_Category_ID = M_Product.M_Product_cagetory_ID AND p2.AD_Org_ID = @AD_Org_Target_ID / -1@)',Updated=TO_TIMESTAMP('2021-03-11 14:18:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=540535 ; -- 2021-03-16T13:22:01.260Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Val_Rule SET Code='M_Product.AD_Org_ID = 0 AND M_Product.M_Product_Category_ID = (SELECT pc.M_Product_Category_ID FROM M_Product_Category pc WHERE pc.AD_Org_ID = 0 AND pc.Value = ''Membership'') AND M_Product.M_Product_Mapping_ID IN (SELECT p2.M_Product_Mapping_ID FROM M_Product p2 WHERE p2.M_Product_Category_ID = M_Product.M_Product_category_ID AND p2.AD_Org_ID = @AD_Org_Target_ID / -1@)',Updated=TO_TIMESTAMP('2021-03-16 15:22:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=540535 ; -- 2021-03-16T13:24:13.165Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET DisplayLogic='@IsShowMembershipParameter@ = ''Y''',Updated=TO_TIMESTAMP('2021-03-16 15:24:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541947 ; -- 2021-03-16T14:56:15.277Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET DefaultValue='@#Date@::Date + INTERVAL ''1 day''',Updated=TO_TIMESTAMP('2021-03-16 16:56:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541948 ; -- 2021-03-16T15:01:59.178Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET DefaultValue='(@#Date@ + INTERVAL ''1 day'')::date',Updated=TO_TIMESTAMP('2021-03-16 17:01:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541948 ; -- None. Deal with it in java -- 2021-03-16T15:21:31.599Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET DefaultValue='',Updated=TO_TIMESTAMP('2021-03-16 17:21:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541948 ; -- 2021-03-16T15:46:25.694Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET IsMandatory='Y',Updated=TO_TIMESTAMP('2021-03-16 17:46:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541948 ; -- 2021-03-18T10:02:12.162Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,578875,0,'Date_OrgChange',TO_TIMESTAMP('2021-03-18 12:02:11','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Org Change Date','Org Change Date',TO_TIMESTAMP('2021-03-18 12:02:11','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-03-18T10:02:12.173Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=578875 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2021-03-18T10:02:34.904Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Element_ID=578875, ColumnName='Date_OrgChange', Description=NULL, Help=NULL, Name='Org Change Date',Updated=TO_TIMESTAMP('2021-03-18 12:02:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541948 ;
the_stack
\set ON_ERROR_STOP 1 BEGIN; ------------------ -- foreign keys -- ------------------ -- intrinsic to tables ALTER TABLE artist ADD CONSTRAINT artist_fk_type FOREIGN KEY (type) REFERENCES artist_type(id); ALTER TABLE artist ADD CONSTRAINT artist_fk_area FOREIGN KEY (area) REFERENCES area(id); ALTER TABLE artist ADD CONSTRAINT artist_fk_gender FOREIGN KEY (gender) REFERENCES gender(id); ALTER TABLE artist ADD CONSTRAINT artist_fk_begin_area FOREIGN KEY (begin_area) REFERENCES area(id); ALTER TABLE artist ADD CONSTRAINT artist_fk_end_area FOREIGN KEY (end_area) REFERENCES area(id); ALTER TABLE artist_alias ADD CONSTRAINT artist_alias_fk_artist FOREIGN KEY (artist) REFERENCES artist(id); ALTER TABLE artist_alias ADD CONSTRAINT artist_alias_fk_type FOREIGN KEY (type) REFERENCES artist_alias_type(id); ALTER TABLE artist_credit_name ADD CONSTRAINT artist_credit_name_fk_artist_credit FOREIGN KEY (artist_credit) REFERENCES artist_credit(id) ON DELETE CASCADE; ALTER TABLE artist_credit_name ADD CONSTRAINT artist_credit_name_fk_artist FOREIGN KEY (artist) REFERENCES artist(id) ON DELETE CASCADE; ALTER TABLE label ADD CONSTRAINT label_fk_type FOREIGN KEY (type) REFERENCES label_type(id); ALTER TABLE label ADD CONSTRAINT label_fk_area FOREIGN KEY (area) REFERENCES area(id); ALTER TABLE label_alias ADD CONSTRAINT label_alias_fk_label FOREIGN KEY (label) REFERENCES label(id); ALTER TABLE label_alias ADD CONSTRAINT label_alias_fk_type FOREIGN KEY (type) REFERENCES label_alias_type(id); ALTER TABLE recording ADD CONSTRAINT recording_fk_artist_credit FOREIGN KEY (artist_credit) REFERENCES artist_credit(id); ALTER TABLE release ADD CONSTRAINT release_fk_artist_credit FOREIGN KEY (artist_credit) REFERENCES artist_credit(id); ALTER TABLE release ADD CONSTRAINT release_fk_release_group FOREIGN KEY (release_group) REFERENCES release_group(id); ALTER TABLE release ADD CONSTRAINT release_fk_status FOREIGN KEY (status) REFERENCES release_status(id); ALTER TABLE release ADD CONSTRAINT release_fk_packaging FOREIGN KEY (packaging) REFERENCES release_packaging(id); ALTER TABLE release ADD CONSTRAINT release_fk_language FOREIGN KEY (language) REFERENCES language(id); ALTER TABLE release ADD CONSTRAINT release_fk_script FOREIGN KEY (script) REFERENCES script(id); ALTER TABLE release_group ADD CONSTRAINT release_group_fk_artist_credit FOREIGN KEY (artist_credit) REFERENCES artist_credit(id); ALTER TABLE release_group ADD CONSTRAINT release_group_fk_type FOREIGN KEY (type) REFERENCES release_group_primary_type(id); ALTER TABLE track ADD CONSTRAINT track_fk_recording FOREIGN KEY (recording) REFERENCES recording(id); ALTER TABLE track ADD CONSTRAINT track_fk_medium FOREIGN KEY (medium) REFERENCES medium(id); ALTER TABLE track ADD CONSTRAINT track_fk_artist_credit FOREIGN KEY (artist_credit) REFERENCES artist_credit(id); ALTER TABLE work ADD CONSTRAINT work_fk_type FOREIGN KEY (type) REFERENCES work_type(id); ALTER TABLE work ADD CONSTRAINT work_fk_language FOREIGN KEY (language) REFERENCES language(id); ALTER TABLE work_alias ADD CONSTRAINT work_alias_fk_work FOREIGN KEY (work) REFERENCES work(id); ALTER TABLE work_alias ADD CONSTRAINT work_alias_fk_type FOREIGN KEY (type) REFERENCES work_alias_type(id); -- artist ALTER TABLE artist_annotation ADD CONSTRAINT artist_annotation_fk_artist FOREIGN KEY (artist) REFERENCES artist(id); ALTER TABLE artist_gid_redirect ADD CONSTRAINT artist_gid_redirect_fk_new_id FOREIGN KEY (new_id) REFERENCES artist(id); ALTER TABLE artist_ipi ADD CONSTRAINT artist_ipi_fk_artist FOREIGN KEY (artist) REFERENCES artist(id); ALTER TABLE artist_isni ADD CONSTRAINT artist_isni_fk_artist FOREIGN KEY (artist) REFERENCES artist(id); ALTER TABLE artist_meta ADD CONSTRAINT artist_meta_fk_id FOREIGN KEY (id) REFERENCES artist(id) ON DELETE CASCADE; ALTER TABLE artist_rating_raw ADD CONSTRAINT artist_rating_raw_fk_artist FOREIGN KEY (artist) REFERENCES artist(id); ALTER TABLE artist_tag ADD CONSTRAINT artist_tag_fk_artist FOREIGN KEY (artist) REFERENCES artist(id); ALTER TABLE artist_tag_raw ADD CONSTRAINT artist_tag_raw_fk_artist FOREIGN KEY (artist) REFERENCES artist(id); ALTER TABLE edit_artist ADD CONSTRAINT edit_artist_fk_artist FOREIGN KEY (artist) REFERENCES artist(id) ON DELETE CASCADE; ALTER TABLE editor_subscribe_artist ADD CONSTRAINT editor_subscribe_artist_fk_artist FOREIGN KEY (artist) REFERENCES artist(id); ALTER TABLE editor_watch_artist ADD CONSTRAINT editor_watch_artist_fk_artist FOREIGN KEY (artist) REFERENCES artist(id) ON DELETE CASCADE; ALTER TABLE l_area_artist ADD CONSTRAINT l_area_artist_fk_entity1 FOREIGN KEY (entity1) REFERENCES artist(id); ALTER TABLE l_artist_artist ADD CONSTRAINT l_artist_artist_fk_entity0 FOREIGN KEY (entity0) REFERENCES artist(id); ALTER TABLE l_artist_artist ADD CONSTRAINT l_artist_artist_fk_entity1 FOREIGN KEY (entity1) REFERENCES artist(id); ALTER TABLE l_artist_label ADD CONSTRAINT l_artist_label_fk_entity0 FOREIGN KEY (entity0) REFERENCES artist(id); ALTER TABLE l_artist_recording ADD CONSTRAINT l_artist_recording_fk_entity0 FOREIGN KEY (entity0) REFERENCES artist(id); ALTER TABLE l_artist_release ADD CONSTRAINT l_artist_release_fk_entity0 FOREIGN KEY (entity0) REFERENCES artist(id); ALTER TABLE l_artist_release_group ADD CONSTRAINT l_artist_release_group_fk_entity0 FOREIGN KEY (entity0) REFERENCES artist(id); ALTER TABLE l_artist_url ADD CONSTRAINT l_artist_url_fk_entity0 FOREIGN KEY (entity0) REFERENCES artist(id); ALTER TABLE l_artist_work ADD CONSTRAINT l_artist_work_fk_entity0 FOREIGN KEY (entity0) REFERENCES artist(id); -- artist_alias (no FKs) -- artist_credit (all done above) -- artist_credit_name (no FKs) -- label ALTER TABLE edit_label ADD CONSTRAINT edit_label_fk_label FOREIGN KEY (label) REFERENCES label(id) ON DELETE CASCADE; ALTER TABLE editor_subscribe_label ADD CONSTRAINT editor_subscribe_label_fk_label FOREIGN KEY (label) REFERENCES label(id); ALTER TABLE label_annotation ADD CONSTRAINT label_annotation_fk_label FOREIGN KEY (label) REFERENCES label(id); ALTER TABLE label_gid_redirect ADD CONSTRAINT label_gid_redirect_fk_new_id FOREIGN KEY (new_id) REFERENCES label(id); ALTER TABLE label_ipi ADD CONSTRAINT label_ipi_fk_label FOREIGN KEY (label) REFERENCES label(id); ALTER TABLE label_isni ADD CONSTRAINT label_isni_fk_label FOREIGN KEY (label) REFERENCES label(id); ALTER TABLE label_meta ADD CONSTRAINT label_meta_fk_id FOREIGN KEY (id) REFERENCES label(id) ON DELETE CASCADE; ALTER TABLE label_rating_raw ADD CONSTRAINT label_rating_raw_fk_label FOREIGN KEY (label) REFERENCES label(id); ALTER TABLE label_tag ADD CONSTRAINT label_tag_fk_label FOREIGN KEY (label) REFERENCES label(id); ALTER TABLE label_tag_raw ADD CONSTRAINT label_tag_raw_fk_label FOREIGN KEY (label) REFERENCES label(id); ALTER TABLE release_label ADD CONSTRAINT release_label_fk_label FOREIGN KEY (label) REFERENCES label(id); ALTER TABLE l_area_label ADD CONSTRAINT l_area_label_fk_entity1 FOREIGN KEY (entity1) REFERENCES label(id); ALTER TABLE l_artist_label ADD CONSTRAINT l_artist_label_fk_entity1 FOREIGN KEY (entity1) REFERENCES label(id); ALTER TABLE l_label_label ADD CONSTRAINT l_label_label_fk_entity0 FOREIGN KEY (entity0) REFERENCES label(id); ALTER TABLE l_label_label ADD CONSTRAINT l_label_label_fk_entity1 FOREIGN KEY (entity1) REFERENCES label(id); ALTER TABLE l_label_recording ADD CONSTRAINT l_label_recording_fk_entity0 FOREIGN KEY (entity0) REFERENCES label(id); ALTER TABLE l_label_release ADD CONSTRAINT l_label_release_fk_entity0 FOREIGN KEY (entity0) REFERENCES label(id); ALTER TABLE l_label_release_group ADD CONSTRAINT l_label_release_group_fk_entity0 FOREIGN KEY (entity0) REFERENCES label(id); ALTER TABLE l_label_url ADD CONSTRAINT l_label_url_fk_entity0 FOREIGN KEY (entity0) REFERENCES label(id); ALTER TABLE l_label_work ADD CONSTRAINT l_label_work_fk_entity0 FOREIGN KEY (entity0) REFERENCES label(id); -- label_alias (no FKs) -- release ALTER TABLE edit_release ADD CONSTRAINT edit_release_fk_release FOREIGN KEY (release) REFERENCES release(id) ON DELETE CASCADE; ALTER TABLE editor_collection_release ADD CONSTRAINT editor_collection_release_fk_release FOREIGN KEY (release) REFERENCES release(id); ALTER TABLE medium ADD CONSTRAINT medium_fk_release FOREIGN KEY (release) REFERENCES release(id); ALTER TABLE release_annotation ADD CONSTRAINT release_annotation_fk_release FOREIGN KEY (release) REFERENCES release(id); ALTER TABLE release_country ADD CONSTRAINT release_country_fk_release FOREIGN KEY (release) REFERENCES release(id); ALTER TABLE release_coverart ADD CONSTRAINT release_coverart_fk_id FOREIGN KEY (id) REFERENCES release(id) ON DELETE CASCADE; ALTER TABLE release_gid_redirect ADD CONSTRAINT release_gid_redirect_fk_new_id FOREIGN KEY (new_id) REFERENCES release(id); ALTER TABLE release_label ADD CONSTRAINT release_label_fk_release FOREIGN KEY (release) REFERENCES release(id); ALTER TABLE release_meta ADD CONSTRAINT release_meta_fk_id FOREIGN KEY (id) REFERENCES release(id) ON DELETE CASCADE; ALTER TABLE release_tag ADD CONSTRAINT release_tag_fk_release FOREIGN KEY (release) REFERENCES release(id); ALTER TABLE release_tag_raw ADD CONSTRAINT release_tag_raw_fk_release FOREIGN KEY (release) REFERENCES release(id); ALTER TABLE release_unknown_country ADD CONSTRAINT release_unknown_country_fk_release FOREIGN KEY (release) REFERENCES release(id); ALTER TABLE cover_art_archive.cover_art ADD CONSTRAINT cover_art_fk_release FOREIGN KEY (release) REFERENCES musicbrainz.release(id) ON DELETE CASCADE; ALTER TABLE cover_art_archive.release_group_cover_art ADD CONSTRAINT release_group_cover_art_fk_release FOREIGN KEY (release) REFERENCES musicbrainz.release(id); ALTER TABLE l_area_release ADD CONSTRAINT l_area_release_fk_entity1 FOREIGN KEY (entity1) REFERENCES release(id); ALTER TABLE l_artist_release ADD CONSTRAINT l_artist_release_fk_entity1 FOREIGN KEY (entity1) REFERENCES release(id); ALTER TABLE l_label_release ADD CONSTRAINT l_label_release_fk_entity1 FOREIGN KEY (entity1) REFERENCES release(id); ALTER TABLE l_recording_release ADD CONSTRAINT l_recording_release_fk_entity1 FOREIGN KEY (entity1) REFERENCES release(id); ALTER TABLE l_release_release ADD CONSTRAINT l_release_release_fk_entity0 FOREIGN KEY (entity0) REFERENCES release(id); ALTER TABLE l_release_release ADD CONSTRAINT l_release_release_fk_entity1 FOREIGN KEY (entity1) REFERENCES release(id); ALTER TABLE l_release_release_group ADD CONSTRAINT l_release_release_group_fk_entity0 FOREIGN KEY (entity0) REFERENCES release(id); ALTER TABLE l_release_url ADD CONSTRAINT l_release_url_fk_entity0 FOREIGN KEY (entity0) REFERENCES release(id); ALTER TABLE l_release_work ADD CONSTRAINT l_release_work_fk_entity0 FOREIGN KEY (entity0) REFERENCES release(id); -- release_group ALTER TABLE edit_release_group ADD CONSTRAINT edit_release_group_fk_release_group FOREIGN KEY (release_group) REFERENCES release_group(id) ON DELETE CASCADE; ALTER TABLE release_group_annotation ADD CONSTRAINT release_group_annotation_fk_release_group FOREIGN KEY (release_group) REFERENCES release_group(id); ALTER TABLE release_group_gid_redirect ADD CONSTRAINT release_group_gid_redirect_fk_new_id FOREIGN KEY (new_id) REFERENCES release_group(id); ALTER TABLE release_group_meta ADD CONSTRAINT release_group_meta_fk_id FOREIGN KEY (id) REFERENCES release_group(id) ON DELETE CASCADE; ALTER TABLE release_group_rating_raw ADD CONSTRAINT release_group_rating_raw_fk_release_group FOREIGN KEY (release_group) REFERENCES release_group(id); ALTER TABLE release_group_secondary_type_join ADD CONSTRAINT release_group_secondary_type_join_fk_release_group FOREIGN KEY (release_group) REFERENCES release_group(id); ALTER TABLE release_group_tag ADD CONSTRAINT release_group_tag_fk_release_group FOREIGN KEY (release_group) REFERENCES release_group(id); ALTER TABLE release_group_tag_raw ADD CONSTRAINT release_group_tag_raw_fk_release_group FOREIGN KEY (release_group) REFERENCES release_group(id); ALTER TABLE cover_art_archive.release_group_cover_art ADD CONSTRAINT release_group_cover_art_fk_release_group FOREIGN KEY (release_group) REFERENCES musicbrainz.release_group(id); ALTER TABLE l_area_release_group ADD CONSTRAINT l_area_release_group_fk_entity1 FOREIGN KEY (entity1) REFERENCES release_group(id); ALTER TABLE l_artist_release_group ADD CONSTRAINT l_artist_release_group_fk_entity1 FOREIGN KEY (entity1) REFERENCES release_group(id); ALTER TABLE l_label_release_group ADD CONSTRAINT l_label_release_group_fk_entity1 FOREIGN KEY (entity1) REFERENCES release_group(id); ALTER TABLE l_recording_release_group ADD CONSTRAINT l_recording_release_group_fk_entity1 FOREIGN KEY (entity1) REFERENCES release_group(id); ALTER TABLE l_release_group_release_group ADD CONSTRAINT l_release_group_release_group_fk_entity0 FOREIGN KEY (entity0) REFERENCES release_group(id); ALTER TABLE l_release_group_release_group ADD CONSTRAINT l_release_group_release_group_fk_entity1 FOREIGN KEY (entity1) REFERENCES release_group(id); ALTER TABLE l_release_group_url ADD CONSTRAINT l_release_group_url_fk_entity0 FOREIGN KEY (entity0) REFERENCES release_group(id); ALTER TABLE l_release_group_work ADD CONSTRAINT l_release_group_work_fk_entity0 FOREIGN KEY (entity0) REFERENCES release_group(id); ALTER TABLE l_release_release_group ADD CONSTRAINT l_release_release_group_fk_entity1 FOREIGN KEY (entity1) REFERENCES release_group(id); -- recording ALTER TABLE edit_recording ADD CONSTRAINT edit_recording_fk_recording FOREIGN KEY (recording) REFERENCES recording(id) ON DELETE CASCADE; ALTER TABLE isrc ADD CONSTRAINT isrc_fk_recording FOREIGN KEY (recording) REFERENCES recording(id); ALTER TABLE recording_annotation ADD CONSTRAINT recording_annotation_fk_recording FOREIGN KEY (recording) REFERENCES recording(id); ALTER TABLE recording_gid_redirect ADD CONSTRAINT recording_gid_redirect_fk_new_id FOREIGN KEY (new_id) REFERENCES recording(id); ALTER TABLE recording_meta ADD CONSTRAINT recording_meta_fk_id FOREIGN KEY (id) REFERENCES recording(id) ON DELETE CASCADE; ALTER TABLE recording_rating_raw ADD CONSTRAINT recording_rating_raw_fk_recording FOREIGN KEY (recording) REFERENCES recording(id); ALTER TABLE recording_tag ADD CONSTRAINT recording_tag_fk_recording FOREIGN KEY (recording) REFERENCES recording(id); ALTER TABLE recording_tag_raw ADD CONSTRAINT recording_tag_raw_fk_recording FOREIGN KEY (recording) REFERENCES recording(id); ALTER TABLE l_area_recording ADD CONSTRAINT l_area_recording_fk_entity1 FOREIGN KEY (entity1) REFERENCES recording(id); ALTER TABLE l_artist_recording ADD CONSTRAINT l_artist_recording_fk_entity1 FOREIGN KEY (entity1) REFERENCES recording(id); ALTER TABLE l_label_recording ADD CONSTRAINT l_label_recording_fk_entity1 FOREIGN KEY (entity1) REFERENCES recording(id); ALTER TABLE l_recording_recording ADD CONSTRAINT l_recording_recording_fk_entity0 FOREIGN KEY (entity0) REFERENCES recording(id); ALTER TABLE l_recording_recording ADD CONSTRAINT l_recording_recording_fk_entity1 FOREIGN KEY (entity1) REFERENCES recording(id); ALTER TABLE l_recording_release ADD CONSTRAINT l_recording_release_fk_entity0 FOREIGN KEY (entity0) REFERENCES recording(id); ALTER TABLE l_recording_release_group ADD CONSTRAINT l_recording_release_group_fk_entity0 FOREIGN KEY (entity0) REFERENCES recording(id); ALTER TABLE l_recording_url ADD CONSTRAINT l_recording_url_fk_entity0 FOREIGN KEY (entity0) REFERENCES recording(id); ALTER TABLE l_recording_work ADD CONSTRAINT l_recording_work_fk_entity0 FOREIGN KEY (entity0) REFERENCES recording(id); -- track ALTER TABLE track_gid_redirect ADD CONSTRAINT track_gid_redirect_fk_new_id FOREIGN KEY (new_id) REFERENCES track(id); -- work ALTER TABLE edit_work ADD CONSTRAINT edit_work_fk_work FOREIGN KEY (work) REFERENCES work(id) ON DELETE CASCADE; ALTER TABLE iswc ADD CONSTRAINT iswc_fk_work FOREIGN KEY (work) REFERENCES work(id); ALTER TABLE work_annotation ADD CONSTRAINT work_annotation_fk_work FOREIGN KEY (work) REFERENCES work(id); ALTER TABLE work_attribute ADD CONSTRAINT work_attribute_fk_work FOREIGN KEY (work) REFERENCES work(id); ALTER TABLE work_gid_redirect ADD CONSTRAINT work_gid_redirect_fk_new_id FOREIGN KEY (new_id) REFERENCES work(id); ALTER TABLE work_meta ADD CONSTRAINT work_meta_fk_id FOREIGN KEY (id) REFERENCES work(id) ON DELETE CASCADE; ALTER TABLE work_rating_raw ADD CONSTRAINT work_rating_raw_fk_work FOREIGN KEY (work) REFERENCES work(id); ALTER TABLE work_tag ADD CONSTRAINT work_tag_fk_work FOREIGN KEY (work) REFERENCES work(id); ALTER TABLE work_tag_raw ADD CONSTRAINT work_tag_raw_fk_work FOREIGN KEY (work) REFERENCES work(id); ALTER TABLE l_area_work ADD CONSTRAINT l_area_work_fk_entity1 FOREIGN KEY (entity1) REFERENCES work(id); ALTER TABLE l_artist_work ADD CONSTRAINT l_artist_work_fk_entity1 FOREIGN KEY (entity1) REFERENCES work(id); ALTER TABLE l_label_work ADD CONSTRAINT l_label_work_fk_entity1 FOREIGN KEY (entity1) REFERENCES work(id); ALTER TABLE l_recording_work ADD CONSTRAINT l_recording_work_fk_entity1 FOREIGN KEY (entity1) REFERENCES work(id); ALTER TABLE l_release_group_work ADD CONSTRAINT l_release_group_work_fk_entity1 FOREIGN KEY (entity1) REFERENCES work(id); ALTER TABLE l_release_work ADD CONSTRAINT l_release_work_fk_entity1 FOREIGN KEY (entity1) REFERENCES work(id); ALTER TABLE l_url_work ADD CONSTRAINT l_url_work_fk_entity1 FOREIGN KEY (entity1) REFERENCES work(id); ALTER TABLE l_work_work ADD CONSTRAINT l_work_work_fk_entity0 FOREIGN KEY (entity0) REFERENCES work(id); ALTER TABLE l_work_work ADD CONSTRAINT l_work_work_fk_entity1 FOREIGN KEY (entity1) REFERENCES work(id); -- work_alias (no FKs) -- artist_deletion ALTER TABLE editor_subscribe_artist_deleted ADD CONSTRAINT editor_subscribe_artist_deleted_fk_gid FOREIGN KEY (gid) REFERENCES artist_deletion(gid); -- label_deletion ALTER TABLE editor_subscribe_label_deleted ADD CONSTRAINT editor_subscribe_label_deleted_fk_gid FOREIGN KEY (gid) REFERENCES label_deletion(gid); ----------------- -- constraints -- ----------------- ALTER TABLE artist ADD CHECK (controlled_for_whitespace(comment)); ALTER TABLE label ADD CHECK (controlled_for_whitespace(comment)); ALTER TABLE recording ADD CHECK (controlled_for_whitespace(comment)); ALTER TABLE release ADD CHECK (controlled_for_whitespace(comment)); ALTER TABLE release_group ADD CHECK (controlled_for_whitespace(comment)); ALTER TABLE track ADD CHECK (controlled_for_whitespace(number)); ALTER TABLE work ADD CHECK (controlled_for_whitespace(comment)); ALTER TABLE artist ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''), ADD CONSTRAINT control_for_whitespace_sort_name CHECK (controlled_for_whitespace(sort_name)), ADD CONSTRAINT only_non_empty_sort_name CHECK (sort_name != ''); ALTER TABLE artist_alias ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''), ADD CONSTRAINT control_for_whitespace_sort_name CHECK (controlled_for_whitespace(sort_name)), ADD CONSTRAINT only_non_empty_sort_name CHECK (sort_name != ''); ALTER TABLE artist_credit ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''); ALTER TABLE artist_credit_name ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''); ALTER TABLE label ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''), ADD CONSTRAINT control_for_whitespace_sort_name CHECK (controlled_for_whitespace(sort_name)), ADD CONSTRAINT only_non_empty_sort_name CHECK (sort_name != ''); ALTER TABLE label_alias ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''), ADD CONSTRAINT control_for_whitespace_sort_name CHECK (controlled_for_whitespace(sort_name)), ADD CONSTRAINT only_non_empty_sort_name CHECK (sort_name != ''); ALTER TABLE release ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''); ALTER TABLE release_group ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''); ALTER TABLE track ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''); ALTER TABLE recording ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''); ALTER TABLE work ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''); ALTER TABLE work_alias ADD CONSTRAINT control_for_whitespace CHECK (controlled_for_whitespace(name)), ADD CONSTRAINT only_non_empty CHECK (name != ''), ADD CONSTRAINT control_for_whitespace_sort_name CHECK (controlled_for_whitespace(sort_name)), ADD CONSTRAINT only_non_empty_sort_name CHECK (sort_name != ''); ALTER TABLE artist ADD CONSTRAINT group_type_implies_null_gender CHECK ( (gender IS NULL AND type = 2) OR type IS DISTINCT FROM 2 ); ALTER TABLE artist ADD CONSTRAINT artist_va_check CHECK (id <> 1 OR (type = 3 AND gender IS NULL AND area IS NULL AND begin_area IS NULL AND end_area IS NULL AND begin_date_year IS NULL AND begin_date_month IS NULL AND begin_date_day IS NULL AND end_date_year IS NULL AND end_date_month IS NULL AND end_date_day IS NULL)); -------------- -- triggers -- -------------- CREATE TRIGGER a_ins_artist AFTER INSERT ON artist FOR EACH ROW EXECUTE PROCEDURE a_ins_artist(); CREATE TRIGGER b_upd_artist BEFORE UPDATE ON artist FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE TRIGGER b_del_artist_special BEFORE DELETE ON artist FOR EACH ROW WHEN (OLD.id IN (1, 2)) EXECUTE PROCEDURE deny_special_purpose_deletion(); CREATE TRIGGER end_area_implies_ended BEFORE UPDATE OR INSERT ON artist FOR EACH ROW EXECUTE PROCEDURE end_area_implies_ended(); CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON artist FOR EACH ROW EXECUTE PROCEDURE end_date_implies_ended(); CREATE TRIGGER b_upd_artist_alias BEFORE UPDATE ON artist_alias FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON artist_alias FOR EACH ROW EXECUTE PROCEDURE unique_primary_artist_alias(); CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON artist_alias FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(3); CREATE TRIGGER a_ins_label AFTER INSERT ON label FOR EACH ROW EXECUTE PROCEDURE a_ins_label(); CREATE TRIGGER b_del_label_special BEFORE DELETE ON label FOR EACH ROW WHEN (OLD.id = 1) EXECUTE PROCEDURE deny_special_purpose_deletion(); CREATE TRIGGER b_upd_label BEFORE UPDATE ON label FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE TRIGGER end_date_implies_ended BEFORE UPDATE OR INSERT ON label FOR EACH ROW EXECUTE PROCEDURE end_date_implies_ended(); CREATE TRIGGER b_upd_label_alias BEFORE UPDATE ON label_alias FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON label_alias FOR EACH ROW EXECUTE PROCEDURE unique_primary_label_alias(); CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON label_alias FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2); CREATE TRIGGER a_ins_recording AFTER INSERT ON recording FOR EACH ROW EXECUTE PROCEDURE a_ins_recording(); CREATE TRIGGER a_upd_recording AFTER UPDATE ON recording FOR EACH ROW EXECUTE PROCEDURE a_upd_recording(); CREATE TRIGGER a_del_recording AFTER DELETE ON recording FOR EACH ROW EXECUTE PROCEDURE a_del_recording(); CREATE TRIGGER b_upd_recording BEFORE UPDATE ON recording FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE TRIGGER a_ins_release AFTER INSERT ON release FOR EACH ROW EXECUTE PROCEDURE a_ins_release(); CREATE TRIGGER a_upd_release AFTER UPDATE ON release FOR EACH ROW EXECUTE PROCEDURE a_upd_release(); CREATE TRIGGER a_del_release AFTER DELETE ON release FOR EACH ROW EXECUTE PROCEDURE a_del_release(); CREATE TRIGGER b_upd_release BEFORE UPDATE ON release FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE TRIGGER a_ins_release_group AFTER INSERT ON release_group FOR EACH ROW EXECUTE PROCEDURE a_ins_release_group(); CREATE TRIGGER a_upd_release_group AFTER UPDATE ON release_group FOR EACH ROW EXECUTE PROCEDURE a_upd_release_group(); CREATE TRIGGER a_del_release_group AFTER DELETE ON release_group FOR EACH ROW EXECUTE PROCEDURE a_del_release_group(); CREATE TRIGGER b_upd_release_group BEFORE UPDATE ON release_group FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE TRIGGER a_ins_track AFTER INSERT ON track FOR EACH ROW EXECUTE PROCEDURE a_ins_track(); CREATE TRIGGER a_upd_track AFTER UPDATE ON track FOR EACH ROW EXECUTE PROCEDURE a_upd_track(); CREATE TRIGGER a_del_track AFTER DELETE ON track FOR EACH ROW EXECUTE PROCEDURE a_del_track(); CREATE TRIGGER b_upd_track BEFORE UPDATE ON track FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE CONSTRAINT TRIGGER remove_orphaned_tracks AFTER DELETE OR UPDATE ON track DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE PROCEDURE delete_orphaned_recordings(); CREATE TRIGGER a_ins_work AFTER INSERT ON work FOR EACH ROW EXECUTE PROCEDURE a_ins_work(); CREATE TRIGGER b_upd_work BEFORE UPDATE ON work FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE TRIGGER b_upd_work_alias BEFORE UPDATE ON work_alias FOR EACH ROW EXECUTE PROCEDURE b_upd_last_updated_table(); CREATE TRIGGER unique_primary_for_locale BEFORE UPDATE OR INSERT ON work_alias FOR EACH ROW EXECUTE PROCEDURE unique_primary_work_alias(); CREATE TRIGGER search_hint BEFORE UPDATE OR INSERT ON work_alias FOR EACH ROW EXECUTE PROCEDURE simplify_search_hints(2); COMMIT;
the_stack
SET NAMES 'utf8'; ALTER TABLE `PREFIX_delivery` ADD `id_shop` INT UNSIGNED NULL DEFAULT NULL AFTER `id_delivery`; ALTER TABLE `PREFIX_delivery` ADD `id_group_shop` INT UNSIGNED NULL DEFAULT NULL AFTER `id_shop`; CREATE TABLE IF NOT EXISTS `PREFIX_module_access` ( `id_profile` int(10) unsigned NOT NULL, `id_module` int(10) unsigned NOT NULL, `view` tinyint(1) NOT NULL, `configure` tinyint(1) NOT NULL, PRIMARY KEY (`id_profile`,`id_module`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; /* Create SuperAdmin */ UPDATE `PREFIX_profile_lang` SET `name` = 'SuperAdmin' WHERE `id_profile` = 1; CREATE TABLE IF NOT EXISTS `PREFIX_accounting_zone_shop` ( `id_accounting_zone_shop` int(11) NOT NULL AUTO_INCREMENT, `id_zone` int(11) NOT NULL, `id_shop` int(11) NOT NULL, `account_number` varchar(64) NOT NULL, PRIMARY KEY (`id_accounting_zone_shop`), UNIQUE KEY `id_zone` (`id_zone`,`id_shop`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `PREFIX_accounting_product_zone_shop` ( `id_accounting_product_zone_shop` int(11) NOT NULL AUTO_INCREMENT, `id_product` int(11) NOT NULL, `id_shop` int(11) NOT NULL, `id_zone` int(11) NOT NULL, `account_number` varchar(64) NOT NULL, PRIMARY KEY (`id_accounting_product_zone_shop`), UNIQUE KEY `id_product` (`id_product`,`id_shop`,`id_zone`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; /* PHP:add_accounting_tab(); */; INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) ( SELECT `id_profile`, `id_module`, 0, 1 FROM `PREFIX_access` a, PREFIX_module m WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` != "" LIMIT 1) AND a.`view` = 0 ); INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) ( SELECT `id_profile`, `id_module`, 1, 1 FROM `PREFIX_access` a, PREFIX_module m WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` WHERE `class_name` != "" LIMIT 1) AND a.`view` = 1 ); UPDATE `PREFIX_tab` SET `class_name` = 'AdminThemes' WHERE `class_name` = 'AdminAppearance'; INSERT INTO `PREFIX_hook` ( `name` , `title` , `description` , `position` , `live_edit` ) VALUES ('taxmanager', 'taxmanager', NULL , '1', '0'); ALTER TABLE `PREFIX_tax_rule` ADD `zipcode_from` INT NOT NULL AFTER `id_state` , ADD `zipcode_to` INT NOT NULL AFTER `zipcode_from` , ADD `behavior` INT NOT NULL AFTER `zipcode_to`, ADD `description` VARCHAR( 100 ) NOT NULL AFTER `id_tax`; INSERT INTO `PREFIX_tax_rule` (`id_tax_rules_group`, `id_country`, `id_state`, `id_tax`, `behavior`, `zipcode_from`, `zipcode_to`, `id_county`, `description`, `state_behavior`, `county_behavior`) SELECT r.`id_tax_rules_group`, r.`id_country`, r.`id_state`, r.`id_tax`, 0, z.`from_zip_code`, z.`to_zip_code`, r.`id_county`, r.`description`, r.`state_behavior`, r.county_behavior FROM `PREFIX_tax_rule` r INNER JOIN `PREFIX_county_zip_code` z ON (z.`id_county` = r.`id_county`); UPDATE `PREFIX_tax_rule` SET `behavior` = GREATEST(`state_behavior`, `county_behavior`); DELETE FROM `PREFIX_tax_rule` WHERE `id_county` != 0 AND `zipcode_from` = 0; ALTER TABLE `PREFIX_tax_rule` DROP `id_county`, DROP `state_behavior`, DROP `county_behavior`; /* PHP:remove_tab(AdminCounty); */; DROP TABLE `PREFIX_county_zip_code`; DROP TABLE `PREFIX_county`; ALTER TABLE `PREFIX_employee` ADD `id_last_order` tinyint(1) unsigned NOT NULL default '0', ADD `id_last_customer_message` tinyint(1) unsigned NOT NULL default '0', ADD `id_last_customer` tinyint(1) unsigned NOT NULL default '0'; INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_SHOW_NEW_ORDERS', '1', NOW(), NOW()), ('PS_SHOW_NEW_CUSTOMERS', '1', NOW(), NOW()), ('PS_SHOW_NEW_MESSAGES', '1', NOW(), NOW()), ('PS_FEATURE_FEATURE_ACTIVE', '1', NOW(), NOW()), ('PS_COMBINATION_FEATURE_ACTIVE', '1', NOW(), NOW()), ('PS_ADMINREFRESH_NOTIFICATION', '1', NOW(), NOW()); /* PHP:update_feature_detachable_cache(); */; ALTER TABLE `PREFIX_product` ADD `available_date` DATE NOT NULL AFTER `available_for_order`; ALTER TABLE `PREFIX_product_attribute` ADD `available_date` DATE NOT NULL; /* Index was only used by deprecated function Image::positionImage() */ ALTER TABLE `PREFIX_image` DROP INDEX `product_position`; CREATE TABLE IF NOT EXISTS `PREFIX_gender` ( `id_gender` int(11) NOT NULL AUTO_INCREMENT, `type` tinyint(1) NOT NULL, PRIMARY KEY (`id_gender`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `PREFIX_gender_lang` ( `id_gender` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL, `name` varchar(20) NOT NULL, PRIMARY KEY (`id_gender`,`id_lang`), KEY `id_gender` (`id_gender`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; INSERT INTO `PREFIX_gender` (`id_gender`, `type`) VALUES (1, 0), (2, 1), (3, 1); INSERT INTO `PREFIX_gender_lang` (`id_gender`, `id_lang`, `name`) VALUES (1, 1, 'Mr.'), (1, 2, 'M.'), (1, 3, 'Sr.'), (1, 4, 'Herr'), (1, 5, 'Sig.'), (2, 1, 'Ms.'), (2, 2, 'Mme'), (2, 3, 'Sra.'), (2, 4, 'Frau'), (2, 5, 'Sig.ra'), (3, 1, 'Miss'), (3, 2, 'Mlle'), (3, 3, 'Miss'), (3, 4, 'Miss'), (3, 5, 'Miss'); DELETE FROM `PREFIX_configuration` WHERE `name` = 'PS_FORCE_SMARTY_2'; CREATE TABLE IF NOT EXISTS `PREFIX_order_detail_tax` ( `id_order_detail` INT NOT NULL , `id_tax` INT NOT NULL ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ALTER TABLE `PREFIX_tax` ADD `deleted` INT NOT NULL AFTER `active`; /* PHP:update_order_detail_taxes(); */; CREATE TABLE `PREFIX_customer_message_sync_imap` ( `md5_header` varbinary(32) NOT NULL, KEY `md5_header_index` (`md5_header`(4)) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ALTER TABLE `PREFIX_customer_message` ADD `private` TINYINT NOT NULL DEFAULT '0' AFTER `user_agent`; /* PHP:add_new_tab(AdminGenders, fr:Genres|es:Genders|en:Genders|de:Genders|it:Genders, 2); */; ALTER TABLE `PREFIX_attribute` ADD `position` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'; /* PHP:add_attribute_position(); */; ALTER TABLE `PREFIX_product_download` CHANGE `date_deposit` `date_add` DATETIME NOT NULL ; ALTER TABLE `PREFIX_product_download` CHANGE `physically_filename` `filename` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; ALTER TABLE `PREFIX_product_download` ADD `id_product_attribute` INT( 10 ) UNSIGNED NOT NULL AFTER `id_product` , ADD INDEX ( `id_product_attribute` ); ALTER TABLE `PREFIX_product_download` ADD `is_shareable` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `active`; ALTER TABLE `PREFIX_attribute_group` ADD `position` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'; ALTER TABLE `PREFIX_attribute_group` ADD `group_type` ENUM('select', 'radio', 'color') NOT NULL DEFAULT 'select'; UPDATE `PREFIX_attribute_group` SET `group_type`='color' WHERE `is_color_group` = 1; ALTER TABLE `PREFIX_product` DROP `id_color_default`; /* PHP:add_group_attribute_position(); */; ALTER TABLE `PREFIX_feature` ADD `position` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'; /* PHP:add_feature_position(); */; CREATE TABLE IF NOT EXISTS `PREFIX_request_sql` ( `id_request_sql` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(200) NOT NULL, `sql` text NOT NULL, PRIMARY KEY (`id_request_sql`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; /* PHP:add_new_tab(AdminRequestSql, fr:SQL Manager|es:SQL Manager|en:SQL Manager|de:Wunsh|it:SQL Manager, 9); */; ALTER TABLE `PREFIX_carrier` ADD COLUMN `id_reference` int(10) NOT NULL AFTER `id_carrier`; UPDATE `PREFIX_carrier` SET id_reference = id_carrier; ALTER TABLE `PREFIX_product` ADD `is_virtual` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `cache_has_attachments`; /* PHP:add_new_tab(AdminProducts, fr:Produits|es:Productos|en:Products|de:Produkten|it:Prodotti, 1); */; /* PHP:add_new_tab(AdminCategories, fr:Catégories|es:Categoria|en:Categories|de:Kategorien|it:Categories, 1); */; CREATE TABLE IF NOT EXISTS `PREFIX_employee_shop` ( `id_employee` INT( 11 ) UNSIGNED NOT NULL , `id_shop` INT( 11 ) UNSIGNED NOT NULL , PRIMARY KEY ( `id_employee` , `id_shop` ) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; INSERT INTO `PREFIX_employee_shop` (`id_employee`, `id_shop`) (SELECT `id_employee`, 1 FROM `PREFIX_employee`); UPDATE `PREFIX_access` SET `view` = 0, `add` = 0, `edit` = 0, `delete` = 0 WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminShop' LIMIT 1) AND `id_profile` != 1; ALTER TABLE `PREFIX_carrier` ADD `position` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'; /* PHP:add_carrier_position(); */; ALTER TABLE `PREFIX_order_state` ADD COLUMN `shipped` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `delivery`; UPDATE `PREFIX_order_state` SET `shipped` = 1 WHERE id_order_state IN (4, 5); CREATE TABLE `PREFIX_order_invoice` ( `id_order_invoice` int(11) NOT NULL AUTO_INCREMENT, `id_order` int(11) NOT NULL, `number` int(11) NOT NULL, `total_discount_tax_excl` decimal(17,2) NOT NULL DEFAULT '0.00', `total_discount_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', `total_paid_tax_excl` decimal(17,2) NOT NULL DEFAULT '0.00', `total_paid_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', `total_products` decimal(17,2) NOT NULL DEFAULT '0.00', `total_products_wt` decimal(17,2) NOT NULL DEFAULT '0.00', `total_shipping_tax_excl` decimal(17,2) NOT NULL DEFAULT '0.00', `total_shipping_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', `total_wrapping_tax_excl` decimal(17,2) NOT NULL DEFAULT '0.00', `total_wrapping_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', `date_add` datetime NOT NULL, PRIMARY KEY (`id_order_invoice`), KEY `id_order` (`id_order`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ALTER TABLE `PREFIX_order_detail` ADD `id_order_invoice` int(11) NOT NULL DEFAULT 0 AFTER `id_order`; ALTER TABLE `PREFIX_payment_cc` CHANGE `id_payment_cc` `id_order_payment` INT NOT NULL auto_increment; ALTER TABLE `PREFIX_payment_cc` ADD `id_order_invoice` varchar(255) NOT NULL AFTER `id_order_payment`; ALTER TABLE `PREFIX_payment_cc` ADD `payment_method` varchar(255) NOT NULL AFTER `amount`; ALTER TABLE `PREFIX_payment_cc` ADD `conversion_rate` decimal(13,6) NOT NULL DEFAULT 1 AFTER `payment_method`; RENAME TABLE `PREFIX_payment_cc` TO `PREFIX_order_payment`; ALTER TABLE `PREFIX_carrier` ADD COLUMN `max_width` int(10) DEFAULT 0 AFTER `position`, ADD COLUMN `max_height` int(10) DEFAULT 0 AFTER `max_width`, ADD COLUMN `max_depth` int(10) DEFAULT 0 AFTER `max_height`, ADD COLUMN `max_weight` int(10) DEFAULT 0 AFTER `max_depth`, ADD COLUMN `grade` int(10) DEFAULT 0 AFTER `max_weight`; ALTER TABLE `PREFIX_cart_product` ADD COLUMN `id_address_delivery` int(10) UNSIGNED DEFAULT 0 AFTER `date_add`; UPDATE `PREFIX_cart_product` SET id_address_delivery = 0; ALTER TABLE `PREFIX_cart` ADD COLUMN `allow_seperated_package` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `gift_message`; CREATE TABLE `PREFIX_product_carrier` ( `id_product` int(10) unsigned NOT NULL, `id_carrier_reference` int(10) unsigned NOT NULL, `id_shop` int(10) unsigned NOT NULL, PRIMARY KEY (`id_product`, `id_carrier_reference`, `id_shop`) ) ENGINE = ENGINE_TYPE DEFAULT CHARSET=utf8; ALTER TABLE `PREFIX_customization` ADD COLUMN `id_address_delivery` int(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `id_product_attribute`, DROP PRIMARY KEY, ADD PRIMARY KEY (`id_customization`, `id_cart`, `id_product`, `id_address_delivery`); CREATE TABLE `PREFIX_cart_rule` ( `id_cart_rule` int(10) unsigned NOT NULL auto_increment, `id_customer` int unsigned NOT NULL default 0, `date_from` datetime NOT NULL, `date_to` datetime NOT NULL, `description` text, `quantity` int(10) unsigned NOT NULL default 0, `quantity_per_user` int(10) unsigned NOT NULL default 0, `priority` int(10) unsigned NOT NULL default 1, `code` varchar(254) NOT NULL, `minimum_amount` decimal(17,2) NOT NULL default 0, `minimum_amount_tax` tinyint(1) NOT NULL default 0, `minimum_amount_currency` int unsigned NOT NULL default 0, `minimum_amount_shipping` tinyint(1) NOT NULL default 0, `country_restriction` tinyint(1) unsigned NOT NULL default 0, `carrier_restriction` tinyint(1) unsigned NOT NULL default 0, `group_restriction` tinyint(1) unsigned NOT NULL default 0, `cart_rule_restriction` tinyint(1) unsigned NOT NULL default 0, `product_restriction` tinyint(1) unsigned NOT NULL default 0, `free_shipping` tinyint(1) NOT NULL default 0, `reduction_percent` decimal(5,2) NOT NULL default 0, `reduction_amount` decimal(17,2) NOT NULL default 0, `reduction_tax` tinyint(1) unsigned NOT NULL default 0, `reduction_currency` int(10) unsigned NOT NULL default 0, `reduction_product` int(10) NOT NULL default 0, `gift_product` int(10) unsigned NOT NULL default 0, `active` tinyint(1) unsigned NOT NULL default 0, `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, PRIMARY KEY (`id_cart_rule`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE `PREFIX_cart_rule_country` ( `id_cart_rule` int(10) unsigned NOT NULL, `id_country` int(10) unsigned NOT NULL, PRIMARY KEY (`id_cart_rule`, `id_country`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE `PREFIX_cart_rule_group` ( `id_cart_rule` int(10) unsigned NOT NULL, `id_group` int(10) unsigned NOT NULL, PRIMARY KEY (`id_cart_rule`, `id_group`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE `PREFIX_cart_rule_carrier` ( `id_cart_rule` int(10) unsigned NOT NULL, `id_carrier` int(10) unsigned NOT NULL, PRIMARY KEY (`id_cart_rule`, `id_carrier`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE `PREFIX_cart_rule_combination` ( `id_cart_rule_1` int(10) unsigned NOT NULL, `id_cart_rule_2` int(10) unsigned NOT NULL, PRIMARY KEY (`id_cart_rule_1`, `id_cart_rule_2`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; CREATE TABLE `PREFIX_cart_rule_product_rule` ( `id_product_rule` int(10) unsigned NOT NULL auto_increment, `id_cart_rule` int(10) unsigned NOT NULL, `quantity` int(10) unsigned NOT NULL default 1, `type` ENUM('products', 'categories', 'attributes') NOT NULL, PRIMARY KEY (`id_product_rule`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; SET @id_currency_default = (SELECT value FROM `PREFIX_configuration` WHERE name = 'PS_CURRENCY_DEFAULT' LIMIT 1); INSERT INTO `PREFIX_cart_rule` ( `id_cart_rule`, `id_customer`, `date_from`, `date_to`, `description`, `quantity`, `quantity_per_user`, `priority`, `code`, `minimum_amount`, `minimum_amount_tax`, `minimum_amount_currency`, `minimum_amount_shipping`, `country_restriction`, `carrier_restriction`, `group_restriction`, `cart_rule_restriction`, `product_restriction`, `free_shipping`, `reduction_percent`, `reduction_amount`, `reduction_tax`, `reduction_currency`, `reduction_product`, `gift_product`, `active`, `date_add`, `date_upd` ) ( SELECT `id_discount`, `id_customer`, `date_from`, `date_to`, `name`, `quantity`, `quantity_per_user`, 1, `name`, `minimal`, 1, @id_currency_default, 1, 0, 0, IF(id_group = 0, 0, 1), IF(cumulable = 1, 0, 1), 0, IF(id_discount_type = 3, 1, 0), IF(id_discount_type = 1, value, 0), IF(id_discount_type = 2, value, 0), 1, `id_currency`, 0, 0, `active`, `date_add`, `date_upd` FROM `PREFIX_discount` ); RENAME TABLE `PREFIX_discount_lang` TO `PREFIX_cart_rule_lang`; ALTER TABLE `PREFIX_cart_rule_lang` CHANGE `id_discount` `id_cart_rule` int(10) unsigned NOT NULL; ALTER TABLE `PREFIX_cart_rule_lang` CHANGE `description` `name` varchar(254) NOT NULL; RENAME TABLE `PREFIX_discount_category` TO `PREFIX_cart_rule_product_rule_value`; ALTER TABLE `PREFIX_cart_rule_product_rule_value` CHANGE `id_category` `id_item` int(10) unsigned NOT NULL; ALTER TABLE `PREFIX_cart_rule_product_rule_value` CHANGE `id_discount` `id_product_rule` int(10) unsigned NOT NULL; INSERT INTO `PREFIX_cart_rule_product_rule` (`id_product_rule`, `id_cart_rule`, `quantity`, `type`) ( SELECT DISTINCT `id_product_rule`, `id_product_rule`, 1, 'categories' FROM `PREFIX_cart_rule_product_rule_value` ); UPDATE `PREFIX_cart_rule` SET product_restriction = 1 WHERE `id_cart_rule` IN (SELECT `id_cart_rule` FROM `PREFIX_cart_rule_product_rule`); ALTER TABLE `PREFIX_cart_discount` CHANGE `id_discount` `id_cart_rule` int(10) unsigned NOT NULL; ALTER TABLE `PREFIX_order_discount` CHANGE `id_discount` `id_cart_rule` int(10) unsigned NOT NULL; ALTER TABLE `PREFIX_order_discount` CHANGE `id_order_discount` `id_order_cart_rule` int(10) unsigned NOT NULL AUTO_INCREMENT; RENAME TABLE `PREFIX_order_discount` TO `PREFIX_order_cart_rule`; RENAME TABLE `PREFIX_cart_discount` TO `PREFIX_cart_cart_rule`; INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) ( SELECT 'PS_CART_RULE_FEATURE_ACTIVE', `value`, NOW(), NOW() FROM `PREFIX_configuration` WHERE `name` = 'PS_DISCOUNT_FEATURE_ACTIVE' LIMIT 1 ); UPDATE `PREFIX_tab` SET class_name = 'AdminCartRules' WHERE class_name = 'AdminDiscounts'; UPDATE `PREFIX_hook` SET `name` = 'displayPayment' WHERE `name` = 'payment'; UPDATE `PREFIX_hook` SET `name` = 'actionValidateOrder' WHERE `name` = 'newOrder'; UPDATE `PREFIX_hook` SET `name` = 'actionPaymentConfirmation' WHERE `name` = 'paymentConfirm'; UPDATE `PREFIX_hook` SET `name` = 'displayPaymentReturn' WHERE `name` = 'paymentReturn'; UPDATE `PREFIX_hook` SET `name` = 'actionUpdateQuantity' WHERE `name` = 'updateQuantity'; UPDATE `PREFIX_hook` SET `name` = 'displayRightColumn' WHERE `name` = 'rightColumn'; UPDATE `PREFIX_hook` SET `name` = 'displayLeftColumn' WHERE `name` = 'leftColumn'; UPDATE `PREFIX_hook` SET `name` = 'displayHome' WHERE `name` = 'home'; UPDATE `PREFIX_hook` SET `name` = 'displayHeader' WHERE `name` = 'header'; UPDATE `PREFIX_hook` SET `name` = 'actionCartSave' WHERE `name` = 'cart'; UPDATE `PREFIX_hook` SET `name` = 'actionAuthentication' WHERE `name` = 'authentication'; UPDATE `PREFIX_hook` SET `name` = 'actionProductAdd' WHERE `name` = 'addproduct'; UPDATE `PREFIX_hook` SET `name` = 'actionProductUpdate' WHERE `name` = 'updateproduct'; UPDATE `PREFIX_hook` SET `name` = 'displayTop' WHERE `name` = 'top'; UPDATE `PREFIX_hook` SET `name` = 'displayRightColumnProduct' WHERE `name` = 'extraRight'; UPDATE `PREFIX_hook` SET `name` = 'actionProductDelete' WHERE `name` = 'deleteproduct'; UPDATE `PREFIX_hook` SET `name` = 'displayFooterProduct' WHERE `name` = 'productfooter'; UPDATE `PREFIX_hook` SET `name` = 'displayInvoice' WHERE `name` = 'invoice'; UPDATE `PREFIX_hook` SET `name` = 'actionOrderStatusUpdate' WHERE `name` = 'updateOrderStatus'; UPDATE `PREFIX_hook` SET `name` = 'displayAdminOrder' WHERE `name` = 'adminOrder'; UPDATE `PREFIX_hook` SET `name` = 'displayFooter' WHERE `name` = 'footer'; UPDATE `PREFIX_hook` SET `name` = 'displayPDFInvoice' WHERE `name` = 'PDFInvoice'; UPDATE `PREFIX_hook` SET `name` = 'displayAdminCustomers' WHERE `name` = 'adminCustomers'; UPDATE `PREFIX_hook` SET `name` = 'displayOrderConfirmation' WHERE `name` = 'orderConfirmation'; UPDATE `PREFIX_hook` SET `name` = 'actionCustomerAccountAdd' WHERE `name` = 'createAccount'; UPDATE `PREFIX_hook` SET `name` = 'displayCustomerAccount' WHERE `name` = 'customerAccount'; UPDATE `PREFIX_hook` SET `name` = 'actionOrderSlipAdd' WHERE `name` = 'orderSlip'; UPDATE `PREFIX_hook` SET `name` = 'displayProductTab' WHERE `name` = 'productTab'; UPDATE `PREFIX_hook` SET `name` = 'displayProductTabContent' WHERE `name` = 'productTabContent'; UPDATE `PREFIX_hook` SET `name` = 'displayShoppingCartFooter' WHERE `name` = 'shoppingCart'; UPDATE `PREFIX_hook` SET `name` = 'displayCustomerAccountForm' WHERE `name` = 'createAccountForm'; UPDATE `PREFIX_hook` SET `name` = 'displayAdminStatsModules' WHERE `name` = 'AdminStatsModules'; UPDATE `PREFIX_hook` SET `name` = 'displayAdminStatsGraphEngine' WHERE `name` = 'GraphEngine'; UPDATE `PREFIX_hook` SET `name` = 'actionOrderReturn' WHERE `name` = 'orderReturn'; UPDATE `PREFIX_hook` SET `name` = 'displayProductButtons' WHERE `name` = 'productActions'; UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeHome' WHERE `name` = 'backOfficeHome'; UPDATE `PREFIX_hook` SET `name` = 'displayAdminStatsGridEngine' WHERE `name` = 'GridEngine'; UPDATE `PREFIX_hook` SET `name` = 'actionWatermark' WHERE `name` = 'watermark'; UPDATE `PREFIX_hook` SET `name` = 'actionProductCancel' WHERE `name` = 'cancelProduct'; UPDATE `PREFIX_hook` SET `name` = 'displayLeftColumnProduct' WHERE `name` = 'extraLeft'; UPDATE `PREFIX_hook` SET `name` = 'actionProductOutOfStock' WHERE `name` = 'productOutOfStock'; UPDATE `PREFIX_hook` SET `name` = 'actionProductAttributeUpdate' WHERE `name` = 'updateProductAttribute'; UPDATE `PREFIX_hook` SET `name` = 'displayCarrierList' WHERE `name` = 'extraCarrier'; UPDATE `PREFIX_hook` SET `name` = 'displayShoppingCart' WHERE `name` = 'shoppingCartExtra'; UPDATE `PREFIX_hook` SET `name` = 'actionSearch' WHERE `name` = 'search'; UPDATE `PREFIX_hook` SET `name` = 'displayBeforePayment' WHERE `name` = 'backBeforePayment'; UPDATE `PREFIX_hook` SET `name` = 'actionCarrierUpdate' WHERE `name` = 'updateCarrier'; UPDATE `PREFIX_hook` SET `name` = 'actionOrderStatusPostUpdate' WHERE `name` = 'postUpdateOrderStatus'; UPDATE `PREFIX_hook` SET `name` = 'displayCustomerAccountFormTop' WHERE `name` = 'createAccountTop'; UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeHeader' WHERE `name` = 'backOfficeHeader'; UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeTop' WHERE `name` = 'backOfficeTop'; UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeFooter' WHERE `name` = 'backOfficeFooter'; UPDATE `PREFIX_hook` SET `name` = 'actionProductAttributeDelete' WHERE `name` = 'deleteProductAttribute'; UPDATE `PREFIX_hook` SET `name` = 'actionCarrierProcess' WHERE `name` = 'processCarrier'; UPDATE `PREFIX_hook` SET `name` = 'actionOrderDetail' WHERE `name` = 'orderDetail'; UPDATE `PREFIX_hook` SET `name` = 'displayBeforeCarrier' WHERE `name` = 'beforeCarrier'; UPDATE `PREFIX_hook` SET `name` = 'displayOrderDetail' WHERE `name` = 'orderDetailDisplayed'; UPDATE `PREFIX_hook` SET `name` = 'actionPaymentCCAdd' WHERE `name` = 'paymentCCAdded'; UPDATE `PREFIX_hook` SET `name` = 'displayProductComparison' WHERE `name` = 'extraProductComparison'; UPDATE `PREFIX_hook` SET `name` = 'actionCategoryAdd' WHERE `name` = 'categoryAddition'; UPDATE `PREFIX_hook` SET `name` = 'actionCategoryUpdate' WHERE `name` = 'categoryUpdate'; UPDATE `PREFIX_hook` SET `name` = 'actionCategoryDelete' WHERE `name` = 'categoryDeletion'; UPDATE `PREFIX_hook` SET `name` = 'actionBeforeAuthentication' WHERE `name` = 'beforeAuthentication'; UPDATE `PREFIX_hook` SET `name` = 'displayPaymentTop' WHERE `name` = 'paymentTop'; UPDATE `PREFIX_hook` SET `name` = 'actionHtaccessCreate' WHERE `name` = 'afterCreateHtaccess'; UPDATE `PREFIX_hook` SET `name` = 'actionAdminMetaSave' WHERE `name` = 'afterSaveAdminMeta'; UPDATE `PREFIX_hook` SET `name` = 'displayAttributeGroupForm' WHERE `name` = 'attributeGroupForm'; UPDATE `PREFIX_hook` SET `name` = 'actionAttributeGroupSave' WHERE `name` = 'afterSaveAttributeGroup'; UPDATE `PREFIX_hook` SET `name` = 'actionAttributeGroupDelete' WHERE `name` = 'afterDeleteAttributeGroup'; UPDATE `PREFIX_hook` SET `name` = 'displayFeatureForm' WHERE `name` = 'featureForm'; UPDATE `PREFIX_hook` SET `name` = 'actionFeatureSave' WHERE `name` = 'afterSaveFeature'; UPDATE `PREFIX_hook` SET `name` = 'actionFeatureDelete' WHERE `name` = 'afterDeleteFeature'; UPDATE `PREFIX_hook` SET `name` = 'actionProductSave' WHERE `name` = 'afterSaveProduct'; UPDATE `PREFIX_hook` SET `name` = 'actionProductListOverride' WHERE `name` = 'productListAssign'; UPDATE `PREFIX_hook` SET `name` = 'displayAttributeGroupPostProcess' WHERE `name` = 'postProcessAttributeGroup'; UPDATE `PREFIX_hook` SET `name` = 'displayFeaturePostProcess' WHERE `name` = 'postProcessFeature'; UPDATE `PREFIX_hook` SET `name` = 'displayFeatureValueForm' WHERE `name` = 'featureValueForm'; UPDATE `PREFIX_hook` SET `name` = 'displayFeatureValuePostProcess' WHERE `name` = 'postProcessFeatureValue'; UPDATE `PREFIX_hook` SET `name` = 'actionFeatureValueDelete' WHERE `name` = 'afterDeleteFeatureValue'; UPDATE `PREFIX_hook` SET `name` = 'actionFeatureValueSave' WHERE `name` = 'afterSaveFeatureValue'; UPDATE `PREFIX_hook` SET `name` = 'displayAttributeForm' WHERE `name` = 'attributeForm'; UPDATE `PREFIX_hook` SET `name` = 'actionAttributePostProcess' WHERE `name` = 'postProcessAttribute'; UPDATE `PREFIX_hook` SET `name` = 'actionAttributeDelete' WHERE `name` = 'afterDeleteAttribute'; UPDATE `PREFIX_hook` SET `name` = 'actionAttributeSave' WHERE `name` = 'afterSaveAttribute'; UPDATE `PREFIX_hook` SET `name` = 'actionTaxManager' WHERE `name` = 'taxManager'; ALTER TABLE `PREFIX_order_detail_tax` ADD `unit_amount` DECIMAL(16, 6) NOT NULL AFTER `id_tax`, ADD `total_amount` DECIMAL(16, 6) NOT NULL AFTER `unit_amount`; ALTER TABLE `PREFIX_specific_price` ADD `id_product_attribute` INT UNSIGNED NOT NULL AFTER `id_product`; ALTER TABLE `PREFIX_specific_price` DROP INDEX `id_product`; ALTER TABLE `PREFIX_specific_price` ADD INDEX `id_product` (`id_product`, `id_product_attribute`, `id_shop`, `id_currency`, `id_country`, `id_group`, `from_quantity`, `from`, `to`); /* PHP:add_column_orders_reference_if_not_exists(); */; ALTER TABLE `PREFIX_orders` ADD COLUMN `id_warehouse` int(10) unsigned DEFAULT 0 AFTER `id_carrier`; ALTER TABLE `PREFIX_cart` ADD COLUMN `order_reference` varchar(9) AFTER `id_cart`; ALTER TABLE `PREFIX_cart` ADD COLUMN `delivery_option` varchar(100) AFTER `id_carrier`; ALTER TABLE `PREFIX_tax` ADD COLUMN `account_number` VARCHAR(64) NOT NULL; /* PHP:add_new_tab(AdminAttributeGenerator, fr:Générateur de déclinaisons|es:Combinations generator|en:Combinations generator|de:Combinations generator|it:Combinations generator, -1); */; /* PHP:add_new_tab(AdminCMSCategories, fr:Catégories CMS|es:CMS categories|en:CMS categories|de:CMS categories|it:CMS categories, -1); */; /* PHP:add_new_tab(AdminCMS, fr:Pages CMS|es:CMS pages|en:CMS pages|de:CMS pages|it:CMS pages, -1); */; UPDATE `PREFIX_quick_access` SET `link` = 'index.php?controller=AdminCategories&addcategory' WHERE `id_quick_access` = 3; UPDATE `PREFIX_quick_access` SET `link` = 'index.php?controller=AdminProducts&addproduct' WHERE `id_quick_access` = 4; UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminCmsCategories' LIMIT 1) AND `id_profile` = '3'; UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminCmsCategories' LIMIT 1) AND `id_profile` = '5'; UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminCms' LIMIT 1) AND `id_profile` = '3'; UPDATE `PREFIX_access` SET `view` = '0', `add` = '0', `edit` = '0', `delete` = '0' WHERE `id_tab` = (SELECT `id_tab` FROM `PREFIX_tab` t WHERE t.`class_name` = 'AdminCms' LIMIT 1) AND `id_profile` = '5'; INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_CUSTOMER_GROUP', '1', NOW(), NOW()); /* PHP:add_new_groups('Visiteur', 'Visitor'); */; /* PHP:add_new_groups('Invité', 'Guest'); */; UPDATE `PREFIX_employee` SET `bo_theme` = 'default'; UPDATE `PREFIX_tab` SET `class_name` = 'AdminCmsContent' WHERE `class_name` = 'AdminCMSContent'; UPDATE `PREFIX_tab` SET `class_name` = 'AdminCms' WHERE `class_name` = 'AdminCMS'; UPDATE `PREFIX_tab` SET `class_name` = 'AdminCmsCategories' WHERE `class_name` = 'AdminCMSCategories'; UPDATE `PREFIX_tab` SET `class_name` = 'AdminPdf' WHERE `class_name` = 'AdminPDF'; CREATE TABLE `PREFIX_order_carrier` ( `id_order_carrier` int(11) NOT NULL AUTO_INCREMENT, `id_order` int(11) unsigned NOT NULL, `id_carrier` int(11) unsigned NOT NULL, `id_order_invoice` int(11) unsigned DEFAULT NULL, `weight` float DEFAULT NULL, `shipping_cost_tax_excl` decimal(20,6) DEFAULT NULL, `shipping_cost_tax_incl` decimal(20,6) DEFAULT NULL, `tracking_number` varchar(64) DEFAULT NULL, `date_add` datetime NOT NULL, PRIMARY KEY (`id_order_carrier`), KEY `id_order` (`id_order`), KEY `id_carrier` (`id_carrier`), KEY `id_order_invoice` (`id_order_invoice`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ALTER TABLE `PREFIX_order_slip` ADD COLUMN `amount` DECIMAL(10,2) NOT NULL AFTER `shipping_cost`; ALTER TABLE `PREFIX_order_slip` ADD COLUMN `shipping_cost_amount` DECIMAL(10,2) NOT NULL AFTER `amount`; ALTER TABLE `PREFIX_order_slip` ADD COLUMN `partial` TINYINT(1) NOT NULL AFTER `shipping_cost_amount`; ALTER TABLE `PREFIX_order_slip_detail` ADD COLUMN `amount` DECIMAL(10,2) NOT NULL AFTER `product_quantity`; INSERT INTO `PREFIX_tab` (`id_parent`, `class_name`, `position`) VALUES (-1, 'AdminLogin', 0); CREATE TABLE `PREFIX_hook_alias` ( `id_hook_alias` int(10) unsigned NOT NULL auto_increment, `alias` varchar(64) NOT NULL, `name` varchar(64) NOT NULL, PRIMARY KEY (`id_hook_alias`), UNIQUE KEY `alias` (`alias`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; INSERT INTO `PREFIX_hook_alias` (`id_hook_alias`, `name`, `alias`) VALUES (1, 'displayPayment', 'payment'), (2, 'actionValidateOrder', 'newOrder'), (3, 'actionPaymentConfirmation', 'paymentConfirm'), (4, 'displayPaymentReturn', 'paymentReturn'), (5, 'actionUpdateQuantity', 'updateQuantity'), (6, 'displayRightColumn', 'rightColumn'), (7, 'displayLeftColumn', 'leftColumn'), (8, 'displayHome', 'home'), (9, 'displayHeader', 'header'), (10, 'actionCartSave', 'cart'), (11, 'actionAuthentication', 'authentication'), (12, 'actionProductAdd', 'addproduct'), (13, 'actionProductUpdate', 'updateproduct'), (14, 'displayTop', 'top'), (15, 'displayRightColumnProduct', 'extraRight'), (16, 'actionProductDelete', 'deleteproduct'), (17, 'displayFooterProduct', 'productfooter'), (18, 'displayInvoice', 'invoice'), (19, 'actionOrderStatusUpdate', 'updateOrderStatus'), (20, 'displayAdminOrder', 'adminOrder'), (21, 'displayFooter', 'footer'), (22, 'displayPDFInvoice', 'PDFInvoice'), (23, 'displayAdminCustomers', 'adminCustomers'), (24, 'displayOrderConfirmation', 'orderConfirmation'), (25, 'actionCustomerAccountAdd', 'createAccount'), (26, 'displayCustomerAccount', 'customerAccount'), (27, 'actionOrderSlipAdd', 'orderSlip'), (28, 'displayProductTab', 'productTab'), (29, 'displayProductTabContent', 'productTabContent'), (30, 'displayShoppingCartFooter', 'shoppingCart'), (31, 'displayCustomerAccountForm', 'createAccountForm'), (32, 'displayAdminStatsModules', 'AdminStatsModules'), (33, 'displayAdminStatsGraphEngine', 'GraphEngine'), (34, 'actionOrderReturn', 'orderReturn'), (35, 'displayProductButtons', 'productActions'), (36, 'displayBackOfficeHome', 'backOfficeHome'), (37, 'displayAdminStatsGridEngine', 'GridEngine'), (38, 'actionWatermark', 'watermark'), (39, 'actionProductCancel', 'cancelProduct'), (40, 'displayLeftColumnProduct', 'extraLeft'), (41, 'actionProductOutOfStock', 'productOutOfStock'), (42, 'actionProductAttributeUpdate', 'updateProductAttribute'), (43, 'displayCarrierList', 'extraCarrier'), (44, 'displayShoppingCart', 'shoppingCartExtra'), (45, 'actionSearch', 'search'), (46, 'displayBeforePayment', 'backBeforePayment'), (47, 'actionCarrierUpdate', 'updateCarrier'), (48, 'actionOrderStatusPostUpdate', 'postUpdateOrderStatus'), (49, 'displayCustomerAccountFormTop', 'createAccountTop'), (50, 'displayBackOfficeHeader', 'backOfficeHeader'), (51, 'displayBackOfficeTop', 'backOfficeTop'), (52, 'displayBackOfficeFooter', 'backOfficeFooter'), (53, 'actionProductAttributeDelete', 'deleteProductAttribute'), (54, 'actionCarrierProcess', 'processCarrier'), (55, 'actionOrderDetail', 'orderDetail'), (56, 'displayBeforeCarrier', 'beforeCarrier'), (57, 'displayOrderDetail', 'orderDetailDisplayed'), (58, 'actionPaymentCCAdd', 'paymentCCAdded'), (59, 'displayProductComparison', 'extraProductComparison'), (60, 'actionCategoryAdd', 'categoryAddition'), (61, 'actionCategoryUpdate', 'categoryUpdate'), (62, 'actionCategoryDelete', 'categoryDeletion'), (63, 'actionBeforeAuthentication', 'beforeAuthentication'), (64, 'displayPaymentTop', 'paymentTop'), (65, 'actionHtaccessCreate', 'afterCreateHtaccess'), (66, 'actionAdminMetaSave', 'afterSaveAdminMeta'), (67, 'displayAttributeGroupForm', 'attributeGroupForm'), (68, 'actionAttributeGroupSave', 'afterSaveAttributeGroup'), (69, 'actionAttributeGroupDelete', 'afterDeleteAttributeGroup'), (70, 'displayFeatureForm', 'featureForm'), (71, 'actionFeatureSave', 'afterSaveFeature'), (72, 'actionFeatureDelete', 'afterDeleteFeature'), (73, 'actionProductSave', 'afterSaveProduct'), (74, 'actionProductListOverride', 'productListAssign'), (75, 'displayAttributeGroupPostProcess', 'postProcessAttributeGroup'), (76, 'displayFeaturePostProcess', 'postProcessFeature'), (77, 'displayFeatureValueForm', 'featureValueForm'), (78, 'displayFeatureValuePostProcess', 'postProcessFeatureValue'), (79, 'actionFeatureValueDelete', 'afterDeleteFeatureValue'), (80, 'actionFeatureValueSave', 'afterSaveFeatureValue'), (81, 'displayAttributeForm', 'attributeForm'), (82, 'actionAttributePostProcess', 'postProcessAttribute'), (83, 'actionAttributeDelete', 'afterDeleteAttribute'), (84, 'actionAttributeSave', 'afterSaveAttribute'), (85, 'actionTaxManager', 'taxManager');
the_stack
-- -- ARRAYS -- CREATE TABLE arrtest ( a int2[], b int4[][][], c name[], d text[][], e float8[], f char(5)[], g varchar(5)[] ); -- -- only the 'e' array is 0-based, the others are 1-based. -- INSERT INTO arrtest (a[1:5], b[1:1][1:2][1:2], c, d, f, g) VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}'); UPDATE arrtest SET e[0] = '1.1'; UPDATE arrtest SET e[1] = '2.2'; INSERT INTO arrtest (f) VALUES ('{"too long"}'); INSERT INTO arrtest (a, b[1:2][1:2], c, d, e, f, g) VALUES ('{11,12,23}', '{{3,4},{4,5}}', '{"foobar"}', '{{"elt1", "elt2"}}', '{"3.4", "6.7"}', '{"abc","abcde"}', '{"abc","abcde"}'); INSERT INTO arrtest (a, b[1:2], c, d[1:2]) VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}'); SELECT * FROM arrtest ORDER BY c[1]; SELECT arrtest.a[1], arrtest.b[1][1][1], arrtest.c[1], arrtest.d[1][1], arrtest.e[0] FROM arrtest ORDER BY c[1]; SELECT a[1], b[1][1][1], c[1], d[1][1], e[0] FROM arrtest ORDER BY c[1]; SELECT a[1:3], b[1:1][1:2][1:2], c[1:2], d[1:1][1:2] FROM arrtest ORDER BY c[1]; SELECT array_ndims(a) AS a,array_ndims(b) AS b,array_ndims(c) AS c FROM arrtest arr ORDER BY arr.c[1]; SELECT array_dims(a) AS a,array_dims(b) AS b,array_dims(c) AS c FROM arrtest arr ORDER BY arr.c[1]; -- returns nothing SELECT * FROM arrtest WHERE a[1] < 5 and c = '{"foobar"}'::_name; UPDATE arrtest SET a[1:2] = '{16,25}' WHERE NOT a = '{}'::_int2; UPDATE arrtest SET b[1:1][1:1][1:2] = '{113, 117}', b[1:1][1:2][2:2] = '{142, 147}' WHERE array_dims(b) = '[1:1][1:2][1:2]'; UPDATE arrtest SET c[2:2] = '{"new_word"}' WHERE array_dims(c) is not null; SELECT a,b,c FROM arrtest arr ORDER BY arr.c[1]; SELECT a[1:3], b[1:1][1:2][1:2], c[1:2], d[1:1][2:2] FROM arrtest arr ORDER BY arr.c[1]; SELECT b[1:1][2][2], d[1:1][2] FROM arrtest arr ORDER BY arr.c[1]; INSERT INTO arrtest(a) VALUES('{1,null,3}'); SELECT a FROM arrtest arr ORDER BY arr.c[1], arr.a[1]; UPDATE arrtest SET a[4] = NULL WHERE a[2] IS NULL; SELECT a FROM arrtest arr WHERE a[2] IS NULL ORDER BY arr.c[1]; DELETE FROM arrtest WHERE a[2] IS NULL AND b IS NULL; SELECT a,b,c FROM arrtest arr ORDER BY arr.c[1]; -- test mixed slice/scalar subscripting select '{{1,2,3},{4,5,6},{7,8,9}}'::int[]; select ('{{1,2,3},{4,5,6},{7,8,9}}'::int[])[1:2][2]; select '[0:2][0:2]={{1,2,3},{4,5,6},{7,8,9}}'::int[]; select ('[0:2][0:2]={{1,2,3},{4,5,6},{7,8,9}}'::int[])[1:2][2]; -- -- check subscription corner cases -- -- More subscripts than MAXDIMS(6) SELECT ('{}'::int[])[1][2][3][4][5][6][7]; -- NULL index yields NULL when selecting SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][NULL][1]; SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][NULL:1][1]; SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][1:NULL][1]; -- NULL index in assignment is an error UPDATE arrtest SET c[NULL] = '{"can''t assign"}' WHERE array_dims(c) is not null; UPDATE arrtest SET c[NULL:1] = '{"can''t assign"}' WHERE array_dims(c) is not null; UPDATE arrtest SET c[1:NULL] = '{"can''t assign"}' WHERE array_dims(c) is not null; -- test slices with empty lower and/or upper index CREATE TEMP TABLE arrtest_s ( id int primary key, a int2[], b int2[][] ); INSERT INTO arrtest_s VALUES (1, '{1,2,3,4,5}', '{{1,2,3}, {4,5,6}, {7,8,9}}'); INSERT INTO arrtest_s VALUES (2, '[0:4]={1,2,3,4,5}', '[0:2][0:2]={{1,2,3}, {4,5,6}, {7,8,9}}'); SELECT * FROM arrtest_s ORDER BY id; SELECT a[:3], b[:2][:2] FROM arrtest_s ORDER BY id; SELECT a[2:], b[2:][2:] FROM arrtest_s ORDER BY id; SELECT a[:], b[:] FROM arrtest_s ORDER BY id; -- updates UPDATE arrtest_s SET a[:3] = '{11, 12, 13}', b[:2][:2] = '{{11,12}, {14,15}}' WHERE array_lower(a,1) = 1; SELECT * FROM arrtest_s ORDER BY id; UPDATE arrtest_s SET a[3:] = '{23, 24, 25}', b[2:][2:] = '{{25,26}, {28,29}}'; SELECT * FROM arrtest_s ORDER BY id; UPDATE arrtest_s SET a[:] = '{11, 12, 13, 14, 15}'; SELECT * FROM arrtest_s ORDER BY id; UPDATE arrtest_s SET a[:] = '{23, 24, 25}'; -- fail, too small INSERT INTO arrtest_s VALUES(3, NULL, NULL); UPDATE arrtest_s SET a[:] = '{11, 12, 13, 14, 15}'; -- fail, no good with null -- check with fixed-length-array type, such as point SELECT f1[0:1] FROM POINT_TBL; SELECT f1[0:] FROM POINT_TBL; SELECT f1[:1] FROM POINT_TBL; SELECT f1[:] FROM POINT_TBL; -- subscript assignments to fixed-width result in NULL if previous value is NULL UPDATE point_tbl SET f1[0] = 10 WHERE f1 IS NULL RETURNING *; INSERT INTO point_tbl(f1[0]) VALUES(0) RETURNING *; -- NULL assignments get ignored UPDATE point_tbl SET f1[0] = NULL WHERE f1::text = '(10,10)'::point::text RETURNING *; -- but non-NULL subscript assignments work UPDATE point_tbl SET f1[0] = -10, f1[1] = -10 WHERE f1::text = '(10,10)'::point::text RETURNING *; -- but not to expand the range UPDATE point_tbl SET f1[3] = 10 WHERE f1::text = '(-10,-10)'::point::text RETURNING *; -- -- test array extension -- CREATE TEMP TABLE arrtest1 (i int[], t text[]); insert into arrtest1 values(array[1,2,null,4], array['one','two',null,'four']); select * from arrtest1; update arrtest1 set i[2] = 22, t[2] = 'twenty-two'; select * from arrtest1; update arrtest1 set i[5] = 5, t[5] = 'five'; select * from arrtest1; update arrtest1 set i[8] = 8, t[8] = 'eight'; select * from arrtest1; update arrtest1 set i[0] = 0, t[0] = 'zero'; select * from arrtest1; update arrtest1 set i[-3] = -3, t[-3] = 'minus-three'; select * from arrtest1; update arrtest1 set i[0:2] = array[10,11,12], t[0:2] = array['ten','eleven','twelve']; select * from arrtest1; update arrtest1 set i[8:10] = array[18,null,20], t[8:10] = array['p18',null,'p20']; select * from arrtest1; update arrtest1 set i[11:12] = array[null,22], t[11:12] = array[null,'p22']; select * from arrtest1; update arrtest1 set i[15:16] = array[null,26], t[15:16] = array[null,'p26']; select * from arrtest1; update arrtest1 set i[-5:-3] = array[-15,-14,-13], t[-5:-3] = array['m15','m14','m13']; select * from arrtest1; update arrtest1 set i[-7:-6] = array[-17,null], t[-7:-6] = array['m17',null]; select * from arrtest1; update arrtest1 set i[-12:-10] = array[-22,null,-20], t[-12:-10] = array['m22',null,'m20']; select * from arrtest1; delete from arrtest1; insert into arrtest1 values(array[1,2,null,4], array['one','two',null,'four']); select * from arrtest1; update arrtest1 set i[0:5] = array[0,1,2,null,4,5], t[0:5] = array['z','p1','p2',null,'p4','p5']; select * from arrtest1; -- -- array expressions and operators -- -- table creation and INSERTs CREATE TEMP TABLE arrtest2 (i integer ARRAY[4], f float8[], n numeric[], t text[], d timestamp[]); INSERT INTO arrtest2 VALUES( ARRAY[[[113,142],[1,147]]], ARRAY[1.1,1.2,1.3]::float8[], ARRAY[1.1,1.2,1.3], ARRAY[[['aaa','aab'],['aba','abb'],['aca','acb']],[['baa','bab'],['bba','bbb'],['bca','bcb']]], ARRAY['19620326','19931223','19970117']::timestamp[] ); -- some more test data CREATE TEMP TABLE arrtest_f (f0 int, f1 text, f2 float8); insert into arrtest_f values(1,'cat1',1.21); insert into arrtest_f values(2,'cat1',1.24); insert into arrtest_f values(3,'cat1',1.18); insert into arrtest_f values(4,'cat1',1.26); insert into arrtest_f values(5,'cat1',1.15); insert into arrtest_f values(6,'cat2',1.15); insert into arrtest_f values(7,'cat2',1.26); insert into arrtest_f values(8,'cat2',1.32); insert into arrtest_f values(9,'cat2',1.30); CREATE TEMP TABLE arrtest_i (f0 int, f1 text, f2 int); insert into arrtest_i values(1,'cat1',21); insert into arrtest_i values(2,'cat1',24); insert into arrtest_i values(3,'cat1',18); insert into arrtest_i values(4,'cat1',26); insert into arrtest_i values(5,'cat1',15); insert into arrtest_i values(6,'cat2',15); insert into arrtest_i values(7,'cat2',26); insert into arrtest_i values(8,'cat2',32); insert into arrtest_i values(9,'cat2',30); -- expressions SELECT t.f[1][3][1] AS "131", t.f[2][2][1] AS "221" FROM ( SELECT ARRAY[[[111,112],[121,122],[131,132]],[[211,212],[221,122],[231,232]]] AS f ) AS t; SELECT ARRAY[[[[[['hello'],['world']]]]]]; SELECT ARRAY[ARRAY['hello'],ARRAY['world']]; SELECT ARRAY(select f2 from arrtest_f order by f2) AS "ARRAY"; -- with nulls SELECT '{1,null,3}'::int[]; SELECT ARRAY[1,NULL,3]; -- functions SELECT array_append(array[42], 6) AS "{42,6}"; SELECT array_prepend(6, array[42]) AS "{6,42}"; SELECT array_cat(ARRAY[1,2], ARRAY[3,4]) AS "{1,2,3,4}"; SELECT array_cat(ARRAY[1,2], ARRAY[[3,4],[5,6]]) AS "{{1,2},{3,4},{5,6}}"; SELECT array_cat(ARRAY[[3,4],[5,6]], ARRAY[1,2]) AS "{{3,4},{5,6},{1,2}}"; SELECT array_position(ARRAY[1,2,3,4,5], 4); SELECT array_position(ARRAY[5,3,4,2,1], 4); SELECT array_position(ARRAY[[1,2],[3,4]], 3); SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'mon'); SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'sat'); SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], NULL); SELECT array_position(ARRAY['sun','mon','tue','wed','thu',NULL,'fri','sat'], NULL); SELECT array_position(ARRAY['sun','mon','tue','wed','thu',NULL,'fri','sat'], 'sat'); SELECT array_positions(NULL, 10); SELECT array_positions(NULL, NULL::int); SELECT array_positions(ARRAY[1,2,3,4,5,6,1,2,3,4,5,6], 4); SELECT array_positions(ARRAY[[1,2],[3,4]], 4); SELECT array_positions(ARRAY[1,2,3,4,5,6,1,2,3,4,5,6], NULL); SELECT array_positions(ARRAY[1,2,3,NULL,5,6,1,2,3,NULL,5,6], NULL); SELECT array_length(array_positions(ARRAY(SELECT 'AAAAAAAAAAAAAAAAAAAAAAAAA'::text || i % 10 FROM generate_series(1,100) g(i)), 'AAAAAAAAAAAAAAAAAAAAAAAAA5'), 1); DO $$ DECLARE o int; a int[] := ARRAY[1,2,3,2,3,1,2]; BEGIN o := array_position(a, 2); WHILE o IS NOT NULL LOOP RAISE NOTICE '%', o; o := array_position(a, 2, o + 1); END LOOP; END $$ LANGUAGE plpgsql; SELECT array_position('[2:4]={1,2,3}'::int[], 1); SELECT array_positions('[2:4]={1,2,3}'::int[], 1); SELECT array_position(ids, (1, 1)), array_positions(ids, (1, 1)) FROM (VALUES (ARRAY[(0, 0), (1, 1)]), (ARRAY[(1, 1)]) ) AS f (ids); -- operators SELECT a FROM arrtest WHERE b = ARRAY[[[113,142],[1,147]]]; SELECT NOT ARRAY[1.1,1.2,1.3] = ARRAY[1.1,1.2,1.3] AS "FALSE"; SELECT ARRAY[1,2] || 3 AS "{1,2,3}"; SELECT 0 || ARRAY[1,2] AS "{0,1,2}"; SELECT ARRAY[1,2] || ARRAY[3,4] AS "{1,2,3,4}"; SELECT ARRAY[[['hello','world']]] || ARRAY[[['happy','birthday']]] AS "ARRAY"; SELECT ARRAY[[1,2],[3,4]] || ARRAY[5,6] AS "{{1,2},{3,4},{5,6}}"; SELECT ARRAY[0,0] || ARRAY[1,1] || ARRAY[2,2] AS "{0,0,1,1,2,2}"; SELECT 0 || ARRAY[1,2] || 3 AS "{0,1,2,3}"; SELECT * FROM array_op_test WHERE i @> '{32}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i && '{32}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i @> '{17}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i && '{17}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i @> '{32,17}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i && '{32,17}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i <@ '{38,34,32,89}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i = '{}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i @> '{}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i && '{}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i <@ '{}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i = '{NULL}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i @> '{NULL}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i && '{NULL}' ORDER BY seqno; SELECT * FROM array_op_test WHERE i <@ '{NULL}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t @> '{AAAAAAAA72908}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t && '{AAAAAAAA72908}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t @> '{AAAAAAAAAA646}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t && '{AAAAAAAAAA646}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t @> '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t && '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t <@ '{AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t = '{}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t @> '{}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t && '{}' ORDER BY seqno; SELECT * FROM array_op_test WHERE t <@ '{}' ORDER BY seqno; -- array casts SELECT ARRAY[1,2,3]::text[]::int[]::float8[] AS "{1,2,3}"; SELECT ARRAY[1,2,3]::text[]::int[]::float8[] is of (float8[]) as "TRUE"; SELECT ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[] AS "{{a,bc},{def,hijk}}"; SELECT ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[] is of (varchar[]) as "TRUE"; SELECT CAST(ARRAY[[[[[['a','bb','ccc']]]]]] as text[]) as "{{{{{{a,bb,ccc}}}}}}"; SELECT NULL::text[]::int[] AS "NULL"; -- scalar op any/all (array) select 33 = any ('{1,2,3}'); select 33 = any ('{1,2,33}'); select 33 = all ('{1,2,33}'); select 33 >= all ('{1,2,33}'); -- boundary cases select null::int >= all ('{1,2,33}'); select null::int >= all ('{}'); select null::int >= any ('{}'); -- cross-datatype select 33.4 = any (array[1,2,3]); select 33.4 > all (array[1,2,3]); -- errors select 33 * any ('{1,2,3}'); select 33 * any (44); -- nulls select 33 = any (null::int[]); select null::int = any ('{1,2,3}'); select 33 = any ('{1,null,3}'); select 33 = any ('{1,null,33}'); select 33 = all (null::int[]); select null::int = all ('{1,2,3}'); select 33 = all ('{1,null,3}'); select 33 = all ('{33,null,33}'); -- nulls later in the bitmap SELECT -1 != ALL(ARRAY(SELECT NULLIF(g.i, 900) FROM generate_series(1,1000) g(i))); -- test indexes on arrays create temp table arr_tbl (f1 int[] unique); insert into arr_tbl values ('{1,2,3}'); insert into arr_tbl values ('{1,2}'); -- failure expected: insert into arr_tbl values ('{1,2,3}'); insert into arr_tbl values ('{2,3,4}'); insert into arr_tbl values ('{1,5,3}'); insert into arr_tbl values ('{1,2,10}'); set enable_seqscan to off; set enable_bitmapscan to off; select * from arr_tbl where f1 > '{1,2,3}' and f1 <= '{1,5,3}'; select * from arr_tbl where f1 >= '{1,2,3}' and f1 < '{1,5,3}'; -- test ON CONFLICT DO UPDATE with arrays -- TODO(jason) Change the below to `create temp table` when issue #1999 is -- resolved. create table arr_pk_tbl (pk int4 primary key, f1 int[]); insert into arr_pk_tbl values (1, '{1,2,3}'); insert into arr_pk_tbl values (1, '{3,4,5}') on conflict (pk) do update set f1[1] = excluded.f1[1], f1[3] = excluded.f1[3] returning pk, f1; insert into arr_pk_tbl(pk, f1[1:2]) values (1, '{6,7,8}') on conflict (pk) do update set f1[1] = excluded.f1[1], f1[2] = excluded.f1[2], f1[3] = excluded.f1[3] returning pk, f1; -- note: if above selects don't produce the expected tuple order, -- then you didn't get an indexscan plan, and something is busted. reset enable_seqscan; reset enable_bitmapscan; -- test [not] (like|ilike) (any|all) (...) select 'foo' like any (array['%a', '%o']); -- t select 'foo' like any (array['%a', '%b']); -- f select 'foo' like all (array['f%', '%o']); -- t select 'foo' like all (array['f%', '%b']); -- f select 'foo' not like any (array['%a', '%b']); -- t select 'foo' not like all (array['%a', '%o']); -- f select 'foo' ilike any (array['%A', '%O']); -- t select 'foo' ilike all (array['F%', '%O']); -- t -- -- General array parser tests -- -- none of the following should be accepted select '{{1,{2}},{2,3}}'::text[]; select '{{},{}}'::text[]; select E'{{1,2},\\{2,3}}'::text[]; select '{{"1 2" x},{3}}'::text[]; select '{}}'::text[]; select '{ }}'::text[]; select array[]; -- none of the above should be accepted -- all of the following should be accepted select '{}'::text[]; select '{{{1,2,3,4},{2,3,4,5}},{{3,4,5,6},{4,5,6,7}}}'::text[]; select '{0 second ,0 second}'::interval[]; select '{ { "," } , { 3 } }'::text[]; select ' { { " 0 second " , 0 second } }'::text[]; select '{ 0 second, @ 1 hour @ 42 minutes @ 20 seconds }'::interval[]; select array[]::text[]; select '[0:1]={1.1,2.2}'::float8[]; -- all of the above should be accepted -- tests for array aggregates CREATE TEMP TABLE arraggtest ( f1 INT[], f2 TEXT[][], f3 FLOAT[]); INSERT INTO arraggtest (f1, f2, f3) VALUES ('{1,2,3,4}','{{grey,red},{blue,blue}}','{1.6, 0.0}'); INSERT INTO arraggtest (f1, f2, f3) VALUES ('{1,2,3}','{{grey,red},{grey,blue}}','{1.6}'); SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; INSERT INTO arraggtest (f1, f2, f3) VALUES ('{3,3,2,4,5,6}','{{white,yellow},{pink,orange}}','{2.1,3.3,1.8,1.7,1.6}'); SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; INSERT INTO arraggtest (f1, f2, f3) VALUES ('{2}','{{black,red},{green,orange}}','{1.6,2.2,2.6,0.4}'); SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; INSERT INTO arraggtest (f1, f2, f3) VALUES ('{4,2,6,7,8,1}','{{red},{black},{purple},{blue},{blue}}',NULL); SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; INSERT INTO arraggtest (f1, f2, f3) VALUES ('{}','{{pink,white,blue,red,grey,orange}}','{2.1,1.87,1.4,2.2}'); SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; -- A few simple tests for arrays of composite types create type comptype as (f1 int, f2 text); create table comptable (c1 comptype, c2 comptype[]); -- XXX would like to not have to specify row() construct types here ... insert into comptable values (row(1,'foo'), array[row(2,'bar')::comptype, row(3,'baz')::comptype]); -- check that implicitly named array type _comptype isn't a problem create type _comptype as enum('fooey'); select * from comptable; select c2[2].f2 from comptable; drop type _comptype; drop table comptable; drop type comptype; create or replace function unnest1(anyarray) returns setof anyelement as $$ select $1[s] from generate_subscripts($1,1) g(s); $$ language sql immutable; create or replace function unnest2(anyarray) returns setof anyelement as $$ select $1[s1][s2] from generate_subscripts($1,1) g1(s1), generate_subscripts($1,2) g2(s2); $$ language sql immutable; select * from unnest1(array[1,2,3]); select * from unnest2(array[[1,2,3],[4,5,6]]); drop function unnest1(anyarray); drop function unnest2(anyarray); select array_fill(null::integer, array[3,3],array[2,2]); select array_fill(null::integer, array[3,3]); select array_fill(null::text, array[3,3],array[2,2]); select array_fill(null::text, array[3,3]); select array_fill(7, array[3,3],array[2,2]); select array_fill(7, array[3,3]); select array_fill('juhu'::text, array[3,3],array[2,2]); select array_fill('juhu'::text, array[3,3]); select a, a = '{}' as is_eq, array_dims(a) from (select array_fill(42, array[0]) as a) ss; select a, a = '{}' as is_eq, array_dims(a) from (select array_fill(42, '{}') as a) ss; select a, a = '{}' as is_eq, array_dims(a) from (select array_fill(42, '{}', '{}') as a) ss; -- raise exception select array_fill(1, null, array[2,2]); select array_fill(1, array[2,2], null); select array_fill(1, array[2,2], '{}'); select array_fill(1, array[3,3], array[1,1,1]); select array_fill(1, array[1,2,null]); select array_fill(1, array[[1,2],[3,4]]); select string_to_array('1|2|3', '|'); select string_to_array('1|2|3|', '|'); select string_to_array('1||2|3||', '||'); select string_to_array('1|2|3', ''); select string_to_array('', '|'); select string_to_array('1|2|3', NULL); select string_to_array(NULL, '|') IS NULL; select string_to_array('abc', ''); select string_to_array('abc', '', 'abc'); select string_to_array('abc', ','); select string_to_array('abc', ',', 'abc'); select string_to_array('1,2,3,4,,6', ','); select string_to_array('1,2,3,4,,6', ',', ''); select string_to_array('1,2,3,4,*,6', ',', '*'); select array_to_string(NULL::int4[], ',') IS NULL; select array_to_string('{}'::int4[], ','); select array_to_string(array[1,2,3,4,NULL,6], ','); select array_to_string(array[1,2,3,4,NULL,6], ',', '*'); select array_to_string(array[1,2,3,4,NULL,6], NULL); select array_to_string(array[1,2,3,4,NULL,6], ',', NULL); select array_to_string(string_to_array('1|2|3', '|'), '|'); select array_length(array[1,2,3], 1); select array_length(array[[1,2,3], [4,5,6]], 0); select array_length(array[[1,2,3], [4,5,6]], 1); select array_length(array[[1,2,3], [4,5,6]], 2); select array_length(array[[1,2,3], [4,5,6]], 3); select cardinality(NULL::int[]); select cardinality('{}'::int[]); select cardinality(array[1,2,3]); select cardinality('[2:4]={5,6,7}'::int[]); select cardinality('{{1,2}}'::int[]); select cardinality('{{1,2},{3,4},{5,6}}'::int[]); select cardinality('{{{1,9},{5,6}},{{2,3},{3,4}}}'::int[]); -- array_agg(anynonarray) select array_agg(unique1) from (select unique1 from tenk1 where unique1 < 15 order by unique1) ss; select array_agg(ten) from (select ten from tenk1 where unique1 < 15 order by unique1) ss; select array_agg(nullif(ten, 4)) from (select ten from tenk1 where unique1 < 15 order by unique1) ss; select array_agg(unique1) from tenk1 where unique1 < -15; -- array_agg(anyarray) select array_agg(ar) from (values ('{1,2}'::int[]), ('{3,4}'::int[])) v(ar); select array_agg(distinct ar order by ar desc) from (select array[i / 2] from generate_series(1,10) a(i)) b(ar); select array_agg(ar) from (select array_agg(array[i, i+1, i-1]) from generate_series(1,2) a(i)) b(ar); select array_agg(array[i+1.2, i+1.3, i+1.4]) from generate_series(1,3) g(i); select array_agg(array['Hello', i::text]) from generate_series(9,11) g(i); select array_agg(array[i, nullif(i, 3), i+1]) from generate_series(1,4) g(i); -- errors select array_agg('{}'::int[]) from generate_series(1,2); select array_agg(null::int[]) from generate_series(1,2); select array_agg(ar) from (values ('{1,2}'::int[]), ('{3}'::int[])) v(ar); select unnest(array[1,2,3]); select * from unnest(array[1,2,3]); select unnest(array[1,2,3,4.5]::float8[]); select unnest(array[1,2,3,4.5]::numeric[]); select unnest(array[1,2,3,null,4,null,null,5,6]); select unnest(array[1,2,3,null,4,null,null,5,6]::text[]); select abs(unnest(array[1,2,null,-3])); select array_remove(array[1,2,2,3], 2); select array_remove(array[1,2,2,3], 5); select array_remove(array[1,NULL,NULL,3], NULL); select array_remove(array['A','CC','D','C','RR'], 'RR'); select array_remove('{{1,2,2},{1,4,3}}', 2); -- not allowed select array_remove(array['X','X','X'], 'X') = '{}'; select array_replace(array[1,2,5,4],5,3); select array_replace(array[1,2,5,4],5,NULL); select array_replace(array[1,2,NULL,4,NULL],NULL,5); select array_replace(array['A','B','DD','B'],'B','CC'); select array_replace(array[1,NULL,3],NULL,NULL); select array_replace(array['AB',NULL,'CDE'],NULL,'12'); -- array(select array-value ...) select array(select array[i,i/2] from generate_series(1,5) i); select array(select array['Hello', i::text] from generate_series(9,11) i); -- Insert/update on a column that is array of composite create temp table t1 (f1 int8_tbl[]); insert into t1 (f1[5].q1) values(42); select * from t1; update t1 set f1[5].q2 = 43; select * from t1; -- Check that arrays of composites are safely detoasted when needed -- TODO(jason): uncomment this section when issue #2003 is closed. -- create temp table src (f1 text); -- insert into src -- select string_agg(random()::text,'') from generate_series(1,10000); -- create type textandtext as (c1 text, c2 text); -- create temp table dest (f1 textandtext[]); -- insert into dest select array[row(f1,f1)::textandtext] from src; -- select length(md5((f1[1]).c2)) from dest; -- delete from src; -- select length(md5((f1[1]).c2)) from dest; -- truncate table src; -- drop table src; -- select length(md5((f1[1]).c2)) from dest; -- drop table dest; -- drop type textandtext; -- Tests for polymorphic-array form of width_bucket() -- this exercises the varwidth and float8 code paths SELECT op, width_bucket(op::numeric, ARRAY[1, 3, 5, 10.0]::numeric[]) AS wb_n1, width_bucket(op::numeric, ARRAY[0, 5.5, 9.99]::numeric[]) AS wb_n2, width_bucket(op::numeric, ARRAY[-6, -5, 2.0]::numeric[]) AS wb_n3, width_bucket(op::float8, ARRAY[1, 3, 5, 10.0]::float8[]) AS wb_f1, width_bucket(op::float8, ARRAY[0, 5.5, 9.99]::float8[]) AS wb_f2, width_bucket(op::float8, ARRAY[-6, -5, 2.0]::float8[]) AS wb_f3 FROM (VALUES (-5.2), (-0.0000000001), (0.000000000001), (1), (1.99999999999999), (2), (2.00000000000001), (3), (4), (4.5), (5), (5.5), (6), (7), (8), (9), (9.99999999999999), (10), (10.0000000000001) ) v(op); -- ensure float8 path handles NaN properly SELECT op, width_bucket(op, ARRAY[1, 3, 9, 'NaN', 'NaN']::float8[]) AS wb FROM (VALUES (-5.2::float8), (4::float8), (77::float8), ('NaN'::float8) ) v(op); -- these exercise the generic fixed-width code path SELECT op, width_bucket(op, ARRAY[1, 3, 5, 10]) AS wb_1 FROM generate_series(0,11) as op; SELECT width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]); -- corner cases SELECT width_bucket(5, ARRAY[3]); SELECT width_bucket(5, '{}'); -- error cases SELECT width_bucket('5'::text, ARRAY[3, 4]::integer[]); SELECT width_bucket(5, ARRAY[3, 4, NULL]); SELECT width_bucket(5, ARRAY[ARRAY[1, 2], ARRAY[3, 4]]);
the_stack
-- VLAN tag in IpAddresses BEGIN TRANSACTION SET QUOTED_IDENTIFIER ON SET ARITHABORT ON SET NUMERIC_ROUNDABORT OFF SET CONCAT_NULL_YIELDS_NULL ON SET ANSI_NULLS ON SET ANSI_PADDING ON SET ANSI_WARNINGS ON COMMIT BEGIN TRANSACTION GO ALTER TABLE dbo.IPAddresses ADD VLAN int NULL GO ALTER TABLE dbo.IPAddresses SET (LOCK_ESCALATION = TABLE) GO COMMIT SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[GetIPAddress] ( @AddressID int ) AS BEGIN -- select SELECT AddressID, ServerID, ExternalIP, InternalIP, PoolID, SubnetMask, DefaultGateway, Comments, VLAN FROM IPAddresses WHERE AddressID = @AddressID RETURN END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[GetIPAddresses] ( @ActorID int, @PoolID int, @ServerID int ) AS BEGIN -- check rights DECLARE @IsAdmin bit SET @IsAdmin = dbo.CheckIsUserAdmin(@ActorID) SELECT IP.AddressID, IP.PoolID, IP.ExternalIP, IP.InternalIP, IP.SubnetMask, IP.DefaultGateway, IP.Comments, IP.VLAN, IP.ServerID, S.ServerName, PA.ItemID, SI.ItemName, PA.PackageID, P.PackageName, P.UserID, U.UserName FROM dbo.IPAddresses AS IP LEFT JOIN Servers AS S ON IP.ServerID = S.ServerID LEFT JOIN PackageIPAddresses AS PA ON IP.AddressID = PA.AddressID LEFT JOIN ServiceItems SI ON PA.ItemId = SI.ItemID LEFT JOIN dbo.Packages P ON PA.PackageID = P.PackageID LEFT JOIN dbo.Users U ON U.UserID = P.UserID WHERE @IsAdmin = 1 AND (@PoolID = 0 OR @PoolID <> 0 AND IP.PoolID = @PoolID) AND (@ServerID = 0 OR @ServerID <> 0 AND IP.ServerID = @ServerID) END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[UpdateIPAddress] ( @AddressID int, @ServerID int, @ExternalIP varchar(24), @InternalIP varchar(24), @PoolID int, @SubnetMask varchar(15), @DefaultGateway varchar(15), @Comments ntext, @VLAN int ) AS BEGIN IF @ServerID = 0 SET @ServerID = NULL UPDATE IPAddresses SET ExternalIP = @ExternalIP, InternalIP = @InternalIP, ServerID = @ServerID, PoolID = @PoolID, SubnetMask = @SubnetMask, DefaultGateway = @DefaultGateway, Comments = @Comments, VLAN = @VLAN WHERE AddressID = @AddressID RETURN END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[UpdateIPAddresses] ( @xml ntext, @PoolID int, @ServerID int, @SubnetMask varchar(15), @DefaultGateway varchar(15), @Comments ntext, @VLAN int ) AS BEGIN SET NOCOUNT ON; IF @ServerID = 0 SET @ServerID = NULL DECLARE @idoc int --Create an internal representation of the XML document. EXEC sp_xml_preparedocument @idoc OUTPUT, @xml -- update UPDATE IPAddresses SET ServerID = @ServerID, PoolID = @PoolID, SubnetMask = @SubnetMask, DefaultGateway = @DefaultGateway, Comments = @Comments, VLAN = @VLAN FROM IPAddresses AS IP INNER JOIN OPENXML(@idoc, '/items/item', 1) WITH ( AddressID int '@id' ) as PV ON IP.AddressID = PV.AddressID -- remove document exec sp_xml_removedocument @idoc END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[GetIPAddresses] ( @ActorID int, @PoolID int, @ServerID int ) AS BEGIN -- check rights DECLARE @IsAdmin bit SET @IsAdmin = dbo.CheckIsUserAdmin(@ActorID) SELECT IP.AddressID, IP.PoolID, IP.ExternalIP, IP.InternalIP, IP.SubnetMask, IP.DefaultGateway, IP.Comments, IP.VLAN, IP.ServerID, S.ServerName, PA.ItemID, SI.ItemName, PA.PackageID, P.PackageName, P.UserID, U.UserName FROM dbo.IPAddresses AS IP LEFT JOIN Servers AS S ON IP.ServerID = S.ServerID LEFT JOIN PackageIPAddresses AS PA ON IP.AddressID = PA.AddressID LEFT JOIN ServiceItems SI ON PA.ItemId = SI.ItemID LEFT JOIN dbo.Packages P ON PA.PackageID = P.PackageID LEFT JOIN dbo.Users U ON U.UserID = P.UserID WHERE @IsAdmin = 1 AND (@PoolID = 0 OR @PoolID <> 0 AND IP.PoolID = @PoolID) AND (@ServerID = 0 OR @ServerID <> 0 AND IP.ServerID = @ServerID) END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[AddIPAddress] ( @AddressID int OUTPUT, @ServerID int, @ExternalIP varchar(24), @InternalIP varchar(24), @PoolID int, @SubnetMask varchar(15), @DefaultGateway varchar(15), @Comments ntext, @VLAN int ) AS BEGIN IF @ServerID = 0 SET @ServerID = NULL INSERT INTO IPAddresses (ServerID, ExternalIP, InternalIP, PoolID, SubnetMask, DefaultGateway, Comments, VLAN) VALUES (@ServerID, @ExternalIP, @InternalIP, @PoolID, @SubnetMask, @DefaultGateway, @Comments, @VLAN) SET @AddressID = SCOPE_IDENTITY() RETURN END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[GetUnallottedIPAddresses] @PackageID int, @ServiceID int, @PoolID int = 0 AS BEGIN DECLARE @ParentPackageID int DECLARE @ServerID int IF (@PackageID = -1) -- NO PackageID defined, use ServerID from ServiceID (VPS Import) BEGIN SELECT @ServerID = ServerID, @ParentPackageID = 1 FROM Services WHERE ServiceID = @ServiceID END ELSE BEGIN SELECT @ParentPackageID = ParentPackageID, @ServerID = ServerID FROM Packages WHERE PackageID = @PackageId END IF (@ParentPackageID = 1 OR @PoolID = 4 /* management network */) -- "System" space BEGIN -- check if server is physical IF EXISTS(SELECT * FROM Servers WHERE ServerID = @ServerID AND VirtualServer = 0) BEGIN -- physical server SELECT IP.AddressID, IP.ExternalIP, IP.InternalIP, IP.ServerID, IP.PoolID, IP.SubnetMask, IP.DefaultGateway, IP.VLAN FROM dbo.IPAddresses AS IP WHERE IP.ServerID = @ServerID AND IP.AddressID NOT IN (SELECT PIP.AddressID FROM dbo.PackageIPAddresses AS PIP) AND (@PoolID = 0 OR @PoolID <> 0 AND IP.PoolID = @PoolID) ORDER BY IP.DefaultGateway, IP.ExternalIP END ELSE BEGIN -- virtual server -- get resource group by service DECLARE @GroupID int SELECT @GroupID = P.GroupID FROM Services AS S INNER JOIN Providers AS P ON S.ProviderID = P.ProviderID WHERE S.ServiceID = @ServiceID SELECT IP.AddressID, IP.ExternalIP, IP.InternalIP, IP.ServerID, IP.PoolID, IP.SubnetMask, IP.DefaultGateway, IP.VLAN FROM dbo.IPAddresses AS IP WHERE IP.ServerID IN ( SELECT SVC.ServerID FROM [dbo].[Services] AS SVC INNER JOIN [dbo].[Providers] AS P ON SVC.ProviderID = P.ProviderID WHERE [SVC].[ServiceID] = @ServiceId AND P.GroupID = @GroupID ) AND IP.AddressID NOT IN (SELECT PIP.AddressID FROM dbo.PackageIPAddresses AS PIP) AND (@PoolID = 0 OR @PoolID <> 0 AND IP.PoolID = @PoolID) ORDER BY IP.DefaultGateway, IP.ExternalIP END END ELSE -- 2rd level space and below BEGIN -- get service location SELECT @ServerID = S.ServerID FROM Services AS S WHERE S.ServiceID = @ServiceID SELECT IP.AddressID, IP.ExternalIP, IP.InternalIP, IP.ServerID, IP.PoolID, IP.SubnetMask, IP.DefaultGateway, IP.VLAN FROM dbo.PackageIPAddresses AS PIP INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID WHERE PIP.PackageID = @ParentPackageID AND PIP.ItemID IS NULL AND (@PoolID = 0 OR @PoolID <> 0 AND IP.PoolID = @PoolID) AND IP.ServerID = @ServerID ORDER BY IP.DefaultGateway, IP.ExternalIP END END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[GetIPAddressesPaged] ( @ActorID int, @PoolID int, @ServerID int, @FilterColumn nvarchar(50) = '', @FilterValue nvarchar(50) = '', @SortColumn nvarchar(50), @StartRow int, @MaximumRows int ) AS BEGIN -- check rights DECLARE @IsAdmin bit SET @IsAdmin = dbo.CheckIsUserAdmin(@ActorID) -- start DECLARE @condition nvarchar(700) SET @condition = ' @IsAdmin = 1 AND (@PoolID = 0 OR @PoolID <> 0 AND IP.PoolID = @PoolID) AND (@ServerID = 0 OR @ServerID <> 0 AND IP.ServerID = @ServerID) ' IF @FilterValue <> '' AND @FilterValue IS NOT NULL BEGIN IF @FilterColumn <> '' AND @FilterColumn IS NOT NULL SET @condition = @condition + ' AND ' + @FilterColumn + ' LIKE ''' + @FilterValue + '''' ELSE SET @condition = @condition + ' AND (ExternalIP LIKE ''' + @FilterValue + ''' OR InternalIP LIKE ''' + @FilterValue + ''' OR DefaultGateway LIKE ''' + @FilterValue + ''' OR ServerName LIKE ''' + @FilterValue + ''' OR ItemName LIKE ''' + @FilterValue + ''' OR Username LIKE ''' + @FilterValue + ''')' END IF @SortColumn IS NULL OR @SortColumn = '' SET @SortColumn = 'IP.ExternalIP ASC' DECLARE @sql nvarchar(3500) set @sql = ' SELECT COUNT(IP.AddressID) FROM dbo.IPAddresses AS IP LEFT JOIN Servers AS S ON IP.ServerID = S.ServerID LEFT JOIN PackageIPAddresses AS PA ON IP.AddressID = PA.AddressID LEFT JOIN ServiceItems SI ON PA.ItemId = SI.ItemID LEFT JOIN dbo.Packages P ON PA.PackageID = P.PackageID LEFT JOIN dbo.Users U ON P.UserID = U.UserID WHERE ' + @condition + ' DECLARE @Addresses AS TABLE ( AddressID int ); WITH TempItems AS ( SELECT ROW_NUMBER() OVER (ORDER BY ' + @SortColumn + ') as Row, IP.AddressID FROM dbo.IPAddresses AS IP LEFT JOIN Servers AS S ON IP.ServerID = S.ServerID LEFT JOIN PackageIPAddresses AS PA ON IP.AddressID = PA.AddressID LEFT JOIN ServiceItems SI ON PA.ItemId = SI.ItemID LEFT JOIN dbo.Packages P ON PA.PackageID = P.PackageID LEFT JOIN dbo.Users U ON U.UserID = P.UserID WHERE ' + @condition + ' ) INSERT INTO @Addresses SELECT AddressID FROM TempItems WHERE TempItems.Row BETWEEN @StartRow + 1 and @StartRow + @MaximumRows SELECT IP.AddressID, IP.PoolID, IP.ExternalIP, IP.InternalIP, IP.SubnetMask, IP.DefaultGateway, IP.Comments, IP.VLAN, IP.ServerID, S.ServerName, PA.ItemID, SI.ItemName, PA.PackageID, P.PackageName, P.UserID, U.UserName FROM @Addresses AS TA INNER JOIN dbo.IPAddresses AS IP ON TA.AddressID = IP.AddressID LEFT JOIN Servers AS S ON IP.ServerID = S.ServerID LEFT JOIN PackageIPAddresses AS PA ON IP.AddressID = PA.AddressID LEFT JOIN ServiceItems SI ON PA.ItemId = SI.ItemID LEFT JOIN dbo.Packages P ON PA.PackageID = P.PackageID LEFT JOIN dbo.Users U ON U.UserID = P.UserID ' exec sp_executesql @sql, N'@IsAdmin bit, @PoolID int, @ServerID int, @StartRow int, @MaximumRows int', @IsAdmin, @PoolID, @ServerID, @StartRow, @MaximumRows END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[GetPackageUnassignedIPAddresses] ( @ActorID int, @PackageID int, @OrgID int, @PoolID int = 0 ) AS BEGIN SELECT PIP.PackageAddressID, IP.AddressID, IP.ExternalIP, IP.InternalIP, IP.ServerID, IP.PoolID, PIP.IsPrimary, IP.SubnetMask, IP.DefaultGateway, IP.VLAN FROM PackageIPAddresses AS PIP INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID WHERE PIP.ItemID IS NULL AND PIP.PackageID = @PackageID AND (@PoolID = 0 OR @PoolID <> 0 AND IP.PoolID = @PoolID) AND (@OrgID = 0 OR @OrgID <> 0 AND PIP.OrgID = @OrgID) AND dbo.CheckActorPackageRights(@ActorID, PIP.PackageID) = 1 ORDER BY IP.DefaultGateway, IP.ExternalIP END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[GetPackageIPAddresses] ( @PackageID int, @OrgID int, @FilterColumn nvarchar(50) = '', @FilterValue nvarchar(50) = '', @SortColumn nvarchar(50), @StartRow int, @MaximumRows int, @PoolID int = 0, @Recursive bit = 0 ) AS BEGIN -- start DECLARE @condition nvarchar(700) SET @condition = ' ((@Recursive = 0 AND PA.PackageID = @PackageID) OR (@Recursive = 1 AND dbo.CheckPackageParent(@PackageID, PA.PackageID) = 1)) AND (@PoolID = 0 OR @PoolID <> 0 AND IP.PoolID = @PoolID) AND (@OrgID = 0 OR @OrgID <> 0 AND PA.OrgID = @OrgID) ' IF @FilterValue <> '' AND @FilterValue IS NOT NULL BEGIN IF @FilterColumn <> '' AND @FilterColumn IS NOT NULL SET @condition = @condition + ' AND ' + @FilterColumn + ' LIKE ''' + @FilterValue + '''' ELSE SET @condition = @condition + ' AND (ExternalIP LIKE ''' + @FilterValue + ''' OR InternalIP LIKE ''' + @FilterValue + ''' OR DefaultGateway LIKE ''' + @FilterValue + ''' OR ItemName LIKE ''' + @FilterValue + ''' OR Username LIKE ''' + @FilterValue + ''')' END IF @SortColumn IS NULL OR @SortColumn = '' SET @SortColumn = 'IP.ExternalIP ASC' DECLARE @sql nvarchar(3500) set @sql = ' SELECT COUNT(PA.PackageAddressID) FROM dbo.PackageIPAddresses PA INNER JOIN dbo.IPAddresses AS IP ON PA.AddressID = IP.AddressID INNER JOIN dbo.Packages P ON PA.PackageID = P.PackageID INNER JOIN dbo.Users U ON U.UserID = P.UserID LEFT JOIN ServiceItems SI ON PA.ItemId = SI.ItemID WHERE ' + @condition + ' DECLARE @Addresses AS TABLE ( PackageAddressID int ); WITH TempItems AS ( SELECT ROW_NUMBER() OVER (ORDER BY ' + @SortColumn + ') as Row, PA.PackageAddressID FROM dbo.PackageIPAddresses PA INNER JOIN dbo.IPAddresses AS IP ON PA.AddressID = IP.AddressID INNER JOIN dbo.Packages P ON PA.PackageID = P.PackageID INNER JOIN dbo.Users U ON U.UserID = P.UserID LEFT JOIN ServiceItems SI ON PA.ItemId = SI.ItemID WHERE ' + @condition + ' ) INSERT INTO @Addresses SELECT PackageAddressID FROM TempItems WHERE TempItems.Row BETWEEN @StartRow + 1 and @StartRow + @MaximumRows SELECT PA.PackageAddressID, PA.AddressID, IP.ExternalIP, IP.InternalIP, IP.SubnetMask, IP.DefaultGateway, IP.VLAN, PA.ItemID, SI.ItemName, PA.PackageID, P.PackageName, P.UserID, U.UserName, PA.IsPrimary FROM @Addresses AS TA INNER JOIN dbo.PackageIPAddresses AS PA ON TA.PackageAddressID = PA.PackageAddressID INNER JOIN dbo.IPAddresses AS IP ON PA.AddressID = IP.AddressID INNER JOIN dbo.Packages P ON PA.PackageID = P.PackageID INNER JOIN dbo.Users U ON U.UserID = P.UserID LEFT JOIN ServiceItems SI ON PA.ItemId = SI.ItemID ' print @sql exec sp_executesql @sql, N'@PackageID int, @OrgID int, @StartRow int, @MaximumRows int, @Recursive bit, @PoolID int', @PackageID, @OrgID, @StartRow, @MaximumRows, @Recursive, @PoolID END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[GetPackageIPAddress] @PackageAddressID int AS BEGIN SELECT PA.PackageAddressID, PA.AddressID, IP.ExternalIP, IP.InternalIP, IP.SubnetMask, IP.DefaultGateway, IP.VLAN, PA.ItemID, SI.ItemName, PA.PackageID, P.PackageName, P.UserID, U.UserName, PA.IsPrimary FROM dbo.PackageIPAddresses AS PA INNER JOIN dbo.IPAddresses AS IP ON PA.AddressID = IP.AddressID INNER JOIN dbo.Packages P ON PA.PackageID = P.PackageID INNER JOIN dbo.Users U ON U.UserID = P.UserID LEFT JOIN ServiceItems SI ON PA.ItemId = SI.ItemID WHERE PA.PackageAddressID = @PackageAddressID END GO
the_stack
-- 09.02.2016 18:48 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsBetaFunctionality,IsDirectPrint,IsOneInstanceOnly,IsReport,IsServerProcess,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Statistic_Count,Statistic_Seconds,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,540655,'Y','N',TO_TIMESTAMP('2016-02-09 18:48:12','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y','N','N','N','N','N',0,'ADR Auswertung','N','Y',0,0,'Java',TO_TIMESTAMP('2016-02-09 18:48:12','YYYY-MM-DD HH24:MI:SS'),100,'ADR Auswertung') ; -- 09.02.2016 18:48 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=540655 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 09.02.2016 18:49 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET JasperReport='@PREFIX@de/metas/reports/umsatzreport_adr_bpartner/report.jasper',Updated=TO_TIMESTAMP('2016-02-09 18:49:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540655 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Process_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES ('R',1000000,540680,0,540655,TO_TIMESTAMP('2016-02-09 18:50:43','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','ADR Auswertung','Y','N','N','N','ADR Auswertung',TO_TIMESTAMP('2016-02-09 18:50:43','YYYY-MM-DD HH24:MI:SS'),100) ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=540680 AND NOT EXISTS (SELECT * FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID) ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 540680, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=1000000 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=540680) ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540614 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540616 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540617 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540618 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540619 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540632 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540635 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540637 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540638 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540648 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540674 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540676 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540678 AND AD_Tree_ID=10 ; -- 09.02.2016 18:50 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540680 AND AD_Tree_ID=10 ; -- 09.02.2016 18:55 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,574,0,540655,540887,15,'StartDate',TO_TIMESTAMP('2016-02-09 18:55:48','YYYY-MM-DD HH24:MI:SS'),100,'First effective day (inclusive)','de.metas.fresh',0,'The Start Date indicates the first or starting date','Y','N','Y','N','Y','N','Anfangsdatum',10,TO_TIMESTAMP('2016-02-09 18:55:48','YYYY-MM-DD HH24:MI:SS'),100) ; -- 09.02.2016 18:55 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540887 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 09.02.2016 18:56 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,294,0,540655,540888,15,'EndDate',TO_TIMESTAMP('2016-02-09 18:56:04','YYYY-MM-DD HH24:MI:SS'),100,'Last effective date (inclusive)','de.metas.fresh',0,'The End Date indicates the last date in this range.','Y','N','Y','N','Y','N','Enddatum',20,TO_TIMESTAMP('2016-02-09 18:56:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 09.02.2016 18:56 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540888 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 09.02.2016 18:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Reference_Value_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,1106,0,540655,540889,17,319,'IsSOTrx',TO_TIMESTAMP('2016-02-09 18:59:12','YYYY-MM-DD HH24:MI:SS'),100,'This is a Sales Transaction','de.metas.fresh',0,'The Sales Transaction checkbox indicates if this item is a Sales Transaction.','Y','N','Y','N','N','N','Sales Transaction',30,TO_TIMESTAMP('2016-02-09 18:59:12','YYYY-MM-DD HH24:MI:SS'),100) ; -- 09.02.2016 18:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540889 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 09.02.2016 18:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,187,0,540655,540890,30,'C_BPartner_ID',TO_TIMESTAMP('2016-02-09 18:59:45','YYYY-MM-DD HH24:MI:SS'),100,'Bezeichnet einen Geschäftspartner','de.metas.fresh',0,'Ein Geschäftspartner ist jemand, mit dem Sie interagieren. Dies kann Lieferanten, Kunden, Mitarbeiter oder Handelsvertreter umfassen.','Y','N','Y','N','N','N','Geschäftspartner',40,TO_TIMESTAMP('2016-02-09 18:59:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 09.02.2016 18:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540890 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 09.02.2016 18:59 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET IsAutocomplete='Y',Updated=TO_TIMESTAMP('2016-02-09 18:59:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540890 ; -- 09.02.2016 19:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,2019,0,540655,540891,35,'M_AttributeSetInstance_ID',TO_TIMESTAMP('2016-02-09 19:00:21','YYYY-MM-DD HH24:MI:SS'),100,'Instanz des Merkmals-Satzes zum Produkt','de.metas.fresh',0,'The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.','Y','N','Y','N','N','N','Ausprägung Merkmals-Satz',50,TO_TIMESTAMP('2016-02-09 19:00:21','YYYY-MM-DD HH24:MI:SS'),100) ; -- 09.02.2016 19:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540891 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540614 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540616 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540617 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540618 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540619 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540632 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540635 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540637 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540638 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540648 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540674 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540680 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540676 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540678 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540614 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540616 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540680 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540617 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540618 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540619 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540632 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540635 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540637 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540638 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540648 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540674 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540676 AND AD_Tree_ID=10 ; -- 09.02.2016 19:01 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540678 AND AD_Tree_ID=10 ; -- 09.02.2016 19:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET IsReport='Y',Updated=TO_TIMESTAMP('2016-02-09 19:03:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540655 ; -- 09.02.2016 19:05 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Value='ADR Auswertung (Jasper)',Updated=TO_TIMESTAMP('2016-02-09 19:05:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540655 ; -- 09.02.2016 19:06 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Classname='org.compiere.report.ReportStarter',Updated=TO_TIMESTAMP('2016-02-09 19:06:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540655 ; -- 09.02.2016 19:11 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Menu_Trl WHERE AD_Menu_ID=540680 ; -- 09.02.2016 19:11 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Menu WHERE AD_Menu_ID=540680 ; -- 09.02.2016 19:11 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_TreeNodeMM n WHERE Node_ID=540680 AND EXISTS (SELECT * FROM AD_Tree t WHERE t.AD_Tree_ID=n.AD_Tree_ID AND t.AD_Table_ID=116) ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Process_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES ('R',0,540681,0,540655,TO_TIMESTAMP('2016-02-09 19:14:52','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','ADR Auswertung (Jasper)','Y','N','N','N','ADR Auswertung',TO_TIMESTAMP('2016-02-09 19:14:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=540681 AND NOT EXISTS (SELECT * FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID) ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 540681, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=540681) ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540614 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540616 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540617 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540618 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540619 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540632 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540635 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540637 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540638 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540648 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540674 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540676 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540678 AND AD_Tree_ID=10 ; -- 09.02.2016 19:14 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540681 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540614 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540616 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540681 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540617 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540618 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540619 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540632 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540635 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540637 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540638 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540648 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540674 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540676 AND AD_Tree_ID=10 ; -- 09.02.2016 19:15 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540678 AND AD_Tree_ID=10 ; -- 10.02.2016 17:25 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET IsMandatory='Y',Updated=TO_TIMESTAMP('2016-02-10 17:25:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540889 ; -- 10.02.2016 17:25 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET JasperReport_Tabular='@PREFIX@de/metas/reports/umsatzreport_adr_bpartner/report_TabularView.jasper',Updated=TO_TIMESTAMP('2016-02-10 17:25:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540655 ; -- 10.02.2016 17:49 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Reference_ID=20, AD_Reference_Value_ID=NULL,Updated=TO_TIMESTAMP('2016-02-10 17:49:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540889 ; -- 10.02.2016 17:54 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET IsMandatory='N',Updated=TO_TIMESTAMP('2016-02-10 17:54:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540889 ; -- 10.02.2016 18:47 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Element_ID=NULL, ColumnName='Base_Period_Start', Name='Zeitperiode von',Updated=TO_TIMESTAMP('2016-02-10 18:47:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540887 ; -- 10.02.2016 18:47 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para_Trl SET IsTranslated='N' WHERE AD_Process_Para_ID=540887 ; -- 10.02.2016 18:47 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET Description=NULL, Help=NULL,Updated=TO_TIMESTAMP('2016-02-10 18:47:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540887 ; -- 10.02.2016 18:47 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para_Trl SET IsTranslated='N' WHERE AD_Process_Para_ID=540887 ; -- 10.02.2016 18:47 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Element_ID=NULL, ColumnName='Base_Period_End', Description=NULL, Help=NULL, Name='Zeitperiode bis',Updated=TO_TIMESTAMP('2016-02-10 18:47:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540888 ; -- 10.02.2016 18:47 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para_Trl SET IsTranslated='N' WHERE AD_Process_Para_ID=540888 ;
the_stack
drop table if exists phone_book; create table phone_book ( lname char varying(25), fname char varying(25), state char(2), phone_num bigint ) distributed by (lname); \copy public.phone_book from 'data/phone_book.txt' delimiter as '|' drop table if exists phone_book_substr; create table phone_book_substr ( lname_substr char(3), lname char varying(25), fname char varying(25), state char(2), phone_num bigint ) distributed by (lname_substr); --distributed by (substr(lname,1,2)); insert into phone_book_substr ( lname_substr, lname, fname, state, phone_num ) select substr(lname,1,3), lname, fname, state, phone_num from phone_book order by lname ; analyze phone_book_substr; select count(*) from phone_book_substr ; --17388 --------------------------------------------------------- select lname_substr from phone_book_substr where lname_substr LIKE 'Aa' group by 1 order by 1; --0 Rows. select lname_substr from phone_book_substr where lname_substr LIKE 'A%' group by 1 order by 1; select count(*) from phone_book_substr where lname_substr LIKE 'A%'; --621 select lname_substr from phone_book_substr where lname_substr LIKE '_a_' group by 1 order by 1; select lname_substr from phone_book_substr where lname_substr LIKE '_Z_' group by 1 order by 1; --0 Rows. select lname_substr from phone_book_substr where lname_substr LIKE 'Abd' group by 1 order by 1; --0 Rows. -- ~~ is equivalent to LIKE select count(*) from phone_book_substr where lname_substr ~~ 'A%'; --621 select count(*) from phone_book_substr where lname_substr ~~ '_b_'; --3240 -- ILIKE case sensitive LIKE select count(*) from phone_book_substr where lname_substr ILIKE 'a%'; -- ~~* is equivalent to ILIKE select count(*) from phone_book_substr where lname_substr ~~* 'a%'; --621 select count(*) from phone_book_substr where lname_substr ~~* '_b_'; --3240 -- NOT LIKE select lname_substr from phone_book_substr where lname_substr NOT LIKE 'Z%' group by 1 order by 1; -- !~~ is equivalent to NOT LIKE select count(*) from phone_book_substr where lname_substr !~~ 'A%'; --16767 select count(*) from phone_book_substr where lname_substr !~~ '_A%'; --17388 select count(*) from phone_book_substr where lname_substr !~~ '_b%'; --14148 select count(*) from phone_book_substr where lname_substr !~~ '_B%'; --17388 select count(*) from phone_book_substr where lname_substr !~~ '_b%'; --14148 -- !~~* is equivalent to NOT ILIKE select count(*) from phone_book_substr where lname_substr !~~* 'a%'; --16767 select count(*) from phone_book_substr where lname_substr !~~* '_A%'; --16740 select count(*) from phone_book_substr where lname_substr !~~* '_b%'; --14148 select count(*) from phone_book_substr where lname_substr !~~* '_B%'; --14148 select count(*) from phone_book_substr where lname_substr !~~* '_B_'; --14148 select count(*) from phone_book_substr where lname_substr !~~* '_b_'; --14148 -- ARRAY --select array(select fname -- from phone_book_substr -- where lname_substr LIKE '%y%'); --select count(*) --from phone_book_substr --; --17388 --------------------------------------------------------- -- ILIKE case sensitive LIKE select count(*) from phone_book_substr where lname_substr ILIKE 'a%'; --621 select count(*) from phone_book_substr where lname_substr ILIKE 'A%'; --621 select count(*) from phone_book_substr where lname_substr ILIKE 'Aa'; --0 select count(*) from phone_book_substr where lname_substr ILIKE '_a_'; --648 select count(*) from phone_book_substr where lname_substr ILIKE '_Z_'; --0 select count(*) from phone_book_substr where lname_substr ILIKE 'Abd'; --0 --select count(*) --from phone_book_substr --; --17388 --------------------------------------------------------- -- NOT SIMILAR TO -- | is equivalent to LOGICAL "OR" select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO '(A|B)%'; --16146 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO 'A%'; --16767 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO 'B%'; --16767 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO 'A%' AND lname_substr NOT SIMILAR TO 'B%'; --16146 ------------------------------------------- -- * denotes repetition of the previous item zero or more times. select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO '(A|B)*'; --17388 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO 'A*'; --17388 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO 'B*'; --17388 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO 'A*' AND lname_substr NOT SIMILAR TO 'B*'; --17388 ------------------------------------------- -- + denotes repetition of the previous item zero or more times. select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO '(A|B)+'; --17388 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO 'A+'; --17388 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO 'B+'; --17388 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO 'A+' AND lname_substr NOT SIMILAR TO 'B+'; --17388 ------------------------------------------- -- [...] denotes specifies a character class. select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO '([A...]|[B...])'; --17388 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO '[A...]'; --17388 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO '[B...]'; --17388 select count(*) from phone_book_substr where lname_substr NOT SIMILAR TO '[A...]' AND lname_substr NOT SIMILAR TO '[B...]'; --17388 --select count(*) --from phone_book_substr --; --17388 --------------------------------------------------------- -- ~~ is equivalent to LIKE select count(*) from phone_book_substr where lname_substr !~~ 'A%'; --16767 select count(*) from phone_book_substr where lname_substr !~~ '_A%'; --17388 select count(*) from phone_book_substr where lname_substr !~~ '_b%'; --14148 select count(*) from phone_book_substr where lname_substr !~~ '_B%'; --17388 select count(*) from phone_book_substr where lname_substr !~~ 'B%'; --16767 select count(*) from phone_book_substr where lname_substr !~~ '_b_'; --14148 ----------------------------------------------------------------- ---substring(string from pattern for escape character) -- provides extraction of a substring that matches a SQL -- regular expression. To indicate the part of the pattern -- that should be returned on success, the pattern must -- contain two occurrences of the escape character -- followed by a double quote ("). The -- text matching the portion of the pattern between these markers -- is returned. ---------------------------------------------------------- SELECT SUBSTRING('XY1234Z', 'Y*([0-9]{1,3})'); -- substring ----------- -- 123 --(1 row) SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})'); -- substring ----------- -- 1 --(1 row) ---------------------------------------------------------- ---------------------------------------------------------- --select substring(lname from '%#"Z_y#"%' for '#') IS NOT NULL --from phone_book_substr --where substring(lname from '%#"Z_y#"%' for '#') IS NOT NULL --; -- returns 27 rows. -- lname | substring -----------+----------- -- Zdygahd | Zdy select lname, substring(lname from '%#"Z_yg_h#"%' for '#') from phone_book_substr where substring(lname from '%#"Z_yg_h#"%' for '#') IS NOT NULL ; -- returns 27 rows. -- lname | substring ---------+----------- -- Zdygahd | Zdy --select lname, substring(lname from '%\\"Z_yg_h\\"%' for '\\') --from phone_book_substr --where substring(lname from '%\\"Z_yg_h\\"%' for '\\') IS NOT NULL --; -- returns 27 rows. -- lname | substring ---------+----------- -- Zdygahd | Zdy --select DISTINCT lname, substring(lname from '%\\"__yg_h\\"%' for '\\') --from phone_book_substr --where substring(lname from '%\\"__yg_h\\"%' for '\\') IS NOT NULL --; --dygahd | Adygah -- Bdygahd | Bdygah -- Cdygahd | Cdygah -- Ddygahd | Ddygah -- Edygahd | Edygah -- Fdygahd | Fdygah -- Gdygahd | Gdygah -- Hdygahd | Hdygah -- Idygahd | Idygah -- Jdygahd | Jdygah -- Kdygahd | Kdygah -- Keygahd | Keygah -- Ldygahd | Ldygah -- Liygahd | Liygah -- Mdygahd | Mdygah -- Moygahd | Moygah -- Ndygahd | Ndygah -- Nuygahd | Nuygah -- Odygahd | Odygah -- Pdygahd | Pdygah -- Rdygahd | Rdygah -- Sdygahd | Sdygah -- Udygahd | Udygah -- Gdygahd | Gdygah -- Hdygahd | Hdygah -- Idygahd | Idygah -- Jdygahd | Jdygah -- Kdygahd | Kdygah -- Keygahd | Keygah -- Ldygahd | Ldygah -- Liygahd | Liygah -- Mdygahd | Mdygah -- Moygahd | Moygah -- Ndygahd | Ndygah -- Nuygahd | Nuygah -- Odygahd | Odygah -- Pdygahd | Pdygah -- Rdygahd | Rdygah -- Sdygahd | Sdygah -- Udygahd | Udygah -- Vdygahd | Vdygah -- Wdygahd | Wdygah -- Xdygahd | Xdygah -- Ydygahd | Ydygah -- Zdygahd | Zdygah ------------------------------------------------------------------------ -- The function regexp_replace: Regular Expression Replace. -- The syntax for regexp_replace is -- regexp_replace(source, pattern, replacement[,flags]) -- The syntax is reg ------------------------------------------------------------------------ select regexp_replace('foobarbaz', 'b..', 'X'); -- regexp_replace ---------------- -- fooXbaz --(1 row) select regexp_replace('foobarbaz', 'b..', 'X', 'g'); -- regexp_replace ---------------- -- fooXX --(1 row) --select regexp_replace('foobarbaz', 'b(..)', E'X\\1Y', 'g'); -- regexp_replace ---------------- -- fooXarYXazY --(1 row) select regexp_replace('Zdygahd', 'yg','GY') ; -- regexp_replace ---------------- -- ZdGYahd --(1 row) select DISTINCT lname, regexp_replace(lname, '...g..','G') from phone_book_substr order by lname ; -- lname | regexp_replace ---------+---------------- -- Aadgahd | Gd -- Abegahd | Gd -- Abfgahd | Gd -- Abggahd | Gd -- Abhgahd | Gd -- Abigahd | Gd --............. --.............. -- Zdugahd | Gd -- Zdvgahd | Gd -- Zdwgahd | Gd -- Zdxgahd | Gd -- Zdygahd | Gd -- Zdzgahd | Gd --(644 rows) select DISTINCT lname, regexp_replace(lname, '...g...','G') from phone_book_substr order by lname ; -- lname | regexp_replace -----------+---------------- -- Aadgahd | G -- Abegahd | G -- Abfgahd | G --............... --............... -- Zdxgahd | G -- Zdygahd | G -- Zdzgahd | G --(644 rows) select DISTINCT lname, regexp_replace(lname, '...g...','...G...') from phone_book_substr order by lname ; -- lname | regexp_replace -----------+---------------- -- Aadgahd | ...G... -- Abegahd | ...G... --............... --............... -- Zdxgahd | ...G... -- Zdygahd | ...G... -- Zdzgahd | ...G... --(644 rows) select DISTINCT lname, regexp_replace(lname, 'A..g..d','a..G..D') from phone_book_substr order by lname ; -- lname | regexp_replace -----------+---------------- -- Aadgahd | a..G..D -- Abegahd | a..G..D -- Abfgahd | a..G..D --............... --............... -- Adzgahd | a..G..D -- Badgahd | Badgahd -- Bbegahd | Bbegahd --............... --............... -- Zdxgahd | Zdxgahd -- Zdygahd | Zdygahd -- Zdzgahd | Zdzgahd --(644 rows) select DISTINCT lname, regexp_replace(lname, 'a','Z','ig') from phone_book_substr order by lname ; -- replaces 'a' with 'Z' globally. The matching is case-insensitive. -- flag 'g' is global replacement and flag 'i' is for matching -- case-insensitive. -- lname | regexp_replace -----------+---------------- -- Aadgahd | ZZdgZhd -- Abegahd | ZbegZhd -- Abfgahd | ZbfgZhd -- Abggahd | ZbggZhd --................... --................... -- Zdwgahd | ZdwgZhd -- Zdxgahd | ZdxgZhd -- Zdygahd | ZdygZhd -- Zdzgahd | ZdzgZhd --(644 rows) -- match 3rd occurance of 'a' (parenthesized subrexpression of the -- pattern should be inserted.) and replace it with 'Z' -- \& indicates that the substring matching the entire pattern -- shouldbeisered. --select DISTINCT lname, regexp_replace(lname, 'a(..)','\\3\\&Z','g') --from phone_book_substr --; -- lname | regexp_replace -----------+---------------- -- Aadgahd | AadgZahdZ -- Abegahd | AbegahdZ -- Abfgahd | AbfgahdZ --................... --................... -- Zdwgahd | ZdwgahdZ -- Zdxgahd | ZdxgahdZ -- Zdygahd | ZdygahdZ -- Zdzgahd | ZdzgahdZ --(644 rows) --select DISTINCT lname, regexp_replace(lname, 'yg','GY') --from phone_book_substr --where substring(lname from '%\\"yg\\"%' for '\\') IS NOT NULL --; -- lname | regexp_replace -----------+---------------- -- Adygahd | AdGYahd -- Bdygahd | BdGYahd -- Cdygahd | CdGYahd -- Ddygahd | DdGYahd -- Edygahd | EdGYahd --.................. --.................. -- Udygahd | UdGYahd -- Vdygahd | VdGYahd -- Wdygahd | WdGYahd -- Xdygahd | XdGYahd -- Ydygahd | YdGYahd -- Zdygahd | ZdGYahd --(28 rows) --select DISTINCT lname, regexp_replace(lname, 'yg.h.','GY') --from phone_book_substr --where substring(lname from '%\\"yg_h\\"%' for '\\') IS NOT NULL --; -- lname | regexp_replace -----------+---------------- -- Adygahd | AdGY -- Bdygahd | BdGY -- Cdygahd | CdGY -- Ddygahd | DdGY --........................ --........................ -- Wdygahd | WdGY -- Xdygahd | XdGY -- Ydygahd | YdGY -- Zdygahd | ZdGY --(28 rows) ----------------------------------------------------------------------- SELECT regexp_matches('foobarbequebaz', '(bar)(beque)'); -- regexp_matches ---------------- -- {bar,beque} --(1 row) SELECT regexp_matches('foobarbequebazilbarfbonk', '(b[^b]+)(b[^b]+)', 'g'); -- regexp_matches ---------------- -- {bar,beque} -- {bazil,barf} --(2 rows) SELECT regexp_matches('foobarbequebaz', 'barbeque'); -- regexp_matches ---------------- -- {barbeque} --(1 row) select regexp_matches('Aadgahd', '(ad)'); -- regexp_matches ---------------- -- {ad} --(1 row) select DISTINCT lname, regexp_matches(lname, 'yg') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Adygahd | {yg} -- Bdygahd | {yg} -- Cdygahd | {yg} -- Ddygahd | {yg} -- Edygahd | {yg} -- .............. -- .............. -- Vdygahd | {yg} -- Wdygahd | {yg} -- Xdygahd | {yg} -- Ydygahd | {yg} -- Zdygahd | {yg} --(28 rows) select DISTINCT lname, regexp_matches(lname, 'z_y') from phone_book_substr ; -- lname | regexp_matches -------+---------------- --(0 rows) select DISTINCT lname, regexp_matches(lname, 'z') from phone_book_substr order by lname; -- lname | regexp_matches ---------+---------------- -- Adzgahd | {z} -- Bdzgahd | {z} -- Cdzgahd | {z} -- Ddzgahd | {z} --.............. --.............. -- Wdzgahd | {z} -- Xdzgahd | {z} -- Ydzgahd | {z} -- Zdzgahd | {z} --(28 rows) select DISTINCT lname, regexp_matches(lname, 'Z') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Zadgahd | {Z} -- Zbegahd | {Z} -- Zbfgahd | {Z} -- Zbggahd | {Z} --.............. --.............. -- Zdxgahd | {Z} -- Zdygahd | {Z} -- Zdzgahd | {Z} --(23 rows) select DISTINCT lname, regexp_matches(lname, 'W') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Wadgahd | {W} -- Wbegahd | {W} -- Wbfgahd | {W} -- Wbggahd | {W} --.............. --.............. -- Wdxgahd | {W} -- Wdygahd | {W} -- Wdzgahd | {W} --(23 rows) select DISTINCT lname, regexp_matches(lname, '^W') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Wadgahd | {W} -- Wbegahd | {W} -- Wbfgahd | {W} --............. --.............. -- Wdxgahd | {W} -- Wdygahd | {W} -- Wdzgahd | {W} --(23 rows) select DISTINCT lname, regexp_matches(lname, '^W_x') from phone_book_substr ; -- lname | regexp_matches -------+---------------- --(0 rows) select DISTINCT lname, regexp_matches(lname, '^W_x____') from phone_book_substr ; -- lname | regexp_matches -------+---------------- --(0 rows) select DISTINCT lname, regexp_matches(lname, '^W_x*') from phone_book_substr ; -- lname | regexp_matches -------+---------------- --(0 rows) select DISTINCT lname, regexp_matches(lname, '^W_x$d') from phone_book_substr ; -- lname | regexp_matches -------+---------------- --(0 rows) select DISTINCT lname, regexp_matches(lname, '(dad)') from phone_book_substr ; -- lname | regexp_matches -------+---------------- --(0 rows) --Changed to First Name from Last Name. select DISTINCT fname, regexp_matches(fname, '(dad)') from phone_book_substr order by lname; -- fname | regexp_matches ---------+---------------- -- Aahdadj | {dad} -- Abhdadj | {dad} -- Achdadj | {dad} -- Adhdadj | {dad} --................ --................ -- Zuhdadj | {dad} -- Zwhdadj | {dad} -- Zxhdadj | {dad} -- Zyhdadj | {dad} --(377 rows) select DISTINCT fname, regexp_matches(fname, '(uh)(ad)') from phone_book_substr ; -- fname | regexp_matches -------+---------------- --(0 rows) select DISTINCT fname, regexp_matches(fname, '(uh)(dad)') from phone_book_substr order by fname; -- fname | regexp_matches -----------+---------------- -- Auhdadj | {uh,dad} -- Buhdadj | {uh,dad} -- Duhdadj | {uh,dad} --................... --................... -- Xuhdadj | {uh,dad} -- Yuhdadj | {uh,dad} -- Zuhdadj | {uh,dad} --(19 rows) select DISTINCT fname, regexp_matches(fname, '(uhdad)') from phone_book_substr order by fname; -- fname | regexp_matches -----------+---------------- -- Auhdadj | {uhdad} -- Buhdadj | {uhdad} -- Duhdadj | {uhdad} --.................. --.................. -- Xuhdadj | {uhdad} -- Yuhdadj | {uhdad} -- Zuhdadj | {uhdad} --(19 rows) select DISTINCT fname, regexp_matches(fname, '(y)','i') from phone_book_substr order by fname; -- fname | regexp_matches -----------+---------------- -- Ayhdadj | {y} -- Byhdadj | {y} -- Dyhdadj | {y} --.............. --.............. -- Vyhdadj | {y} -- Xyhdadj | {y} -- Yahdadj | {Y} -- Ybhdadj | {Y} -- Ychdadj | {Y} -- Ydhdadj | {Y} --.............. --.............. -- Yxhdadj | {Y} -- Yyhdadj | {Y} -- Zyhdadj | {y} --(33 rows) select DISTINCT fname, regexp_matches(fname, '(y|h)','i') from phone_book_substr order by fname; -- fname | regexp_matches -----------+---------------- -- Aahdadj | {h} -- Abhdadj | {h} --.............. -- Bghdadj | {h} -- Bihdadj | {h} --.............. -- Yxhdadj | {Y} -- Yyhdadj | {Y} -- Zahdadj | {h} --.............. -- Zxhdadj | {h} -- Zyhdadj | {y} --(377 rows) -- --Exactly one match {1} select DISTINCT fname, regexp_matches(fname, '(y|h){1}','i') from phone_book_substr order by fname; -- fname | regexp_matches -----------+---------------- -- Aahdadj | {h} -- Abhdadj | {h} -- Achdadj | {h} -- Adhdadj | {h} --.............. -- Vyhdadj | {y} -- Wahdadj | {h} --.............. -- Xwhdadj | {h} -- Xxhdadj | {h} -- Xyhdadj | {y} -- Yahdadj | {Y} --.............. -- Yxhdadj | {Y} -- Yyhdadj | {Y} -- Zahdadj | {h} --.............. -- Zwhdadj | {h} -- Zxhdadj | {h} -- Zyhdadj | {y} --(377 rows) select DISTINCT fname, regexp_matches(fname, '(W){2}','i') from phone_book_substr ; -- fname | regexp_matches -------+---------------- --(0 rows) --Exactly two consecutive matches {2}. --Is this right? select DISTINCT fname, regexp_matches(fname, '(d){2}','i') from phone_book_substr ; -- fname | regexp_matches ---------+---------------- -- Ddhdadj | {d} --(1 row) --One or more but not more than two. --Is this right? select DISTINCT fname, regexp_matches(fname, '(d){1,2}','i') from phone_book_substr order by fname; -- fname | regexp_matches ---------+---------------- -- Aahdadj | {d} -- Abhdadj | {d} -- Achdadj | {d} --.............. -- Dahdadj | {D} -- Dbhdadj | {D} -- Dchdadj | {D} -- Ddhdadj | {d} -- Dehdadj | {D} -- Dfhdadj | {D} --.............. -- Zwhdadj | {d} -- Zxhdadj | {d} -- Zyhdadj | {d} --(424 rows) -- --Two or more matches {2,} select DISTINCT lname, regexp_matches(lname, '(d){2,}','i') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Ddsgahd | {d} -- Ddtgahd | {d} -- Ddugahd | {d} -- Ddvgahd | {d} -- Ddwgahd | {d} -- Ddxgahd | {d} -- Ddygahd | {d} -- Ddzgahd | {d} --(8 rows) -- --3 or more matches. --Is this right? select DISTINCT lname, regexp_matches(lname, '(d){3,}','i') from phone_book_substr ; -- lname | regexp_matches -------+---------------- --(0 rows) --Exactly 3 matches select DISTINCT lname, regexp_matches(lname, '(d){3}','i') from phone_book_substr ; -- lname | regexp_matches -------+---------------- --(0 rows) --Two or more but not more than 3 matches. select DISTINCT lname, regexp_matches(lname, '(d){2,3}','i') from phone_book_substr order by lname; -- lname | regexp_matches ---------+---------------- -- Ddsgahd | {d} -- Ddtgahd | {d} -- Ddugahd | {d} -- Ddvgahd | {d} -- Ddwgahd | {d} -- Ddxgahd | {d} -- Ddygahd | {d} -- Ddzgahd | {d} --(8 rows) -- --One or more but not more than 2 matches. --Is this right? select DISTINCT lname, regexp_matches(lname, '(d){1,2}','i') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Aadgahd | {d} -- Abegahd | {d} -- Abfgahd | {d} --.............. -- Ddvgahd | {d} -- Ddwgahd | {d} -- Ddxgahd | {d} --.............. -- Zdxgahd | {d} -- Zdygahd | {d} -- Zdzgahd | {d} --(644 rows) select DISTINCT lname, regexp_matches(lname, '(d.d)','i') from phone_book_substr ; -- lname | regexp_matches ---------+---------------- -- Dadgahd | {Dad} --(1 row) select DISTINCT lname, regexp_matches(lname, '(g.h)', 'i') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Aadgahd | {gah} -- Abegahd | {gah} -- Abfgahd | {gah} --................ -- Zdxgahd | {gah} -- Zdygahd | {gah} -- Zdzgahd | {gah} --(644 rows) select DISTINCT lname, regexp_matches(lname, '[zh]', 'i') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Aadgahd | {h} -- Abegahd | {h} -- Abfgahd | {h} --.............. -- Gdygahd | {h} -- Gdzgahd | {z} -- Hadgahd | {H} -- Hbegahd | {H} --.............. -- Ydygahd | {h} -- Ydzgahd | {z} -- Zadgahd | {Z} --.............. -- Zdxgahd | {Z} -- Zdygahd | {Z} -- Zdzgahd | {Z} --(644 rows) select DISTINCT fname, regexp_matches(fname, '(h){2}','i') from phone_book_substr ; -- fname | regexp_matches -------+---------------- --(0 rows) --Two or more matches. select DISTINCT lname, regexp_matches(lname, '(h){2,}','i') from phone_book_substr ; -- lname | regexp_matches -------+---------------- --(0 rows) select DISTINCT fname, regexp_matches(fname, '(x){2}','i') from phone_book_substr ; -- fname | regexp_matches -----------+---------------- -- Xxhdadj | {x} --(1 row) select DISTINCT fname, regexp_matches(fname, '(x){3}','i') from phone_book_substr ; -- fname | regexp_matches -------+---------------- --(0 rows) select DISTINCT lname, regexp_matches(lname, '(c){2}','i') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Ccjgahd | {c} -- Cckgahd | {c} -- Cclgahd | {c} -- Ccmgahd | {c} -- Ccngahd | {c} -- Ccogahd | {c} -- Ccpgahd | {c} -- Ccqgahd | {c} -- Ccrgahd | {c} --(9 rows) ----------------------------------------------------------------------- --Constraints ----------- --re - Regular Expression. --Constraint Description -------------------------------------------------------------------------- -- ^ matches at the beginning of the string -- $ matches at the end of the string -- (?=re) positive lookahead matches at any point where a substring matching -- re begins (AREs only) -- (?!re) negative lookahead matches at any point where no substring matching -- re begins (AREs only) ----------------------------------------------------------------------- select DISTINCT lname, regexp_matches(lname, '^z', 'i') from phone_book_substr order by lname; -- lname | regexp_matches -----------+---------------- -- Zadgahd | {Z} -- Zbegahd | {Z} --.............. -- Zdygahd | {Z} -- Zdzgahd | {Z} --(23 rows) select DISTINCT lname, regexp_matches(lname, '$z', 'i') from phone_book_substr; -- lname | regexp_matches -------+---------------- --(0 rows) select DISTINCT lname, regexp_matches(lname, 'z$') from phone_book_substr; -- lname | regexp_matches -------+---------------- --(0 rows) select DISTINCT lname, regexp_matches(lname, 'd$') from phone_book_substr order by lname; -- lname | regexp_matches ---------+---------------- -- Aadgahd | {d} -- Abegahd | {d} -- Abfgahd | {d} --................ -- Zdygahd | {d} -- Zdzgahd | {d} --(644 rows) -- --(?=re) positive lookahead matches at any point where a substring matching -- re begins (AREs only) --select DISTINCT lname, regexp_matches(lname, '(?=zd)', 'i') from phone_book_substr; -- lname | regexp_matches -----------+---------------- -- Zdsgahd | {""} -- Zdtgahd | {""} -- Zdugahd | {""} -- Zdvgahd | {""} -- Zdwgahd | {""} -- Zdxgahd | {""} -- Zdygahd | {""} -- Zdzgahd | {""} --(8 rows) --select DISTINCT lname, regexp_matches(lname, '(?=wg)', 'i') from phone_book_substr; -- lname | regexp_matches -----------+---------------- -- Adwgahd | {""} -- Bdwgahd | {""} --................ -- Xdwgahd | {""} -- Ydwgahd | {""} -- Zdwgahd | {""} --(28 rows) --select DISTINCT lname, regexp_matches(lname, '(?=Ad)', 'i') from phone_book_substr; -- lname | regexp_matches -----------+---------------- -- Aadgahd | {""} -- Adsgahd | {""} -- Adtgahd | {""} --................ -- Yadgahd | {""} -- Zadgahd | {""} --(32 rows) -- -- --(?!re) negative lookahead matches at any point where no substring matching -- re begins (AREs only) --select DISTINCT lname, regexp_matches(lname, '(?!Ad)', 'i') from phone_book_substr; -- lname | regexp_matches -----------+---------------- -- Aadgahd | {""} -- Abegahd | {""} --............... -- Zdygahd | {""} -- Zdzgahd | {""} --(644 rows) --select DISTINCT lname, regexp_matches(lname, '(?!hd)', 'i') from phone_book_substr; -- lname | regexp_matches -----------+---------------- -- Aadgahd | {""} -- Abegahd | {""} --............... -- Zdxgahd | {""} -- Zdygahd | {""} -- Zdzgahd | {""} --(644 rows) ----------------------------------------------------------------------- ----------------------------------------------------------------------- --where substring(lname from '%\\"yg\\"%' for '\\') IS NOT NULL --; ----------------------------------------------------------------------- -- Function regexp_split_to_table returns all the captured substrings -- that match with the pattern. -- select regexp_split_to_table(string, pattern [,flags])'); -- this function splits a string using a POSIX regular expression -- pattern as a delimiter. select foo from regexp_split_to_table('the quick brown fox jumped over the lazy dog',E'\\\s+') AS foo; SELECT foo FROM regexp_split_to_table('the quick brown fox', E'\\s*') AS foo; ----------------------------------------------------------------------- ---------------------------------------------------------- ---substring(string from pattern for escape character) -- provides extraction of a substring that matches a SQL -- regular expression. To indicate the part of the pattern -- that should be returned on success, the pattern must -- contain two occurrences of the escape character -- followed by a double quote ("). The -- text matching the portion of the pattern between these markers -- is returned. ---------------------------------------------------------- select substring('foobar' from 'foo'); --returns foo select substring('foobar' from 'oba'); --returns oba select substring('foobar' from 'oo%'); --returns nothing --select substring('foobar' from '%"o_b#"%' for '#'); --returns nothing select substring('foobar' from '%#"o_b#"%' for '#'); --returns oob select count(substring(lname from '%#"o_b#"%' for '#')) from phone_book_substr; --0 select count(substring(lname from '%#"Ab#"%' for '#')) from phone_book_substr; --135 select substring(lname from '%#"Ab#"%' for '#') from phone_book_substr where substring(lname from '%#"Ab#"%' for '#') IS NOT NULL; --returns 'Ab' 135 times. select substring(lname from '%#"Zd#"%' for '#') from phone_book_substr where substring(lname from '%#"Zd#"%' for '#') IS NOT NULL ; --returns 'Zd' 216 times. select substring(lname from '%#"Z_k#"%' for '#') from phone_book_substr where substring(lname from '%#"Z_k#"%' for '#') IS NOT NULL ; --returns 'Zck' 27 times. select lname, substring(lname from '%#"Z_y#"%' for '#') from phone_book_substr where substring(lname from '%#"Z_y#"%' for '#') IS NOT NULL ; -- returns 27 rows. -- lname | substring ---------+----------- -- Zdygahd | Zdy select lname, substring(lname from '%#"Z_yg_h#"%' for '#') from phone_book_substr where substring(lname from '%#"Z_yg_h#"%' for '#') IS NOT NULL ; -- returns 27 rows. -- lname | substring ---------+----------- -- Zdygahd | Zdy --select lname, substring(lname from '%\\"Z_yg_h\\"%' for '\\') --from phone_book_substr --where substring(lname from '%\\"Z_yg_h\\"%' for '\\') IS NOT NULL --; -- returns 27 rows. -- lname | substring ---------+----------- -- Zdygahd | Zdy --select DISTINCT lname, substring(lname from '%\\"__yg_h\\"%' for '\\') --from phone_book_substr --where substring(lname from '%\\"__yg_h\\"%' for '\\') IS NOT NULL --; --dygahd | Adygah -- Bdygahd | Bdygah -- Cdygahd | Cdygah -- Ddygahd | Ddygah -- Edygahd | Edygah -- Fdygahd | Fdygah -- Gdygahd | Gdygah -- Hdygahd | Hdygah -- Idygahd | Idygah -- Jdygahd | Jdygah -- Kdygahd | Kdygah -- Keygahd | Keygah -- Ldygahd | Ldygah -- Liygahd | Liygah -- Mdygahd | Mdygah -- Moygahd | Moygah -- Ndygahd | Ndygah -- Nuygahd | Nuygah -- Odygahd | Odygah -- Pdygahd | Pdygah -- Rdygahd | Rdygah -- Sdygahd | Sdygah -- Udygahd | Udygah -- Gdygahd | Gdygah -- Hdygahd | Hdygah -- Idygahd | Idygah -- Jdygahd | Jdygah -- Kdygahd | Kdygah -- Keygahd | Keygah -- Ldygahd | Ldygah -- Liygahd | Liygah -- Mdygahd | Mdygah -- Moygahd | Moygah -- Ndygahd | Ndygah -- Nuygahd | Nuygah -- Odygahd | Odygah -- Pdygahd | Pdygah -- Rdygahd | Rdygah -- Sdygahd | Sdygah -- Udygahd | Udygah -- Vdygahd | Vdygah -- Wdygahd | Wdygah -- Xdygahd | Xdygah -- Ydygahd | Ydygah -- Zdygahd | Zdygah select count(*) from phone_book_substr ; --17388 --------------------------------------------------------- select lname_substr from phone_book_substr where lname_substr LIKE 'Aa' group by 1 order by 1; --0 Rows. select lname_substr from phone_book_substr where lname_substr LIKE 'A%' group by 1 order by 1; select count(*) from phone_book_substr where lname_substr LIKE 'A%'; --621 select lname_substr from phone_book_substr where lname_substr LIKE '_a_' group by 1 order by 1; select lname_substr from phone_book_substr where lname_substr LIKE '_Z_' group by 1 order by 1; --0 Rows. select lname_substr from phone_book_substr where lname_substr LIKE 'Abd' group by 1 order by 1; --0 Rows. -- ~~ is equivalent to LIKE select count(*) from phone_book_substr where lname_substr ~~ 'A%'; --621 select count(*) from phone_book_substr where lname_substr ~~ '_b_'; --3240 -- ILIKE case sensitive LIKE select count(*) from phone_book_substr where lname_substr ILIKE 'a%'; -- ~~* is equivalent to ILIKE select count(*) from phone_book_substr where lname_substr ~~* 'a%'; --621 select count(*) from phone_book_substr where lname_substr ~~* '_b_'; --3240 -- NOT LIKE select lname_substr from phone_book_substr where lname_substr NOT LIKE 'Z%' group by 1 order by 1; -- !~~ is equivalent to NOT LIKE select count(*) from phone_book_substr where lname_substr !~~ 'A%'; --16767 select count(*) from phone_book_substr where lname_substr !~~ '_A%'; --17388 select count(*) from phone_book_substr where lname_substr !~~ '_b%'; --14148 select count(*) from phone_book_substr where lname_substr !~~ '_B%'; --17388 select count(*) from phone_book_substr where lname_substr !~~ '_b%'; --14148 -- !~~* is equivalent to NOT ILIKE select count(*) from phone_book_substr where lname_substr !~~* 'a%'; --16767 select count(*) from phone_book_substr where lname_substr !~~* '_A%'; --16740 select count(*) from phone_book_substr where lname_substr !~~* '_b%'; --14148 select count(*) from phone_book_substr where lname_substr !~~* '_B%'; --14148 select count(*) from phone_book_substr where lname_substr !~~* '_B_'; --14148 select count(*) from phone_book_substr where lname_substr !~~* '_b_'; --14148 -- ARRAY --select array(select fname -- from phone_book_substr -- where lname_substr LIKE '%y%'); select lname_substr from phone_book_substr where lname_substr similar to '(A|B)%' group by 1 order by 1; select lname_substr from phone_book_substr where lname_substr similar to '(A|B)%' group by 1 order by 1; --select array(select fname -- from phone_book_substr -- where lname_substr like '%y%'); select lname_substr from phone_book_substr where lname_substr like 'A%' group by 1 order by 1; select lname_substr from phone_book_substr where lname_substr similar to '(A|B)%' group by 1 order by 1; drop table phone_book; drop table phone_book_substr;
the_stack
IF NOT EXISTS (SELECT * FROM sys.change_tracking_databases WHERE database_id=DB_ID('AXDB_Source')) BEGIN ALTER DATABASE AXDB_Source SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 2 DAYS, AUTO_CLEANUP = ON) END /***** Creating schema sqltosql *****/ IF NOT EXISTS ( SELECT * FROM sys.schemas WHERE name = N'sqltosql' ) EXEC('CREATE SCHEMA [sqltosql]'); GO /****** Object: Table [sqltosql].[SQLToSQLDATASYNCSETUP] Script Date: 4/6/2021 12:37:59 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME='SQLToSQLDATASYNCSETUP' AND XTYPE='U') CREATE TABLE [sqltosql].[SQLToSQLDATASYNCSETUP]( [TABLENAME] [varchar](200) NOT NULL, [TARGETTABLENAME] [varchar](200) NOT NULL, [CHANGEVERSION] [bigint] NOT NULL, [PUBLISHED] [int] NULL, [STATUS] [int] NULL, [CREATEDDATETIME] [datetime] NULL, [MODIFIEDDATETIME] [datetime] NULL, [FULLEXPORTSCRIPT] [nvarchar](max) NULL, [INCREMENTALEXPORTSCRIPT] [nvarchar](max) NULL, [PRIMARYINDEXCOLUMNS] [nvarchar](max) NULL, CONSTRAINT [PK_SQLToSQLDATASYNCSETUP_TABLENAME] PRIMARY KEY CLUSTERED ( [TABLENAME] ASC )WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY], CONSTRAINT [AK_SQLToSQLDATASYNCSETUP_TARGETTABLENAME] UNIQUE NONCLUSTERED ( [TARGETTABLENAME] ASC )WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO /****** Object: UserDefinedFunction [sqltosql].[SQLToSQL_GenerateFieldList] Script Date: 4/6/2021 12:47:26 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER FUNCTION [sqltosql].[SQLToSQL_GenerateFieldList] ( @SOURCETABLENAME VARCHAR(200) ) RETURNS VARCHAR(MAX) AS BEGIN Declare @Schema nvarchar(100) ; Declare @TableName nvarchar(100) ; set @Schema = left(@SOURCETABLENAME,CHARINDEX('.', @SOURCETABLENAME)-1) set @TableName = right(@SOURCETABLENAME,len(@SOURCETABLENAME) - CHARINDEX('.',@SOURCETABLENAME)) DECLARE @Columns VARCHAR(max) select @Columns = COALESCE(@Columns + ', ', '') + C.COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS c where c.TABLE_NAME = @TableName and c.TABLE_SCHEMA = @Schema and DATA_TYPE not in ('xml', 'varbinary', 'binary') order by C.COLUMN_NAME ASC return @Columns End GO /****** Object: UserDefinedFunction [sqltosql].[SQLToSQL_GetCTFieldList] Script Date: 4/6/2021 12:47:53 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER FUNCTION [sqltosql].[SQLToSQL_GetCTFieldList] ( @SOURCETABLENAME VARCHAR(50), @SOURCEALIAS varchar(20) = 'SOURCE', @CTALIAS varchar(20) = 'CT' ) RETURNS VARCHAR(MAX) AS BEGIN Declare @Schema nvarchar(100) ; Declare @TableName nvarchar(100) ; set @Schema = left(@SOURCETABLENAME,CHARINDEX('.', @SOURCETABLENAME)-1) set @TableName = right(@SOURCETABLENAME,len(@SOURCETABLENAME) - CHARINDEX('.',@SOURCETABLENAME)) declare @SelectList varchar(max) = @CTALIAS + '.SYS_CHANGE_OPERATION ' ; select @SelectList = COALESCE(@SelectList + ', ', '') + case ISNULL(i.is_primary_key, 0) when 0 then @SOURCEALIAS + '.' + C.Name when 1 then @CTALIAS + '.' + C.name end from sys.columns c join sys.objects o on c.object_id = o.object_id and o.schema_id = SCHEMA_ID(@Schema) outer Apply ( SELECT top 1 i.is_primary_key from sys.index_columns ic LEFT OUTER JOIN sys.indexes i ON ic.object_id = i.object_id AND ic.index_id = i.index_id and i.is_primary_key =1 where ic.object_id = c.object_id AND ic.column_id = c.column_id) as i where o.name = @TableName and o.schema_id = SCHEMA_ID(@Schema) and c.system_type_id not in ( select distinct xtype from Sys.systypes t where t.name in ('xml', 'varbinary', 'binary') ) order by c.name ASC return @SelectList End GO /****** Object: UserDefinedFunction [sqltosql].[SQLToSQL_GetJoinStatement] Script Date: 4/6/2021 12:48:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER FUNCTION [sqltosql].[SQLToSQL_GetJoinStatement] ( @SOURCETABLENAME VARCHAR(50), @SOURCEALIAS varchar(20) = 'SOURCE', @CTALIAS varchar(20) = 'CT' ) RETURNS VARCHAR(MAX) AS BEGIN declare @ONSTATEMENT varchar(8000); Declare @Schema nvarchar(100) ; Declare @TableName nvarchar(100) ; set @Schema = left(@SOURCETABLENAME,CHARINDEX('.', @SOURCETABLENAME)-1) set @TableName = right(@SOURCETABLENAME,len(@SOURCETABLENAME) - CHARINDEX('.',@SOURCETABLENAME)) select @ONSTATEMENT = COALESCE(@ONSTATEMENT + ' AND ', '') + @SOURCEALIAS + '.' + C.Name + ' = ' + @CTALIAS + '.' + C.name from sys.columns c join sys.objects o on c.object_id = o.object_id and o.schema_id = SCHEMA_ID(@Schema) Inner JOIN sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id Inner JOIN sys.indexes i ON ic.object_id = i.object_id AND ic.index_id = i.index_id and i.is_primary_key = 1 where o.name = @TableName and o.schema_id = SCHEMA_ID(@Schema) return @ONSTATEMENT End GO /****** Object: UserDefinedFunction [sqltosql].[SQLToSQL_GetPrimaryIndexColumns] Script Date: 4/6/2021 12:49:25 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER FUNCTION [sqltosql].[SQLToSQL_GetPrimaryIndexColumns] ( @SOURCETABLENAME VARCHAR(100) ) RETURNS VARCHAR(MAX) AS BEGIN Declare @Schema nvarchar(100) ; Declare @TableName nvarchar(100) ; set @Schema = left(@SOURCETABLENAME,CHARINDEX('.', @SOURCETABLENAME)-1) set @TableName = right(@SOURCETABLENAME,len(@SOURCETABLENAME) - CHARINDEX('.',@SOURCETABLENAME)) declare @IndexColumns varchar(max) select @IndexColumns = COALESCE(@IndexColumns + ',', '') + C.Name from sys.columns c join sys.objects o on c.object_id = o.object_id and o.schema_id = SCHEMA_ID(@Schema) Inner JOIN sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id Inner JOIN sys.indexes i ON ic.object_id = i.object_id AND ic.index_id = i.index_id and i.is_primary_key = 1 where o.name = @TableName and o.schema_id = SCHEMA_ID(@Schema) return @IndexColumns End GO /****** Object: UserDefinedFunction [sqltosql].[SQLToSQL_INCREMENTALSCRIPT] Script Date: 4/6/2021 12:49:43 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER FUNCTION [sqltosql].[SQLToSQL_INCREMENTALSCRIPT] ( @SOURCETABLENAME VARCHAR(50), @SOURCEALIAS varchar(20) = 'SOURCE', @CTALIAS varchar(20) = 'CT' ) RETURNS VARCHAR(MAX) AS BEGIN DECLARE @Statement VARCHAR(max); Set @Statement = ' SELECT ' + sqltosql.SQLToSQL_GetCTFieldList(@SOURCETABLENAME, @SOURCEALIAS, @CTALIAS) + ' FROM CHANGETABLE(CHANGES ' + @SOURCETABLENAME + ', {LASTSYNCVERSION}) ' + @CTALIAS + ' LEFT JOIN ' + @SOURCETABLENAME + ' ' + @SOURCEALIAS+ ' ON ' + sqltosql.SQLToSQL_GetJoinStatement(@SOURCETABLENAME, @SOURCEALIAS, @CTALIAS) + ' WHERE CT.Sys_Change_Version <= {CURRENTSYNCVERSION}' ; return @Statement End GO /****** Object: StoredProcedure [dbo].[SetTableStatus] Script Date: 4/6/2021 12:40:32 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /****** Object: StoredProcedure [dbo].[SetTableStatus] Update status******/ CREATE OR ALTER PROC [sqltosql].[SetTableStatus] @TableName nvarchar(100), @TargetTableName nvarchar(100), @Status int, @LAST_FILENAME nvarchar(100) null as begin update SynapseToSQLTables set Status = @Status, LastProcessedFile = ISNULL(@LAST_FILENAME, '') where TableName = @TableName and TargetTableName = @TargetTableName end GO /****** Object: StoredProcedure [sqltosql].[GetUpdatedTables] Script Date: 4/6/2021 12:41:10 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER Procedure [sqltosql].[GetUpdatedTables] AS SET NOCOUNT ON; DECLARE @currentSyncVersion TABLE (TableName nvarchar(200), currentSyncVersion bigint) DECLARE @SetupTableCursor as CURSOR; DECLARE @TABLENAME as nvarchar(200); DECLARE @LastSyncVersion as bigint; SET @SetupTableCursor = CURSOR FOR SELECT A.TABLENAME FROM sqlToSQL.SQLToSQLDataSyncSetup A where A.Published = 1 and A.Status = 0 OPEN @SetupTableCursor; FETCH NEXT FROM @SetupTableCursor INTO @TABLENAME; WHILE @@FETCH_STATUS = 0 BEGIN select top 1 @LastSyncVersion = X.ChangeVersion from sqlToSQL.SQLToSQLDataSyncSetup X WHERE X.TableName = @TABLENAME; insert into @currentSyncVersion(TableName, currentSyncVersion) exec [sqlToSQL].SQLToSQL_GetCurrentSyncVersion @TABLENAME, @LastSyncVersion FETCH NEXT FROM @SetupTableCursor INTO @TABLENAME; END Select A.TableName AS TABLENAME ,SUBSTRING(A.TargetTableName, 0, CHARINDEX('.', A.TargetTableName)) AS [TARGET_SCHEMA] ,SUBSTRING(A.TargetTableName, CHARINDEX('.', A.TargetTableName) + 1, LEN(A.TargetTableName)) AS [TARGET_TABLENAME] ,A.ChangeVersion AS LAST_SYNC_VERSION ,b.CURRENTSYNCVERSION as CURRENT_SYNC_VERSION, replace(replace(A.INCREMENTALEXPORTSCRIPT, '{LASTSYNCVERSION}', A.ChangeVersion) , '{CURRENTSYNCVERSION}', b.CURRENTSYNCVERSION) AS INCREMENTAL_EXPORT_SCRIPT from sqlToSQL.SQLToSQLDataSyncSetup A join @currentSyncVersion as b on A.TableName = b.TABLENAME where A.PUBLISHED = 1 and A.Status = 0 and b.currentSyncVersion > a.ChangeVersion GO /****** Object: StoredProcedure [sqltosql].[SQLToSQL_GetCurrentSyncVersion] Script Date: 4/6/2021 12:42:27 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Create Or Alter PROC [sqltosql].[SQLToSQL_GetCurrentSyncVersion] @TableName nvarchar(200), @LastSyncVersion bigInt AS SET NOCOUNT ON; declare @ctStatement nvarchar(1000); IF EXISTS (SELECT 1 FROM sys.change_tracking_tables WHERE object_id = OBJECT_ID(@TableName)) Begin set @ctStatement = FORMATMESSAGE('select ''%s'' as TableName, max(CT.SYS_CHANGE_VERSION) CurrentSyncVersion from CHANGETABLE(CHANGES %s, %I64d) CT', @TableName, @TableName, @LastSyncVersion); END EXECUTE sp_executesql @ctStatement GO /****** Object: StoredProcedure [sqltosql].[SQLToSQL_PublishTable] Script Date: 4/6/2021 12:43:47 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER PROCEDURE [sqltosql].[SQLToSQL_PublishTable] @SourceTableName nvarchar(200), @TargetTableName nvarchar(200) AS BEGIN SET NOCOUNT ON; Declare @Schema nvarchar(100) ; Declare @TableName nvarchar(100) ; set @Schema = left(@SOURCETABLENAME,CHARINDEX('.', @SOURCETABLENAME)-1) set @TableName = right(@SOURCETABLENAME,len(@SOURCETABLENAME) - CHARINDEX('.',@SOURCETABLENAME)) -- enable change tracking declare @ChangeTrackingStatement [nvarchar] (max) set @ChangeTrackingStatement = FORMATMESSAGE( 'declare @ChangeTrackingEnabled bit; set @ChangeTrackingEnabled = (select top 1 1 as Exist from sys.change_tracking_tables where object_id = object_id(''%s'')) if @ChangeTrackingEnabled is null begin ALTER TABLE %s ENABLE CHANGE_TRACKING end' ,@SourceTableName, @SourceTableName) ; Exec (@ChangeTrackingStatement) -- calculate script Declare @FULLEXPORTSCRIPT [nvarchar](max) Declare @INCREMENTALEXPORTSCRIPT [nvarchar](max) Declare @PUBLISHEDSCHEMAJSON [nvarchar](max) Declare @PrimaryIndexColumns [nvarchar](max) set @FULLEXPORTSCRIPT = 'select ''I'' as SYS_CHANGE_OPERATION, ' + sqltosql.SQLToSQL_GenerateFieldList(@SourceTableName) + ' From ' + @SourceTableName; set @INCREMENTALEXPORTSCRIPT = sqltosql.SQLToSQL_INCREMENTALSCRIPT(@SourceTableName, 'SOURCE', 'CT'); set @PrimaryIndexColumns = sqltosql.SQLToSQL_GetPrimaryIndexColumns(@SourceTableName); DECLARE @next_baseline bigint; SET @next_baseline = CHANGE_TRACKING_CURRENT_VERSION(); update [SQLToSQLDataSyncSetup] set ChangeVersion = @next_baseline , Published = 0 ,Status = 1 ,ModifiedDateTime = getDate(), FULLEXPORTSCRIPT = @FULLEXPORTSCRIPT, INCREMENTALEXPORTSCRIPT = @INCREMENTALEXPORTSCRIPT, PRIMARYINDEXCOLUMNS = @PrimaryIndexColumns where TableName = @SourceTableName; if @@rowcount =0 begin insert into [SQLToSQLDataSyncSetup] (TableName, TargetTableName, ChangeVersion, CreatedDateTime, ModifiedDateTime, FULLEXPORTSCRIPT, INCREMENTALEXPORTSCRIPT, PRIMARYINDEXCOLUMNS, Published, Status) values (@SourceTableName, @TargetTableName, 0, getDate(), getDate(), @FULLEXPORTSCRIPT, @INCREMENTALEXPORTSCRIPT, @PrimaryIndexColumns, 0, 1); end END GO /****** Object: StoredProcedure [sqltosql].[SQLToSQL_UpdateLastSyncVersion] Script Date: 4/6/2021 12:44:14 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER PROC [sqltosql].[SQLToSQL_UpdateLastSyncVersion] @TableName varchar(200), @LastSyncVersion bigInt AS SET NOCOUNT ON; UPDATE SQLToSQLDataSyncSetup SET ChangeVersion = @LastSyncVersion, Status = 0, ModifiedDateTime = GetDate() WHERE TableName = @TableName; GO /****** Object: StoredProcedure [sqltosql].[SQLToSQL_UpdatePublished] Script Date: 4/6/2021 12:44:33 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER PROC [sqltosql].[SQLToSQL_UpdatePublished] @TableName varchar(200) AS SET NOCOUNT ON; UPDATE [SQLToSQLDataSyncSetup] SET Published = 1, Status = 0, ModifiedDateTime = getDate() WHERE TableName = @TableName; GO /****** Object: StoredProcedure [sqltosql].[SQLToSQL_UpdateStatusInProcess] Script Date: 4/6/2021 12:44:50 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE OR ALTER PROC [sqltosql].[SQLToSQL_UpdateStatusInProcess] @TableName varchar(200) AS SET NOCOUNT ON; UPDATE SQLToSQLDataSyncSetup SET [Status] = 1, ModifiedDateTime = getDate() WHERE TableName = @TableName; GO
the_stack
CREATE DATABASE IF NOT EXISTS `library` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; USE `library`; -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: 115.159.112.233 Database: library -- ------------------------------------------------------ -- Server version 5.7.22-0ubuntu0.16.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Temporary view structure for view `arrive_reminder` -- DROP TABLE IF EXISTS `arrive_reminder`; /*!50001 DROP VIEW IF EXISTS `arrive_reminder`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `arrive_reminder` AS SELECT 1 AS `user_name`, 1 AS `bname`, 1 AS `email`*/; SET character_set_client = @saved_cs_client; -- -- Table structure for table `book` -- DROP TABLE IF EXISTS `book`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `book` ( `book_id` int(11) NOT NULL AUTO_INCREMENT, `ISBN` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `location` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `state` int(11) NOT NULL, `operator` int(11) NOT NULL, PRIMARY KEY (`book_id`), UNIQUE KEY `BID_UNIQUE` (`book_id`), KEY `op2_idx` (`operator`), KEY `bo_idx` (`ISBN`), CONSTRAINT `bo` FOREIGN KEY (`ISBN`) REFERENCES `booklist` (`ISBN`) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `op2` FOREIGN KEY (`operator`) REFERENCES `manager` (`manager_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=176 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `book` -- LOCK TABLES `book` WRITE; /*!40000 ALTER TABLE `book` DISABLE KEYS */; INSERT INTO `book` VALUES (151,'0000000000001','流通室',0,6),(152,'0000000000001','流通室',0,6),(153,'0000000000001','流通室',0,6),(154,'9787100000000','流通室',0,6),(155,'9787100000000','流通室',0,6),(156,'9787100000000','流通室',0,6),(157,'9787100000000','流通室',0,6),(158,'9787100000000','流通室',0,6),(159,'9787100000000','流通室',0,6),(160,'9787100000000','流通室',0,6),(161,'9787100000000','流通室',0,6),(162,'9787111421900','流通室',0,6),(163,'9787111421900','流通室',0,6),(164,'9787115417305','流通室',0,6),(165,'9787115417305','流通室',0,6),(166,'9787115417305','流通室',0,6),(167,'9787115417305','流通室',0,6),(168,'9787115417305','流通室',0,6),(169,'9787115417305','流通室',0,6),(170,'9787121254437','流通室',0,6),(171,'9787121254437','流通室',0,6),(172,'9787121254437','流通室',0,6),(173,'9787121254437','流通室',0,6),(174,'9787121254437','流通室',0,6),(175,'9787121254437','流通室',0,6); /*!40000 ALTER TABLE `book` ENABLE KEYS */; UNLOCK TABLES; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `library`.`book_AFTER_DELETE` AFTER DELETE ON `book` FOR EACH ROW BEGIN UPDATE booklist SET number=number-1 WHERE ISBN=old.ISBN; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `booklist` -- DROP TABLE IF EXISTS `booklist`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `booklist` ( `ISBN` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `bname` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `publisher` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `writer` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `ptime` date DEFAULT NULL, `number` int(11) NOT NULL DEFAULT '0', `operator` int(11) NOT NULL, `is_popular` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`ISBN`), UNIQUE KEY `ISBN_UNIQUE` (`ISBN`), KEY `op_idx` (`operator`), CONSTRAINT `op` FOREIGN KEY (`operator`) REFERENCES `manager` (`manager_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `booklist` -- LOCK TABLES `booklist` WRITE; /*!40000 ALTER TABLE `booklist` DISABLE KEYS */; INSERT INTO `booklist` VALUES ('0000000000001','SQL必知必会','芳文社','陈之豪','8102-05-20',3,6,0),('9787100000000','Qian\'s C Compiler——The speed of the art','路边社','钱晨','2018-05-14',8,6,0),('9787111421900','深入理解Java虚拟机','机械工业出版社','周志明','2013-06-01',2,6,1),('9787115417305','spring实战','人民邮电出版社','Adrian Mouat','2017-04-01',6,6,1),('9787121254437','集体智慧编程','人民邮电出版社','Toby Segaran','2015-03-01',6,6,0); /*!40000 ALTER TABLE `booklist` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `borrow` -- DROP TABLE IF EXISTS `borrow`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `borrow` ( `borrow_id` int(11) NOT NULL AUTO_INCREMENT, `book_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `btime` datetime NOT NULL, `deadline` datetime NOT NULL, `rtime` datetime DEFAULT NULL, `operator` int(11) DEFAULT NULL, PRIMARY KEY (`borrow_id`), UNIQUE KEY `BWID_UNIQUE` (`borrow_id`), KEY `boo_idx` (`book_id`), KEY `re_idx` (`user_id`), KEY `op3_idx` (`operator`), CONSTRAINT `boo` FOREIGN KEY (`book_id`) REFERENCES `book` (`book_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `op3` FOREIGN KEY (`operator`) REFERENCES `manager` (`manager_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `re` FOREIGN KEY (`user_id`) REFERENCES `reader` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `borrow` -- LOCK TABLES `borrow` WRITE; /*!40000 ALTER TABLE `borrow` DISABLE KEYS */; INSERT INTO `borrow` VALUES (89,162,26,'2018-05-31 10:32:13','2018-07-30 10:32:13','2018-05-31 10:32:19',6); /*!40000 ALTER TABLE `borrow` ENABLE KEYS */; UNLOCK TABLES; -- -- Temporary view structure for view `borrow_detail` -- DROP TABLE IF EXISTS `borrow_detail`; /*!50001 DROP VIEW IF EXISTS `borrow_detail`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `borrow_detail` AS SELECT 1 AS `borrow_id`, 1 AS `btime`, 1 AS `rtime`, 1 AS `deadline`, 1 AS `book_id`, 1 AS `bname`, 1 AS `user_id`, 1 AS `user_name`*/; SET character_set_client = @saved_cs_client; -- -- Table structure for table `manager` -- DROP TABLE IF EXISTS `manager`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `manager` ( `manager_id` int(11) NOT NULL AUTO_INCREMENT, `pass_wd` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `mname` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`manager_id`), UNIQUE KEY `MID_UNIQUE` (`manager_id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `manager` -- LOCK TABLES `manager` WRITE; /*!40000 ALTER TABLE `manager` DISABLE KEYS */; INSERT INTO `manager` VALUES (5,'123456','admin_czh'),(6,'123456','admin_czc'),(7,'123456','admin_qc'); /*!40000 ALTER TABLE `manager` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `reader` -- DROP TABLE IF EXISTS `reader`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `reader` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `pass_wd` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `rname` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `phone` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`user_id`), UNIQUE KEY `RID_UNIQUE` (`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `reader` -- LOCK TABLES `reader` WRITE; /*!40000 ALTER TABLE `reader` DISABLE KEYS */; INSERT INTO `reader` VALUES (26,'czc_reader','123456','陈至成','13800138000','1966557473@qq.com'),(27,'czh_reader','123456','czh','00000000000','1797079433@qq.com'); /*!40000 ALTER TABLE `reader` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `reservation` -- DROP TABLE IF EXISTS `reservation`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `reservation` ( `reservation_id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `book_id` int(11) NOT NULL, `deadline` datetime DEFAULT NULL, PRIMARY KEY (`reservation_id`), UNIQUE KEY `REID_UNIQUE` (`reservation_id`), UNIQUE KEY `BID_UNIQUE` (`book_id`), KEY `re2_idx` (`user_id`), KEY `book_idx` (`book_id`), CONSTRAINT `book` FOREIGN KEY (`book_id`) REFERENCES `book` (`book_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `re2` FOREIGN KEY (`user_id`) REFERENCES `reader` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `reservation` -- LOCK TABLES `reservation` WRITE; /*!40000 ALTER TABLE `reservation` DISABLE KEYS */; /*!40000 ALTER TABLE `reservation` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `reservation_arrived` -- DROP TABLE IF EXISTS `reservation_arrived`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `reservation_arrived` ( `reservation_arrived_id` int(11) NOT NULL AUTO_INCREMENT, `reservation_id` int(11) NOT NULL, PRIMARY KEY (`reservation_arrived_id`), KEY `res_id_fk_idx` (`reservation_id`), CONSTRAINT `res_id_fk` FOREIGN KEY (`reservation_id`) REFERENCES `reservation` (`reservation_id`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `reservation_arrived` -- LOCK TABLES `reservation_arrived` WRITE; /*!40000 ALTER TABLE `reservation_arrived` DISABLE KEYS */; /*!40000 ALTER TABLE `reservation_arrived` ENABLE KEYS */; UNLOCK TABLES; -- -- Temporary view structure for view `reservation_detail` -- DROP TABLE IF EXISTS `reservation_detail`; /*!50001 DROP VIEW IF EXISTS `reservation_detail`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `reservation_detail` AS SELECT 1 AS `user_id`, 1 AS `user_name`, 1 AS `reservation_id`, 1 AS `book_id`, 1 AS `bname`, 1 AS `deadline`*/; SET character_set_client = @saved_cs_client; -- -- Temporary view structure for view `return_reminder` -- DROP TABLE IF EXISTS `return_reminder`; /*!50001 DROP VIEW IF EXISTS `return_reminder`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `return_reminder` AS SELECT 1 AS `user_name`, 1 AS `btime`, 1 AS `bname`, 1 AS `email`*/; SET character_set_client = @saved_cs_client; -- -- Temporary view structure for view `sec_kill` -- DROP TABLE IF EXISTS `sec_kill`; /*!50001 DROP VIEW IF EXISTS `sec_kill`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `sec_kill` AS SELECT 1 AS `ISBN`, 1 AS `bname`, 1 AS `publisher`, 1 AS `writer`, 1 AS `ptime`, 1 AS `number`*/; SET character_set_client = @saved_cs_client; -- -- Dumping events for database 'library' -- -- -- Dumping routines for database 'library' -- /*!50003 DROP PROCEDURE IF EXISTS `borrow_from_res` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `borrow_from_res`(in res_id int, in op int) BEGIN declare bid int; declare uid int; declare num int; declare t_error integer default 0; declare continue handler for sqlexception set t_error=1; start transaction; select count(*) into num from reservation where reservation_id=res_id; if num > 0 then select book_id, user_id into bid, uid from reservation where reservation_id=res_id; insert into borrow(book_id, user_id, btime, deadline, operator) values (bid, uid, now(), date_add(now(), interval 60 day), op); DELETE from reservation where book_id=bid; UPDATE book SET state=2 where book_id=bid; end if; if t_error=1 then rollback; else commit; end if; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `do_sec_kill` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `do_sec_kill`(IN bn varchar(30), IN uid int, OUT st int) BEGIN declare num int; declare bid int; declare t_error integer default 0; declare continue handler for sqlexception set t_error=1; start transaction; select count(*) into num from book where ISBN=bn and state=0; select book_id into bid from book where ISBN=bn and state=0 order by book_id limit 0, 1; if num > 0 then insert into reservation(user_id, book_id, deadline) values(uid, bid, date_add(now(), interval 10 day)); update book set state=1 where book_id=bid; set st = 1; else set st=0; end if; if t_error=1 then rollback; set st=-4; else commit; end if; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `make_reservation` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `make_reservation`(IN bn varchar(30), IN uid int, OUT st int) BEGIN declare num int; declare ispop int; declare bid int; declare stat int; declare t_error integer default 0; declare continue handler for sqlexception set t_error=1; start transaction; select count(*) into num from book where ISBN=bn and (state=0 or (state=2 and book_id not in (select reservation.book_id from reservation))) order by state; select is_popular into ispop from booklist where booklist.ISBN=bn; if ispop > 0 then set st=-1; else if num > 0 then select state, book_id into stat, bid from book where ISBN=bn and (state=0 or (state=2 and book_id not in (select reservation.book_id from reservation))) order by state limit 0, 1; if stat > 0 then insert into reservation(user_id, book_id) values(uid, bid); set st = 2; else insert into reservation(user_id, book_id, deadline) values(uid, bid, date_add(now(), interval 10 day)); update book set state=1 where book_id=bid; set st = 1; end if; else set st=0; end if; end if; if t_error=1 then rollback; set st=-4; else commit; end if; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `new_book` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `new_book`(IN ISBN varchar(30),IN bname varchar(45), IN publisher varchar(45), IN writer varchar(45), IN ptime date, IN num int, IN operator int,IN location varchar(45),IN state int) BEGIN DECLARE i int; declare t_error integer default 0; declare continue handler for sqlexception set t_error=1; start transaction; insert into booklist(ISBN,bname, publisher, writer, ptime, number, operator)values (ISBN, bname, publisher, writer, ptime, num, operator); SET i=0; while i<num DO insert into book(ISBN,location,state,operator) values(ISBN,location,state,operator); SET i=i+1; end while; if t_error=1 then rollback; else commit; end if; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `return_book` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `return_book`(in bor_id int) BEGIN declare num int; declare bid int; declare n int; declare resid int; declare t_error integer default 0; declare continue handler for sqlexception set t_error=1; start transaction; select count(*) into n from borrow where borrow_id=bor_id and rtime is null; if n > 0 then select book_id into bid from borrow where borrow_id=bor_id; select count(*) into num from reservation where book_id=bid; if num > 0 then update borrow set rtime=now() where borrow_id=bor_id; update book set state=1 where book_id=bid; update reservation set deadline=now() where book_id=bid; select reservation_id into resid from reservation where book_id=bid; insert into reservation_arrived (reservation_id) values (resid); else update borrow set rtime=now() where borrow_id=bor_id; update book set state=0 where book_id=bid; end if; end if; if t_error=1 then rollback; else commit; end if; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Final view structure for view `arrive_reminder` -- /*!50001 DROP VIEW IF EXISTS `arrive_reminder`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET character_set_client = utf8 */; /*!50001 SET character_set_results = utf8 */; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ /*!50001 VIEW `arrive_reminder` AS select `reader`.`user_name` AS `user_name`,`booklist`.`bname` AS `bname`,`reader`.`email` AS `email` from ((((`reservation_arrived` join `reservation`) join `reader`) join `book`) join `booklist`) where ((`reservation_arrived`.`reservation_id` = `reservation`.`reservation_id`) and (`reservation`.`user_id` = `reader`.`user_id`) and (`reservation`.`book_id` = `book`.`book_id`) and (`book`.`ISBN` = `booklist`.`ISBN`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- -- Final view structure for view `borrow_detail` -- /*!50001 DROP VIEW IF EXISTS `borrow_detail`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET character_set_client = utf8 */; /*!50001 SET character_set_results = utf8 */; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ /*!50001 VIEW `borrow_detail` AS select `borrow`.`borrow_id` AS `borrow_id`,`borrow`.`btime` AS `btime`,`borrow`.`rtime` AS `rtime`,`borrow`.`deadline` AS `deadline`,`borrow`.`book_id` AS `book_id`,`booklist`.`bname` AS `bname`,`borrow`.`user_id` AS `user_id`,`reader`.`user_name` AS `user_name` from (((`borrow` join `book`) join `booklist`) join `reader`) where ((`borrow`.`book_id` = `book`.`book_id`) and (`booklist`.`ISBN` = `book`.`ISBN`) and (`borrow`.`user_id` = `reader`.`user_id`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- -- Final view structure for view `reservation_detail` -- /*!50001 DROP VIEW IF EXISTS `reservation_detail`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET character_set_client = utf8 */; /*!50001 SET character_set_results = utf8 */; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ /*!50001 VIEW `reservation_detail` AS select `reader`.`user_id` AS `user_id`,`reader`.`user_name` AS `user_name`,`reservation`.`reservation_id` AS `reservation_id`,`book`.`book_id` AS `book_id`,`booklist`.`bname` AS `bname`,`reservation`.`deadline` AS `deadline` from (((`booklist` join `book`) join `reader`) join `reservation`) where ((`reservation`.`user_id` = `reader`.`user_id`) and (`reservation`.`book_id` = `book`.`book_id`) and (`book`.`ISBN` = `booklist`.`ISBN`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- -- Final view structure for view `return_reminder` -- /*!50001 DROP VIEW IF EXISTS `return_reminder`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET character_set_client = utf8 */; /*!50001 SET character_set_results = utf8 */; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ /*!50001 VIEW `return_reminder` AS select `reader`.`user_name` AS `user_name`,`borrow`.`btime` AS `btime`,`booklist`.`bname` AS `bname`,`reader`.`email` AS `email` from (((`borrow` join `reader`) join `book`) join `booklist`) where ((`reader`.`user_id` = `borrow`.`user_id`) and (`borrow`.`book_id` = `book`.`book_id`) and (`book`.`ISBN` = `booklist`.`ISBN`) and isnull(`borrow`.`rtime`)) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- -- Final view structure for view `sec_kill` -- /*!50001 DROP VIEW IF EXISTS `sec_kill`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET character_set_client = utf8 */; /*!50001 SET character_set_results = utf8 */; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ /*!50001 VIEW `sec_kill` AS select `booklist`.`ISBN` AS `ISBN`,`booklist`.`bname` AS `bname`,`booklist`.`publisher` AS `publisher`,`booklist`.`writer` AS `writer`,`booklist`.`ptime` AS `ptime`,(select count(0) from `book` where ((`book`.`ISBN` = `booklist`.`ISBN`) and (`book`.`state` = 0))) AS `number` from `booklist` where (`booklist`.`is_popular` = 1) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2018-05-31 12:56:01
the_stack
----------------------------------------------------------------------- -- Oracle Machine Learning for SQL (OML4SQL) 19c -- -- OML R Extensible - Regression and Classification via RF - tmrgtrfdemo.sql -- -- Copyright (c) 2020 Oracle Corporation and/or its affilitiates. -- -- The Universal Permissive License (UPL), Version 1.0 -- -- https://oss.oracle.com/licenses/upl/ ----------------------------------------------------------------------- SET ECHO ON SET FEEDBACK 1 SET NUMWIDTH 10 SET LINESIZE 80 SET TRIMSPOOL ON SET TAB OFF SET PAGESIZE 100 SET LONG 10000 ------------------------------------------------------------------------------- -- RANDOMFOREST REGRESSION DEMO ------------------------------------------------------------------------------- -- Explaination: -- This demo shows how to implement the random forest regression algorithm in -- Oracle Data Mining using R nnet algorithm. -- Cleanup old output table for repeat runs ----------------------------------- BEGIN EXECUTE IMMEDIATE 'DROP TABLE RF_RDEMO_SETTINGS_RE'; EXCEPTION WHEN OTHERS THEN NULL; END; / BEGIN sys.rqScriptDrop('RF_RDEMO_BUILD_REGRESSION', v_silent => TRUE); sys.rqScriptDrop('RF_RDEMO_SCORE_REGRESSION', v_silent => TRUE); sys.rqScriptDrop('RF_RDEMO_DETAILS_REGRESSION', v_silent => TRUE); sys.rqScriptDrop('RF_RDEMO_WEIGHT_REGRESSION', v_silent => TRUE); END; / -- Model Settings ------------------------------------------------------------- CREATE TABLE RF_RDEMO_SETTINGS_RE ( setting_name varchar2(30), setting_value varchar2(4000)); BEGIN INSERT INTO RF_RDEMO_SETTINGS_RE VALUES ('ALGO_EXTENSIBLE_LANG', 'R'); END; / BEGIN -- Build R Function ----------------------------------------------------------- -- Explanation: -- User can define their own R script function to build the model they want. -- For example, here a script named RF_RDEMO_BUILD_REGRESSION is defined. This -- function builds and returns a random forest regression model using R -- randomForest algorithm. User can also choose other R algorithm to implement -- the random forest regression algorithm. sys.rqScriptCreate('RF_RDEMO_BUILD_REGRESSION', 'function(dat, form) { require(randomForest); set.seed(1234); mod <- randomForest(formula = formula(form), data=dat); mod}'); -- Score R Function ----------------------------------------------------------- -- Explanation: -- User can define their own R script function to do the scoring using the built -- model. For example, here a script named RF_RDEMO_SCORE_REGRESSION is defined. -- This function creates and returns an R data.frame containing the target -- predictions. User can also define other prediction functions with different -- settings. Note that the randomForest function in R requires types and levels -- of the scoring data be exactly same with types and levels of training data sys.rqScriptCreate('RF_RDEMO_SCORE_REGRESSION', 'function(mod, dat) { require(randomForest); for(i in 1:length(names(dat))) { if(is.numeric(dat[1,i])) { dat[,i] = as.numeric(dat[,i]);} else { dat[,i] = factor(dat[,i], levels=mod$forest$xlevels[[i]]); } } res <- predict(mod, newdata = dat); data.frame(pred=res)}'); -- Detail R Function ---------------------------------------------------------- -- Explanation: -- User can define their own R script function to show the model details they -- want to display. For example, here a script named RF_RDEMO_DETAILS_REGRESSION -- is defined. This function creates and returns an R data.frame containing the -- attribute importance of the built random forest regression model. User can -- also display other details. sys.rqScriptCreate('RF_RDEMO_DETAILS_REGRESSION', 'function(object, x) { mod <- object; data.frame(row_name=row.names(mod$importance), importance=mod$importance)}'); INSERT INTO RF_RDEMO_SETTINGS_RE VALUES(dbms_data_mining.ralg_build_function, 'RF_RDEMO_BUILD_REGRESSION'); INSERT INTO RF_RDEMO_SETTINGS_RE VALUES(dbms_data_mining.ralg_score_function, 'RF_RDEMO_SCORE_REGRESSION'); INSERT INTO RF_RDEMO_SETTINGS_RE VALUES(dbms_data_mining.ralg_details_function, 'RF_RDEMO_DETAILS_REGRESSION'); -- Once this setting is specified, a model view will be created. This model -- view will be generated to display the model details, which contains the -- attribute names and the corresponding importance. INSERT INTO RF_RDEMO_SETTINGS_RE VALUES(dbms_data_mining.ralg_details_format, 'select cast(''a'' as varchar2(100)) name, 1 importance from dual'); -- In this setting, a formula is specified, which will be passed as a parameter -- to the model build function to build the model. INSERT INTO RF_RDEMO_SETTINGS_RE VALUES(dbms_data_mining.ralg_build_parameter, 'select ''AGE ~ .'' "form" from dual'); END; / BEGIN DBMS_DATA_MINING.DROP_MODEL('RF_RDEMO_REGRESSION'); EXCEPTION WHEN OTHERS THEN NULL; END; / ------------------------------------------------------------------------------- -- MODEL BUILD ------------------------------------------------------------------------------- -- Explanation: -- Build the model using the R script user defined. Here R script -- RF_RDEMO_BUILD_REGRESSION will be used to create the random forest -- regression model RF_RDEMO_REGRESSION using dataset mining_data_build_v. BEGIN dbms_data_mining.create_model( model_name => 'RF_RDEMO_REGRESSION', mining_function => dbms_data_mining.regression, data_table_name => 'mining_data_build_v', case_id_column_name => 'CUST_ID', target_column_name => 'AGE', settings_table_name => 'RF_RDEMO_SETTINGS_RE'); END; / ------------------------------------------------------------------------------- -- MODEL DETAIL ------------------------------------------------------------------------------- -- Explanation: -- Display the details of the built model using the R script user defined. -- Here R script RF_RDEMO_DETAIL_REGRESSION will be used to display the model -- details. column name format a30; SELECT name, round(importance, 3) as importance, rank() OVER (ORDER BY importance DESC) rank from DM$VDRF_RDEMO_REGRESSION order by importance desc; ------------------------------------------------------------------------------- -- MODEL SCORE ------------------------------------------------------------------------------- -- Explanation: -- Score the model using the R script user defined. Here R script -- RF_RDEMO_SCORE_REGRESSION will be used to do the scoring. -- PREDICTION/PREDICTION_PROBABILITY ------------------------------------------ -- Explanation: -- Show actual target value and predicted target values. SELECT CUST_ID, AGE as AGE_act, round(PREDICTION(RF_RDEMO_REGRESSION USING *), 3) as AGE_pred FROM mining_data_apply_v where CUST_ID <= 100010 order by CUST_ID; ------------------------------------------------------------------------------- -- RANDOM FOREST CLASSIFICATION DEMO ------------------------------------------------------------------------------- -- Explaination: -- This demo shows how to implement the random forest classification algorithm -- in Oracle Data Mining using R randomForest algorithm. -- Cleanup old output table for repeat runs ----------------------------------- BEGIN EXECUTE IMMEDIATE 'DROP TABLE RF_RDEMO_SETTINGS_CL'; EXCEPTION WHEN OTHERS THEN NULL; END; / BEGIN sys.rqScriptDrop('RF_RDEMO_BUILD_CLASSIFICATION', v_silent => TRUE); sys.rqScriptDrop('RF_RDEMO_SCORE_CLASSIFICATION', v_silent => TRUE); sys.rqScriptDrop('RF_RDEMO_DETAILS_CLASSIFICATION', v_silent => TRUE); sys.rqScriptDrop('RF_RDEMO_WEIGHT_CLASSIFICATION', v_silent => TRUE); END; / -- Model Settings ------------------------------------------------------------- create table RF_RDEMO_SETTINGS_CL ( setting_name varchar2(30), setting_value varchar2(4000)); BEGIN INSERT INTO RF_RDEMO_SETTINGS_CL VALUES ('ALGO_EXTENSIBLE_LANG', 'R'); END; / BEGIN -- Build Function ------------------------------------------------------------- -- Explanation: -- User can define their own R script function to build the model they want. -- For example, here a script named RF_RDEMO_BUILD_CLASSIFICATION is defined. -- This function builds and returns a random forest classification model using -- R randomForest algorithm. User can also choose other R algorithm to -- implement the random forest classification algorithm. sys.rqScriptCreate('RF_RDEMO_BUILD_CLASSIFICATION', 'function(dat) { require(randomForest); set.seed(1234); dat$AFFINITY_CARD=as.factor(dat$AFFINITY_CARD); mod <- randomForest(AFFINITY_CARD ~ ., data=dat); mod}'); -- Score R Function ----------------------------------------------------------- -- Explanation: -- User can define their own R script function to do the scoring using the built -- model. For example, here a script named RF_RDEMO_SCORE_CLASSIFICATION is -- defined. This function creates and returns an R data.frame containing the -- target predictions with type vote. User can also define other prediction -- functions with other types. Note that the randomForest function in R -- requires types and levels of the scoring data be exactly same with types -- and levels of training data sys.rqScriptCreate('RF_RDEMO_SCORE_CLASSIFICATION', 'function(mod, dat) { require(randomForest); for(i in 1:length(names(dat))) { if(is.numeric(dat[1,i])) { dat[,i] = as.numeric(dat[,i]);} else { dat[,i] = factor(dat[,i], levels=mod$forest$xlevels[[i]]); } } res <- data.frame(predict(mod, newdata=dat, type="vote")); names(res) <- c("0", "1"); res}'); -- Detail R Function ----------------------------------------------------------- -- Explanation: -- User can define their own R script function to show the model details they -- want to display. For example, here a script named -- RF_RDEMO_DETAILS_CLASSIFICATION is defined. This function creates and -- returns an R data.frame containing the attribute importance of the built -- random forest classification model. User can also display other details. sys.rqScriptCreate('RF_RDEMO_DETAILS_CLASSIFICATION', 'function(object, x) { mod <- object; data.frame(row_name=row.names(mod$importance), importance=mod$importance)}'); -- Weight R Function ----------------------------------------------------------- -- Explanation: -- User can define their own R script function to provide the attribute weights -- of the scoring data. For example, here a script named -- RF_RDEMO_WEIGHT_CLASSIFICATION is defined. This function creates and returns -- an R data.frame containing the weights of each attribute of the scoring data. -- Here we simply use the ratio of the predicted target probability with all -- attribute values present to the predicted target probability with one -- attribute value missing as the weight of the missing attribute. User can -- define their own method to calculate the attribute weight. Note that the -- randomForest function in R requires types and levels of the scoring data be -- exactly same with types and levels of training data. sys.rqScriptCreate('RF_RDEMO_WEIGHT_CLASSIFICATION', 'function(mod, dat, clas) { require(randomForest); for(i in 1:length(names(dat))) { if(is.numeric(dat[,i])) { dat[,i] = as.numeric(dat[,i]);} else { dat[,i] = factor(dat[,i], levels=mod$forest$xlevels[[i]]); } } v0 <- as.data.frame(predict(mod, newdata=dat, type = "prob")); res <- data.frame(lapply(seq_along(dat), function(x, dat) { if(is.numeric(dat[[x]])) dat[,x] <- as.numeric(0) else {dat[,x] <- factor(NA, levels = mod$forest$xlevels[[x]]);}; vv <- as.data.frame(predict(mod, newdata = dat, type = "prob")); v0[[clas]] / vv[[clas]]}, dat = dat)); names(res) <- names(dat); res}'); INSERT INTO RF_RDEMO_SETTINGS_CL VALUES(dbms_data_mining.ralg_build_function, 'RF_RDEMO_BUILD_CLASSIFICATION'); INSERT INTO RF_RDEMO_SETTINGS_CL VALUES(dbms_data_mining.ralg_score_function, 'RF_RDEMO_SCORE_CLASSIFICATION'); INSERT INTO RF_RDEMO_SETTINGS_CL VALUES(dbms_data_mining.ralg_details_function, 'RF_RDEMO_DETAILS_CLASSIFICATION'); INSERT INTO RF_RDEMO_SETTINGS_CL VALUES(dbms_data_mining.ralg_weight_function, 'RF_RDEMO_WEIGHT_CLASSIFICATION'); -- Once this setting is specified, a model view will be created. This model -- view will be generated to display the model details, which contains the -- attribute names and the corresponding importance. INSERT INTO RF_RDEMO_SETTINGS_CL VALUES(dbms_data_mining.ralg_details_format, 'select cast(''a'' as varchar2(100)) name, 1 importance from dual'); END; / BEGIN DBMS_DATA_MINING.DROP_MODEL('RF_RDEMO_CLASSIFICATION'); EXCEPTION WHEN OTHERS THEN NULL; END; / ------------------------------------------------------------------------------- -- MODEL BUILD ------------------------------------------------------------------------------- -- Explanation: -- Build the model using the R script user defined. Here R script -- RF_RDEMO_BUILD_CLASSIFICATION will be used to create the random forest -- classification model RF_RDEMO_CLASSIFICATION using dataset mining_data_build_v. begin dbms_data_mining.create_model( model_name => 'RF_RDEMO_CLASSIFICATION', mining_function => dbms_data_mining.classification, data_table_name => 'mining_data_build_v', case_id_column_name => 'CUST_ID', target_column_name => 'AFFINITY_CARD', settings_table_name => 'RF_RDEMO_SETTINGS_CL'); end; / ------------------------------------------------------------------------------- -- MODEL DETAIL ------------------------------------------------------------------------------- -- Display the details of the built model using the R script user defined. -- Here R script RF_RDEMO_DETAIL_CLASSIFICATION will be used to display the -- model details. column name format a30; select name, round(importance, 3) as importance, rank() OVER (ORDER BY importance DESC) rank from DM$VDRF_RDEMO_CLASSIFICATION order by importance desc; ------------------------------------------------------------------------------- -- MODEL SCORE ------------------------------------------------------------------------------- -- Explanation: -- Score the model using the R script user defined. -- PREDICTION/PREDICTION_PROBABILITY ------------------------------------------ -- Explanation: -- Here R script RF_RDEMO_SCORE_CLASSIFICATION is used to get the prediction -- value and the prediction probability. Actual target value and predicted -- target values are provided. SELECT cust_id, affinity_card as affinity_card_act, PREDICTION(RF_RDEMO_CLASSIFICATION USING *) affinity_card_pred, round(PREDICTION_PROBABILITY(RF_RDEMO_CLASSIFICATION USING *), 3) as affinity_card_prob FROM mining_data_apply_v where CUST_ID <= 100010 order by cust_id; -- PREDICTION_SET ------------------------------------------------------------- -- Explanation: -- Here R script RF_RDEMO_SCORE_CLASSIFICATION is used to get the -- prediction set. Actual target value and predicted target values are provided. select T.CUST_ID, T.affinity_card, S.prediction, round(S.probability, 3) as probability from (select CUST_ID, affinity_card, PREDICTION_SET(RF_RDEMO_CLASSIFICATION USING *) pset from mining_data_apply_v where CUST_ID <= 100010) T, TABLE(T.pset) S where S.probability > 0 order by T.CUST_ID, S.prediction; -- PREDICTION_DETAILS --------------------------------------------------------- -- Explanation: -- The R script RF_RDEMO_WEIGHT_CLASSIFICATION is used to get the prediction -- details. The AFFINITY_CARD and the prediction details with the weight of each -- attribute are provided. column pred_det format a65; SELECT CUST_ID, PREDICTION_DETAILS(RF_RDEMO_CLASSIFICATION, '1' USING *) pred_det FROM mining_data_apply_v where CUST_ID <= 100010 order by CUST_ID;
the_stack
-- 2019-04-29T16:40:14.084 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Trl WHERE AD_Element_ID=217 AND AD_Language='fr_CH' ; -- 2019-04-29T16:40:14.312 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Trl WHERE AD_Element_ID=217 AND AD_Language='it_CH' ; -- 2019-04-29T16:40:14.339 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Trl WHERE AD_Element_ID=217 AND AD_Language='en_GB' ; -- 2019-04-29T16:41:18.049 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Maßeinheit, in die eine bestimmte Menge konvertiert werden soll', Help='', IsTranslated='Y', Name='Ziel-Maßeinheit', PrintName='Ziel-Maßeinheit',Updated=TO_TIMESTAMP('2019-04-29 16:41:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=217 AND AD_Language='de_CH' ; -- 2019-04-29T16:41:18.113 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(217,'de_CH') ; -- 2019-04-29T16:41:31.722 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Ziel-Maßeinheit', PrintName='Ziel-Maßeinheit',Updated=TO_TIMESTAMP('2019-04-29 16:41:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=217 AND AD_Language='de_DE' ; -- 2019-04-29T16:41:31.724 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(217,'de_DE') ; -- 2019-04-29T16:41:31.738 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(217,'de_DE') ; -- 2019-04-29T16:41:31.740 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='C_UOM_To_ID', Name='Ziel-Maßeinheit', Description='Zielmaßeinheit', Help='"Maßeinheit Nach" gibt die Zielmaßeinheit für eine Umrechnung an.' WHERE AD_Element_ID=217 ; -- 2019-04-29T16:41:31.742 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='C_UOM_To_ID', Name='Ziel-Maßeinheit', Description='Zielmaßeinheit', Help='"Maßeinheit Nach" gibt die Zielmaßeinheit für eine Umrechnung an.', AD_Element_ID=217 WHERE UPPER(ColumnName)='C_UOM_TO_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2019-04-29T16:41:31.744 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='C_UOM_To_ID', Name='Ziel-Maßeinheit', Description='Zielmaßeinheit', Help='"Maßeinheit Nach" gibt die Zielmaßeinheit für eine Umrechnung an.' WHERE AD_Element_ID=217 AND IsCentrallyMaintained='Y' ; -- 2019-04-29T16:41:31.745 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Ziel-Maßeinheit', Description='Zielmaßeinheit', Help='"Maßeinheit Nach" gibt die Zielmaßeinheit für eine Umrechnung an.' WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=217) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 217) ; -- 2019-04-29T16:41:31.764 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Ziel-Maßeinheit', Name='Ziel-Maßeinheit' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=217) ; -- 2019-04-29T16:41:31.768 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Ziel-Maßeinheit', Description='Zielmaßeinheit', Help='"Maßeinheit Nach" gibt die Zielmaßeinheit für eine Umrechnung an.', CommitWarning = NULL WHERE AD_Element_ID = 217 ; -- 2019-04-29T16:41:31.770 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Ziel-Maßeinheit', Description='Zielmaßeinheit', Help='"Maßeinheit Nach" gibt die Zielmaßeinheit für eine Umrechnung an.' WHERE AD_Element_ID = 217 ; -- 2019-04-29T16:41:31.774 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Ziel-Maßeinheit', Description = 'Zielmaßeinheit', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 217 ; -- 2019-04-29T16:41:41.238 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Maßeinheit, in die eine bestimmte Menge konvertiert werden soll', Help='',Updated=TO_TIMESTAMP('2019-04-29 16:41:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=217 AND AD_Language='de_DE' ; -- 2019-04-29T16:41:41.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(217,'de_DE') ; -- 2019-04-29T16:41:41.247 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(217,'de_DE') ; -- 2019-04-29T16:41:41.248 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='C_UOM_To_ID', Name='Ziel-Maßeinheit', Description='Maßeinheit, in die eine bestimmte Menge konvertiert werden soll', Help='' WHERE AD_Element_ID=217 ; -- 2019-04-29T16:41:41.249 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='C_UOM_To_ID', Name='Ziel-Maßeinheit', Description='Maßeinheit, in die eine bestimmte Menge konvertiert werden soll', Help='', AD_Element_ID=217 WHERE UPPER(ColumnName)='C_UOM_TO_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2019-04-29T16:41:41.251 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='C_UOM_To_ID', Name='Ziel-Maßeinheit', Description='Maßeinheit, in die eine bestimmte Menge konvertiert werden soll', Help='' WHERE AD_Element_ID=217 AND IsCentrallyMaintained='Y' ; -- 2019-04-29T16:41:41.252 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Ziel-Maßeinheit', Description='Maßeinheit, in die eine bestimmte Menge konvertiert werden soll', Help='' WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=217) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 217) ; -- 2019-04-29T16:41:41.261 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Ziel-Maßeinheit', Description='Maßeinheit, in die eine bestimmte Menge konvertiert werden soll', Help='', CommitWarning = NULL WHERE AD_Element_ID = 217 ; -- 2019-04-29T16:41:41.263 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Ziel-Maßeinheit', Description='Maßeinheit, in die eine bestimmte Menge konvertiert werden soll', Help='' WHERE AD_Element_ID = 217 ; -- 2019-04-29T16:41:41.264 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Ziel-Maßeinheit', Description = 'Maßeinheit, in die eine bestimmte Menge konvertiert werden soll', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 217 ; -- 2019-04-29T16:41:44.029 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Help='',Updated=TO_TIMESTAMP('2019-04-29 16:41:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=217 AND AD_Language='nl_NL' ; -- 2019-04-29T16:41:44.031 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(217,'nl_NL') ; -- 2019-04-29T16:42:18.162 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='UOM into which a given quantity shall be converted', Help='', PrintName='Target-UOM',Updated=TO_TIMESTAMP('2019-04-29 16:42:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=217 AND AD_Language='en_US' ; -- 2019-04-29T16:42:18.164 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(217,'en_US') ; -- 2019-04-29T16:42:30.694 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Target-UoM',Updated=TO_TIMESTAMP('2019-04-29 16:42:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=217 AND AD_Language='en_US' ; -- 2019-04-29T16:42:30.696 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(217,'en_US') ; -- 2019-04-29T16:42:39.354 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Ziel-Maßeinheit', PrintName='Ziel-Maßeinheit',Updated=TO_TIMESTAMP('2019-04-29 16:42:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=217 AND AD_Language='nl_NL' ; -- 2019-04-29T16:42:39.355 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(217,'nl_NL') ; -- 2019-04-29T16:42:44.194 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Maßeinheit, in die eine bestimmte Menge konvertiert werden soll',Updated=TO_TIMESTAMP('2019-04-29 16:42:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=217 AND AD_Language='nl_NL' ; -- 2019-04-29T16:42:44.195 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(217,'nl_NL') ; -- 2019-04-29T16:47:32.336 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Trl WHERE AD_Element_ID=466 AND AD_Language='fr_CH' ; -- 2019-04-29T16:47:32.383 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Trl WHERE AD_Element_ID=466 AND AD_Language='it_CH' ; -- 2019-04-29T16:47:32.444 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Trl WHERE AD_Element_ID=466 AND AD_Language='en_GB' ; -- 2019-04-29T16:50:57.776 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,576693,0,'C_UOM_Conversion_MultiplyRate',TO_TIMESTAMP('2019-04-29 16:50:57','YYYY-MM-DD HH24:MI:SS'),100,'Beispiel: Für Maßeinheit Minute und Ziel-Maßeinheit Stunde beträgt der Faktor 1/60, da eine Minute 1/60 eine Stunde ist.','D','Y','Faktor für Ziel-Maßeinheit','Faktor für Ziel-Maßeinheit',TO_TIMESTAMP('2019-04-29 16:50:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-04-29T16:50:57.778 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=576693 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2019-04-29T16:51:03.046 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-04-29 16:51:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576693 AND AD_Language='de_CH' ; -- 2019-04-29T16:51:03.048 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576693,'de_CH') ; -- 2019-04-29T16:51:05.781 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-04-29 16:51:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576693 AND AD_Language='de_DE' ; -- 2019-04-29T16:51:05.783 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576693,'de_DE') ; -- 2019-04-29T16:51:05.792 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(576693,'de_DE') ; -- 2019-04-29T16:52:12.421 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Example: for UOM minute and target-UOM hour, the factor is 1/60, because a minute is 1/60 of an hour', IsTranslated='Y', Name='Factor for Target-UOM', PrintName='Factor for Target-UOM',Updated=TO_TIMESTAMP('2019-04-29 16:52:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=576693 AND AD_Language='en_US' ; -- 2019-04-29T16:52:12.422 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(576693,'en_US') ; -- 2019-04-29T16:52:26.273 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET AD_Name_ID=576693, Description='Beispiel: Für Maßeinheit Minute und Ziel-Maßeinheit Stunde beträgt der Faktor 1/60, da eine Minute 1/60 eine Stunde ist.', Help=NULL, Name='Faktor für Ziel-Maßeinheit',Updated=TO_TIMESTAMP('2019-04-29 16:52:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=463 ; -- 2019-04-29T16:52:26.277 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(576693) ; -- 2019-04-29T16:52:26.291 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=463 ; -- 2019-04-29T16:52:26.294 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(463) ; -- 2019-04-29T16:52:57.044 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Trl WHERE AD_Element_ID=286 AND AD_Language='fr_CH' ; -- 2019-04-29T16:52:57.066 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Trl WHERE AD_Element_ID=286 AND AD_Language='it_CH' ; -- 2019-04-29T16:52:57.091 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Trl WHERE AD_Element_ID=286 AND AD_Language='en_GB' ; -- 2019-04-29T16:53:35.610 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Der Divisor ist der Kehrwert des Umrechnungsfaktors.', Help='', IsTranslated='Y',Updated=TO_TIMESTAMP('2019-04-29 16:53:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=286 AND AD_Language='de_CH' ; -- 2019-04-29T16:53:35.612 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(286,'de_CH') ; -- 2019-04-29T16:54:23.248 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='The divide rate is the factor''s reciprocal', Help='',Updated=TO_TIMESTAMP('2019-04-29 16:54:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=286 AND AD_Language='en_US' ; -- 2019-04-29T16:54:23.250 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(286,'en_US') ; -- 2019-04-29T16:54:27.926 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-04-29 16:54:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=286 AND AD_Language='de_DE' ; -- 2019-04-29T16:54:27.928 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(286,'de_DE') ; -- 2019-04-29T16:54:27.944 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(286,'de_DE') ; -- 2019-04-29T16:54:38.489 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Der Divisor ist der Kehrwert des Umrechnungsfaktors.', Help='',Updated=TO_TIMESTAMP('2019-04-29 16:54:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=286 AND AD_Language='de_DE' ; -- 2019-04-29T16:54:38.491 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(286,'de_DE') ; -- 2019-04-29T16:54:38.498 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(286,'de_DE') ; -- 2019-04-29T16:54:38.500 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='DivideRate', Name='Divisor', Description='Der Divisor ist der Kehrwert des Umrechnungsfaktors.', Help='' WHERE AD_Element_ID=286 ; -- 2019-04-29T16:54:38.501 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='DivideRate', Name='Divisor', Description='Der Divisor ist der Kehrwert des Umrechnungsfaktors.', Help='', AD_Element_ID=286 WHERE UPPER(ColumnName)='DIVIDERATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2019-04-29T16:54:38.503 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='DivideRate', Name='Divisor', Description='Der Divisor ist der Kehrwert des Umrechnungsfaktors.', Help='' WHERE AD_Element_ID=286 AND IsCentrallyMaintained='Y' ; -- 2019-04-29T16:54:38.504 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Divisor', Description='Der Divisor ist der Kehrwert des Umrechnungsfaktors.', Help='' WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=286) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 286) ; -- 2019-04-29T16:54:38.515 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Divisor', Description='Der Divisor ist der Kehrwert des Umrechnungsfaktors.', Help='', CommitWarning = NULL WHERE AD_Element_ID = 286 ; -- 2019-04-29T16:54:38.517 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Divisor', Description='Der Divisor ist der Kehrwert des Umrechnungsfaktors.', Help='' WHERE AD_Element_ID = 286 ; -- 2019-04-29T16:54:38.519 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Divisor', Description = 'Der Divisor ist der Kehrwert des Umrechnungsfaktors.', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 286 ; /* Fix existing minute=>hour conversion rate(s) */ UPDATE C_UOM_Conversion SET MultiplyRate=0.016666666667, DivideRate=60 WHERE C_UOM_ID=103 /*Minute*/ AND C_UOM_To_ID=101 /*Hour*/;
the_stack
-- 采集器管理相关表 CREATE DATABASE IF NOT EXISTS bkdata_basic; USE bkdata_basic; SET NAMES utf8; CREATE TABLE `collector_register_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `collector_name` varchar(128) NOT NULL COMMENT '采集器名称', `url_start` varchar(128) NOT NULL COMMENT '启动URL', `url_stop` varchar(128) NOT NULL COMMENT '停止URL', `url_reload` varchar(128) NOT NULL COMMENT '重新加载URL', `url_deploy` varchar(128) NOT NULL COMMENT '部署URL', `url_remove` varchar(128) NOT NULL COMMENT '卸载URL', `url_upgrade` varchar(128) NOT NULL COMMENT '升级URL', `url_status` varchar(128) NOT NULL COMMENT '采集器查询状态URL', `version` varchar(128) NOT NULL COMMENT '版本', `url_check_result` varchar(128) NOT NULL COMMENT '查询结果URL', `created_by` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(50) DEFAULT NULL COMMENT '修改人 ', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采集器注册信息表, 这个表维护了采集器的名称,部署采集器回调的接口'; CREATE TABLE `collector_deploy_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `collector_id` int(11) NOT NULL COMMENT '采集器id', `bk_biz_id` int(11) NOT NULL COMMENT '业务id', `raw_data_id` int(11) NOT NULL COMMENT '原始数据id', `deploy_plan_id` int(11) NOT NULL COMMENT '部署任务id', `scope` text NOT NULL COMMENT '部署范围', `exclude` text NOT NULL COMMENT '部署排除范围', `created_by` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(50) DEFAULT NULL COMMENT '修改人 ', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采集器部署配置表'; CREATE TABLE `collector_deploy_task` ( `id` int(7) NOT NULL AUTO_INCREMENT COMMENT '部署任务id', `operator` varchar(128) DEFAULT NULL COMMENT '操作者', `scope` text NOT NULL COMMENT '部署范围,包含配置和host列表', `status` varchar(32) NOT NULL COMMENT '部署状态,1部署中,2部署完成', `msg` text COMMENT '部署中的阶段信息,部署完成时的结果信息', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部署配置表'; CREATE TABLE `collector_deploy_status` ( `id` int(11) NOT NULL AUTO_INCREMENT, `deploy_plan_id` int(11) NOT NULL COMMENT '部署配置id', `deploy_task_id` int(11) NOT NULL COMMENT '部署任务id', `raw_data_id` int(11) NOT NULL COMMENT '原始数据id', `bk_cloud_id` int(11) NOT NULL COMMENT '云区域id', `ip` varchar(16) NOT NULL COMMENT 'IP', `version` varchar(16) NOT NULL COMMENT '部署版本', `scope` varchar(32) NOT NULL COMMENT '所属范围,模块或主机', `deploy_status` varchar(32) NOT NULL COMMENT '部署状态', `collector_status` varchar(32) NOT NULL COMMENT '采集状态: nodata, reporting', `msg` text NOT NULL COMMENT '部署失败时的错误信息', `created_by` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(50) DEFAULT NULL COMMENT '修改人 ', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采集器部署状态'; CREATE TABLE `collector_deploy_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `deploy_plan_id` int(11) NOT NULL COMMENT '部署配置id', `deploy_task_id` int(11) NOT NULL COMMENT '部署任务id', `raw_data_id` int(11) NOT NULL COMMENT '原始数据id', `ip` varchar(16) NOT NULL COMMENT 'IP', `bk_cloud_id` int(11) NOT NULL COMMENT '云区域id', `deploy_status` varchar(32) NOT NULL COMMENT '部署状态 0:准备部署,1:部署中,2:部署完成', `type` varchar(32) NOT NULL COMMENT '操作类型 deploy start stop', `msg` text NOT NULL COMMENT '部署失败时的错误信息', `created_by` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(50) DEFAULT NULL COMMENT '修改人 ', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='采集器部署日志'; -- 数据接入相关表: CREATE TABLE `access_user_file` ( `id` int(11) NOT NULL AUTO_INCREMENT, `bk_biz_id` int(11) NOT NULL COMMENT '业务id', `cloud_id` int(11) NOT NULL COMMENT '云区域id', `ip` varchar(16) NOT NULL COMMENT '存储文件的IP', `user_name` varchar(64) NOT NULL COMMENT '用户名', `status` varchar(64) NOT NULL COMMENT '接入第三方fs的时候,上传状态', `file_root` text NOT NULL COMMENT 'ftp://xxx.xxx, file://', `file_path` text NOT NULL COMMENT '上传的路径', `file_type` varchar(64) NOT NULL COMMENT '文件类型:二进制、配置', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户上传采集器文件记录表,如csv'; CREATE TABLE `collector_exporter_info` ( -- 这个是采集器相关的 `id` int(11) NOT NULL AUTO_INCREMENT, `bk_biz_id` int(11) NOT NULL COMMENT '业务id', `exporter_name` varchar(64) NOT NULL COMMENT 'exporter名称', `exporter_desc` text NOT NULL COMMENT '描述exporter功能', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='组件exportor采集配置表'; CREATE TABLE `access_raw_data` ( `id` int(11) NOT NULL AUTO_INCREMENT, `bk_biz_id` int(11) NOT NULL COMMENT '业务id', `raw_data_name` varchar(128) NOT NULL COMMENT '源数据英文标示', `raw_data_alias` varchar(128) NOT NULL COMMENT '数据别名:中文名、英文名取决于环境', `sensitivity` varchar(32) DEFAULT 'public' COMMENT '敏感性', `data_source` varchar(32) NOT NULL COMMENT '数据来源(GSE数据管道、TEG数据管道、MIG灯塔)', `data_encoding` varchar(32) DEFAULT 'UTF8' COMMENT '编码', `data_category` varchar(32) DEFAULT 'UTF8' COMMENT '数据分类(在线、登录等)', `data_scenario` varchar(128) NOT NULL COMMENT '接入场景(日志、数据库、灯塔、TLOG)', `bk_app_code` varchar(128) NOT NULL COMMENT '接入的来源APP', `storage_channel_id` INT(11) DEFAULT NULL COMMENT '所属存储(kafka等)集群id', `storage_partitions` INT(11) DEFAULT NULL COMMENT '所属存储(kafka等)集群分区数 ', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', `maintainer` varchar(255) DEFAULT NULL COMMENT '业务数据维护人', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='原始数据信息配置表'; CREATE TABLE `access_resource_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `raw_data_id` int(11) NOT NULL COMMENT '原始数据id', `resource` text COMMENT '统一资源定位', `collection_type` varchar(255) DEFAULT NULL COMMENT '采集方式', `start_at` int(11) DEFAULT '0' COMMENT '起始位置', `increment_field` varchar(255) DEFAULT NULL COMMENT '增长字段', `period` int(11) DEFAULT NULL COMMENT '拉取周期, 0表示实时,-1表示一次性', `time_format` varchar(255) DEFAULT NULL COMMENT '时间格式', `before_time` int(11) DEFAULT NULL COMMENT '数据延迟时间', `conditions` text COMMENT '过滤条件', `active` tinyint(1) DEFAULT '1' COMMENT '记录是否有效', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=94 DEFAULT CHARSET=utf8 COMMENT='接入配置表'; CREATE TABLE `access_task` ( `id` int(11) NOT NULL AUTO_INCREMENT, `data_scenario` varchar(128) NOT NULL COMMENT '接入场景', `bk_biz_id` int(11) NOT NULL COMMENT '业务id', `deploy_plans` longtext NOT NULL COMMENT '部署计划', `logs` longtext COMMENT '接入日志', `logs_en` longtext COMMENT '接入日志英文', `context` longtext, `result` varchar(64) NOT NULL COMMENT '状态', `created_by` varchar(128) NOT NULL COMMENT '创建人', `created_at` datetime(6) DEFAULT NULL COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL, `updated_at` datetime(6) DEFAULT NULL COMMENT '修改时间', `description` longtext NOT NULL COMMENT '描述', `action` varchar(64) DEFAULT NULL COMMENT '回调动作', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接入任务表'; CREATE TABLE `access_scenario_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `data_scenario_name` varchar(128) NOT NULL COMMENT '接入场景名称(log, db, beacon, tlog)', `data_scenario_alias` varchar(128) NOT NULL COMMENT '接入场景别名, 日志、数据库、灯塔、TLOG', `active` tinyint(1) DEFAULT '1' COMMENT '记录是否有效', `type` varchar(12) DEFAULT 'common' COMMENT '场景类别', `orders` int(11) DEFAULT '1' COMMENT '顺序', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 COMMENT='平台已经支持数据接入场景配置'; CREATE TABLE `access_source_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `pid` int(11) DEFAULT '0' COMMENT '父节点id', `active` int(11) DEFAULT '1' COMMENT '是否可用', `data_source_name` varchar(128) NOT NULL COMMENT '原始数据来源(GSE数据管道、TEG数据管道、MIG灯塔)', `data_source_alias` varchar(128) NOT NULL COMMENT '原始数据来源别名', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='数据接入来源配置表'; insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (1,0,1,"network_devices","网络设备","网络设备"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (2,0,1,"business_server","业务服务器","务服务器"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (3,0,0,"terminal_devices","终端设备","终端设备"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (4,0,0,"business_client","业务客户端","业务客户端"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (5,0,1,"file","本地文件","本地文件"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (6,0,1,"other","其他","其他"); insert into access_source_config(id, pid, active , data_source_name, data_source_alias, description) VALUES (7,0,1,"system","第三方系统","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (8,7,1,"biz_analysis_sys","经营分析系统(IEG)","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (9,7,1,"mig","灯塔系统(MIG)","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (10,7,1,"tglog","TGLOG系统(IEG)","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (12,7,1,"tqos","TQOS系统(IEG)","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (13,7,1,"tdw","TDW","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (14,7,0,"ams","AMS(IEG)","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (15,7,0,"tnm2","TNM2","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (16,7,0,"idip","IDIP(IEG)","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (17,7,0,"msdk","MSDK(IEG)","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (18,7,0,"gcs","GCS(IEG)","第三方系统"); insert into access_source_config(id, pid, active, data_source_name, data_source_alias, description) VALUES (19,7,1,"tdm","TDM(IEG)","第三方系统"); CREATE TABLE `access_scenario_source_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `access_scenario_id` int(11) NOT NULL COMMENT '接入场景ID', `access_source_id` int(11) NOT NULL COMMENT '数据来源ID', `active` TINYINT(1) NULL DEFAULT 1 COMMENT '记录是否有效', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接入场景来源配置表'; insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (35,2,1,"log"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (35,1,1,"log"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (35,3,1,"log"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (35,6,1,"log"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (36,2,1,"db"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (36,8,1,"db"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (36,13,1,"db"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (36,6,1,"db"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (38,2,1,"http"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (38,4,1,"http"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (38,13,1,"http"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (38,14,1,"http"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (38,15,1,"http"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (38,18,1,"http"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (38,6,1,"http"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (39,5,1,"file"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (40,2,1,"file"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (42,9,1,"beacon"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (43,10,1,"tglog"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (43,17,1,"tglog"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (44,2,1,"tlog"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (44,16,1,"tlog"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (44,17,1,"tlog"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (45,12,1,"tqos"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (46,13,1,"tdw"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (47,2,1,"custom"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (48,13,1,"tube"); insert into access_scenario_source_config(access_scenario_id, access_source_id, active, description) values (49,19,1,"tdm"); CREATE TABLE `access_tqos_zone_config` ( `tqos_zone_id` int(11) NOT NULL COMMENT 'tqos大区id', `tqos_zone_name` varchar(128) NOT NULL COMMENT 'tqos大区名称', `ip_set` varchar(128) NOT NULL COMMENT '多个IP用逗号分隔', `active` TINYINT(1) NULL DEFAULT 1 COMMENT '记录是否有效', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`tqos_zone_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='tqos大区配置表'; CREATE TABLE `access_db_type_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `db_type_name` varchar(128) NOT NULL COMMENT '数据库类型名称', `db_type_alias` varchar(128) NOT NULL , `active` TINYINT(1) NULL DEFAULT 1 COMMENT '记录是否有效', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='已经支持数据库类型数据接入的配置表'; insert into access_db_type_config(db_type_name, db_type_alias, description)values ("mysql", "mysql", "mysql"); CREATE TABLE `access_manager_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `names` varchar(128) NOT NULL COMMENT '负责人名称,用逗号分隔', `type` varchar(12) NOT NULL COMMENT 'email,job', `active` tinyint(1) DEFAULT '1' COMMENT '记录是否有效', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='管理员配置表'; CREATE TABLE `field_delimiter_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `delimiter` varchar(12) NOT NULL COMMENT '分隔符', `delimiter_alias` varchar(128) NOT NULL COMMENT '分隔符别名', `active` tinyint(1) DEFAULT '1' COMMENT '记录是否有效', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='分隔符配置表'; insert into field_delimiter_config(delimiter,delimiter_alias,description)values ("|","竖线","竖线"); insert into field_delimiter_config(delimiter,delimiter_alias,description)values (",","逗号","逗号"); insert into field_delimiter_config(delimiter,delimiter_alias,description)values ("`","反引号","反引号"); CREATE TABLE `access_scenario_storage_channel` ( `id` int(11) NOT NULL AUTO_INCREMENT, `data_scenario` varchar(128) NOT NULL COMMENT '接入场景', `storage_channel_id` INT(11) NOT NULL COMMENT '所属存储(kafka等)集群id', `priority` INT(11) DEFAULT 0 COMMENT '优先级', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接入场景对应存储映射表'; CREATE TABLE `access_operation_log` ( `id`int(11) NOT NULL AUTO_INCREMENT, `raw_data_id` int(10) COMMENT '源数据ID', `args` mediumtext NUlL COMMENT '配置', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接入变更操作流水表'; CREATE TABLE `access_raw_data_task` ( `id` int(11) NOT NULL AUTO_INCREMENT, `raw_data_id` INT(11) NOT NULL COMMENT '数据源id', `task_id` INT(11) NOT NULL COMMENT '任务id', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='源数据任务映射表'; CREATE TABLE `access_host_config` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `ip` varchar(256) NOT NULL COMMENT '主机ip', `source` int(11) DEFAULT '1' COMMENT 'bk_clund_id', `operator` varchar(256) DEFAULT NULL COMMENT '操作人', `data_scenario` varchar(128) NOT NULL COMMENT '接入场景', `action` varchar(256) NOT NULL COMMENT '主机动作属性', `ext` text NULL COMMENT '扩展信息', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接入主机配置'; -- ## 数据总线相关表: CREATE TABLE `databus_channel_cluster_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `cluster_name` varchar(32) UNIQUE NOT NULL COMMENT 'channel集群名称', `cluster_type` varchar(32) NOT NULL COMMENT 'channel类型kafka,other等', `cluster_role` varchar(32) NOT NULL COMMENT '集群类型outer表示外部kafka,inner表示内部kafka', `cluster_domain` varchar(128) NOT NULL COMMENT 'Kafka域名', `cluster_backup_ips` varchar(128) NOT NULL COMMENT '备用ip列表', -- 这个机制需要保证么 `cluster_port` int(8) NOT NULL COMMENT 'Kafka端口', `zk_domain` varchar(128) NOT NULL COMMENT 'zk域名', `zk_port` int(8) NOT NULL COMMENT 'zk端口', `zk_root_path` varchar(128) NOT NULL COMMENT 'kafka的配置路径', `active` TINYINT(1) NULL DEFAULT 1 COMMENT '记录是否有效', `priority` int(8) DEFAULT '0' COMMENT '默认写入优先级', `attribute` varchar(128) DEFAULT 'bkdata' COMMENT '标记这个字段是系统的bkdata还是用户的other', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据总线传输集群(outter、innter)'; CREATE TABLE `databus_connector_cluster_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `cluster_name` varchar(32) UNIQUE NOT NULL COMMENT 'cluster name for kafka connect. the group.id in properties file', `cluster_rest_domain` varchar(64) NOT NULL DEFAULT '' COMMENT '集群rest域名', `cluster_rest_port` int(11) NOT NULL DEFAULT '8083' COMMENT 'the rest.port in properties file.', `cluster_bootstrap_servers` varchar(255) NOT NULL COMMENT 'the bootstrap.servers in properties file', -- 改成id? `cluster_props` text COMMENT '集群配置,可以覆盖总线集群配置文件中的cluster相关配置项', -- 配置覆盖? `consumer_bootstrap_servers` varchar(255) DEFAULT '', -- 改成id? `consumer_props` text COMMENT 'consumer配置,可以覆盖总线集群配置文件中的consumer相关配置项', `monitor_props` text COMMENT 'monitor配置,可以覆盖总线集群配置文件中的monitor相关配置项', `other_props` text COMMENT 'other配置,可以覆盖总线集群配置文件中的配置项', `module` varchar(32) NOT NULL DEFAULT '' COMMENT '打点信息module', `component` varchar(32) NOT NULL DEFAULT '' COMMENT '打点信息component', `state` varchar(20) DEFAULT 'RUNNING' COMMENT '集群状态信息', `limit_per_day` int(11) NOT NULL DEFAULT '1440000' COMMENT '集群处理能力上限', `priority` int(11) NOT NULL DEFAULT '10' COMMENT '优先级,值越大优先级越高,0表示暂停接入', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据总线任务集群'; CREATE TABLE `databus_clean_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `clean_config_name` varchar(255) NOT NULL COMMENT '清洗配置名称', `clean_result_table_name` varchar(255) NOT NULL COMMENT '清洗结果表英文名', `clean_result_table_name_alias` varchar(255) NOT NULL COMMENT '清洗结果表中文名', `processing_id` varchar(255) NOT NULL, `raw_data_id` int(11) NOT NULL DEFAULT '0' COMMENT '原始数据的id', `pe_config` text NOT NULL COMMENT '清洗pe格式的配置', `json_config` text NOT NULL COMMENT '清洗json格式的配置', `status` varchar(32) NOT NULL DEFAULT 'stopped', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`), UNIQUE KEY `processing_id` (`processing_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据清洗配置表'; CREATE TABLE `databus_shipper_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `processing_id` varchar(255) NOT NULL, `connector_task_name` varchar(255) UNIQUE NOT NULL COMMENT 'connector任务名称', `config` text NOT NULL COMMENT 'shipper的配置', `status` varchar(32) NOT NULL DEFAULT 'stopped' COMMENT '分发任务状态', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据分发配置表'; CREATE TABLE `databus_processor_info` ( `processing_id` varchar(255) NOT NULL, `connector_task_name` varchar(255) NOT NULL COMMENT 'connector任务名称', `config` text NOT NULL COMMENT 'shipper的配置', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`processing_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据分发配置表'; CREATE TABLE `databus_connector_task` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', `connector_task_name` varchar(255) UNIQUE NOT NULL COMMENT 'connector任务名称', `task_type` varchar(32) NOT NULL COMMENT '任务类型:clean,shipper,puller', `processing_id` varchar(255) NOT NULL COMMENT 'result_table_id', `cluster_name` varchar(255) NOT NULL COMMENT '总线集群', `status` varchar(32) NOT NULL DEFAULT 'RUNNING' COMMENT '任务是否正常,并在使用中', `data_source` varchar(255) NOT NULL COMMENT '数据源', `source_type` varchar(32) NOT NULL COMMENT '数据源类型', `data_sink` varchar(255) NOT NULL COMMENT '数据目的地', `sink_type` varchar(32) NOT NULL COMMENT '目的地类型', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`), INDEX idx1 (processing_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据总线任务运行表'; CREATE TABLE `databus_channel_status` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', `source` varchar(255) NOT NULL COMMENT '数据源名称', -- 改成topic? `source_type` varchar(32) NOT NULL COMMENT '数据源类型', -- kafka集群id? `msg_count_daily` bigint(20) NOT NULL DEFAULT '0' COMMENT '最近三天每天平均记录数量', `msg_size_daily` bigint(20) NOT NULL DEFAULT '0' COMMENT '最近三天每天平均记录大小', `size_class` varchar(32) NOT NULL DEFAULT 'M' COMMENT '数据大小分类,取值范围为S/M/L/XL1/XL2/XL3等,默认为M', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据总线传输状态表'; CREATE TABLE IF NOT EXISTS `databus_clean_factor_config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `factor_name` varchar(128) NOT NULL, `factor_alias` varchar(128) NOT NULL, `active` tinyint(1) NOT NULL DEFAULT '1', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='清洗算子'; CREATE TABLE `databus_config` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', `conf_key` varchar(255) NOT NULL COMMENT '配置项', `conf_value` text NOT NULL COMMENT '配置项的值', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`), INDEX idx1 (conf_key) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='总线配置项配置表'; CREATE TABLE IF NOT EXISTS `databus_hdfs_import_tasks` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', `result_table_id` varchar(255) NOT NULL COMMENT 'result_table_id', `data_dir` varchar(512) NOT NULL COMMENT 'data file directory of this task in HDFS', `hdfs_conf_dir` varchar(512) NOT NULL COMMENT 'HDFS conf files directory', `hdfs_custom_property` text NOT NULL COMMENT 'HDFS集群配置参数', `kafka_bs` varchar(512) NOT NULL COMMENT 'kafka bootstrap servers', `finished` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'offline task finished or not', `status` varchar(512) NOT NULL DEFAULT '' COMMENT 'offline task processing status', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`), INDEX idx1 (result_table_id), INDEX idx2 (data_dir), INDEX idx3 (finished) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='HDFS数据入总线kafka任务流水表'; CREATE TABLE IF NOT EXISTS `databus_storage_event` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', `result_table_id` varchar(255) NOT NULL COMMENT '结果表result_table_id', `storage` varchar(32) NOT NULL COMMENT '存储类型', `event_type` varchar(32) NOT NULL COMMENT '事件类型', `event_value` varchar(255) NOT NULL COMMENT '事件值', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`), INDEX idx1 (result_table_id), INDEX idx2 (event_type), INDEX idx3 (event_value), INDEX idx4 (storage) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='总线存储事件表'; CREATE TABLE IF NOT EXISTS `databus_operation_log` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', `operation_type` varchar(255) NOT NULL COMMENT '操作类型', `item` varchar(255) NOT NULL COMMENT '任务名称', `target` varchar(510) NOT NULL DEFAULT '' COMMENT '操作涉及的集群、地址等信息', `request` text NOT NULL COMMENT '请求参数', `response` text NOT NULL COMMENT '请求返回结果', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', PRIMARY KEY (`id`), INDEX idx1 (operation_type), INDEX idx2 (item) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='总线操作流水表'; CREATE TABLE IF NOT EXISTS `databus_transform_processing` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', `connector_name` varchar(255) NOT NULL COMMENT 'kafka connector name', `processing_id` varchar(255) NOT NULL COMMENT '清洗任务id', `node_type` varchar(255) NOT NULL COMMENT '节点类型', `source_result_table_ids` varchar(2048) NOT NULL COMMENT '结果表result_table_id列表,逗号分隔', `config` text NOT NULL COMMENT '清洗逻辑配置 json格式', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`), INDEX idx1 (processing_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='总线清洗任务配置表'; CREATE TABLE `file_frequency_config` ( `id` int(10) NOT NULL AUTO_INCREMENT, `en_display` varchar(128) NOT NULL, `display` varchar(128) NOT NULL, `value` varchar(128) NOT NULL, `active` tinyint(1) NOT NULL DEFAULT '1', `created_by` varchar(50) NOT NULL COMMENT 'created by', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time', `updated_by` varchar(50) DEFAULT NULL COMMENT 'updated by ', `updated_at` timestamp NULL COMMENT 'update time', `description` text DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='日志文件生成频率'; CREATE TABLE IF NOT EXISTS `data_category_config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `data_category_name` varchar(128) NOT NULL, `data_category_alias` varchar(128) NOT NULL, `active` tinyint(1) NOT NULL DEFAULT '1', `created_by` varchar(50) NOT NULL COMMENT 'created by', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time', `updated_by` varchar(50) DEFAULT NULL COMMENT 'updated by ', `updated_at` timestamp NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time', `description` text DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='接入分类'; CREATE TABLE `data_storage_config` ( `id` int(11) NOT NULL AUTO_INCREMENT, `raw_data_id` int(11) NOT NULL COMMENT '数据源id', `cluster_type` varchar(225) NOT NULL COMMENT '存储类型', `cluster_name` varchar(225) NOT NULL COMMENT '存储集群名称', `expires` varchar(225) NOT NULL COMMENT '过期时间', `data_type` varchar(12) NOT NULL COMMENT '数据类型,raw_data,clean', `result_table_id` varchar(255) NOT NULL COMMENT '结果表id', `created_by` varchar(128) DEFAULT NULL COMMENT '创建人', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_by` varchar(128) DEFAULT NULL COMMENT '修改人', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `description` text NOT NULL COMMENT '备注信息', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COMMENT='数据入库配置表';
the_stack
----------------------------------------------------------------------------- -- (c) Copyright IBM Corp. 2011 All rights reserved. -- -- The following sample of source code ("Sample") is owned by International -- Business Machines Corporation or one of its subsidiaries ("IBM") and is -- copyrighted and licensed, not sold. You may use, copy, modify, and -- distribute the Sample in any form without payment to IBM, for the purpose of -- assisting you in the development of your applications. -- -- The Sample code is provided to you on an "AS IS" basis, without warranty of -- any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR -- IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do -- not allow for the exclusion or limitation of implied warranties, so the above -- limitations or exclusions may not apply to you. IBM shall not be liable for -- any damages you suffer as a result of using, copying, modifying or -- distributing the Sample, even if IBM has been advised of the possibility of -- such damages. ----------------------------------------------------------------------------- -- -- SOURCE FILE NAME: temporal_revert.db2 -- -- SAMPLE: Creates the SQL procedure REVERT_TABLE_SYSTEM_TIME -- -- To create the SQL procedure REVERT_TABLE_SYSTEM_TIME(): -- 1. Connect to your database -- 2. At the OS prompt, enter the following command: -- -- db2 -td@ -vf temporal_revert.db2 -- -- -- To call the SQL procedure from the command line: -- 1. Connect to your database -- 2. Enter command such as the following: -- db2 "call REVERT_TABLE_SYSTEM_TIME('DB2INST1', 'EMPLOYEES002', -- TIMESTAMP('2003-06-21-11.17.04.663397000000'), 'YES', 'empID > 50')"; -- You can also use tthe default value: -- db2 "call REVERT_TABLE_SYSTEM_TIME('DB2INST1', 'EMPLOYEES002', -- TIMESTAMP('2003-06-21-11.17.04.663397000000'))"; -- -- ---------------------------------------------------------------------------- -- -- REVERT_TABLE_SYSTEM_TIME -- -- Purpose: The REVERT_TABLE_SYSTEM_TIME procedure reverts a system-period temporal -- table or a subset of its rows to a prior point in time. -- -- -- Syntax: -- -- >>-REVERT_TABLE_SYSTEM_TIME-- (--tableschema--,--tablename--,+--timestamp--+--> -- -- >--before--,--row_identifying_predicate--) ------------------------>< -- -- Procedure parameters -- -- tableschema -- Schema of the table to revert. -- tablename -- Unqualified name of the table to revert. This table must be a -- system-period temporal table with versioning enabled. -- timestamp -- A past point in time that is used to revert the table. This point in time -- can indicate one of two things: -- (a) The exact point in time to which the table will be reverted, e.g. the -- time of the last known good state of the table. In this case, set the -- parameter before to 'NO'. -- (b) The timestamp of a bad transaction that needs to be undone, if the -- table should be reverted to the state before this transaction. In this -- case, set the parameter before to 'YES'. -- -- Example: TIMESTAMP ('2009-11-10-00.12.32.123456123456') -- TIMESTAMP ('2009-11-10') -- -- before -- This parameter is optional and specifies how to revert the table. -- There are two values for this parameter, 'YES' and 'NO' -- YES: The table is reverted to last valid state before the specified timestamp. -- NO: The table is reverted to the state as it was at the specified timestamp. -- If this parameter is omitted, the default value is 'NO'. Must not be NULL. -- -- row_identifying_predicate -- This parameter is optional and can specifiy a predicate that selects a subset -- of rows that need to be reverted. -- -- -- Authorization: -- The user that invokes the stored procedure must have authorizations -- to SELECT, INSERT and DELETE rows in the specified table. -- -- Note: -- The procedure performs the following checks to ensure a proper revert operation: -- - Input parameters for tableschema, tablename, timestamp, before must not be null. -- - The specified table must be system-period temporaql table. -- - All input values have a valid format for the required data type. -- -- -- Usage notes: -- 1. DELETE and INSERT row-level triggers fire for each row that is -- deleted and each history rows that is reinserted into the base table. -- 2. The REVERT_TABLE_SYSTEM_TIME procedure does not DELETE or change rows -- in the history table. On the contrary, any changes performed by the procedure -- are captured in the history table so that the revert operation itself can be -- reverted if necessary. -- 3. The procedures can be called mutliple times on the same tables, if needed. -- 4. When REVERT_TABLE_SYSTEM_TIME is executed, the selected rows have -- their data reverted, but their system time values are not reverted. -- Instead, the new system start times for these rows will be the time of -- executing the revert procedure. -- 5. The procedures returns one of the following codes: -- -9999 : means the target table is not a system-period temporal table -- 100 : means no change to target table was performed -- -206 : means the specified row_identifying_predicate is incorrect -- other : Other sqlcodes may be returned for other failures. -- 6. If an error occurrs, any work performed in the unit of work -- that called the REVERT_TABLE_SYSTEM_TIME procedure is also rolled back. -- This behavior ensures that no table is changed if an error occurs. -- ----------------------------------------------------------------------------- -- -- For more information on the sample scripts, see the README file. -- -- For information on creating SQL procedures, see the Application -- Development Guide. -- -- For information on using SQL statements, see the SQL Reference. -- -- For the latest information on programming, building, and running DB2 -- applications, visit the DB2 application development website: -- http://www.software.ibm.com/data/db2/udb/ad ----------------------------------------------------------------------------- --#SET TERMINATOR @ -- Drop all necessary type and SPs DROP PROCEDURE GET_TABLE_COLUMN_NAME @ DROP PROCEDURE GET_HISTORY_TABLE_NAME @ DROP PROCEDURE REVERT_TABLE_SYSTEM_TIME @ -- This SP returns information about all columns in a table CREATE PROCEDURE GET_TABLE_COLUMN_NAME ( IN schemaname VARCHAR(128), IN tablename VARCHAR(128), INOUT sys_start VARCHAR(128), INOUT sys_end VARCHAR(128), INOUT trans_start VARCHAR(128), INOUT result VARCHAR(20000) ) LANGUAGE SQL -- Transaction has to be atomic if we -- want to be able to roll back changes BEGIN ATOMIC -- Get "SYSTEM_START", "SYSTEM_END", "TRANS_START" column names using SYSIBM.SYSCOLUMNS -- We also get other column names list in this SP. FOR conc AS SELECT name, identity FROM sysibm.syscolumns WHERE TBNAME = tablename and TBCREATOR = schemaname DO IF -- 'B' means ||sys_start|| column conc.IDENTITY = 'B' THEN SET sys_start = name ; ELSEIF -- 'E' means ||sys_end|| column conc.IDENTITY = 'E' then set sys_end = name ; ELSEIF -- 'S' means TRANS_START column conc.IDENTITY = 'S' THEN SET trans_start = name; ELSE SET result = CASE WHEN COALESCE(result, '') = '' THEN '"' CONCAT name CONCAT '"' ELSE result CONCAT ',' CONCAT '"' CONCAT name CONCAT '"' END; END IF; END FOR; END @ -- This SP returns all column names of an input table (excluding sys_start and sys_end) -- in a comma-separated string CREATE PROCEDURE GET_HISTORY_TABLE_NAME ( IN schemaname VARCHAR(128), IN tablename VARCHAR(128), INOUT hisfullname VARCHAR(257) ) LANGUAGE SQL -- Transaction has to be atomic if we -- want to be able to roll back changes BEGIN ATOMIC -- Get history table names using SYSCAT.PERIODS FOR conc AS SELECT historytabname,historytabschema FROM syscat.periods WHERE tabschema = schemaname AND tabname = tablename DO SET hisfullname = case WHEN COALESCE(conc.historytabname, '') = '' THEN '' ELSE conc.historytabschema CONCAT '.' CONCAT conc.historytabname END; END FOR; END @ ----------------------------------------------------------------------------------- -- The main revert stored procedure CREATE PROCEDURE REVERT_TABLE_SYSTEM_TIME ( IN tschema VARCHAR(128), IN tname VARCHAR(128), IN pointInTime TIMESTAMP, IN before VARCHAR(3) default 'NO', IN row_identifying_predicate VARCHAR(20000) default '1=1') LANGUAGE SQL -- Transaction has to be atomic if we -- want to be able to roll back changes BEGIN ATOMIC -- Local variable declaration DECLARE del_stmt VARCHAR(20000); DECLARE ins_stmt VARCHAR(20000); -- pit = point in time DECLARE pit_strg VARCHAR(50); DECLARE ret INTEGER default 0; DECLARE result VARCHAR(20000); DECLARE sys_start VARCHAR(128); DECLARE sys_end VARCHAR(128); DECLARE trans_start VARCHAR(128); DECLARE hisfullname VARCHAR(257); DECLARE sql_code INTEGER default 0; DECLARE sqlcode INTEGER default 0; DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET sql_code = sqlcode; DECLARE CONTINUE HANDLER FOR SQLWARNING SET sql_code = sqlcode; DECLARE CONTINUE HANDLER FOR NOT FOUND SET sql_code = sqlcode; SET pit_strg = CAST(pointInTime AS VARCHAR(50)); -- Each time a table is reverted, result and hisfullname are first set to '' in order to -- retrieve correct table's column names SET result = ''; SET hisfullname =''; CALL GET_TABLE_COLUMN_NAME (tschema, tname, sys_start, sys_end, trans_start, result); CALL GET_HISTORY_TABLE_NAME (tschema, tname, hisfullname); -- If we don't get a history table name, it means the given table is not a temporal table or -- that verisoning is not enabled. If we encouter either case, we return a error. IF hisfullname = '' THEN SET ret = 1; GOTO nohistory; END IF; IF (UCASE(before)) = 'YES' THEN SET before = 'YES'; ELSE SET before = 'NO'; END IF; -- First, delete all rows where start time > pit. -- Then select all rows from history where start time < pit and end time > pit, -- and insert them into the base table. CASE WHEN before='YES' THEN SET del_stmt = 'DELETE FROM "' || tschema || '"."' || tname || '" WHERE '||sys_start||' >= timestamp(' || '''' || pit_strg || '''' || ')' || ' and '||sys_end||' = timestamp(''9999-12-30-00.00.00.000000000000'')' || ' and ('||row_identifying_predicate||')' ; SET ins_stmt = ' INSERT INTO "' || tschema || '"."' || tname || '" (' || result || ') SELECT ' || result || ' FROM '||hisfullname|| ' WHERE '||sys_start||' < timestamp(' || '''' || pit_strg || '''' || ')' || ' and '||sys_end||' > timestamp(' || '''' || pit_strg || '''' || ')' || ' and ('||row_identifying_predicate||') ' ; EXECUTE IMMEDIATE del_stmt; IF sql_code = 100 THEN SET ret = ret + 100; ELSEIF sql_code < 0 THEN RETURN sql_code; END IF; EXECUTE IMMEDIATE ins_stmt; IF sql_code = 100 THEN SET ret = ret + 100; ELSEIF sql_code < 0 THEN RETURN sql_code; END IF; WHEN before='NO' THEN SET del_stmt = 'DELETE FROM "' || tschema || '"."' || tname || '" WHERE '||sys_start||' >= timestamp(' || '''' || pit_strg || '''' || ')' || ' and '||sys_end||' = timestamp(''9999-12-30-00.00.00.000000000000'')' || ' and ('||row_identifying_predicate||')' ; SET ins_stmt = ' INSERT INTO "' || tschema || '"."' || tname || '" (' || result || ') SELECT ' || result || ' FROM '||hisfullname|| ' WHERE '||sys_start||' <= timestamp(' || '''' || pit_strg || '''' || ')' || ' and '||sys_end||' >= timestamp(' || '''' || pit_strg || '''' || ')' || ' and ('||row_identifying_predicate||')'; EXECUTE IMMEDIATE del_stmt; IF sql_code = 100 THEN SET ret = ret + 100; ELSEIF sql_code < 0 THEN RETURN sql_code; END IF; EXECUTE IMMEDIATE ins_stmt; IF sql_code = 100 THEN SET ret = ret + 100; ELSEIF sql_code < 0 THEN RETURN sql_code; END IF; END CASE; nohistory : IF ret = 1 THEN RETURN -9999; END IF; IF RET = 200 THEN RETURN 100; END IF; end @
the_stack
Standardized clinical data ************************/ CREATE INDEX idx_person_id ON @cdmDatabaseSchema.person (person_id ASC); CLUSTER @cdmDatabaseSchema.person USING idx_person_id ; CREATE INDEX idx_gender ON @cdmDatabaseSchema.person (gender_concept_id ASC); CREATE INDEX idx_observation_period_id_1 ON @cdmDatabaseSchema.observation_period (person_id ASC); CLUSTER @cdmDatabaseSchema.observation_period USING idx_observation_period_id_1 ; CREATE INDEX idx_visit_person_id_1 ON @cdmDatabaseSchema.visit_occurrence (person_id ASC); CLUSTER @cdmDatabaseSchema.visit_occurrence USING idx_visit_person_id_1 ; CREATE INDEX idx_visit_concept_id_1 ON @cdmDatabaseSchema.visit_occurrence (visit_concept_id ASC); CREATE INDEX idx_visit_det_person_id_1 ON @cdmDatabaseSchema.visit_detail (person_id ASC); CLUSTER @cdmDatabaseSchema.visit_detail USING idx_visit_det_person_id_1 ; CREATE INDEX idx_visit_det_concept_id_1 ON @cdmDatabaseSchema.visit_detail (visit_detail_concept_id ASC); CREATE INDEX idx_visit_det_occ_id ON @cdmDatabaseSchema.visit_detail (visit_occurrence_id ASC); CREATE INDEX idx_condition_person_id_1 ON @cdmDatabaseSchema.condition_occurrence (person_id ASC); CLUSTER @cdmDatabaseSchema.condition_occurrence USING idx_condition_person_id_1 ; CREATE INDEX idx_condition_concept_id_1 ON @cdmDatabaseSchema.condition_occurrence (condition_concept_id ASC); CREATE INDEX idx_condition_visit_id_1 ON @cdmDatabaseSchema.condition_occurrence (visit_occurrence_id ASC); CREATE INDEX idx_drug_person_id_1 ON @cdmDatabaseSchema.drug_exposure (person_id ASC); CLUSTER @cdmDatabaseSchema.drug_exposure USING idx_drug_person_id_1 ; CREATE INDEX idx_drug_concept_id_1 ON @cdmDatabaseSchema.drug_exposure (drug_concept_id ASC); CREATE INDEX idx_drug_visit_id_1 ON @cdmDatabaseSchema.drug_exposure (visit_occurrence_id ASC); CREATE INDEX idx_procedure_person_id_1 ON @cdmDatabaseSchema.procedure_occurrence (person_id ASC); CLUSTER @cdmDatabaseSchema.procedure_occurrence USING idx_procedure_person_id_1 ; CREATE INDEX idx_procedure_concept_id_1 ON @cdmDatabaseSchema.procedure_occurrence (procedure_concept_id ASC); CREATE INDEX idx_procedure_visit_id_1 ON @cdmDatabaseSchema.procedure_occurrence (visit_occurrence_id ASC); CREATE INDEX idx_device_person_id_1 ON @cdmDatabaseSchema.device_exposure (person_id ASC); CLUSTER @cdmDatabaseSchema.device_exposure USING idx_device_person_id_1 ; CREATE INDEX idx_device_concept_id_1 ON @cdmDatabaseSchema.device_exposure (device_concept_id ASC); CREATE INDEX idx_device_visit_id_1 ON @cdmDatabaseSchema.device_exposure (visit_occurrence_id ASC); CREATE INDEX idx_measurement_person_id_1 ON @cdmDatabaseSchema.measurement (person_id ASC); CLUSTER @cdmDatabaseSchema.measurement USING idx_measurement_person_id_1 ; CREATE INDEX idx_measurement_concept_id_1 ON @cdmDatabaseSchema.measurement (measurement_concept_id ASC); CREATE INDEX idx_measurement_visit_id_1 ON @cdmDatabaseSchema.measurement (visit_occurrence_id ASC); CREATE INDEX idx_observation_person_id_1 ON @cdmDatabaseSchema.observation (person_id ASC); CLUSTER @cdmDatabaseSchema.observation USING idx_observation_person_id_1 ; CREATE INDEX idx_observation_concept_id_1 ON @cdmDatabaseSchema.observation (observation_concept_id ASC); CREATE INDEX idx_observation_visit_id_1 ON @cdmDatabaseSchema.observation (visit_occurrence_id ASC); CREATE INDEX idx_death_person_id_1 ON @cdmDatabaseSchema.death (person_id ASC); CLUSTER @cdmDatabaseSchema.death USING idx_death_person_id_1 ; CREATE INDEX idx_note_person_id_1 ON @cdmDatabaseSchema.note (person_id ASC); CLUSTER @cdmDatabaseSchema.note USING idx_note_person_id_1 ; CREATE INDEX idx_note_concept_id_1 ON @cdmDatabaseSchema.note (note_type_concept_id ASC); CREATE INDEX idx_note_visit_id_1 ON @cdmDatabaseSchema.note (visit_occurrence_id ASC); CREATE INDEX idx_note_nlp_note_id_1 ON @cdmDatabaseSchema.note_nlp (note_id ASC); CLUSTER @cdmDatabaseSchema.note_nlp USING idx_note_nlp_note_id_1 ; CREATE INDEX idx_note_nlp_concept_id_1 ON @cdmDatabaseSchema.note_nlp (note_nlp_concept_id ASC); CREATE INDEX idx_specimen_person_id_1 ON @cdmDatabaseSchema.specimen (person_id ASC); CLUSTER @cdmDatabaseSchema.specimen USING idx_specimen_person_id_1 ; CREATE INDEX idx_specimen_concept_id_1 ON @cdmDatabaseSchema.specimen (specimen_concept_id ASC); CREATE INDEX idx_fact_relationship_id1 ON @cdmDatabaseSchema.fact_relationship (domain_concept_id_1 ASC); CREATE INDEX idx_fact_relationship_id2 ON @cdmDatabaseSchema.fact_relationship (domain_concept_id_2 ASC); CREATE INDEX idx_fact_relationship_id3 ON @cdmDatabaseSchema.fact_relationship (relationship_concept_id ASC); /************************ Standardized health system data ************************/ CREATE INDEX idx_location_id_1 ON @cdmDatabaseSchema.location (location_id ASC); CLUSTER @cdmDatabaseSchema.location USING idx_location_id_1 ; CREATE INDEX idx_care_site_id_1 ON @cdmDatabaseSchema.care_site (care_site_id ASC); CLUSTER @cdmDatabaseSchema.care_site USING idx_care_site_id_1 ; CREATE INDEX idx_provider_id_1 ON @cdmDatabaseSchema.provider (provider_id ASC); CLUSTER @cdmDatabaseSchema.provider USING idx_provider_id_1 ; /************************ Standardized health economics ************************/ CREATE INDEX idx_period_person_id_1 ON @cdmDatabaseSchema.payer_plan_period (person_id ASC); CLUSTER @cdmDatabaseSchema.payer_plan_period USING idx_period_person_id_1 ; CREATE INDEX idx_cost_event_id ON @cdmDatabaseSchema.cost (cost_event_id ASC); /************************ Standardized derived elements ************************/ CREATE INDEX idx_drug_era_person_id_1 ON @cdmDatabaseSchema.drug_era (person_id ASC); CLUSTER @cdmDatabaseSchema.drug_era USING idx_drug_era_person_id_1 ; CREATE INDEX idx_drug_era_concept_id_1 ON @cdmDatabaseSchema.drug_era (drug_concept_id ASC); CREATE INDEX idx_dose_era_person_id_1 ON @cdmDatabaseSchema.dose_era (person_id ASC); CLUSTER @cdmDatabaseSchema.dose_era USING idx_dose_era_person_id_1 ; CREATE INDEX idx_dose_era_concept_id_1 ON @cdmDatabaseSchema.dose_era (drug_concept_id ASC); CREATE INDEX idx_condition_era_person_id_1 ON @cdmDatabaseSchema.condition_era (person_id ASC); CLUSTER @cdmDatabaseSchema.condition_era USING idx_condition_era_person_id_1 ; CREATE INDEX idx_condition_era_concept_id_1 ON @cdmDatabaseSchema.condition_era (condition_concept_id ASC); /************************** Standardized meta-data ***************************/ CREATE INDEX idx_metadata_concept_id_1 ON @cdmDatabaseSchema.metadata (metadata_concept_id ASC); CLUSTER @cdmDatabaseSchema.metadata USING idx_metadata_concept_id_1 ; /************************** Standardized vocabularies ***************************/ CREATE INDEX idx_concept_concept_id ON @cdmDatabaseSchema.concept (concept_id ASC); CLUSTER @cdmDatabaseSchema.concept USING idx_concept_concept_id ; CREATE INDEX idx_concept_code ON @cdmDatabaseSchema.concept (concept_code ASC); CREATE INDEX idx_concept_vocabluary_id ON @cdmDatabaseSchema.concept (vocabulary_id ASC); CREATE INDEX idx_concept_domain_id ON @cdmDatabaseSchema.concept (domain_id ASC); CREATE INDEX idx_concept_class_id ON @cdmDatabaseSchema.concept (concept_class_id ASC); CREATE INDEX idx_vocabulary_vocabulary_id ON @cdmDatabaseSchema.vocabulary (vocabulary_id ASC); CLUSTER @cdmDatabaseSchema.vocabulary USING idx_vocabulary_vocabulary_id ; CREATE INDEX idx_domain_domain_id ON @cdmDatabaseSchema.domain (domain_id ASC); CLUSTER @cdmDatabaseSchema.domain USING idx_domain_domain_id ; CREATE INDEX idx_concept_class_class_id ON @cdmDatabaseSchema.concept_class (concept_class_id ASC); CLUSTER @cdmDatabaseSchema.concept_class USING idx_concept_class_class_id ; CREATE INDEX idx_concept_relationship_id_1 ON @cdmDatabaseSchema.concept_relationship (concept_id_1 ASC); CLUSTER @cdmDatabaseSchema.concept_relationship USING idx_concept_relationship_id_1 ; CREATE INDEX idx_concept_relationship_id_2 ON @cdmDatabaseSchema.concept_relationship (concept_id_2 ASC); CREATE INDEX idx_concept_relationship_id_3 ON @cdmDatabaseSchema.concept_relationship (relationship_id ASC); CREATE INDEX idx_relationship_rel_id ON @cdmDatabaseSchema.relationship (relationship_id ASC); CLUSTER @cdmDatabaseSchema.relationship USING idx_relationship_rel_id ; CREATE INDEX idx_concept_synonym_id ON @cdmDatabaseSchema.concept_synonym (concept_id ASC); CLUSTER @cdmDatabaseSchema.concept_synonym USING idx_concept_synonym_id ; CREATE INDEX idx_concept_ancestor_id_1 ON @cdmDatabaseSchema.concept_ancestor (ancestor_concept_id ASC); CLUSTER @cdmDatabaseSchema.concept_ancestor USING idx_concept_ancestor_id_1 ; CREATE INDEX idx_concept_ancestor_id_2 ON @cdmDatabaseSchema.concept_ancestor (descendant_concept_id ASC); CREATE INDEX idx_source_to_concept_map_3 ON @cdmDatabaseSchema.source_to_concept_map (target_concept_id ASC); CLUSTER @cdmDatabaseSchema.source_to_concept_map USING idx_source_to_concept_map_3 ; CREATE INDEX idx_source_to_concept_map_1 ON @cdmDatabaseSchema.source_to_concept_map (source_vocabulary_id ASC); CREATE INDEX idx_source_to_concept_map_2 ON @cdmDatabaseSchema.source_to_concept_map (target_vocabulary_id ASC); CREATE INDEX idx_source_to_concept_map_c ON @cdmDatabaseSchema.source_to_concept_map (source_code ASC); CREATE INDEX idx_drug_strength_id_1 ON @cdmDatabaseSchema.drug_strength (drug_concept_id ASC); CLUSTER @cdmDatabaseSchema.drug_strength USING idx_drug_strength_id_1 ; CREATE INDEX idx_drug_strength_id_2 ON @cdmDatabaseSchema.drug_strength (ingredient_concept_id ASC); --Additional v6.0 indices --CREATE CLUSTERED INDEX idx_survey_person_id_1 ON @cdmDatabaseSchema.survey_conduct (person_id ASC); --CREATE CLUSTERED INDEX idx_episode_person_id_1 ON @cdmDatabaseSchema.episode (person_id ASC); --CREATE INDEX idx_episode_concept_id_1 ON @cdmDatabaseSchema.episode (episode_concept_id ASC); --CREATE CLUSTERED INDEX idx_episode_event_id_1 ON @cdmDatabaseSchema.episode_event (episode_id ASC); --CREATE INDEX idx_ee_field_concept_id_1 ON @cdmDatabaseSchema.episode_event (event_field_concept_id ASC);
the_stack
declare @type varchar(100) = 'PARQUET&DELTA' select schema_name(v.schema_id), v.name, m.definition from sys.views v join sys.sql_modules m on v.object_id = m.object_id where CASE WHEN (UPPER(m.definition) LIKE '%''PARQUET''%' AND UPPER(m.definition) LIKE '%''CSV''%' ) THEN 'PARQUET&CSV' WHEN (UPPER(m.definition) LIKE '%''PARQUET''%' AND UPPER(m.definition) LIKE '%''DELTA''%' ) THEN 'PARQUET&DELTA' WHEN (UPPER(m.definition) LIKE '%''PARQUET''%' AND UPPER(m.definition) LIKE '%''COSMOSDB''%' ) THEN 'PARQUET&COSMOSDB' WHEN (UPPER(m.definition) LIKE '%''CSV''%' AND UPPER(m.definition) LIKE '%''DELTA''%' ) THEN 'CSV&DELTA' WHEN (UPPER(m.definition) LIKE '%''CSV''%' AND UPPER(m.definition) LIKE '%''COSMOSDB''%' ) THEN 'CSV&COSMOSDB' WHEN (UPPER(m.definition) LIKE '%''DELTA''%' AND UPPER(m.definition) LIKE '%''COSMOSDB''%' ) THEN 'DELTA&COSMOSDB' WHEN UPPER(m.definition) LIKE '%''PARQUET''%' THEN 'PARQUET' WHEN UPPER(m.definition) LIKE '%''DELTA''%' THEN 'DELTA' WHEN UPPER(m.definition) LIKE '%''CSV''%' THEN 'CSV' WHEN UPPER(m.definition) LIKE '%''COSMOSDB''%' THEN 'COSMOSDB' WHEN UPPER(m.definition) NOT LIKE '%''PARQUET''%' AND (UPPER(m.definition) NOT LIKE '%''CSV''%' ) AND (UPPER(m.definition) NOT LIKE '%''DELTA''%' ) AND (UPPER(m.definition) NOT LIKE '%''COSMOSDB''%' ) THEN 'COMPOSITE' ELSE 'MIXED' END = @type */ -- Views created on Delta Lake, Cosmos DB, Parquet and CSV/UTF-8 files with NVARCHAR/NCHAR columns or CHAR/VARCHAR without UTF8 collation: ; with sql_definition as ( select object_id, format_type = CASE WHEN UPPER(m.definition) LIKE '%''PARQUET''%' THEN 'PARQUET' WHEN UPPER(m.definition) LIKE '%''DELTA''%' THEN 'DELTA' WHEN UPPER(m.definition) LIKE '%''CSV''%' THEN 'CSV' WHEN UPPER(m.definition) LIKE '%''COSMOSDB''%' THEN 'COSMOSDB' WHEN UPPER(m.definition) NOT LIKE '%''PARQUET''%' AND (UPPER(m.definition) NOT LIKE '%''CSV''%' ) AND (UPPER(m.definition) NOT LIKE '%''DELTA''%' ) AND (UPPER(m.definition) NOT LIKE '%''COSMOSDB''%' ) THEN 'COMPOSITE' ELSE 'MIXED' END from sys.sql_modules m ), bulkpath as ( select schema_name = schema_name(v.schema_id), v.name, val =TRIM(SUBSTRING( LOWER(m.definition) , PATINDEX('%bulk%', LOWER(m.definition)), 2048)), m.definition from sys.views v join sys.sql_modules m on v.object_id = m.object_id where PATINDEX('%bulk%', LOWER(m.definition)) > 0 ), view_path as ( select name, schema_name, path = SUBSTRING(val, CHARINDEX('''', val, 0)+1, (CHARINDEX('''', val, CHARINDEX('''', val, 0)+1) - CHARINDEX('''', val, 0) - 1)) from bulkpath where CHARINDEX('''', val, 0) > 0 ), recommendations as ( select impact = 1.0, type = 'WRONG TYPE', schema_name = schema_name(v.schema_id), object = v.name, column_name = c.name, message = CONCAT('The view ', v.name, ' that is created on ', m.format_type,' dataset has ', count(c.column_id), ' columns with ') + IIF( t.name = 'nchar', 'NVARCHAR/NCHAR type.', 'VARCHAR/CHAR type without UTF-8 collation.') + ' You might get conversion error.' + ' Change the column types to VARCHAR with some UTF8 collation.' from sys.views as v join sys.columns as c on v.object_id = c.object_id join sql_definition m on v.object_id = m.object_id join sys.types t on c.user_type_id = t.user_type_id where ( m.format_type IN ('PARQUET', 'DELTA', 'COSMOSDB', 'MIXED') ) AND ( (t.name iN ('nchar', 'nvarhar')) OR (t.name iN ('nchar', 'nvarhar') AND c.collation_name NOT LIKE '%UTF8') ) group by v.schema_id, v.name, t.name, m.format_type, c.name union all -- Tables on UTF-8 files with NVARCHAR/NCHAR columns or CHAR/VARCHAR without UTF8 collation: select impact = IIF( t.name LIKE 'n%', 0.3, 1.0), type = 'WRONG TYPE', schema_name = schema_name(e.schema_id), object = e.name, column_name = IIF(count(c.column_id)=1, max(c.name), CONCAT(count(c.column_id), ' columns')), message = CONCAT('The table "', schema_name(e.schema_id), '.', e.name, '" that is created on ', f.format_type, ' files ') + CONCAT(IIF( f.encoding = 'UTF8', ' with UTF-8 encoding ', ''), ' has ', IIF(count(c.column_id)=1, '"' + max(c.name) + '" column', CONCAT(count(c.column_id), ' columns') ), ' with ') + IIF( t.name LIKE 'n%', 'NVARCHAR/NCHAR', 'VARCHAR/CHAR without UTF-8 collation.') + ' type. Change the column types to VARCHAR with some UTF8 collation.' from sys.external_tables as e join sys.columns as c on e.object_id = c.object_id join sys.external_file_formats f on e.file_format_id = f.file_format_id join sys.types t on c.user_type_id = t.user_type_id where ( (f.format_type IN ('PARQUET', 'DELTA')) OR f.encoding = 'UTF8' ) AND ( (t.name iN ('nchar', 'nvarhar')) OR (t.name iN ('nchar', 'nvarhar') AND c.collation_name NOT LIKE '%UTF8')) group by e.schema_id, f.format_type, e.name, f.encoding , t.name, c.name union all -- Tables on UTF-16 files with VARCHAR/CHAR columns: select impact = 1.0, type = 'WRONG TYPE', schema_name = schema_name(e.schema_id), object = e.name, column_name = IIF(count(c.column_id)=1, max(c.name), CONCAT(count(c.column_id), ' columns')), message = CONCAT('The table "', schema_name(e.schema_id), '.', e.name, '" created on CSV files with UTF16 encoding has ', IIF(count(c.column_id)=1, '"' + max(c.name) + '" column', CONCAT(count(c.column_id), ' columns') ), ' with ') + 'VARCHAR/CHAR type. Change the column type to NVARCHAR.' from sys.external_tables as e join sys.columns as c on e.object_id = c.object_id join sys.external_file_formats f on e.file_format_id = f.file_format_id join sys.types t on c.user_type_id = t.user_type_id where (f.encoding = 'UTF16' ) AND (t.name iN ('nchar', 'nvarhar')) group by e.schema_id, f.format_type, e.name, f.encoding , t.name union all -- Views created on Delta Lake, CosmosDB, or Parquet datasets with the columns without BIN2 UTF-8 collation: /*; with sql_definition as ( select object_id, format_type = CASE WHEN UPPER(m.definition) LIKE '%''PARQUET''%' THEN 'PARQUET' WHEN UPPER(m.definition) LIKE '%''DELTA''%' THEN 'DELTA' WHEN UPPER(m.definition) LIKE '%''CSV''%' THEN 'CSV' WHEN UPPER(m.definition) LIKE '%''COSMOSDB''%' THEN 'COSMOSDB' WHEN UPPER(m.definition) NOT LIKE '%''PARQUET''%' AND (UPPER(m.definition) NOT LIKE '%''CSV''%' ) AND (UPPER(m.definition) NOT LIKE '%''DELTA''%' ) AND (UPPER(m.definition) NOT LIKE '%''COSMOSDB''%' ) THEN 'COMPOSITE' ELSE 'MIXED' END from sys.sql_modules m ) */ select impact = case when string_agg(c.name,',') like '%id%' then 0.9 when string_agg(c.name,',') like '%code%' then 0.9 when count(c.column_id) > 1 then 0.81 else 0.71 end, type = 'SLOW STRING FILTERS', schema_name = schema_name(v.schema_id), object = v.name, column_name = IIF(count(c.column_id)=1, max(c.name), CONCAT(count(c.column_id), ' columns')), message = CONCAT('The view "', schema_name(v.schema_id), '.', v.name, '" that is created on ', m.format_type, ' dataset has ', IIF(count(c.column_id)=1, '"' + max(c.name) + '" column', CONCAT(count(c.column_id), ' columns') ), ' with ') + IIF( t.name = 'nchar', 'NVARCHAR/NCHAR type.', 'VARCHAR/CHAR type without BIN2 UTF8 collation.') + ' Change the column types to VARCHAR with the Latin1_General_100_BIN2_UTF8 collation.' from sys.views as v join sys.columns as c on v.object_id = c.object_id join sql_definition m on v.object_id = m.object_id join sys.types t on c.user_type_id = t.user_type_id where ( m.format_type IN ('PARQUET', 'DELTA', 'COSMOSDB', 'MIXED') ) AND ( t.name IN ('char', 'varchar') AND c.collation_name <> 'Latin1_General_100_BIN2_UTF8' ) group by v.schema_id, v.name, t.name, m.format_type union all -- Tables on Parquet/Delta Lake files with the columns without BIN2 UTF-8 collation: select impact = 0.6, type = 'SLOW STRING FILTERS', schema_name = schema_name(e.schema_id), object = e.name, column_name = c.name, message = CONCAT('The string column "', c.name, '" in table "', schema_name(t.schema_id), '.', t.name, '" doesn''t have "Latin1_General_100_BIN2_UTF8". String filter on this column are suboptimal') from sys.external_tables as e join sys.columns as c on e.object_id = c.object_id join sys.external_file_formats f on e.file_format_id = f.file_format_id join sys.types t on c.user_type_id = t.user_type_id where ( (f.format_type IN ('PARQUET', 'DELTA'))) AND t.name IN ('char', 'varchar') AND c.collation_name <> 'Latin1_General_100_BIN2_UTF8' union all -- Oversized string columns: select impact = ROUND(0.3 + (IIF(c.max_length=-1, 0.7*12000., c.max_length)/12000.),1), type = 'BIG COLUMN', schema_name = schema_name(o.schema_id), object = o.name, column_name = c.name, message = CONCAT('The string column "', c.name, '" has a max size ', IIF(c.max_length=-1, ' 2 GB', CAST( c.max_length AS VARCHAR(10)) + ' bytes'), '. Check could you use a column with a smaller size.', IIF(o.type = 'U', ' Table ', ' View '), '"', schema_name(o.schema_id), '.', o.name, '"') from sys.objects as o join sys.columns as c on o.object_id = c.object_id join sys.types t on c.user_type_id = t.user_type_id where t.name LIKE '%char' AND (c.max_length > 256 OR c.max_length = -1) and o.type in ('U', 'V') and lower(c.name) not like '%desc%' and lower(c.name) not like '%comment%' and lower(c.name) not like '%note%' and lower(c.name) not like '%exception%' and lower(c.name) not like '%reason%' and lower(c.name) not like '%explanation%' union all -- Oversized key columns: select impact = 0.4 + ROUND((1-EXP(-IIF(c.max_length=-1, 8000., c.max_length)/8000.)),1), type = 'BIG KEY', schema_name = schema_name(o.schema_id), object = o.name, column_name = c.name, message = CONCAT('Are you using the column "', c.name, '" in join/filter predicates? ', 'The column type is ', t.name, '(size:',IIF(c.max_length=-1, ' 2 GB', CAST( c.max_length AS VARCHAR(10)) + ' bytes'),'). ', 'Try to use a column with a smaller type or size.') from sys.objects as o join sys.columns as c on o.object_id = c.object_id join sys.types t on c.user_type_id = t.user_type_id where (c.name LIKE '%code' OR c.name LIKE '%id') AND (c.max_length > 8 OR c.max_length = -1) and o.type in ('U', 'V') union all -- The tables that are referencing the same location: select impact = 0.9, type = 'DUPLICATE REFERENCES', schema_name = NULL, object = NULL, column_name = NULL, message = CONCAT('The tables ', string_agg(concat('"',schema_name(e.schema_id),'.',e.name,'"'), ','), ' are referencing the same location') from sys.external_tables e group by data_source_id, location having count(*) > 1 union all -- Partitioned external table select impact = 1.0, type = 'PARTITIONED TABLES', schema_name = schema_name(e.schema_id), object = e.name, column_name = NULL, message = CONCAT('The table ', e.name, ' is created on a partitioned data set, but cannot leverage partition elimination. Replace it with a partitioned view.') from sys.external_tables e where REPLACE(location, '*.', '') like '%*%' union all select impact = IIF(c.max_length=-1, 1.0, 0.2 + ROUND((1-EXP(-c.max_length/50.))/2,1)), type = 'BAD TYPE', schema_name = schema_name(o.schema_id), object = o.name, column_name = c.name, message = CONCAT('Do you need to use the type "', t.name, '(size:',IIF(c.max_length=-1, ' 2 GB', CAST( c.max_length AS VARCHAR(10)) + ' bytes'),') in column "', c.name, '" in view: "', schema_name(o.schema_id), '.', o.name, '"') from sys.objects as o join sys.columns as c on o.object_id = c.object_id join sys.types t on c.user_type_id = t.user_type_id where t.name IN ('nchar', 'nvarchar', 'char', 'varchar', 'binary', 'varbinary') AND ( LOWER(c.name) like '%date%' OR LOWER(c.name) like '%time%' OR LOWER(c.name) like '%guid%' OR LOWER(c.name) like '%price%' OR LOWER(c.name) like '%amount%' ) AND o.type in ('U', 'V') and lower(c.name) not like '%desc%' and lower(c.name) not like '%comment%' and lower(c.name) not like '%note%' and lower(c.name) not like '%exception%' and lower(c.name) not like '%reason%' and lower(c.name) not like '%explanation%' union all select impact = 0.9, type = 'DUPLICATE REFERENCES', schema_name = NULL, object = NULL, column_name = NULL, message = CONCAT('Views ', string_agg(concat(schema_name,'.',name), ','), ' are referencing the same path: ', path) from view_path group by path having count(*) > 1 ) --/* select * from recommendations order by impact desc --*/ /* select type = isnull(type,'TOTAL'), issues = count(*) from recommendations group by type with rollup */ /* select type = isnull(type,'total'), impact, issues = count(*) from recommendations group by type, impact */
the_stack
/* chinese traditional (Taiwan/HongKong) charsets: */ /* BIG5, MS950, APPLE_CHINTRAD */ /* ======================================================================= */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_00[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, /* 0x00 */ 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, /* 0x00 */ 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, /* 0x10 */ 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, /* 0x10 */ 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, /* 0x20 */ 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, /* 0x20 */ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, /* 0x30 */ 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, /* 0x30 */ 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, /* 0x40 */ 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, /* 0x40 */ 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, /* 0x50 */ 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, /* 0x50 */ 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, /* 0x60 */ 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, /* 0x60 */ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, /* 0x70 */ 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0xA246, 0xA247, 0, 0xA244, 0, 0xA1B1, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0xA1C2, /* 0xA0 */ 0xA258, 0xA1D3, 0, 0, 0, 0, 0, 0xA150, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0xA1D1, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0xA1D2 /* 0xF0 */ /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_APPLECHINTRAD_00[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, /* 0x00 */ 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, /* 0x00 */ 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, /* 0x10 */ 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, /* 0x10 */ 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, /* 0x20 */ 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, /* 0x20 */ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, /* 0x30 */ 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, /* 0x30 */ 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, /* 0x40 */ 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, /* 0x40 */ 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, /* 0x50 */ 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, /* 0x50 */ 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, /* 0x60 */ 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, /* 0x60 */ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, /* 0x70 */ 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0x00A0, 0, 0xA246, 0xA247, 0, 0xA244, 0, 0xA1B1, /* 0xA0 */ 0, 0x00FD, 0, 0, 0, 0, 0, 0xA1C2, /* 0xA0 */ 0xA258, 0xA1D3, 0, 0, 0, 0, 0, 0xA145, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0xA1D1, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0xA1D2 /* 0xF0 */ /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_02[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA3BE, /* 0xC0 */ 0, 0xA3BC, 0xA3BD, 0xA3BF, 0, 0xA1C5, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0xA3BB /* 0xD0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_03[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA344, 0xA345, 0xA346, 0xA347, 0xA348, 0xA349, 0xA34A, /* 0x90 */ 0xA34B, 0xA34C, 0xA34D, 0xA34E, 0xA34F, 0xA350, 0xA351, 0xA352, /* 0x90 */ 0xA353, 0xA354, 0, 0xA355, 0xA356, 0xA357, 0xA358, 0xA359, /* 0xA0 */ 0xA35A, 0xA35B, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0xA35C, 0xA35D, 0xA35E, 0xA35F, 0xA360, 0xA361, 0xA362, /* 0xB0 */ 0xA363, 0xA364, 0xA365, 0xA366, 0xA367, 0xA368, 0xA369, 0xA36A, /* 0xB0 */ 0xA36B, 0xA36C, 0, 0xA36D, 0xA36E, 0xA36F, 0xA370, 0xA371, /* 0xC0 */ 0xA372, 0xA373 /* 0xC0 */ }; /* ----------------------------------------------------------------------- */ /* only defined in BIG5, but we convert back to this codes in all systems */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_04[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC7B3, 0, 0, 0, 0, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0xC7B1, 0xC7B2, 0xC7B4, 0xC7B5, /* 0x10 */ 0xC7B6, 0xC7B7, 0xC7B8, 0xC7B9, 0xC7BA, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0xC7BB, 0xC7BC, 0xC7BD, 0xC7BE, 0xC7BF, /* 0x20 */ 0xC7C0, 0xC7C1, 0xC7C2, 0xC7C3, 0xC7C4, 0xC7C5, 0xC7C6, 0xC7C7, /* 0x20 */ 0xC7C8, 0xC7C9, 0xC7CA, 0xC7CB, 0xC7CC, 0xC7CD, 0xC7CF, 0xC7D0, /* 0x30 */ 0xC7D1, 0xC7D2, 0xC7D3, 0xC7D4, 0xC7D5, 0xC7D6, 0xC7D7, 0xC7D8, /* 0x30 */ 0xC7D9, 0xC7DA, 0xC7DB, 0xC7DC, 0xC7DD, 0xC7DE, 0xC7DF, 0xC7E0, /* 0x40 */ 0xC7E1, 0xC7E2, 0xC7E3, 0xC7E4, 0xC7E5, 0xC7E6, 0xC7E7, 0xC7E8, /* 0x40 */ 0, 0xC7CE /* 0x50 */ /* 0x50 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_20[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA156, 0xA158, 0, 0, 0, /* 0x10 */ 0xA1A5, 0xA1A6, 0, 0, 0xA1A7, 0xA1A8, 0, 0, /* 0x10 */ 0, 0, 0xA145, 0, 0, 0xA14C, 0xA14B, 0xA145, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0xA1AC, 0, 0, 0xA1AB, 0, 0, /* 0x30 */ 0, 0, 0, 0xA1B0, 0, 0, 0xA1C2, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0xA3E1 /* 0xA0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_21[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA24A, 0, 0xA1C1, 0, 0, /* 0x00 */ 0, 0xA24B, 0, 0, 0, 0, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0xA2B9, 0xA2BA, 0xA2BB, 0xA2BC, 0xA2BD, 0xA2BE, 0xA2BF, 0xA2C0, /* 0x60 */ 0xA2C1, 0xA2C2, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0xA1F6, 0xA1F4, 0xA1F7, 0xA1F5, 0, 0, 0xA1F8, 0xA1F9, /* 0x90 */ 0xA1FB, 0xA1FA /* 0x90 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_APPLECHINTRAD_21[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA24A, 0, 0xA1C1, 0, 0, /* 0x00 */ 0, 0xA24B, 0, 0, 0, 0, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0x00FE, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0xA2B9, 0xA2BA, 0xA2BB, 0xA2BC, 0xA2BD, 0xA2BE, 0xA2BF, 0xA2C0, /* 0x60 */ 0xA2C1, 0xA2C2, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0xA1F6, 0xA1F4, 0xA1F7, 0xA1F5, 0, 0, 0xA1F8, 0xA1F9, /* 0x90 */ 0xA1FB, 0xA1FA /* 0x90 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_22[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA241, 0, 0, /* 0x10 */ 0, 0, 0xA1D4, 0, 0, 0, 0xA1DB, 0xA1E8, /* 0x10 */ 0xA1E7, 0, 0, 0xA1FD, 0, 0xA1FC, 0, 0, /* 0x20 */ 0, 0xA1E4, 0xA1E5, 0xA1EC, 0, 0, 0xA1ED, 0, /* 0x20 */ 0, 0, 0, 0, 0xA1EF, 0xA1EE, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0xA1E3, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0xA1DC, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0xA1DA, 0xA1DD, 0, 0, 0, 0, 0xA1D8, 0xA1D9, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0xA1F2, 0, 0, /* 0x90 */ 0, 0xA1F3, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0xA1E6, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0xA1E9, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0xA14B /* 0xE0 */ }; /* ----------------------------------------------------------------------- */ /* only defined in BIG5, but we convert back to this codes in all systems */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_24[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC7E9, 0xC7EA, 0xC7EB, 0xC7EC, 0xC7ED, 0xC7EE, 0xC7EF, 0xC7F0, /* 0x60 */ 0xC7F1, 0xC7F2, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0xC7F3, 0xC7F4, 0xC7F5, 0xC7F6, /* 0x70 */ 0xC7F7, 0xC7F8, 0xC7F9, 0xC7FA, 0xC7FB, 0xC7FC /* 0x70 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_25[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA277, 0, 0xA278, 0, 0, 0, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0xA27A, 0, 0, 0, /* 0x00 */ 0xA27B, 0, 0, 0, 0xA27C, 0, 0, 0, /* 0x10 */ 0xA27D, 0, 0, 0, 0xA275, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0xA274, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0xA273, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0xA272, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0xA271, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0xA2A4, 0xF9F8, 0xF9E6, 0xF9EF, 0xF9DD, 0xF9E8, 0xF9F1, 0xF9DF, /* 0x50 */ 0xF9EC, 0xF9F5, 0xF9E3, 0xF9EE, 0xF9F7, 0xF9E5, 0xA2A5, 0xF9F2, /* 0x50 */ 0xF9E0, 0xA2A7, 0xF9F4, 0xF9E2, 0xF9E7, 0xF9F0, 0xF9DE, 0xF9ED, /* 0x60 */ 0xF9F6, 0xF9E4, 0xA2A6, 0xF9F3, 0xF9E1, 0xA27E, 0xA2A1, 0xA2A3, /* 0x60 */ 0xA2A2, 0xA2AC, 0xA2AD, 0xA2AE, 0xA15A, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0xA262, 0xA263, 0xA264, 0xA265, 0xA266, 0xA267, 0xA268, /* 0x80 */ 0xA269, 0xA270, 0xA26F, 0xA26E, 0xA26D, 0xA26C, 0xA26B, 0xA26A, /* 0x80 */ 0, 0, 0, 0xF9FE, 0xA276, 0xA279, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0xA1BD, 0xA1BC, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0xA1B6, 0xA1B5, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0xA1BF, 0xA1BE, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0xA1BB, 0xA1BA, /* 0xC0 */ 0, 0, 0, 0xA1B3, 0, 0, 0xA1B7, 0xA1B4, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0xA2A8, 0xA2A9, 0xA2AB, 0xA2AA /* 0xE0 */ /* 0xE0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_26[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA1B9, 0xA1B8, 0, /* 0x00 */ 0, 0xA1F3, 0, 0, 0, 0, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0xA1F0, 0xA1F2, 0xA1F1 /* 0x40 */ /* 0x40 */ }; /* ----------------------------------------------------------------------- */ /* all values with 0xC6.. or 0xC7.. only defined in BIG5, but we convert back */ /* to this codes in all systems */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_30[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA140, 0xA142, 0xA143, 0xA1B2, 0, 0xC6A4, 0, 0, /* 0x00 */ 0xA171, 0xA172, 0xA16D, 0xA16E, 0xA175, 0xA176, 0xA179, 0xA17A, /* 0x00 */ 0xA169, 0xA16A, 0xA245, 0, 0xA165, 0xA166, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0xA1A9, 0xA1AA, 0, /* 0x10 */ 0, 0xA2C3, 0xA2C4, 0xA2C5, 0xA2C6, 0xA2C7, 0xA2C8, 0xA2C9, /* 0x20 */ 0xA2CA, 0xA2CB, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0xC6A5, 0xC6A6, 0xC6A7, 0xC6A8, 0xC6A9, 0xC6AA, 0xC6AB, /* 0x40 */ 0xC6AC, 0xC6AD, 0xC6AE, 0xC6AF, 0xC6B0, 0xC6B1, 0xC6B2, 0xC6B3, /* 0x40 */ 0xC6B4, 0xC6B5, 0xC6B6, 0xC6B7, 0xC6B8, 0xC6B9, 0xC6BA, 0xC6BB, /* 0x50 */ 0xC6BC, 0xC6BD, 0xC6BE, 0xC6BF, 0xC6C0, 0xC6C1, 0xC6C2, 0xC6C3, /* 0x50 */ 0xC6C4, 0xC6C5, 0xC6C6, 0xC6C7, 0xC6C8, 0xC6C9, 0xC6CA, 0xC6CB, /* 0x60 */ 0xC6CC, 0xC6CD, 0xC6CE, 0xC6CF, 0xC6D0, 0xC6D1, 0xC6D2, 0xC6D3, /* 0x60 */ 0xC6D4, 0xC6D5, 0xC6D6, 0xC6D7, 0xC6D8, 0xC6D9, 0xC6DA, 0xC6DB, /* 0x70 */ 0xC6DC, 0xC6DD, 0xC6DE, 0xC6DF, 0xC6E0, 0xC6E1, 0xC6E2, 0xC6E3, /* 0x70 */ 0xC6E4, 0xC6E5, 0xC6E6, 0xC6E7, 0xC6E8, 0xC6E9, 0xC6EA, 0xC6EB, /* 0x80 */ 0xC6EC, 0xC6ED, 0xC6EE, 0xC6EF, 0xC6F0, 0xC6F1, 0xC6F2, 0xC6F3, /* 0x80 */ 0xC6F4, 0xC6F5, 0xC6F6, 0xC6F7, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0xC6A2, 0xC6A3, 0, /* 0x90 */ 0, 0xC6F8, 0xC6F9, 0xC6FA, 0xC6FB, 0xC6FC, 0xC6FD, 0xC6FE, /* 0xA0 */ 0xC740, 0xC741, 0xC742, 0xC743, 0xC744, 0xC745, 0xC746, 0xC747, /* 0xA0 */ 0xC748, 0xC749, 0xC74A, 0xC74B, 0xC74C, 0xC74D, 0xC74E, 0xC74F, /* 0xB0 */ 0xC750, 0xC751, 0xC752, 0xC753, 0xC754, 0xC755, 0xC756, 0xC757, /* 0xB0 */ 0xC758, 0xC759, 0xC75A, 0xC75B, 0xC75C, 0xC75D, 0xC75E, 0xC75F, /* 0xC0 */ 0xC760, 0xC761, 0xC762, 0xC763, 0xC764, 0xC765, 0xC766, 0xC767, /* 0xC0 */ 0xC768, 0xC769, 0xC76A, 0xC76B, 0xC76C, 0xC76D, 0xC76E, 0xC76F, /* 0xD0 */ 0xC770, 0xC771, 0xC772, 0xC773, 0xC774, 0xC775, 0xC776, 0xC777, /* 0xD0 */ 0xC778, 0xC779, 0xC77A, 0xC77B, 0xC77C, 0xC77D, 0xC77E, 0xC7A1, /* 0xE0 */ 0xC7A2, 0xC7A3, 0xC7A4, 0xC7A5, 0xC7A6, 0xC7A7, 0xC7A8, 0xC7A9, /* 0xE0 */ 0xC7AA, 0xC7AB, 0xC7AC, 0xC7AD, 0xC7AE, 0xC7AF, 0xC7B0, 0, /* 0xF0 */ 0, 0, 0, 0, 0, 0, 0xC6A1 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_31[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA374, 0xA375, 0xA376, /* 0x00 */ 0xA377, 0xA378, 0xA379, 0xA37A, 0xA37B, 0xA37C, 0xA37D, 0xA37E, /* 0x00 */ 0xA3A1, 0xA3A2, 0xA3A3, 0xA3A4, 0xA3A5, 0xA3A6, 0xA3A7, 0xA3A8, /* 0x10 */ 0xA3A9, 0xA3AA, 0xA3AB, 0xA3AC, 0xA3AD, 0xA3AE, 0xA3AF, 0xA3B0, /* 0x10 */ 0xA3B1, 0xA3B2, 0xA3B3, 0xA3B4, 0xA3B5, 0xA3B6, 0xA3B7, 0xA3B8, /* 0x20 */ 0xA3B9, 0xA3BA /* 0x20 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_32[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA1C0 /* 0xA0 */ /* 0xA0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_33[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ /* 0x80 */ 0xA255, 0xA256, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0xA250, 0xA251, 0xA252, 0, /* 0x90 */ 0, 0xA254, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0xA257, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0xA253, 0, /* 0xC0 */ 0, 0xA1EB, 0xA1EA, 0, 0, 0xA24F /* 0xD0 */ /* 0xD0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_4E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA440, 0xA442, 0, 0xA443, 0, 0, 0, 0xC945, /* 0x00 */ 0xA456, 0xA454, 0xA457, 0xA455, 0xC946, 0xA4A3, 0xC94F, 0xC94D, /* 0x00 */ 0xA4A2, 0xA4A1, 0, 0, 0xA542, 0xA541, 0xA540, 0, /* 0x10 */ 0xA543, 0xA4FE, 0, 0, 0, 0, 0xA5E0, 0xA5E1, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0xA8C3, 0, /* 0x20 */ 0, 0, 0, 0xA458, 0, 0xA4A4, 0xC950, 0, /* 0x20 */ 0xA4A5, 0xC963, 0xA6EA, 0xCBB1, 0, 0, 0, 0, /* 0x30 */ 0xA459, 0xA4A6, 0, 0xA544, 0xC964, 0, 0, 0, /* 0x30 */ 0, 0, 0xC940, 0xA444, 0, 0xA45B, 0, 0xC947, /* 0x40 */ 0xA45C, 0, 0, 0xA4A7, 0, 0xA545, 0xA547, 0xA546, /* 0x40 */ 0, 0, 0xA5E2, 0xA5E3, 0, 0, 0xA8C4, 0, /* 0x50 */ 0xADBC, 0xA441, 0, 0, 0xC941, 0xA445, 0xA45E, 0xA45D, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0xA5E4, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0xA8C5, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0xB0AE, 0xD44B, /* 0x70 */ 0, 0, 0xB6C3, 0xDCB1, 0xDCB2, 0, 0xA446, 0, /* 0x80 */ 0xA4A9, 0, 0, 0xA8C6, 0xA447, 0xC948, 0xA45F, 0, /* 0x80 */ 0, 0xA4AA, 0xA4AC, 0xC951, 0xA4AD, 0xA4AB, 0, 0, /* 0x90 */ 0, 0xA5E5, 0, 0xA8C7, 0, 0, 0xA8C8, 0xAB45, /* 0x90 */ 0, 0xA460, 0xA4AE, 0, 0xA5E6, 0xA5E8, 0xA5E7, 0, /* 0xA0 */ 0xA6EB, 0, 0, 0xA8C9, 0xA8CA, 0xAB46, 0xAB47, 0, /* 0xA0 */ 0, 0, 0, 0xADBD, 0, 0, 0xDCB3, 0, /* 0xB0 */ 0, 0xF6D6, 0xA448, 0, 0, 0, 0, 0, /* 0xB0 */ 0xA4B0, 0xA4AF, 0xC952, 0xA4B1, 0xA4B7, 0, 0xA4B2, 0xA4B3, /* 0xC0 */ 0xC954, 0xC953, 0xA4B5, 0xA4B6, 0, 0xA4B4, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0xA54A, 0xA54B, 0xA54C, 0xA54D, /* 0xD0 */ 0xA549, 0xA550, 0xC96A, 0, 0xC966, 0xC969, 0xA551, 0xA561, /* 0xD0 */ 0, 0xC968, 0, 0xA54E, 0xA54F, 0xA548, 0, 0, /* 0xE0 */ 0xC965, 0xC967, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0xA5F5, 0xC9B0, 0xA5F2, 0xA5F6, 0xC9BA, 0xC9AE, 0xA5F3, 0xC9B2, /* 0xF0 */ 0, 0, 0, 0xA5F4, 0, 0xA5F7, 0, 0xA5E9 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_4F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC9B1, 0xA5F8, 0xC9B5, 0, 0xC9B9, 0xC9B6, 0, 0, /* 0x00 */ 0xC9B3, 0xA5EA, 0xA5EC, 0xA5F9, 0, 0xA5EE, 0xC9AB, 0xA5F1, /* 0x00 */ 0xA5EF, 0xA5F0, 0xC9BB, 0xC9B8, 0xC9AF, 0xA5ED, 0, 0, /* 0x10 */ 0xC9AC, 0xA5EB, 0, 0, 0, 0xC9B4, 0, 0, /* 0x10 */ 0, 0, 0xC9B7, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0xC9AD, 0xCA66, 0, 0xA742, /* 0x20 */ 0xA6F4, 0, 0, 0xCA67, 0xA6F1, 0, 0xA744, 0, /* 0x30 */ 0xA6F9, 0, 0xA6F8, 0xCA5B, 0xA6FC, 0xA6F7, 0xCA60, 0xCA68, /* 0x30 */ 0, 0xCA64, 0, 0xA6FA, 0, 0, 0xA6FD, 0xA6EE, /* 0x40 */ 0xA747, 0xCA5D, 0, 0, 0xCBBD, 0xA6EC, 0xA743, 0xA6ED, /* 0x40 */ 0xA6F5, 0xA6F6, 0xCA62, 0xCA5E, 0xA6FB, 0xA6F3, 0xCA5A, 0xA6EF, /* 0x50 */ 0xCA65, 0xA745, 0xA748, 0xA6F2, 0xA740, 0xA746, 0xA6F0, 0xCA63, /* 0x50 */ 0xA741, 0xCA69, 0xCA5C, 0xA6FE, 0xCA5F, 0, 0, 0xCA61, /* 0x60 */ 0, 0xA8D8, 0xCBBF, 0xCBCB, 0xA8D0, 0, 0xCBCC, 0xA8CB, /* 0x60 */ 0xA8D5, 0, 0, 0xA8CE, 0xCBB9, 0xA8D6, 0xCBB8, 0xCBBC, /* 0x70 */ 0xCBC3, 0xCBC1, 0xA8DE, 0xA8D9, 0xCBB3, 0xCBB5, 0xA8DB, 0xA8CF, /* 0x70 */ 0xCBB6, 0xCBC2, 0xCBC9, 0xA8D4, 0xCBBB, 0xCBB4, 0xA8D3, 0xCBB7, /* 0x80 */ 0xA8D7, 0xCBBA, 0, 0xA8D2, 0, 0xA8CD, 0, 0xA8DC, /* 0x80 */ 0xCBC4, 0xA8DD, 0xCBC8, 0, 0xCBC6, 0xCBCA, 0xA8DA, 0xCBBE, /* 0x90 */ 0xCBB2, 0, 0xCBC0, 0xA8D1, 0xCBC5, 0xA8CC, 0xCBC7, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0xAB56, 0xAB4A, /* 0xA0 */ 0, 0, 0xCDE0, 0xCDE8, 0, 0xAB49, 0xAB51, 0xAB5D, /* 0xB0 */ 0, 0xCDEE, 0xCDEC, 0xCDE7, 0, 0, 0, 0xAB4B, /* 0xB0 */ 0xCDED, 0xCDE3, 0xAB59, 0xAB50, 0xAB58, 0xCDDE, 0, 0xCDEA, /* 0xC0 */ 0, 0xCDE1, 0xAB54, 0xCDE2, 0, 0xCDDD, 0xAB5B, 0xAB4E, /* 0xC0 */ 0xAB57, 0xAB4D, 0, 0xCDDF, 0xCDE4, 0, 0xCDEB, 0xAB55, /* 0xD0 */ 0xAB52, 0xCDE6, 0xAB5A, 0xCDE9, 0xCDE5, 0xAB4F, 0xAB5C, 0xAB53, /* 0xD0 */ 0xAB4C, 0xAB48, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0xCDEF, 0, 0xADD7, 0xADC1, /* 0xE0 */ 0, 0xADD1, 0, 0xADD6, 0xD0D0, 0xD0CF, 0xD0D4, 0xD0D5, /* 0xF0 */ 0xADC4, 0, 0xADCD, 0, 0, 0, 0xADDA /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_50[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xADCE, 0, 0, 0, 0, 0xD0C9, 0xADC7, 0xD0CA, /* 0x00 */ 0, 0xADDC, 0, 0xADD3, 0xADBE, 0xADBF, 0xD0DD, 0xB0BF, /* 0x00 */ 0, 0xADCC, 0xADCB, 0xD0CB, 0xADCF, 0xD45B, 0xADC6, 0xD0D6, /* 0x10 */ 0xADD5, 0xADD4, 0xADCA, 0xD0CE, 0xD0D7, 0, 0xD0C8, 0xADC9, /* 0x10 */ 0xD0D8, 0xADD2, 0xD0CC, 0xADC0, 0, 0xADC3, 0xADC2, 0xD0D9, /* 0x20 */ 0xADD0, 0xADC5, 0xADD9, 0xADDB, 0xD0D3, 0xADD8, 0, 0xD0DB, /* 0x20 */ 0xD0CD, 0xD0DC, 0, 0xD0D1, 0, 0xD0DA, 0, 0xD0D2, /* 0x30 */ 0, 0, 0, 0, 0xADC8, 0, 0, 0, /* 0x30 */ 0xD463, 0xD457, 0, 0xB0B3, 0, 0xD45C, 0xD462, 0xB0B2, /* 0x40 */ 0xD455, 0xB0B6, 0xD459, 0xD452, 0xB0B4, 0xD456, 0xB0B9, 0xB0BE, /* 0x40 */ 0, 0xD467, 0, 0xD451, 0, 0xB0BA, 0, 0xD466, /* 0x50 */ 0, 0, 0xB0B5, 0xD458, 0xB0B1, 0xD453, 0xD44F, 0xD45D, /* 0x50 */ 0xD450, 0xD44E, 0xD45A, 0xD460, 0xD461, 0xB0B7, 0, 0, /* 0x60 */ 0xD85B, 0xD45E, 0xD44D, 0xD45F, 0, 0xB0C1, 0xD464, 0xB0C0, /* 0x60 */ 0xD44C, 0, 0xD454, 0xD465, 0xB0BC, 0xB0BB, 0xB0B8, 0xB0BD, /* 0x70 */ 0, 0, 0xB0AF, 0, 0, 0xB0B0, 0, 0, /* 0x70 */ 0xB3C8, 0, 0xD85E, 0xD857, 0, 0xB3C5, 0, 0xD85F, /* 0x80 */ 0, 0, 0, 0xD855, 0xD858, 0xB3C4, 0xD859, 0, /* 0x80 */ 0, 0xB3C7, 0xD85D, 0, 0xD853, 0xD852, 0xB3C9, 0, /* 0x90 */ 0xB3CA, 0xB3C6, 0xB3CB, 0xD851, 0xD85C, 0xD85A, 0xD854, 0, /* 0x90 */ 0, 0, 0xB3C3, 0xD856, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0xB6CA, 0xB6C4, 0xDCB7, 0xB6CD, /* 0xA0 */ 0xDCBD, 0xDCC0, 0xB6C6, 0xB6C7, 0xDCBA, 0xB6C5, 0xDCC3, 0xB6CB, /* 0xB0 */ 0xDCC4, 0, 0xDCBF, 0xB6CC, 0, 0xDCB4, 0xB6C9, 0xDCB5, /* 0xB0 */ 0, 0xDCBE, 0xDCBC, 0, 0xDCB8, 0xB6C8, 0xDCB6, 0xB6CE, /* 0xC0 */ 0xDCBB, 0xDCC2, 0xDCB9, 0xDCC1, 0, 0, 0xB9B6, 0xB9B3, /* 0xC0 */ 0, 0xB9B4, 0, 0xE0F9, 0xE0F1, 0xB9B2, 0xB9AF, 0xE0F2, /* 0xD0 */ 0, 0, 0xB9B1, 0xE0F5, 0, 0xE0F7, 0, 0, /* 0xD0 */ 0xE0FE, 0, 0, 0xE0FD, 0xE0F8, 0xB9AE, 0xE0F0, 0xB9AC, /* 0xE0 */ 0xE0F3, 0xB9B7, 0xE0F6, 0, 0xE0FA, 0xB9B0, 0xB9AD, 0xE0FC, /* 0xE0 */ 0xE0FB, 0xB9B5, 0, 0xE0F4, 0, 0xBBF8, 0xE4EC, 0, /* 0xF0 */ 0xE4E9, 0xBBF9, 0, 0xBBF7, 0, 0xE4F0, 0xE4ED, 0xE4E6 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_51[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xBBF6, 0, 0xBBFA, 0xE4E7, 0xBBF5, 0xBBFD, 0xE4EA, 0xE4EB, /* 0x00 */ 0xBBFB, 0xBBFC, 0xE4F1, 0xE4EE, 0xE4EF, 0, 0, 0, /* 0x00 */ 0xBEAA, 0xE8F8, 0xBEA7, 0xE8F5, 0xBEA9, 0xBEAB, 0, 0xE8F6, /* 0x10 */ 0xBEA8, 0, 0xE8F7, 0, 0xE8F4, 0, 0, 0xC076, /* 0x10 */ 0xECBD, 0xC077, 0xECBB, 0, 0xECBC, 0xECBA, 0xECB9, 0, /* 0x20 */ 0, 0xECBE, 0xC075, 0, 0, 0xEFB8, 0xEFB9, 0, /* 0x20 */ 0xE4E8, 0xEFB7, 0xC078, 0xC35F, 0xF1EB, 0xF1EC, 0, 0xC4D7, /* 0x30 */ 0xC4D8, 0xF5C1, 0xF5C0, 0xC56C, 0xC56B, 0xF7D0, 0, 0xA449, /* 0x30 */ 0xA461, 0xA4B9, 0, 0xA4B8, 0xA553, 0xA552, 0xA5FC, 0xA5FB, /* 0x40 */ 0xA5FD, 0xA5FA, 0, 0xA74A, 0xA749, 0xA74B, 0, 0, /* 0x40 */ 0, 0, 0xA8E0, 0, 0xA8DF, 0xA8E1, 0, 0xAB5E, /* 0x50 */ 0, 0xA259, 0xD0DE, 0xA25A, 0xB0C2, 0xA25C, 0xA25B, 0xD860, /* 0x50 */ 0, 0xA25D, 0xB9B8, 0xA25E, 0, 0xA44A, 0, 0xA4BA, /* 0x60 */ 0xA5FE, 0xA8E2, 0, 0xA44B, 0xA4BD, 0xA4BB, 0xA4BC, 0, /* 0x60 */ 0, 0xA640, 0, 0, 0, 0xA74C, 0xA8E4, 0xA8E3, /* 0x70 */ 0xA8E5, 0, 0, 0, 0xADDD, 0, 0, 0, /* 0x70 */ 0xBEAC, 0, 0, 0, 0, 0, 0, 0xC94E, /* 0x80 */ 0, 0xA554, 0xA555, 0, 0, 0xA641, 0, 0xCA6A, /* 0x80 */ 0, 0xAB60, 0xAB5F, 0xD0E0, 0xD0DF, 0xB0C3, 0, 0xA4BE, /* 0x90 */ 0xC955, 0, 0, 0, 0, 0, 0xCBCD, 0, /* 0x90 */ 0xAB61, 0, 0xADE0, 0, 0xADDE, 0xADDF, 0, 0, /* 0xA0 */ 0, 0, 0xBEAD, 0, 0xA556, 0, 0, 0, /* 0xA0 */ 0xA642, 0xC9BC, 0, 0, 0, 0, 0xA74D, 0xA74E, /* 0xB0 */ 0, 0xCA6B, 0, 0, 0xCBCE, 0xA8E6, 0xCBCF, 0, /* 0xB0 */ 0, 0, 0, 0, 0xD0E2, 0xD0E3, 0xADE3, 0, /* 0xC0 */ 0xD0E4, 0, 0xD0E1, 0xADE4, 0xADE2, 0xADE1, 0xD0E5, 0, /* 0xC0 */ 0xD468, 0, 0, 0, 0xD861, 0, 0, 0xDCC5, /* 0xD0 */ 0xE140, 0, 0, 0, 0xBBFE, 0xBEAE, 0xE8F9, 0, /* 0xD0 */ 0xA44C, 0xA45A, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0xB0C4, 0xB3CD, 0, 0xB9B9, 0, 0xC942, 0xA4BF, 0, /* 0xF0 */ 0xA559, 0xA557, 0xA558, 0, 0, 0xA8E7 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_52[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA44D, 0xA44E, 0, 0xA462, 0, 0, 0xA4C0, 0xA4C1, /* 0x00 */ 0xA4C2, 0xC9BE, 0xA55A, 0, 0xC96B, 0, 0xA646, 0, /* 0x00 */ 0xC9BF, 0xA644, 0xA645, 0xC9BD, 0, 0, 0xA647, 0xA643, /* 0x10 */ 0, 0, 0, 0, 0xCA6C, 0xAAEC, 0xCA6D, 0, /* 0x10 */ 0, 0xCA6E, 0, 0, 0xA750, 0xA74F, 0, 0, /* 0x20 */ 0xA753, 0xA751, 0xA752, 0, 0, 0, 0xA8ED, 0, /* 0x20 */ 0xA8EC, 0xCBD4, 0xCBD1, 0xCBD2, 0, 0xCBD0, 0xA8EE, 0xA8EA, /* 0x30 */ 0xA8E9, 0, 0xA8EB, 0xA8E8, 0, 0, 0, 0, /* 0x30 */ 0, 0xA8EF, 0, 0xAB63, 0xCDF0, 0, 0xCBD3, 0xAB68, /* 0x40 */ 0, 0xCDF1, 0xAB64, 0xAB67, 0xAB66, 0xAB65, 0xAB62, 0, /* 0x40 */ 0, 0, 0xD0E8, 0, 0xADE7, 0xD0EB, 0xADE5, 0, /* 0x50 */ 0, 0, 0xD0E7, 0xADE8, 0xADE6, 0xADE9, 0xD0E9, 0xD0EA, /* 0x50 */ 0, 0xD0E6, 0xD0EC, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0xB3D1, 0xB0C5, 0xD469, 0xD46B, 0xD46A, 0xD46C, 0xB0C6, /* 0x60 */ 0, 0, 0xB3CE, 0, 0xB3CF, 0xB3D0, 0, 0xB6D0, /* 0x70 */ 0xDCC7, 0, 0xDCC6, 0xDCC8, 0xDCC9, 0xB6D1, 0, 0xB6CF, /* 0x70 */ 0xE141, 0xE142, 0xB9BB, 0xB9BA, 0xE35A, 0, 0, 0xBC40, /* 0x80 */ 0xBC41, 0xBC42, 0xBC44, 0xE4F2, 0xE4F3, 0xBC43, 0, 0, /* 0x80 */ 0, 0xBEAF, 0, 0xBEB0, 0, 0, 0xF1ED, 0xF5C3, /* 0x90 */ 0xF5C2, 0xF7D1, 0, 0xA44F, 0, 0, 0, 0xA55C, /* 0x90 */ 0xA55B, 0, 0, 0xA648, 0, 0, 0xC9C0, 0, /* 0xA0 */ 0, 0xA755, 0xA756, 0xA754, 0xA757, 0xCA6F, 0xCA70, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0xA8F1, 0xCBD5, 0, 0xA8F0, 0, /* 0xB0 */ 0xCDF2, 0xAB6C, 0xCDF3, 0xAB6B, 0, 0, 0, 0xAB69, /* 0xC0 */ 0, 0xAB6A, 0, 0, 0, 0xD0ED, 0, 0, /* 0xC0 */ 0, 0, 0xB0C7, 0xD46E, 0, 0xB0CA, 0xD46D, 0xB1E5, /* 0xD0 */ 0xB0C9, 0xB0C8, 0, 0xB3D4, 0, 0xB3D3, 0xB3D2, 0xB6D2, /* 0xD0 */ 0, 0, 0xB6D5, 0xB6D6, 0xB6D4, 0, 0xB6D3, 0, /* 0xE0 */ 0, 0xE143, 0, 0xE144, 0, 0, 0, 0xE4F5, /* 0xE0 */ 0xBC45, 0xE4F4, 0, 0xBEB1, 0xECBF, 0xC079, 0, 0xF1EE, /* 0xF0 */ 0xC455, 0, 0xA463, 0xA4C3, 0xC956, 0, 0xA4C4, 0xA4C5 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_53[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA55D, 0xA55E, 0, /* 0x00 */ 0xA649, 0xCA71, 0xCBD6, 0xCBD7, 0, 0xAB6D, 0xD0EE, 0xB0CC, /* 0x00 */ 0xB0CB, 0xD863, 0xD862, 0, 0, 0xA450, 0xA4C6, 0xA55F, /* 0x10 */ 0, 0xB0CD, 0xC943, 0, 0xC96C, 0xA560, 0, 0xC9C2, /* 0x10 */ 0xA64B, 0xA64A, 0xC9C1, 0xA758, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0xADEA, 0, 0, 0xD46F, 0, 0xB6D7, /* 0x20 */ 0xE145, 0xB9BC, 0, 0, 0xE8FA, 0, 0, 0xF3FD, /* 0x30 */ 0, 0xA4C7, 0, 0, 0xCBD8, 0xCDF4, 0xB0D0, 0xB0CE, /* 0x30 */ 0xB0CF, 0xA451, 0, 0xA464, 0xA2CD, 0xA4CA, 0, 0xA4C9, /* 0x40 */ 0xA4C8, 0xA563, 0xA562, 0, 0xC96D, 0xC9C3, 0, 0, /* 0x40 */ 0, 0xA8F5, 0xA8F2, 0xA8F4, 0xA8F3, 0, 0, 0xAB6E, /* 0x50 */ 0, 0, 0xB3D5, 0, 0xA452, 0, 0xA4CB, 0, /* 0x50 */ 0xA565, 0xA564, 0, 0xCA72, 0, 0, 0xA8F6, 0, /* 0x60 */ 0, 0, 0, 0, 0xC957, 0, 0xA567, 0xA566, /* 0x60 */ 0xA64C, 0xA64D, 0xCA73, 0xA759, 0, 0xA75A, 0, 0xA8F7, /* 0x70 */ 0xA8F8, 0xA8F9, 0, 0xAB6F, 0xCDF5, 0, 0, 0xADEB, /* 0x70 */ 0, 0, 0xC944, 0, 0xA4CC, 0, 0, 0, /* 0x80 */ 0, 0, 0xC9C4, 0, 0, 0, 0xCA74, 0xCA75, /* 0x80 */ 0, 0, 0xCBD9, 0, 0xCBDA, 0, 0xCDF7, 0xCDF6, /* 0x90 */ 0xCDF9, 0xCDF8, 0xAB70, 0, 0xD470, 0xADED, 0xD0EF, 0xADEC, /* 0x90 */ 0, 0, 0, 0, 0xD864, 0xB3D6, 0, 0xD865, /* 0xA0 */ 0, 0, 0, 0, 0xE146, 0xB9BD, 0, 0, /* 0xA0 */ 0, 0, 0xBC46, 0, 0xF1EF, 0, 0, 0, /* 0xB0 */ 0, 0xC958, 0, 0xA568, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0xB0D1, 0, 0, 0, 0, /* 0xC0 */ 0xA453, 0xA465, 0xA4CE, 0xA4CD, 0, 0xA4CF, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0xA8FB, 0, 0xA8FA, 0xA8FC, /* 0xD0 */ 0, 0, 0, 0xAB71, 0, 0, 0, 0xADEE, /* 0xD0 */ 0, 0xE8FB, 0xC24F, 0xA466, 0xA56A, 0xA579, 0xA574, 0, /* 0xE0 */ 0xA56F, 0xA56E, 0xA575, 0xA573, 0xA56C, 0xA57A, 0xA56D, 0xA569, /* 0xE0 */ 0xA578, 0xA577, 0xA576, 0xA56B, 0, 0xA572, 0, 0, /* 0xF0 */ 0xA571, 0, 0, 0xA57B, 0xA570 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_54[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA653, 0, 0xA659, 0xA655, 0, 0xA65B, 0xC9C5, /* 0x00 */ 0xA658, 0xA64E, 0xA651, 0xA654, 0xA650, 0xA657, 0xA65A, 0xA64F, /* 0x00 */ 0xA652, 0xA656, 0xA65C, 0, 0, 0, 0, 0, /* 0x10 */ 0xCA7E, 0xCA7B, 0, 0xA767, 0xCA7C, 0xA75B, 0xA75D, 0xA775, /* 0x10 */ 0xA770, 0, 0, 0, 0xCAA5, 0xCA7D, 0xA75F, 0xA761, /* 0x20 */ 0xCAA4, 0xA768, 0xCA78, 0xA774, 0xA776, 0xA75C, 0xA76D, 0, /* 0x20 */ 0xCA76, 0xA773, 0, 0xA764, 0, 0xA76E, 0xA76F, 0xCA77, /* 0x30 */ 0xA76C, 0xA76A, 0, 0xA76B, 0xA771, 0xCAA1, 0xA75E, 0, /* 0x30 */ 0xA772, 0xCAA3, 0xA766, 0xA763, 0, 0xCA7A, 0xA762, 0xCAA6, /* 0x40 */ 0xA765, 0, 0xA769, 0, 0, 0, 0xA760, 0xCAA2, /* 0x40 */ 0, 0, 0, 0, 0xCA79, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0xCBEB, 0xCBEA, 0xA94F, 0xCBED, 0xCBEF, 0xCBE4, 0xCBE7, 0xCBEE, /* 0x60 */ 0xA950, 0, 0, 0xCBE1, 0xCBE5, 0, 0, 0xCBE9, /* 0x60 */ 0xCE49, 0xA94B, 0xCE4D, 0xA8FD, 0xCBE6, 0xA8FE, 0xA94C, 0xA945, /* 0x70 */ 0xA941, 0, 0xCBE2, 0xA944, 0xA949, 0xA952, 0xCBE3, 0xCBDC, /* 0x70 */ 0xA943, 0xCBDD, 0xCBDF, 0, 0xA946, 0, 0xA948, 0xCBDB, /* 0x80 */ 0xCBE0, 0, 0, 0xA951, 0xA94D, 0xCBE8, 0xA953, 0, /* 0x80 */ 0xA94A, 0xCBDE, 0xA947, 0, 0, 0xA942, 0xA940, 0, /* 0x90 */ 0xCBEC, 0, 0xA94E, 0, 0, 0, 0, 0, /* 0x90 */ 0xCE48, 0xCDFB, 0xCE4B, 0, 0, 0xCDFD, 0xAB78, 0xABA8, /* 0xA0 */ 0xAB74, 0xABA7, 0xAB7D, 0xABA4, 0xAB72, 0xCDFC, 0xCE43, 0xABA3, /* 0xA0 */ 0xCE4F, 0xABA5, 0, 0xAB79, 0, 0, 0xCE45, 0xCE42, /* 0xB0 */ 0xAB77, 0, 0xCDFA, 0xABA6, 0xCE4A, 0xAB7C, 0xCE4C, 0xABA9, /* 0xB0 */ 0xAB73, 0xAB7E, 0xAB7B, 0xCE40, 0xABA1, 0xCE46, 0xCE47, 0xAB7A, /* 0xC0 */ 0xABA2, 0xAB76, 0, 0, 0, 0, 0xAB75, 0xCDFE, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0xCE44, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0xCE4E, 0, /* 0xD0 */ 0xD144, 0xADFB, 0xD0F1, 0, 0xD0F6, 0xADF4, 0xAE40, 0xD0F4, /* 0xE0 */ 0xADEF, 0xADF9, 0xADFE, 0xD0FB, 0, 0xADFA, 0xADFD, 0, /* 0xE0 */ 0, 0xD0FE, 0xADF5, 0xD0F5, 0, 0, 0, 0xD142, /* 0xF0 */ 0xD143, 0, 0xADF7, 0xD141, 0xADF3, 0xAE43, 0, 0xD0F8 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_55[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xADF1, 0, 0xD146, 0xD0F9, 0xD0FD, 0xADF6, 0xAE42, /* 0x00 */ 0xD0FA, 0xADFC, 0xD140, 0xD147, 0xD4A1, 0, 0xD145, 0xAE44, /* 0x00 */ 0xADF0, 0xD0FC, 0xD0F3, 0, 0xADF8, 0, 0, 0xD0F2, /* 0x10 */ 0, 0, 0xD0F7, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0xD0F0, 0xAE41, /* 0x20 */ 0, 0, 0xD477, 0, 0xB0E4, 0xD4A7, 0xB0E2, 0xB0DF, /* 0x20 */ 0xD47C, 0xB0DB, 0xD4A2, 0xB0E6, 0xD476, 0xD47B, 0xD47A, 0xADF2, /* 0x30 */ 0xB0E1, 0xD4A5, 0, 0xD4A8, 0xD473, 0, 0xB3E8, 0, /* 0x30 */ 0xD4A9, 0xB0E7, 0, 0xB0D9, 0xB0D6, 0xD47E, 0xB0D3, 0, /* 0x40 */ 0xD4A6, 0, 0xB0DA, 0xD4AA, 0, 0xD474, 0xD4A4, 0xB0DD, /* 0x40 */ 0xD475, 0xD478, 0xD47D, 0, 0, 0xB0DE, 0xB0DC, 0xB0E8, /* 0x50 */ 0, 0, 0, 0, 0xB0E3, 0, 0xB0D7, 0xB1D2, /* 0x50 */ 0, 0xB0D8, 0xD479, 0xB0E5, 0xB0E0, 0xD4A3, 0xB0D5, 0, /* 0x60 */ 0, 0, 0xB0D4, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0xD471, 0xD472, 0xD86A, /* 0x70 */ 0, 0, 0, 0xB3D7, 0xB3DA, 0xD875, 0xB3EE, 0xD878, /* 0x70 */ 0xB3D8, 0xD871, 0xB3DE, 0xB3E4, 0xB5BD, 0, 0, 0xB3E2, /* 0x80 */ 0xD86E, 0xB3EF, 0xB3DB, 0xB3E3, 0xD876, 0xDCD7, 0xD87B, 0xD86F, /* 0x80 */ 0, 0xD866, 0xD873, 0xD86D, 0xB3E1, 0xD879, 0, 0, /* 0x90 */ 0xB3DD, 0xB3F1, 0xB3EA, 0, 0xB3DF, 0xB3DC, 0, 0xB3E7, /* 0x90 */ 0, 0xD87A, 0xD86C, 0xD872, 0xD874, 0xD868, 0xD877, 0xB3D9, /* 0xA0 */ 0xD867, 0, 0xB3E0, 0xB3F0, 0xB3EC, 0xD869, 0xB3E6, 0, /* 0xA0 */ 0, 0xB3ED, 0xB3E9, 0xB3E5, 0, 0xD870, 0, 0, /* 0xB0 */ 0, 0, 0, 0xB3EB, 0, 0, 0, 0xDCD5, /* 0xB0 */ 0xDCD1, 0, 0xDCE0, 0xDCCA, 0xDCD3, 0xB6E5, 0xB6E6, 0xB6DE, /* 0xC0 */ 0xDCDC, 0xB6E8, 0xDCCF, 0xDCCE, 0xDCCC, 0xDCDE, 0xB6DC, 0xDCD8, /* 0xC0 */ 0xDCCD, 0xB6DF, 0xDCD6, 0xB6DA, 0xDCD2, 0xDCD9, 0xDCDB, 0, /* 0xD0 */ 0, 0xDCDF, 0xB6E3, 0xDCCB, 0xB6DD, 0xDCD0, 0, 0xB6D8, /* 0xD0 */ 0, 0xB6E4, 0xDCDA, 0xB6E0, 0xB6E1, 0xB6E7, 0xB6DB, 0xA25F, /* 0xE0 */ 0xB6D9, 0xDCD4, 0, 0, 0, 0, 0, 0xB6E2, /* 0xE0 */ 0, 0, 0xDCDD, 0, 0, 0, 0xB9CD, 0xB9C8, /* 0xF0 */ 0, 0xE155, 0xE151, 0, 0xE14B, 0xB9C2, 0xB9BE, 0xE154 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_56[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xB9BF, 0xE14E, 0xE150, 0, 0xE153, 0, 0xB9C4, 0, /* 0x00 */ 0xB9CB, 0xB9C5, 0, 0, 0xE149, 0xB9C6, 0xB9C7, 0xE14C, /* 0x00 */ 0xB9CC, 0, 0xE14A, 0xE14F, 0xB9C3, 0xE148, 0xB9C9, 0xB9C1, /* 0x10 */ 0, 0, 0, 0xB9C0, 0xE14D, 0xE152, 0, 0xB9CA, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0xE147, /* 0x20 */ 0, 0xBC4D, 0xE547, 0, 0xE544, 0, 0xBC47, 0xBC53, /* 0x20 */ 0xBC54, 0, 0xBC4A, 0xE542, 0xBC4C, 0xE4F9, 0xBC52, 0, /* 0x30 */ 0xE546, 0xBC49, 0xE548, 0xBC48, 0, 0xE543, 0xE545, 0xBC4B, /* 0x30 */ 0xE541, 0xE4FA, 0xE4F7, 0, 0, 0xD86B, 0xE4FD, 0, /* 0x40 */ 0xE4F6, 0xE4FC, 0xE4FB, 0, 0xE4F8, 0, 0xBC4F, 0, /* 0x40 */ 0, 0, 0, 0xBC4E, 0, 0, 0, 0xBC50, /* 0x50 */ 0xE4FE, 0xBEB2, 0xE540, 0, 0, 0, 0xE945, 0, /* 0x50 */ 0xE8FD, 0, 0xBEBE, 0xE942, 0xBEB6, 0xBEBA, 0xE941, 0, /* 0x60 */ 0xBEB9, 0xBEB5, 0xBEB8, 0xBEB3, 0xBEBD, 0xE943, 0xE8FE, 0xBEBC, /* 0x60 */ 0xE8FC, 0xBEBB, 0xE944, 0xE940, 0xBC51, 0, 0xBEBF, 0xE946, /* 0x70 */ 0xBEB7, 0xBEB4, 0, 0, 0, 0, 0xECC6, 0xECC8, /* 0x70 */ 0xC07B, 0xECC9, 0xECC7, 0xECC5, 0xECC4, 0xC07D, 0xECC3, 0xC07E, /* 0x80 */ 0, 0, 0, 0, 0xECC1, 0xECC2, 0xC07A, 0xC0A1, /* 0x80 */ 0xC07C, 0, 0, 0xECC0, 0, 0xC250, 0, 0xEFBC, /* 0x90 */ 0xEFBA, 0xEFBF, 0xEFBD, 0, 0xEFBB, 0xEFBE, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0xC360, 0xF1F2, 0xF1F3, /* 0xA0 */ 0xC456, 0, 0xF1F4, 0xF1F0, 0xF1F5, 0xF1F1, 0xC251, 0, /* 0xA0 */ 0, 0, 0xF3FE, 0xF441, 0xC459, 0xF440, 0xC458, 0xC457, /* 0xB0 */ 0, 0, 0, 0, 0xC45A, 0xF5C5, 0xF5C6, 0, /* 0xB0 */ 0xC4DA, 0xC4D9, 0xC4DB, 0xF5C4, 0, 0xF6D8, 0xF6D7, 0, /* 0xC0 */ 0xC56D, 0xC56F, 0xC56E, 0xF6D9, 0xC5C8, 0xF8A6, 0, 0, /* 0xC0 */ 0, 0xC5F1, 0, 0xF8A5, 0xF8EE, 0, 0, 0xC949, /* 0xD0 */ 0, 0, 0xA57D, 0xA57C, 0, 0xA65F, 0xA65E, 0xC9C7, /* 0xD0 */ 0xA65D, 0xC9C6, 0, 0, 0xA779, 0xCAA9, 0, 0xCAA8, /* 0xE0 */ 0, 0, 0xA777, 0xA77A, 0, 0, 0xCAA7, 0, /* 0xE0 */ 0xA778, 0, 0, 0, 0, 0, 0, 0xCBF0, /* 0xF0 */ 0, 0xCBF1, 0xA954, 0, 0, 0, 0, 0xABAA /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_57[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD148, 0xD149, 0xAE45, 0xAE46, 0, 0, 0xD4AC, /* 0x00 */ 0xB0E9, 0xB0EB, 0xD4AB, 0xB0EA, 0xD87C, 0xB3F2, 0, 0, /* 0x00 */ 0, 0, 0xB6E9, 0xB6EA, 0xDCE1, 0, 0xB9CF, 0, /* 0x10 */ 0xB9CE, 0, 0xE549, 0xE948, 0xE947, 0, 0xF96B, 0xA467, /* 0x10 */ 0xC959, 0, 0xC96E, 0xC96F, 0, 0, 0, 0, /* 0x20 */ 0xA662, 0xA666, 0xC9C9, 0, 0xA664, 0xA663, 0xC9C8, 0xA665, /* 0x20 */ 0xA661, 0, 0, 0xA660, 0xC9CA, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0xA7A6, 0, 0, 0xA7A3, 0, /* 0x30 */ 0xA77D, 0xCAAA, 0, 0, 0, 0xCAAB, 0, 0xA7A1, /* 0x40 */ 0, 0xCAAD, 0xA77B, 0xCAAE, 0xCAAC, 0xA77E, 0xA7A2, 0xA7A5, /* 0x40 */ 0xA7A4, 0xA77C, 0xCAAF, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0xA959, 0xCBFE, 0, 0xA95B, 0, 0xA95A, 0, /* 0x60 */ 0xCC40, 0xA958, 0xA957, 0xCBF5, 0, 0xCBF4, 0, 0xCBF2, /* 0x60 */ 0xCBF7, 0xCBF6, 0xCBF3, 0xCBFC, 0xCBFD, 0xCBFA, 0xCBF8, 0xA956, /* 0x70 */ 0, 0, 0, 0xCBFB, 0xA95C, 0xCC41, 0, 0, /* 0x70 */ 0xCBF9, 0, 0xABAB, 0xA955, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0xABAC, 0xCE54, 0, 0, 0xCE5A, /* 0x80 */ 0, 0, 0, 0xABB2, 0xCE58, 0xCE5E, 0, 0xCE55, /* 0x90 */ 0xCE59, 0xCE5B, 0xCE5D, 0xCE57, 0, 0xCE56, 0xCE51, 0xCE52, /* 0x90 */ 0xABAD, 0, 0xABAF, 0xABAE, 0xCE53, 0xCE5C, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0xABB1, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0xCE50, 0xD153, 0, /* 0xB0 */ 0xD152, 0xD157, 0xD14E, 0, 0xD151, 0xD150, 0, 0xD154, /* 0xB0 */ 0, 0xD158, 0xAE47, 0xAE4A, 0, 0, 0xD14F, 0xD155, /* 0xC0 */ 0, 0, 0, 0xAE49, 0xD14A, 0, 0xABB0, 0xD4BA, /* 0xC0 */ 0xD156, 0, 0xD14D, 0, 0xAE48, 0xD14C, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0xD4B1, 0, 0, 0xB0EC, /* 0xD0 */ 0xB0F0, 0xD4C1, 0xD4AF, 0xD4BD, 0xB0F1, 0xD4BF, 0, 0xD4C5, /* 0xE0 */ 0, 0xD4C9, 0, 0, 0xD4C0, 0xD4B4, 0xD4BC, 0, /* 0xE0 */ 0xD4CA, 0xD4C8, 0xD4BE, 0xD4B9, 0xD4B2, 0xD8A6, 0xD4B0, 0xB0F5, /* 0xF0 */ 0xD4B7, 0xB0F6, 0xB0F2, 0xD4AD, 0xD4C3, 0xD4B5 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_58[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD4B3, 0xD4C6, 0xB0F3, 0, 0xD4CC, 0xB0ED, 0xB0EF, 0xD4BB, /* 0x00 */ 0xD4B6, 0xAE4B, 0xB0EE, 0xD4B8, 0xD4C7, 0xD4CB, 0xD4C2, 0, /* 0x00 */ 0xD4C4, 0, 0, 0, 0xD4AE, 0, 0, 0, /* 0x10 */ 0, 0xD8A1, 0, 0xD8AA, 0xD8A9, 0xB3FA, 0xD8A2, 0, /* 0x10 */ 0xB3FB, 0xB3F9, 0, 0xD8A4, 0xB3F6, 0xD8A8, 0, 0xD8A3, /* 0x20 */ 0xD8A5, 0xD87D, 0xB3F4, 0, 0xD8B2, 0xD8B1, 0xD8AE, 0xB3F3, /* 0x20 */ 0xB3F7, 0xB3F8, 0xD14B, 0xD8AB, 0xB3F5, 0xB0F4, 0xD8AD, 0xD87E, /* 0x30 */ 0xD8B0, 0xD8AF, 0, 0xD8B3, 0, 0xDCEF, 0, 0xD8AC, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0xD8A7, 0xDCE7, 0xB6F4, 0xB6F7, 0xB6F2, 0xDCE6, 0xDCEA, 0xDCE5, /* 0x40 */ 0, 0xB6EC, 0xB6F6, 0xDCE2, 0xB6F0, 0xDCE9, 0, 0xB6EE, /* 0x50 */ 0xB6ED, 0xDCEC, 0xB6EF, 0xDCEE, 0, 0xDCEB, 0xB6EB, 0, /* 0x50 */ 0, 0, 0xB6F5, 0xDCF0, 0xDCE4, 0xDCED, 0, 0, /* 0x60 */ 0xDCE3, 0, 0, 0xB6F1, 0, 0xB6F3, 0, 0xDCE8, /* 0x60 */ 0, 0xDCF1, 0, 0, 0xE15D, 0xB9D0, 0xE163, 0, /* 0x70 */ 0, 0xB9D5, 0xE15F, 0xE166, 0xE157, 0xB9D7, 0xB9D1, 0xE15C, /* 0x70 */ 0xBC55, 0xE15B, 0xE164, 0xB9D2, 0, 0xB9D6, 0xE15A, 0xE160, /* 0x80 */ 0xE165, 0xE156, 0xB9D4, 0xE15E, 0, 0, 0xE162, 0xE168, /* 0x80 */ 0xE158, 0xE161, 0, 0xB9D3, 0xE167, 0, 0, 0, /* 0x90 */ 0xE159, 0, 0, 0, 0xBC59, 0xE54B, 0xBC57, 0xBC56, /* 0x90 */ 0xE54D, 0xE552, 0, 0xE54E, 0, 0xE551, 0xBC5C, 0, /* 0xA0 */ 0xBEA5, 0xBC5B, 0, 0xE54A, 0xE550, 0, 0xBC5A, 0xE54F, /* 0xA0 */ 0, 0xE54C, 0, 0xBC58, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0xE94D, 0xF9D9, 0xE94F, 0xE94A, 0xBEC1, 0xE94C, /* 0xB0 */ 0, 0xBEC0, 0xE94E, 0, 0, 0xBEC3, 0xE950, 0xBEC2, /* 0xC0 */ 0xE949, 0xE94B, 0, 0, 0, 0, 0xC0A5, 0xECCC, /* 0xC0 */ 0, 0xC0A4, 0xECCD, 0xC0A3, 0xECCB, 0xC0A2, 0xECCA, 0, /* 0xD0 */ 0xC253, 0xC252, 0xF1F6, 0xF1F8, 0, 0xF1F7, 0xC361, 0xC362, /* 0xD0 */ 0, 0, 0xC363, 0xF442, 0xC45B, 0, 0, 0xF7D3, /* 0xE0 */ 0xF7D2, 0xC5F2, 0, 0xA468, 0xA4D0, 0, 0, 0xA7A7, /* 0xE0 */ 0, 0, 0, 0, 0xCE5F, 0, 0, 0, /* 0xF0 */ 0, 0xB3FC, 0xB3FD, 0, 0xDCF2, 0xB9D8, 0xE169, 0xE553 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_59[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC95A, 0, 0, 0xCAB0, 0, /* 0x00 */ 0, 0, 0, 0, 0xCC42, 0xCE60, 0xD159, 0xAE4C, /* 0x00 */ 0, 0, 0xF1F9, 0, 0xC4DC, 0xA469, 0xA57E, 0xC970, /* 0x10 */ 0, 0xA667, 0xA668, 0, 0xA95D, 0, 0, 0, /* 0x10 */ 0xB0F7, 0, 0xB9DA, 0, 0xB9DB, 0xB9D9, 0, 0xA46A, /* 0x20 */ 0, 0xA4D1, 0xA4D3, 0xA4D2, 0xC95B, 0xA4D4, 0xA5A1, 0xC971, /* 0x20 */ 0, 0xA5A2, 0, 0, 0, 0, 0, 0xA669, /* 0x30 */ 0xA66A, 0, 0, 0, 0xC9CB, 0, 0xA7A8, 0, /* 0x30 */ 0xCAB1, 0, 0, 0, 0xA961, 0xCC43, 0, 0xA95F, /* 0x40 */ 0xA960, 0xA95E, 0xD15A, 0, 0, 0, 0xABB6, 0xABB5, /* 0x40 */ 0xABB7, 0xABB4, 0, 0xCE61, 0xA962, 0xABB3, 0, 0xAE4D, /* 0x50 */ 0xAE4E, 0, 0xAE4F, 0, 0xD4CD, 0, 0, 0, /* 0x50 */ 0xB3FE, 0xD8B4, 0xB0F8, 0, 0, 0, 0, 0xB6F8, /* 0x60 */ 0, 0xB9DD, 0xB9DC, 0xE16A, 0, 0xBC5D, 0xBEC4, 0, /* 0x60 */ 0xEFC0, 0xF6DA, 0xF7D4, 0xA46B, 0xA5A3, 0, 0xA5A4, 0xC9D1, /* 0x70 */ 0xA66C, 0xA66F, 0, 0xC9CF, 0xC9CD, 0xA66E, 0xC9D0, 0xC9D2, /* 0x70 */ 0xC9CC, 0xA671, 0xA670, 0xA66D, 0xA66B, 0xC9CE, 0, 0, /* 0x80 */ 0, 0, 0xA7B3, 0, 0, 0xA7B0, 0xCAB6, 0xCAB9, /* 0x80 */ 0xCAB8, 0, 0xA7AA, 0xA7B2, 0, 0, 0xA7AF, 0xCAB5, /* 0x90 */ 0xCAB3, 0xA7AE, 0, 0, 0, 0xA7A9, 0xA7AC, 0, /* 0x90 */ 0xCAB4, 0xCABB, 0xCAB7, 0xA7AD, 0xA7B1, 0xA7B4, 0xCAB2, 0xCABA, /* 0xA0 */ 0xA7AB, 0, 0, 0, 0, 0, 0xA967, 0xA96F, /* 0xA0 */ 0, 0xCC4F, 0xCC48, 0xA970, 0xCC53, 0xCC44, 0xCC4B, 0, /* 0xB0 */ 0, 0xA966, 0xCC45, 0xA964, 0xCC4C, 0xCC50, 0xA963, 0, /* 0xB0 */ 0xCC51, 0xCC4A, 0, 0xCC4D, 0, 0xA972, 0xA969, 0xCC54, /* 0xC0 */ 0xCC52, 0, 0xA96E, 0xA96C, 0xCC49, 0xA96B, 0xCC47, 0xCC46, /* 0xC0 */ 0xA96A, 0xA968, 0xA971, 0xA96D, 0xA965, 0, 0xCC4E, 0, /* 0xD0 */ 0xABB9, 0, 0xABC0, 0xCE6F, 0xABB8, 0xCE67, 0xCE63, 0, /* 0xD0 */ 0xCE73, 0xCE62, 0, 0xABBB, 0xCE6C, 0xABBE, 0xABC1, 0, /* 0xE0 */ 0xABBC, 0xCE70, 0xABBF, 0, 0xAE56, 0xCE76, 0xCE64, 0, /* 0xE0 */ 0, 0xCE66, 0xCE6D, 0xCE71, 0xCE75, 0xCE72, 0xCE6B, 0xCE6E, /* 0xF0 */ 0, 0, 0xCE68, 0xABC3, 0xCE6A, 0xCE69, 0xCE74, 0xABBA /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_5A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xCE65, 0xABC2, 0, 0xABBD, 0, 0, 0, 0, /* 0x00 */ 0, 0xAE5C, 0xD162, 0, 0xAE5B, 0, 0, 0xD160, /* 0x00 */ 0, 0xAE50, 0, 0xAE55, 0, 0xD15F, 0xD15C, 0xD161, /* 0x10 */ 0xAE51, 0xD15B, 0, 0xAE54, 0xAE52, 0, 0xD163, 0xAE53, /* 0x10 */ 0xAE57, 0, 0, 0xAE58, 0, 0xAE5A, 0, 0, /* 0x20 */ 0, 0xAE59, 0, 0, 0, 0xD15D, 0xD15E, 0, /* 0x20 */ 0, 0, 0, 0xD164, 0, 0xD4D4, 0xB0F9, 0xD8C2, /* 0x30 */ 0xD4D3, 0xD4E6, 0, 0, 0xB140, 0, 0xD4E4, 0, /* 0x30 */ 0xB0FE, 0xB0FA, 0xD4ED, 0xD4DD, 0xD4E0, 0, 0xB143, 0xD4EA, /* 0x40 */ 0xD4E2, 0xB0FB, 0xB144, 0, 0xD4E7, 0xD4E5, 0, 0, /* 0x40 */ 0xD4D6, 0xD4EB, 0xD4DF, 0xD4DA, 0, 0xD4D0, 0xD4EC, 0xD4DC, /* 0x50 */ 0xD4CF, 0, 0xB142, 0xD4E1, 0xD4EE, 0xD4DE, 0xD4D2, 0xD4D7, /* 0x50 */ 0xD4CE, 0, 0xB141, 0, 0xD4DB, 0xD4D8, 0xB0FC, 0xD4D1, /* 0x60 */ 0, 0xD4E9, 0xB0FD, 0, 0xD4D9, 0xD4D5, 0, 0, /* 0x60 */ 0xD4E8, 0, 0, 0, 0, 0, 0, 0xB440, /* 0x70 */ 0xD8BB, 0, 0xD8B8, 0xD8C9, 0xD8BD, 0xD8CA, 0, 0xB442, /* 0x70 */ 0, 0, 0, 0xD8C6, 0xD8C3, 0, 0, 0, /* 0x80 */ 0, 0, 0xD8C4, 0xD8C7, 0xD8CB, 0, 0xD4E3, 0xD8CD, /* 0x80 */ 0xDD47, 0, 0xB443, 0xD8CE, 0xD8B6, 0xD8C0, 0, 0xD8C5, /* 0x90 */ 0, 0, 0xB441, 0xB444, 0xD8CC, 0xD8CF, 0xD8BA, 0xD8B7, /* 0x90 */ 0, 0, 0xD8B9, 0, 0, 0xD8BE, 0xD8BC, 0xB445, /* 0xA0 */ 0, 0xD8C8, 0, 0, 0xD8BF, 0, 0xD8C1, 0xD8B5, /* 0xA0 */ 0xDCFA, 0xDCF8, 0xB742, 0xB740, 0xDD43, 0xDCF9, 0xDD44, 0xDD40, /* 0xB0 */ 0xDCF7, 0xDD46, 0xDCF6, 0xDCFD, 0xB6FE, 0xB6FD, 0xB6FC, 0xDCFB, /* 0xB0 */ 0xDD41, 0xB6F9, 0xB741, 0, 0xDCF4, 0, 0xDCFE, 0xDCF3, /* 0xC0 */ 0xDCFC, 0xB6FA, 0xDD42, 0xDCF5, 0xB6FB, 0xDD45, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0xE16E, 0xB9E2, 0xB9E1, /* 0xD0 */ 0xB9E3, 0xE17A, 0xE170, 0xE176, 0xE16B, 0xE179, 0xE178, 0xE17C, /* 0xD0 */ 0xE175, 0xB9DE, 0xE174, 0xB9E4, 0, 0xE16D, 0xB9DF, 0, /* 0xE0 */ 0xE17B, 0xB9E0, 0xE16F, 0xE172, 0xE177, 0xE171, 0xE16C, 0, /* 0xE0 */ 0, 0, 0, 0xE173, 0xE555, 0xBC61, 0xE558, 0xE557, /* 0xF0 */ 0xE55A, 0xE55C, 0xF9DC, 0xBC5F, 0, 0xE556, 0, 0xE554 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_5B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE55D, 0xE55B, 0xE559, 0, 0xE55F, 0, 0xE55E, /* 0x00 */ 0xBC63, 0xBC5E, 0, 0xBC60, 0xBC62, 0, 0, 0xE560, /* 0x00 */ 0xE957, 0, 0, 0xE956, 0xE955, 0, 0xE958, 0xE951, /* 0x10 */ 0, 0xE952, 0xE95A, 0xE953, 0, 0xBEC5, 0xE95C, 0, /* 0x10 */ 0xE95B, 0xE954, 0, 0xECD1, 0xC0A8, 0xECCF, 0xECD4, 0xECD3, /* 0x20 */ 0xE959, 0, 0xC0A7, 0, 0xECD2, 0xECCE, 0xECD6, 0xECD5, /* 0x20 */ 0xC0A6, 0, 0xECD0, 0, 0xBEC6, 0, 0, 0, /* 0x30 */ 0xC254, 0, 0, 0, 0xEFC1, 0xF1FA, 0xF1FB, 0xF1FC, /* 0x30 */ 0xC45C, 0, 0, 0xC45D, 0, 0xF443, 0, 0xF5C8, /* 0x40 */ 0xF5C7, 0, 0, 0xF6DB, 0xF6DC, 0xF7D5, 0xF8A7, 0, /* 0x40 */ 0xA46C, 0xA46D, 0, 0xA46E, 0xA4D5, 0xA5A5, 0xC9D3, 0xA672, /* 0x50 */ 0xA673, 0, 0xA7B7, 0xA7B8, 0xA7B6, 0xA7B5, 0, 0xA973, /* 0x50 */ 0, 0, 0xCC55, 0xA975, 0xA974, 0xCC56, 0, 0, /* 0x60 */ 0, 0xABC4, 0, 0xAE5D, 0xD165, 0, 0xD4F0, 0, /* 0x60 */ 0xB145, 0xB447, 0xD4EF, 0xB446, 0, 0xB9E5, 0, 0xE17D, /* 0x70 */ 0xBEC7, 0, 0xC0A9, 0xECD7, 0, 0xC45E, 0, 0xC570, /* 0x70 */ 0, 0xC972, 0, 0xA5A6, 0xC973, 0xA676, 0, 0xA674, /* 0x80 */ 0xA675, 0xA677, 0, 0xA7BA, 0xA7B9, 0, 0xCABC, 0xA7BB, /* 0x80 */ 0, 0, 0xCABD, 0xCC57, 0, 0xCC58, 0, 0xA976, /* 0x90 */ 0xA978, 0xA97A, 0xA977, 0xA97B, 0xA979, 0, 0, 0, /* 0x90 */ 0, 0, 0xABC8, 0xABC5, 0xABC7, 0xABC9, 0xABC6, 0xD166, /* 0xA0 */ 0xCE77, 0, 0, 0, 0xD168, 0xD167, 0xAE63, 0, /* 0xA0 */ 0xAE5F, 0, 0, 0xAE60, 0xAE62, 0xAE64, 0xAE61, 0, /* 0xB0 */ 0xAE66, 0xAE65, 0, 0, 0, 0, 0, 0xB14A, /* 0xB0 */ 0xD4F2, 0xD4F1, 0xB149, 0, 0xB148, 0xB147, 0xB14B, 0xB146, /* 0xC0 */ 0, 0, 0xD8D5, 0xD8D2, 0xB449, 0xD8D1, 0xD8D6, 0, /* 0xC0 */ 0xB44B, 0xD8D4, 0xB448, 0xB44A, 0xD8D3, 0, 0xDD48, 0, /* 0xD0 */ 0xDD49, 0xDD4A, 0, 0, 0, 0, 0xB9E6, 0xB9EE, /* 0xD0 */ 0xE17E, 0xB9E8, 0xB9EC, 0xE1A1, 0xB9ED, 0xB9E9, 0xB9EA, 0xB9E7, /* 0xE0 */ 0xB9EB, 0xBC66, 0xD8D0, 0xBC67, 0xBC65, 0, 0xBC64, 0xE95D, /* 0xE0 */ 0xBEC8, 0xECD8, 0xECD9, 0, 0, 0xC364, 0xC45F, 0, /* 0xF0 */ 0xA46F, 0, 0xA678 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_5C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xABCA, 0, 0xD169, 0xAE67, 0, 0, 0xB14E, /* 0x00 */ 0xB14D, 0xB14C, 0xB44C, 0xB44D, 0xD8D7, 0xB9EF, 0xBEC9, 0xA470, /* 0x00 */ 0xC95C, 0xA4D6, 0xC974, 0, 0, 0xC9D4, 0xA679, 0, /* 0x10 */ 0, 0, 0xA97C, 0, 0, 0, 0, 0xDD4B, /* 0x10 */ 0, 0, 0xA471, 0, 0xA4D7, 0xC9D5, 0, 0, /* 0x20 */ 0xCABE, 0, 0xCABF, 0, 0xA7BC, 0, 0, 0, /* 0x20 */ 0xD8D8, 0xB44E, 0, 0xDD4C, 0, 0, 0, 0xC0AA, /* 0x30 */ 0xA472, 0xA4A8, 0xA4D8, 0xC975, 0xA5A7, 0, 0xA7C0, 0xA7BF, /* 0x30 */ 0xA7BD, 0xA7BE, 0, 0, 0xCC59, 0xA97E, 0xA9A1, 0xCC5A, /* 0x40 */ 0xA97D, 0, 0, 0xABCE, 0xCE78, 0xABCD, 0xABCB, 0xABCC, /* 0x40 */ 0xAE6A, 0xAE68, 0, 0, 0xD16B, 0xAE69, 0xD16A, 0, /* 0x50 */ 0xAE5E, 0xD4F3, 0, 0, 0xB150, 0xB151, 0, 0, /* 0x50 */ 0xB14F, 0, 0xB9F0, 0xE1A2, 0xBC68, 0xBC69, 0, 0xE561, /* 0x60 */ 0xC0AB, 0xEFC2, 0xEFC3, 0, 0xC4DD, 0xF8A8, 0xC94B, 0xA4D9, /* 0x60 */ 0, 0xA473, 0, 0xC977, 0xC976, 0, 0, 0, /* 0x70 */ 0, 0xA67A, 0xC9D7, 0xC9D8, 0xC9D6, 0, 0xC9D9, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0xCAC7, 0, /* 0x80 */ 0xCAC2, 0xCAC4, 0xCAC6, 0xCAC3, 0xA7C4, 0xCAC0, 0, 0xCAC1, /* 0x80 */ 0xA7C1, 0xA7C2, 0xCAC5, 0xCAC8, 0xA7C3, 0xCAC9, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0xCC68, 0, 0xCC62, /* 0x90 */ 0xCC5D, 0xA9A3, 0xCC65, 0xCC63, 0xCC5C, 0xCC69, 0xCC6C, 0xCC67, /* 0xA0 */ 0xCC60, 0xA9A5, 0xCC66, 0xA9A6, 0xCC61, 0xCC64, 0xCC5B, 0xCC5F, /* 0xA0 */ 0xCC6B, 0xA9A7, 0, 0xA9A8, 0, 0xCC5E, 0xCC6A, 0xA9A2, /* 0xB0 */ 0xA9A4, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0xCEAB, 0xCEA4, /* 0xC0 */ 0xCEAA, 0xCEA3, 0xCEA5, 0xCE7D, 0xCE7B, 0, 0xCEAC, 0xCEA9, /* 0xC0 */ 0xCE79, 0, 0xABD0, 0xCEA7, 0xCEA8, 0, 0xCEA6, 0xCE7C, /* 0xD0 */ 0xCE7A, 0xABCF, 0xCEA2, 0xCE7E, 0, 0, 0xCEA1, 0xCEAD, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0xAE6F, 0, 0xAE6E, 0, 0xD16C, 0xAE6B, 0xD16E, 0, /* 0xE0 */ 0xAE70, 0xD16F, 0, 0, 0xAE73, 0, 0xAE71, 0xD170, /* 0xF0 */ 0xCEAE, 0xD172, 0, 0xAE6D, 0, 0xAE6C, 0, 0xD16D /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_5D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD171, 0xAE72, 0, 0, 0, 0, 0xB153, 0xB152, /* 0x00 */ 0, 0, 0, 0xD4F5, 0xD4F9, 0xD4FB, 0xB154, 0xD4FE, /* 0x00 */ 0, 0xB158, 0xD541, 0, 0xB15A, 0, 0xB156, 0xB15E, /* 0x10 */ 0, 0xB15B, 0xD4F7, 0xB155, 0, 0xD4F6, 0xD4F4, 0xD543, /* 0x10 */ 0xD4F8, 0, 0xB157, 0xD542, 0xB15C, 0xD4FD, 0xD4FC, 0xB15D, /* 0x20 */ 0xD4FA, 0xB159, 0, 0, 0, 0, 0xD544, 0, /* 0x20 */ 0xD540, 0xD8E7, 0xD8EE, 0xD8E3, 0xB451, 0xD8DF, 0xD8EF, 0xD8D9, /* 0x30 */ 0xD8EC, 0xD8EA, 0xD8E4, 0, 0xD8ED, 0xD8E6, 0, 0xD8DE, /* 0x30 */ 0xD8F0, 0xD8DC, 0xD8E9, 0xD8DA, 0, 0xD8F1, 0, 0xB452, /* 0x40 */ 0, 0xD8EB, 0xDD4F, 0xD8DD, 0xB44F, 0, 0xD8E1, 0, /* 0x40 */ 0xB450, 0xD8E0, 0xD8E5, 0, 0, 0xD8E2, 0, 0, /* 0x50 */ 0, 0xD8E8, 0, 0, 0, 0, 0xDD53, 0, /* 0x50 */ 0, 0, 0xDD56, 0xDD4E, 0, 0xDD50, 0, 0xDD55, /* 0x60 */ 0xDD54, 0xB743, 0, 0xD8DB, 0xDD52, 0, 0, 0xB744, /* 0x60 */ 0, 0xDD4D, 0xDD51, 0, 0, 0, 0, 0xE1A9, /* 0x70 */ 0, 0xE1B0, 0xE1A7, 0, 0xE1AE, 0xE1A5, 0xE1AD, 0xE1B1, /* 0x70 */ 0xE1A4, 0xE1A8, 0xE1A3, 0, 0xB9F1, 0, 0xE1A6, 0xB9F2, /* 0x80 */ 0xE1AC, 0xE1AB, 0xE1AA, 0, 0, 0xE1AF, 0, 0, /* 0x80 */ 0, 0, 0xE565, 0xE567, 0xBC6B, 0xE568, 0, 0xE563, /* 0x90 */ 0, 0xE562, 0xE56C, 0, 0xE56A, 0xBC6A, 0xE56D, 0xE564, /* 0x90 */ 0xE569, 0xE56B, 0xE566, 0, 0, 0, 0, 0xE961, /* 0xA0 */ 0xE966, 0xE960, 0xE965, 0, 0xE95E, 0xE968, 0xE964, 0xE969, /* 0xA0 */ 0xE963, 0xE95F, 0xE967, 0, 0xE96A, 0xE962, 0, 0xECDA, /* 0xB0 */ 0xC0AF, 0, 0xC0AD, 0, 0xC0AC, 0xC0AE, 0, 0, /* 0xB0 */ 0xEFC4, 0, 0xF172, 0xF1FD, 0, 0, 0xF444, 0xF445, /* 0xC0 */ 0, 0xC460, 0, 0xF5C9, 0, 0xC4DE, 0, 0xF5CA, /* 0xC0 */ 0, 0xF6DE, 0xC572, 0, 0xC571, 0xF6DD, 0xC5C9, 0, /* 0xD0 */ 0xF7D6, 0, 0, 0, 0, 0xA474, 0xA67B, 0xC9DA, /* 0xD0 */ 0xCACA, 0xA8B5, 0xB15F, 0, 0, 0xA475, 0xA5AA, 0xA5A9, /* 0xE0 */ 0xA5A8, 0, 0, 0xA7C5, 0, 0, 0xAE74, 0, /* 0xE0 */ 0xDD57, 0xA476, 0xA477, 0xA478, 0xA4DA, 0, 0, 0xABD1, /* 0xF0 */ 0, 0xCEAF, 0, 0, 0, 0xB453, 0xA479, 0xC95D /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_5E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA5AB, 0xA5AC, 0xC978, 0, 0xA67C, 0, /* 0x00 */ 0, 0, 0xCACB, 0, 0xA7C6, 0, 0xCACC, 0, /* 0x00 */ 0, 0xA9AE, 0, 0, 0xCC6E, 0xA9AC, 0xA9AB, 0xCC6D, /* 0x10 */ 0xA9A9, 0xCC6F, 0xA9AA, 0xA9AD, 0, 0xABD2, 0, 0xABD4, /* 0x10 */ 0xCEB3, 0xCEB0, 0xCEB1, 0xCEB2, 0xCEB4, 0xABD3, 0, 0, /* 0x20 */ 0xD174, 0xD173, 0, 0xAE76, 0, 0xAE75, 0, 0, /* 0x20 */ 0, 0, 0, 0xB162, 0xD546, 0, 0xB161, 0xB163, /* 0x30 */ 0xB160, 0, 0, 0, 0, 0xB455, 0xD545, 0, /* 0x30 */ 0xB456, 0xD8F3, 0, 0xB457, 0xD8F2, 0xB454, 0, 0, /* 0x40 */ 0, 0, 0xDD5A, 0xDD5C, 0xB745, 0xDD5B, 0xDD59, 0xDD58, /* 0x40 */ 0, 0, 0, 0xE1B4, 0xB9F7, 0xB9F5, 0, 0xB9F6, /* 0x50 */ 0xE1B2, 0xE1B3, 0, 0xB9F3, 0xE571, 0xE56F, 0, 0xBC6D, /* 0x50 */ 0xE570, 0xBC6E, 0xBC6C, 0xB9F4, 0, 0, 0xE96D, 0xE96B, /* 0x60 */ 0xE96C, 0xE56E, 0xECDC, 0xC0B0, 0xECDB, 0xEFC5, 0xEFC6, 0xE96E, /* 0x60 */ 0xF1FE, 0, 0xA47A, 0xA5AD, 0xA67E, 0xC9DB, 0xA67D, 0, /* 0x70 */ 0xA9AF, 0xB746, 0, 0xA4DB, 0xA5AE, 0xABD5, 0xB458, 0, /* 0x70 */ 0xC979, 0, 0xC97A, 0, 0xC9DC, 0, 0, 0xA7C8, /* 0x80 */ 0xCAD0, 0xCACE, 0xA7C9, 0xCACD, 0xCACF, 0xCAD1, 0, 0xA7C7, /* 0x80 */ 0, 0, 0, 0, 0, 0xA9B3, 0xA9B4, 0xA9B1, /* 0x90 */ 0, 0, 0xA9B0, 0xCEB8, 0xA9B2, 0, 0, 0, /* 0x90 */ 0xABD6, 0, 0xCEB7, 0xCEB9, 0xCEB6, 0xCEBA, 0xABD7, 0xAE79, /* 0xA0 */ 0xD175, 0, 0xD177, 0xAE77, 0xD178, 0xAE78, 0xD176, 0, /* 0xA0 */ 0xCEB5, 0xD547, 0xD54A, 0xD54B, 0xD548, 0xB167, 0xB166, 0xB164, /* 0xB0 */ 0xB165, 0xD549, 0, 0, 0, 0, 0xB168, 0, /* 0xB0 */ 0, 0xB45A, 0xB45B, 0, 0xB45C, 0xDD5D, 0xDD5F, 0xDD61, /* 0xC0 */ 0xB748, 0xB747, 0xB459, 0xDD60, 0xDD5E, 0, 0xE1B8, 0, /* 0xC0 */ 0, 0xE1B6, 0xE1BC, 0xB9F8, 0xE1BD, 0xE1BA, 0xB9F9, 0xE1B7, /* 0xD0 */ 0xE1B5, 0xE1BB, 0xBC70, 0xE573, 0xE1B9, 0xBC72, 0xE574, 0xBC71, /* 0xD0 */ 0xBC74, 0xE575, 0xBC6F, 0xBC73, 0, 0xE973, 0xE971, 0xE970, /* 0xE0 */ 0xE972, 0xE96F, 0, 0, 0xC366, 0, 0xF446, 0xF447, /* 0xE0 */ 0, 0xF5CB, 0xF6DF, 0xC655, 0, 0, 0xA9B5, 0xA7CA, /* 0xF0 */ 0, 0, 0xABD8, 0, 0, 0, 0xA47B, 0xA4DC /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_5F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA5AF, 0xC9DD, 0, 0xA7CB, 0xCAD2, 0, 0xCEBB, /* 0x00 */ 0xABD9, 0, 0xB9FA, 0xA47C, 0, 0, 0, 0xA6A1, /* 0x00 */ 0, 0, 0xB749, 0xA47D, 0xA4DD, 0xA4DE, 0, 0xA5B1, /* 0x10 */ 0xA5B0, 0, 0xC9DE, 0xA6A2, 0, 0xCAD3, 0, 0xA7CC, /* 0x10 */ 0, 0, 0xCC71, 0xCC72, 0xCC73, 0, 0xA9B6, 0xA9B7, /* 0x20 */ 0xCC70, 0xA9B8, 0, 0, 0, 0xABDA, 0xCEBC, 0, /* 0x20 */ 0xD17A, 0xAE7A, 0, 0xD179, 0, 0xB169, 0xD54C, 0xB16A, /* 0x30 */ 0xD54D, 0, 0, 0, 0xB45D, 0, 0, 0, /* 0x30 */ 0xDD62, 0, 0, 0xE1BF, 0xE1BE, 0, 0xB9FB, 0, /* 0x40 */ 0xBC75, 0xE576, 0xBECA, 0xE974, 0xC0B1, 0, 0xC573, 0xF7D8, /* 0x40 */ 0, 0, 0, 0, 0xCC74, 0, 0xCEBD, 0xB16B, /* 0x50 */ 0xD8F4, 0xB74A, 0, 0, 0, 0xC255, 0, 0, /* 0x50 */ 0, 0, 0xA7CE, 0, 0xA7CD, 0xABDB, 0, 0xD17B, /* 0x60 */ 0, 0xB16D, 0xB343, 0xB16E, 0xB16C, 0xB45E, 0, 0xE1C0, /* 0x60 */ 0xB9FC, 0xBC76, 0, 0xC94C, 0xC9DF, 0, 0xCAD5, 0xA7CF, /* 0x70 */ 0xCAD4, 0xA7D0, 0, 0, 0xA9BC, 0xCC77, 0xCC76, 0xA9BB, /* 0x70 */ 0xA9B9, 0xA9BA, 0xCC75, 0, 0, 0xABDD, 0xCEBE, 0xABE0, /* 0x80 */ 0xABDC, 0xABE2, 0xABDE, 0xABDF, 0xABE1, 0, 0, 0, /* 0x80 */ 0xAE7D, 0xAE7C, 0xAE7B, 0, 0, 0, 0xD54F, 0xB16F, /* 0x90 */ 0xB172, 0xB170, 0, 0xD54E, 0xB175, 0, 0xB171, 0xD550, /* 0x90 */ 0xB174, 0xB173, 0, 0, 0, 0xD8F6, 0xD8F5, 0, /* 0xA0 */ 0xB461, 0xB45F, 0xB460, 0xD8F7, 0xB74B, 0xDD64, 0xB74C, 0xDD63, /* 0xA0 */ 0, 0, 0xE577, 0, 0, 0xBC78, 0xE1C1, 0xBC77, /* 0xB0 */ 0, 0xB9FD, 0, 0xECDE, 0xE975, 0xC0B2, 0xECDD, 0xF240, /* 0xB0 */ 0xF448, 0xF449, 0, 0xA4DF, 0, 0xA5B2, 0, 0, /* 0xC0 */ 0, 0xC97B, 0, 0, 0xA7D2, 0xA7D4, 0, 0xC9E2, /* 0xC0 */ 0xCAD8, 0xCAD7, 0xCAD6, 0, 0xC9E1, 0xC9E0, 0xA6A4, 0xA7D3, /* 0xD0 */ 0xA7D1, 0xA6A3, 0, 0, 0, 0xA9BD, 0xCC78, 0, /* 0xD0 */ 0xA9BE, 0xCADD, 0, 0xCADF, 0xCADE, 0xCC79, 0, 0, /* 0xE0 */ 0xCADA, 0, 0xA7D8, 0xA7D6, 0, 0xCAD9, 0xCADB, 0xCAE1, /* 0xE0 */ 0, 0xA7D5, 0, 0xCADC, 0xCAE5, 0xA9C0, 0, 0xCAE2, /* 0xF0 */ 0xA7D7, 0, 0xCAE0, 0xCAE3, 0, 0xA9BF, 0, 0xA9C1 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_60[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xCAE4, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */ 0, 0xCCAF, 0xCCA2, 0xCC7E, 0xCCAE, 0xCCA9, 0xABE7, 0xA9C2, /* 0x00 */ 0xCCAA, 0xCCAD, 0xABE3, 0xCCAC, 0xA9C3, 0xA9C8, 0xA9C6, 0xCCA3, /* 0x10 */ 0, 0xCC7C, 0xCCA5, 0xA9CD, 0xCCB0, 0xABE4, 0xCCA6, 0, /* 0x10 */ 0xABE5, 0xA9C9, 0xCCA8, 0, 0xCECD, 0xABE6, 0xCC7B, 0xA9CA, /* 0x20 */ 0xABE8, 0xA9CB, 0xA9C7, 0xA9CC, 0xCCA7, 0xCC7A, 0xCCAB, 0xA9C4, /* 0x20 */ 0, 0, 0xCC7D, 0xCCA4, 0xCCA1, 0xA9C5, 0, 0xCEBF, /* 0x30 */ 0, 0xCEC0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0xCECA, 0xD1A1, 0xCECB, 0xABEE, 0xCECE, 0xCEC4, 0xABED, 0xCEC6, /* 0x40 */ 0, 0xCEC7, 0, 0, 0xCEC9, 0xABE9, 0, 0, /* 0x40 */ 0xAEA3, 0, 0xF9DA, 0xCEC5, 0xCEC1, 0xAEA4, 0, 0, /* 0x50 */ 0xCECF, 0xAE7E, 0xD17D, 0xCEC8, 0, 0xD17C, 0xCEC3, 0xCECC, /* 0x50 */ 0, 0, 0xABEC, 0xAEA1, 0xABF2, 0xAEA2, 0xCED0, 0xD17E, /* 0x60 */ 0xABEB, 0xAEA6, 0xABF1, 0xABF0, 0xABEF, 0xAEA5, 0xCED1, 0xAEA7, /* 0x60 */ 0xABEA, 0, 0xCEC2, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0xB176, /* 0x70 */ 0xD1A4, 0xD1A6, 0, 0xD1A8, 0xAEA8, 0xAEAE, 0xD553, 0xD1AC, /* 0x80 */ 0xD1A3, 0xB178, 0xD551, 0, 0xAEAD, 0xAEAB, 0xD1AE, 0, /* 0x80 */ 0xD552, 0, 0xD1A5, 0, 0xAEAC, 0xD1A9, 0xAEAF, 0xD1AB, /* 0x90 */ 0, 0, 0xAEAA, 0xD1AA, 0xD1AD, 0xD1A7, 0, 0xAEA9, /* 0x90 */ 0xB179, 0, 0xD1A2, 0xB177, 0, 0, 0, 0, /* 0xA0 */ 0xB17A, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0xD555, 0xD55E, 0xB464, 0, 0xB17C, 0xB1A3, 0xB465, 0xD560, /* 0xB0 */ 0xB1AA, 0xD8F9, 0xD556, 0xB1A2, 0xB1A5, 0xB17E, 0xD554, 0xD562, /* 0xB0 */ 0xD565, 0xD949, 0, 0xD563, 0xD8FD, 0xB1A1, 0xB1A8, 0xB1AC, /* 0xC0 */ 0xD55D, 0xD8F8, 0xD561, 0xB17B, 0xD8FA, 0xD564, 0xD8FC, 0xD559, /* 0xC0 */ 0, 0xB462, 0, 0xD557, 0xD558, 0xB1A7, 0, 0, /* 0xD0 */ 0xB1A6, 0xD55B, 0xB1AB, 0xD55F, 0xB1A4, 0xD55C, 0, 0xB1A9, /* 0xD0 */ 0xB466, 0xB463, 0xD8FB, 0, 0xD55A, 0, 0xB17D, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0xB46B, 0xB46F, 0xD940, 0xB751, 0xB46D, 0xD944, 0xB471, 0xDD65, /* 0xF0 */ 0xD946, 0xB753, 0xB469, 0xB46C, 0xD947, 0, 0xD948, 0xD94E /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_61[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xB473, 0xB754, 0, 0xD94A, 0xD94F, 0xD943, 0xB75E, 0, /* 0x00 */ 0xB755, 0xB472, 0xD941, 0xD950, 0, 0xB75D, 0xB470, 0xB74E, /* 0x00 */ 0xD94D, 0, 0xB474, 0xD945, 0xD8FE, 0xB46A, 0xD942, 0, /* 0x10 */ 0xD94B, 0, 0xB74D, 0xB752, 0xB467, 0xD94C, 0, 0xB750, /* 0x10 */ 0, 0, 0, 0xB468, 0, 0, 0, 0xB75C, /* 0x20 */ 0xE1C3, 0xDD70, 0, 0xDD68, 0xE1C2, 0, 0xDD6C, 0xDD6E, /* 0x20 */ 0, 0, 0xDD6B, 0, 0xB75B, 0, 0xDD6A, 0xB75F, /* 0x30 */ 0, 0, 0, 0xE1D2, 0, 0, 0xB75A, 0xBA40, /* 0x30 */ 0xDD71, 0xE1C4, 0, 0, 0xB758, 0xDD69, 0xDD6D, 0xB9FE, /* 0x40 */ 0xB74F, 0xDD66, 0xDD67, 0xBA41, 0xB757, 0xB759, 0xB756, 0xDD6F, /* 0x40 */ 0, 0, 0xE1C8, 0xE1C9, 0xE1CE, 0xBC7D, 0xE1D5, 0, /* 0x50 */ 0xBA47, 0, 0xBA46, 0xE1D0, 0, 0xBC7C, 0xE1C5, 0xBA45, /* 0x50 */ 0, 0xE1D4, 0xBA43, 0xBA44, 0, 0xE1D1, 0xE5AA, 0xBC7A, /* 0x60 */ 0xB46E, 0, 0xE1D3, 0xBCA3, 0xE1CB, 0, 0xBC7B, 0, /* 0x60 */ 0xBCA2, 0xE1C6, 0xE1CA, 0xE1C7, 0xE1CD, 0xBA48, 0xBC79, 0xBA42, /* 0x70 */ 0, 0xE57A, 0xE1CF, 0, 0xBCA1, 0, 0xBCA4, 0, /* 0x70 */ 0xE1CC, 0, 0xBC7E, 0xE579, 0, 0, 0, 0, /* 0x80 */ 0, 0xE57E, 0xBECE, 0xE578, 0xE9A3, 0xE5A9, 0xBCA8, 0, /* 0x80 */ 0xBCA6, 0xBECC, 0xE5A6, 0xE5A2, 0xBCAC, 0, 0xE978, 0, /* 0x90 */ 0, 0, 0xBCAA, 0xE5A1, 0, 0xE976, 0, 0xE5A5, /* 0x90 */ 0, 0xE5A8, 0xE57D, 0, 0xBCAB, 0, 0, 0xBCA5, /* 0xA0 */ 0xE977, 0xBECD, 0xE5A7, 0xBCA7, 0xBCA9, 0xE5A4, 0xBCAD, 0xE5A3, /* 0xA0 */ 0xE57C, 0xE57B, 0xBECB, 0xE5AB, 0xE97A, 0xECE0, 0xBED0, 0, /* 0xB0 */ 0xE9A2, 0, 0xE97E, 0, 0xECE1, 0, 0xBED1, 0xE9A1, /* 0xB0 */ 0, 0xE97C, 0xC0B4, 0xECDF, 0, 0xE979, 0xE97B, 0xC0B5, /* 0xC0 */ 0xBED3, 0xC0B3, 0xBED2, 0xC0B7, 0xE97D, 0xBECF, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0xEFCF, 0, /* 0xD0 */ 0xEFC7, 0, 0, 0, 0, 0, 0xECE7, 0xEFC8, /* 0xD0 */ 0xECE3, 0, 0, 0xC256, 0xECE5, 0xECE4, 0xC0B6, 0xECE2, /* 0xE0 */ 0xECE6, 0xEFD0, 0xEFCC, 0xEFCE, 0, 0xEFC9, 0xEFCA, 0, /* 0xE0 */ 0xEFCD, 0xEFCB, 0xC367, 0, 0, 0xC36A, 0xC369, 0xC368, /* 0xF0 */ 0xC461, 0xF44A, 0xC462, 0xF241, 0xC4DF, 0xF5CC, 0xC4E0, 0xC574 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_62[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC5CA, 0xF7D9, 0, 0xF7DA, 0xF7DB, 0, 0, 0xF9BA, /* 0x00 */ 0xA4E0, 0xC97C, 0xA5B3, 0, 0xA6A6, 0xA6A7, 0xA6A5, 0, /* 0x00 */ 0xA6A8, 0xA7DA, 0xA7D9, 0, 0xCCB1, 0xA9CF, 0xA9CE, 0, /* 0x10 */ 0, 0xD1AF, 0xB1AD, 0xB1AE, 0, 0, 0, 0xB475, /* 0x10 */ 0xDD72, 0xB760, 0xB761, 0xDD74, 0xDD76, 0xDD75, 0, 0xE1D7, /* 0x20 */ 0, 0xE1D6, 0xBA49, 0xE1D8, 0, 0xE5AC, 0xBCAE, 0, /* 0x20 */ 0xBED4, 0, 0xC0B8, 0xC257, 0xC0B9, 0, 0xA4E1, 0, /* 0x30 */ 0, 0, 0xCAE6, 0, 0, 0xCCB2, 0xA9D1, 0xA9D0, /* 0x30 */ 0xA9D2, 0xABF3, 0xCED2, 0xCED3, 0, 0, 0xD1B0, 0xAEB0, /* 0x40 */ 0xB1AF, 0xB476, 0xD951, 0xA4E2, 0, 0xA47E, 0xA4E3, 0, /* 0x40 */ 0xC97D, 0xA5B7, 0xA5B6, 0xA5B4, 0xA5B5, 0, 0, 0, /* 0x50 */ 0xA6AB, 0xC9E9, 0xC9EB, 0xA6AA, 0xC9E3, 0, 0xC9E4, 0, /* 0x50 */ 0xC9EA, 0xC9E6, 0xC9E8, 0xA6A9, 0xC9E5, 0xC9EC, 0xC9E7, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0xA7E1, 0xA7EA, 0xA7E8, /* 0x60 */ 0xCAF0, 0xCAED, 0xCAF5, 0xA7E6, 0xCAF6, 0, 0xA7DF, 0xCAF3, /* 0x70 */ 0, 0xA7E5, 0xCAEF, 0xCAEE, 0xA7E3, 0xCAF4, 0xA7E4, 0xA9D3, /* 0x70 */ 0xA7DE, 0xCAF1, 0, 0xCAE7, 0xA7DB, 0, 0xA7EE, 0xCAEC, /* 0x80 */ 0xCAF2, 0xA7E0, 0xA7E2, 0, 0xCAE8, 0, 0xCAE9, 0xCAEA, /* 0x80 */ 0, 0xA7ED, 0xA7E7, 0xA7EC, 0xCAEB, 0xA7EB, 0xA7DD, 0xA7DC, /* 0x90 */ 0xA7E9, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0xA9E1, 0xCCBE, 0xCCB7, 0xA9DC, 0xA9EF, 0xCCB3, 0xCCBA, 0xCCBC, /* 0xA0 */ 0xCCBF, 0xA9EA, 0, 0xCCBB, 0xCCB4, 0xA9E8, 0xCCB8, 0, /* 0xB0 */ 0xCCC0, 0xA9D9, 0, 0xCCBD, 0xA9E3, 0xA9E2, 0xCCB6, 0xA9D7, /* 0xB0 */ 0, 0, 0xA9D8, 0, 0xA9D6, 0, 0xA9EE, 0xA9E6, /* 0xC0 */ 0xA9E0, 0xA9D4, 0xCCB9, 0xA9DF, 0xA9D5, 0xA9E7, 0xA9F0, 0xCED4, /* 0xC0 */ 0xA9E4, 0xCCB5, 0xA9DA, 0xA9DD, 0xA9DE, 0, 0xA9EC, 0xA9ED, /* 0xD0 */ 0xA9EB, 0xA9E5, 0xA9E9, 0xA9DB, 0xABF4, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0xCEDA, 0xAC41, 0xABF8, 0xABFA, 0xAC40, /* 0xE0 */ 0xCEE6, 0xABFD, 0xD1B1, 0xAEB1, 0xAC43, 0xCED7, 0xCEDF, 0xABFE, /* 0xF0 */ 0xCEDE, 0xCEDB, 0xCEE3, 0xCEE5, 0xABF7, 0xABFB, 0xAC42, 0xAEB3 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_63[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xCEE0, 0xABF9, 0xAC45, 0xCED9, 0, 0, 0, 0xABFC, /* 0x00 */ 0xAEB2, 0xABF6, 0, 0xCED6, 0xCEDD, 0xCED5, 0xCED8, 0xCEDC, /* 0x00 */ 0xD1B2, 0xAC44, 0, 0xCEE1, 0xCEE2, 0xCEE4, 0xABF5, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0xAEC1, 0xD1BE, 0xAEBF, 0xAEC0, 0xD1B4, 0xD1C4, 0, 0xAEB6, /* 0x20 */ 0, 0, 0xD566, 0xD1C6, 0xD1C0, 0, 0xD1B7, 0, /* 0x30 */ 0xD1C9, 0xD1BA, 0xAEBC, 0xD57D, 0xD1BD, 0xAEBE, 0xAEB5, 0, /* 0x30 */ 0xD1CB, 0xD1BF, 0xAEB8, 0xD1B8, 0xD1B5, 0xD1B6, 0xAEB9, 0xD1C5, /* 0x40 */ 0xD1CC, 0xAEBB, 0xD1BC, 0xD1BB, 0xAEC3, 0xAEC2, 0xAEB4, 0xAEBA, /* 0x40 */ 0xAEBD, 0xD1C8, 0, 0, 0xD1C2, 0xAEB7, 0xD1B3, 0xD1CA, /* 0x50 */ 0xD1C1, 0xD1C3, 0xD1C7, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0xD567, 0, 0xB1B7, /* 0x60 */ 0xB1CB, 0xB1CA, 0, 0xB1BF, 0, 0xD579, 0xD575, 0xD572, /* 0x60 */ 0xD5A6, 0xB1BA, 0xB1B2, 0, 0, 0xD577, 0xB4A8, 0xB1B6, /* 0x70 */ 0xD5A1, 0, 0xB1CC, 0xB1C9, 0xD57B, 0xD56A, 0, 0, /* 0x70 */ 0xB1C8, 0xD5A3, 0xD569, 0xB1BD, 0xB1C1, 0xD5A2, 0, 0xD573, /* 0x80 */ 0xB1C2, 0xB1BC, 0xD568, 0, 0xB478, 0xD5A5, 0xD571, 0xB1C7, /* 0x80 */ 0xD574, 0xD5A4, 0xB1C6, 0, 0xD952, 0, 0xB1B3, 0xD56F, /* 0x90 */ 0xB1B8, 0xB1C3, 0, 0xB1BE, 0xD578, 0xD56E, 0xD56C, 0xD57E, /* 0x90 */ 0xB1B0, 0xB1C4, 0xB1B4, 0xB477, 0xD57C, 0xB1B5, 0, 0xB1B1, /* 0xA0 */ 0xB1C0, 0xB1BB, 0xB1B9, 0xD570, 0xB1C5, 0xD56D, 0xD57A, 0xD576, /* 0xA0 */ 0xD954, 0xD953, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0xD56B, 0xD964, 0, /* 0xB0 */ 0xB47A, 0, 0xD96A, 0xD959, 0xD967, 0xDD77, 0xB47D, 0xD96B, /* 0xC0 */ 0xD96E, 0xB47C, 0xD95C, 0xD96D, 0xD96C, 0xB47E, 0xD955, 0xB479, /* 0xC0 */ 0xB4A3, 0, 0xB4A1, 0xD969, 0, 0xD95F, 0xB4A5, 0xD970, /* 0xD0 */ 0xD968, 0xD971, 0xB4AD, 0xB4AB, 0xD966, 0xD965, 0, 0xD963, /* 0xD0 */ 0xD95D, 0xB4A4, 0, 0xB4A2, 0xD1B9, 0xD956, 0, 0xDDB7, /* 0xE0 */ 0xD957, 0xB47B, 0xB4AA, 0xDD79, 0, 0xB4A6, 0xB4A7, 0xD958, /* 0xE0 */ 0xD96F, 0xDD78, 0xD960, 0xD95B, 0xB4A9, 0xD961, 0xD95E, 0, /* 0xF0 */ 0, 0xB4AE /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_64[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xB770, 0, /* 0x00 */ 0, 0xDD7C, 0xDDB1, 0xDDB6, 0xDDAA, 0xB76C, 0xDDBB, 0xB769, /* 0x00 */ 0xDD7A, 0, 0xDD7B, 0xB762, 0xB76B, 0xDDA4, 0xB76E, 0xB76F, /* 0x10 */ 0xDDA5, 0, 0xDDB2, 0xDDB8, 0xB76A, 0, 0xB764, 0xDDA3, /* 0x10 */ 0xDD7D, 0xDDBA, 0xDDA8, 0xDDA9, 0xDD7E, 0xDDB4, 0xDDAB, 0xDDB5, /* 0x20 */ 0xDDAD, 0, 0xB765, 0xE1D9, 0xB768, 0xB766, 0xDDB9, 0xDDB0, /* 0x20 */ 0xDDAC, 0, 0, 0xDDA1, 0xBA53, 0xDDAF, 0xB76D, 0xDDA7, /* 0x30 */ 0, 0xDDA6, 0, 0, 0, 0xB767, 0xB763, 0xE1EE, /* 0x30 */ 0xDDB3, 0xDDAE, 0, 0xDDA2, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0xE1E9, 0, 0xE1DA, 0xE1E5, 0, /* 0x40 */ 0xE1EC, 0xBA51, 0xB4AC, 0xE1EA, 0xBA4C, 0, 0, 0, /* 0x50 */ 0xBA4B, 0xE1F1, 0, 0xE1DB, 0xE1E8, 0xE1DC, 0xE1E7, 0xBA4F, /* 0x50 */ 0xE1EB, 0xD962, 0, 0, 0, 0xE1F2, 0xE1E3, 0xBA52, /* 0x60 */ 0xE5BA, 0xBCAF, 0, 0xE1F0, 0xE1EF, 0xBA54, 0xE5AD, 0xBCB0, /* 0x60 */ 0xE5AE, 0, 0xE1DF, 0xE1E0, 0xE1DD, 0xE1E2, 0xE1DE, 0xE1F3, /* 0x70 */ 0xBA4E, 0xBCB1, 0xBA50, 0xBA55, 0, 0xE1E1, 0, 0xE1ED, /* 0x70 */ 0, 0, 0xE1E6, 0, 0, 0xE5B1, 0, 0xBA4A, /* 0x80 */ 0xBCB4, 0xE9AA, 0xE5B6, 0xE5B5, 0xE5B7, 0, 0, 0xE5B4, /* 0x80 */ 0xBCB5, 0, 0xBCBB, 0xBCB8, 0, 0xBCB9, 0xE5AF, 0xE5B2, /* 0x90 */ 0xE5BC, 0xBCC1, 0xBCBF, 0, 0xE5B3, 0xD95A, 0xBCB2, 0xE5B9, /* 0x90 */ 0xE5B0, 0, 0xBCC2, 0xE5B8, 0xBA4D, 0xBCB7, 0xE1E4, 0, /* 0xA0 */ 0, 0xBCBA, 0, 0xBCBE, 0xBCC0, 0xBCBD, 0xBCBC, 0, /* 0xA0 */ 0xBCB6, 0xE5BB, 0xBCB3, 0xBCC3, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0xBED8, 0xBED9, 0xE9A9, 0xBEE2, 0xBEDF, /* 0xB0 */ 0, 0xBED6, 0xBEDD, 0xE9AB, 0xBEDB, 0xBED5, 0, 0xBEDC, /* 0xC0 */ 0, 0xE9A8, 0xC0BB, 0xBED7, 0, 0xBEDE, 0xC0BA, 0xE9A7, /* 0xC0 */ 0xE9A6, 0, 0xBEE0, 0, 0xBEE1, 0, 0xE9A5, 0xE9A4, /* 0xD0 */ 0xC0BC, 0xE9AE, 0xBEDA, 0xE9AC, 0, 0, 0, 0, /* 0xD0 */ 0xC0BD, 0, 0xC0C2, 0xECEA, 0xECEC, 0, 0xC0BF, 0, /* 0xE0 */ 0xECED, 0xECE9, 0, 0xECEB, 0xC0C0, 0xC0C3, 0, 0xECE8, /* 0xE0 */ 0xC0BE, 0xC0C1, 0xC259, 0xE9AD, 0xC258, 0, 0, 0xC25E, /* 0xF0 */ 0xEFD4, 0, 0xC25C, 0xC25D, 0xEFD7, 0xEFD3, 0xC25A, 0xEFD1 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_65[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC36B, 0xEFD5, 0, 0xEFD6, 0xEFD2, 0, 0xC25B, 0xF242, /* 0x00 */ 0, 0xF245, 0, 0, 0xF246, 0xF244, 0xF247, 0xC36C, /* 0x00 */ 0xF243, 0, 0, 0xF44E, 0xC464, 0xF44D, 0xF44C, 0xF44B, /* 0x10 */ 0xC463, 0xC465, 0, 0xF5CD, 0xC4E2, 0xC4E1, 0, 0, /* 0x10 */ 0xF6E1, 0xF6E0, 0xF6E3, 0xC5CB, 0xC575, 0xF7DD, 0xF6E2, 0, /* 0x20 */ 0, 0xF7DC, 0xC5CD, 0xC5CC, 0xC5F3, 0xF8A9, 0xF8EF, 0xA4E4, /* 0x20 */ 0, 0, 0xD972, 0xE9AF, 0, 0, 0xA6AC, 0xCAF7, /* 0x30 */ 0xA7F1, 0xA7EF, 0, 0xA7F0, 0, 0xCCC1, 0xA9F1, 0xAC46, /* 0x30 */ 0, 0xCEE7, 0, 0xCEE8, 0, 0xAC47, 0xD1CE, 0, /* 0x40 */ 0xAEC4, 0xAEC5, 0xD1CD, 0, 0, 0, 0, 0xB1D3, /* 0x40 */ 0, 0xB1CF, 0, 0xD5A7, 0xB1D6, 0xB1D5, 0xB1CE, 0xB1D1, /* 0x50 */ 0xB1D4, 0xB1D0, 0, 0, 0xD976, 0xB1CD, 0xB4AF, 0, /* 0x50 */ 0, 0, 0xB4B1, 0xB4B2, 0xD975, 0xD978, 0xB4B0, 0xD973, /* 0x60 */ 0xD977, 0, 0xD974, 0, 0xB771, 0, 0, 0xDDBC, /* 0x60 */ 0, 0, 0xBA56, 0xE1F4, 0xBEE3, 0xBCC4, 0xE5BD, 0xBCC5, /* 0x70 */ 0xBCC6, 0xE5BF, 0xE5BE, 0xE5C0, 0xE9B1, 0, 0, 0xE9B0, /* 0x70 */ 0xECEF, 0xECEE, 0xC0C4, 0xC0C5, 0xF248, 0, 0, 0xA4E5, /* 0x80 */ 0, 0, 0, 0, 0xD979, 0, 0, 0, /* 0x80 */ 0xB4B4, 0xB4B3, 0xDDBD, 0, 0xEFD8, 0xC4E3, 0xF7DE, 0xA4E6, /* 0x90 */ 0, 0xAEC6, 0, 0xB1D8, 0xB1D7, 0xD97A, 0xD97B, 0xB772, /* 0x90 */ 0xE1F5, 0xBA57, 0xE9B2, 0, 0xA4E7, 0xA5B8, 0, 0xA9F2, /* 0xA0 */ 0xCCC2, 0, 0xCEE9, 0xAC48, 0xB1D9, 0, 0xD97C, 0xB4B5, /* 0xA0 */ 0xB773, 0, 0xE5C1, 0xE5C2, 0, 0, 0xECF0, 0xC25F, /* 0xB0 */ 0xF8F0, 0xA4E8, 0, 0xCCC3, 0xA9F3, 0xAC49, 0, 0xCEEA, /* 0xB0 */ 0, 0xAEC7, 0xD1D2, 0xD1D0, 0xD1D1, 0xAEC8, 0xD1CF, 0, /* 0xC0 */ 0, 0, 0, 0xB1DB, 0xB1DC, 0xD5A8, 0xB1DD, 0xB1DA, /* 0xC0 */ 0xD97D, 0, 0xD97E, 0xDDBE, 0, 0, 0xBA59, 0xBA58, /* 0xD0 */ 0, 0, 0xECF1, 0xEFD9, 0, 0xF24A, 0xF249, 0xF44F, /* 0xD0 */ 0, 0xC95E, 0xAC4A, 0, 0, 0xA4E9, 0xA5B9, 0, /* 0xE0 */ 0xA6AE, 0xA6AD, 0, 0, 0xA6AF, 0xA6B0, 0xC9EE, 0xC9ED, /* 0xE0 */ 0xCAF8, 0xA7F2, 0xCAFB, 0xCAFA, 0xCAF9, 0xCAFC, 0, 0, /* 0xF0 */ 0, 0, 0xA9F4, 0xCCC9, 0xCCC5, 0xCCCE /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_66[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA9FB, 0, 0xA9F9, 0xCCCA, 0xCCC6, 0xCCCD, 0xA9F8, 0xAA40, /* 0x00 */ 0xCCC8, 0xCCC4, 0xA9FE, 0xCCCB, 0xA9F7, 0xCCCC, 0xA9FA, 0xA9FC, /* 0x00 */ 0xCCD0, 0xCCCF, 0xCCC7, 0xA9F6, 0xA9F5, 0xA9FD, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0xCEEF, 0xCEF5, 0, 0xAC50, /* 0x10 */ 0xAC4D, 0xCEEC, 0xCEF1, 0, 0xAC53, 0xAC4B, 0xCEF0, 0xAC4E, /* 0x20 */ 0xAC51, 0, 0, 0xCEF3, 0, 0xAC4C, 0xCEF8, 0xAC4F, /* 0x20 */ 0, 0xAC52, 0xCEED, 0xCEF2, 0xCEF6, 0xCEEE, 0xCEEB, 0, /* 0x30 */ 0, 0xCEF7, 0xCEF4, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0xAED0, 0xAEC9, 0xAECC, 0, 0xAECF, 0, 0xD1D5, /* 0x40 */ 0, 0xAECA, 0xD1D3, 0, 0xAECE, 0, 0, 0xAECB, /* 0x40 */ 0, 0xD1D6, 0xAECD, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0xD5AC, 0xB1DF, 0xD5AB, 0xD5AD, 0xB1DE, 0xB1E3, 0xD1D4, /* 0x50 */ 0, 0xD5AA, 0xD5AE, 0, 0xB1E0, 0xD5A9, 0xB1E2, 0, /* 0x60 */ 0xB1E1, 0, 0xD9A7, 0, 0xD9A2, 0, 0xB4B6, 0xB4BA, /* 0x60 */ 0xB4B7, 0xD9A5, 0xD9A8, 0, 0xB4B8, 0, 0xB4B9, 0xB4BE, /* 0x70 */ 0xDDC7, 0xD9A6, 0xB4BC, 0xD9A3, 0xD9A1, 0, 0xB4BD, 0, /* 0x70 */ 0xD9A4, 0, 0, 0, 0xB779, 0, 0xDDBF, 0xB776, /* 0x80 */ 0xB777, 0xB775, 0xDDC4, 0xDDC3, 0xDDC0, 0xB77B, 0, 0, /* 0x80 */ 0xDDC2, 0xB4BB, 0, 0, 0xDDC6, 0xDDC1, 0xB778, 0xB774, /* 0x90 */ 0xB77A, 0xDDC5, 0, 0, 0, 0xBA5C, 0, 0xE1F8, /* 0x90 */ 0xE1F7, 0xE1F6, 0xBA5A, 0, 0, 0, 0, 0, /* 0xA0 */ 0xBA5B, 0xE5C5, 0xE5C8, 0xBCC8, 0, 0, 0xBCC7, 0xE5C9, /* 0xA0 */ 0xE5C4, 0xBCCA, 0xE5C6, 0, 0xBCC9, 0xE5C3, 0, 0xE5C7, /* 0xB0 */ 0xBEE9, 0xBEE6, 0xE9BB, 0xE9BA, 0, 0xE9B9, 0xE9B4, 0, /* 0xB0 */ 0xE9B5, 0, 0, 0, 0xBEE7, 0, 0xBEE4, 0xBEE8, /* 0xC0 */ 0xE9B3, 0xBEE5, 0xE9B6, 0xE9B7, 0xE9BC, 0, 0, 0xE9B8, /* 0xC0 */ 0, 0, 0xECF2, 0, 0, 0, 0xC0C7, 0, /* 0xD0 */ 0xEFDC, 0xC0C6, 0xEFDA, 0xEFDB, 0xC260, 0xC36E, 0xF24B, 0, /* 0xD0 */ 0xC36D, 0, 0, 0xF451, 0xF452, 0, 0xC466, 0, /* 0xE0 */ 0xF450, 0xC4E4, 0, 0xF7DF, 0xC5CE, 0xF8AA, 0xF8AB, 0, /* 0xE0 */ 0xA4EA, 0, 0xA6B1, 0xA6B2, 0xA7F3, 0, 0xCCD1, 0xAC54, /* 0xF0 */ 0xAED1, 0xB1E4, 0, 0, 0xB0D2, 0, 0xB4BF, 0xB4C0 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_67[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xB3CC, 0xD9A9, 0, 0xB77C, 0xE1FA, 0xE1F9, 0, 0, /* 0x00 */ 0xA4EB, 0xA6B3, 0xCCD2, 0xAA42, 0, 0xAA41, 0, 0xCEF9, /* 0x00 */ 0xCEFA, 0, 0xD1D7, 0xD1D8, 0xAED2, 0xAED3, 0, 0xAED4, /* 0x10 */ 0xD5AF, 0, 0, 0xB1E6, 0, 0xB4C2, 0, 0xB4C1, /* 0x10 */ 0xDDC8, 0xDF7A, 0xE1FB, 0xE9BD, 0, 0, 0xC261, 0xC467, /* 0x20 */ 0xA4EC, 0, 0xA5BC, 0xA5BD, 0xA5BB, 0xA5BE, 0xA5BA, 0, /* 0x20 */ 0, 0xA6B6, 0, 0xC9F6, 0xA6B5, 0xA6B7, 0, 0, /* 0x30 */ 0xC9F1, 0xC9F0, 0xC9F3, 0xC9F2, 0xC9F5, 0xA6B4, 0xC9EF, 0xC9F4, /* 0x30 */ 0, 0, 0, 0, 0, 0xCAFD, 0xA7FD, 0xCAFE, /* 0x40 */ 0xCB43, 0xA7FC, 0, 0xCB47, 0xCB42, 0xCB45, 0xA7F5, 0xA7F6, /* 0x40 */ 0xA7F7, 0xA7F8, 0, 0xA840, 0, 0xCB41, 0xA7FA, 0xA841, /* 0x50 */ 0, 0xCB40, 0xCB46, 0, 0xA7F9, 0xCB44, 0xA7FB, 0xA7F4, /* 0x50 */ 0xA7FE, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0xAA57, 0, 0xCCD4, 0xAA43, 0, 0xAA4D, /* 0x60 */ 0xAA4E, 0xAA46, 0xAA58, 0xAA48, 0xCCDC, 0xAA53, 0xCCD7, 0xAA49, /* 0x70 */ 0xCCE6, 0xCCE7, 0xCCDF, 0xCCD8, 0xAA56, 0xCCE4, 0xAA51, 0xAA4F, /* 0x70 */ 0, 0xCCE5, 0, 0xCCE3, 0xCCDB, 0xCCD3, 0xCCDA, 0xAA4A, /* 0x80 */ 0, 0xAA50, 0, 0xAA44, 0xCCDE, 0xCCDD, 0xCCD5, 0, /* 0x80 */ 0xAA52, 0xCCE1, 0xCCD6, 0xAA55, 0xCCE8, 0xAA45, 0, 0xAA4C, /* 0x90 */ 0xCCD9, 0xCCE2, 0xAA54, 0, 0xAA47, 0xAA4B, 0, 0xCCE0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0xCF5B, 0xAC5C, /* 0xA0 */ 0xAC69, 0, 0xCF56, 0xCF4C, 0xAC62, 0xCF4A, 0xAC5B, 0xCF45, /* 0xB0 */ 0xAC65, 0xCF52, 0xCEFE, 0xCF41, 0, 0, 0, 0, /* 0xB0 */ 0xCF44, 0xCEFB, 0xCF51, 0xCF61, 0xAC60, 0xCF46, 0xCF58, 0, /* 0xC0 */ 0xCEFD, 0xCF5F, 0xCF60, 0xCF63, 0xCF5A, 0xCF4B, 0xCF53, 0xAC66, /* 0xC0 */ 0xAC59, 0xAC61, 0xAC6D, 0xAC56, 0xAC58, 0, 0, 0, /* 0xD0 */ 0xCF43, 0xAC6A, 0xAC63, 0xCF5D, 0xCF40, 0xAC6C, 0xAC67, 0xCF49, /* 0xD0 */ 0, 0, 0xAC6B, 0xCF50, 0xCF48, 0xAC64, 0xCF5C, 0xCF54, /* 0xE0 */ 0, 0xAC5E, 0xCF62, 0xCF47, 0xAC5A, 0xCF59, 0xCF4F, 0xAC5F, /* 0xE0 */ 0xCF55, 0xAC57, 0xCEFC, 0xAC68, 0xAEE3, 0xAC5D, 0xCF4E, 0xCF4D, /* 0xF0 */ 0xCF42, 0, 0xCF5E, 0, 0xCF57, 0, 0, 0xAC55 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_68[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD1EC, 0xAEEA, 0xD1ED, 0, 0xD1E1, 0xAEDF, /* 0x10 */ 0xAEEB, 0, 0xD1DA, 0, 0xD1E3, 0xD1EB, 0, 0xD1D9, /* 0x10 */ 0xD1F4, 0xAED5, 0, 0, 0, 0xD1F3, 0xD1EE, 0, /* 0x20 */ 0xD1EF, 0xAEDD, 0xAEE8, 0xD1E5, 0, 0xD1E6, 0xD1F0, 0xD1E7, /* 0x20 */ 0, 0xD1E2, 0xD1DC, 0xD1DD, 0xD1EA, 0xD1E4, 0, 0, /* 0x30 */ 0xAED6, 0xAEDA, 0xD1F2, 0xD1DE, 0xAEE6, 0xAEE2, 0, 0, /* 0x30 */ 0xAEE5, 0xAEEC, 0xAEDB, 0xAEE7, 0xD1E9, 0xAEE9, 0xAED8, 0, /* 0x40 */ 0xAED7, 0xD1DB, 0, 0xD1DF, 0xAEE0, 0xD1F1, 0xD1E8, 0xD1E0, /* 0x40 */ 0xAEE4, 0xAEE1, 0, 0xAED9, 0xAEDC, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0xD5C4, 0, 0xD5B4, 0xD5B5, 0xD5B9, /* 0x60 */ 0, 0xD5C8, 0xD5C5, 0, 0xD5BE, 0xD5BD, 0xB1ED, 0xD5C1, /* 0x70 */ 0xD5D0, 0xD5B0, 0, 0xD5D1, 0xD5C3, 0xD5D5, 0xD5C9, 0xB1EC, /* 0x70 */ 0xD5C7, 0xB1E7, 0xB1FC, 0xB1F2, 0, 0xB1F6, 0xB1F5, 0xD5B1, /* 0x80 */ 0, 0xD5CE, 0xD5D4, 0xD5CC, 0xD5D3, 0, 0, 0xD5C0, /* 0x80 */ 0xD5B2, 0xD5D2, 0xD5C2, 0xB1EA, 0xB1F7, 0, 0xD5CB, 0xB1F0, /* 0x90 */ 0, 0, 0, 0xD5CA, 0xD5B3, 0xB1F8, 0, 0xB1FA, /* 0x90 */ 0xD5CD, 0xB1FB, 0xB1E9, 0xD5BA, 0xD5CF, 0, 0, 0xB1EF, /* 0xA0 */ 0xB1F9, 0xD5BC, 0xD5C6, 0xD5B7, 0xD5BB, 0xB1F4, 0xD5B6, 0xB1E8, /* 0xA0 */ 0xB1F1, 0xB1EE, 0xD5BF, 0xAEDE, 0xD9C0, 0xB1EB, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0xB1F3, 0, 0xD9C3, 0xD9D9, /* 0xC0 */ 0xD9CE, 0xB4D6, 0, 0xB4D1, 0xD9BD, 0xB4D2, 0xD9CD, 0, /* 0xC0 */ 0xD9C6, 0xD9D3, 0xB4CE, 0xD9AB, 0xD9D5, 0xB4C4, 0xD9B3, 0xB4C7, /* 0xD0 */ 0xB4C6, 0, 0xB4D7, 0, 0xD9AD, 0xD9CF, 0xD9D0, 0xB4C9, /* 0xD0 */ 0xB4C5, 0xD9BB, 0, 0xB4D0, 0xD9B6, 0, 0xD9D1, 0xB4CC, /* 0xE0 */ 0xD9C9, 0xD9D6, 0xD9B0, 0xD9B5, 0xD9AF, 0, 0xB4CB, 0xD9C2, /* 0xE0 */ 0xDDDE, 0xD9B1, 0xB4CF, 0xD9BA, 0xD9D2, 0xB4CA, 0xD9B7, 0xD9B4, /* 0xF0 */ 0xD9C5, 0xB4CD, 0xB4C3, 0xB4D9, 0xD9C8, 0xD9C7 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_69[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD9AC, 0xB4C8, 0xD9D4, 0xD9BC, /* 0x00 */ 0xD9BE, 0, 0xD9CB, 0xD9CA, 0xD9AA, 0xB4D3, 0xB4D5, 0xD9B2, /* 0x00 */ 0xD9B9, 0xD9C1, 0xB4D4, 0xD9B8, 0xD9C4, 0xD9D7, 0, 0xD9CC, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0xD9D8, 0, 0, /* 0x20 */ 0, 0, 0xD9AE, 0, 0, 0, 0, 0xDDF2, /* 0x20 */ 0xB7A6, 0, 0xDDF0, 0xDDDB, 0xDDE0, 0xDDD9, 0, 0xDDEC, /* 0x30 */ 0xDDCB, 0xDDD2, 0, 0xDDEA, 0xDDF4, 0xDDDC, 0, 0xDDCF, /* 0x30 */ 0xDDE2, 0xDDE7, 0xDDD3, 0, 0xDDE4, 0xDDD0, 0, 0, /* 0x40 */ 0xDDD7, 0xDDD8, 0xB7A8, 0xDDEB, 0xDDE9, 0, 0xDDCC, 0xDDEE, /* 0x40 */ 0, 0xDDEF, 0xDDF1, 0xB7AC, 0xB7A4, 0, 0xD5B8, 0xDDD4, /* 0x50 */ 0xDDE6, 0xDDD5, 0xB7A1, 0xB7B1, 0xDDED, 0xB7AF, 0xB7AB, 0xDDCA, /* 0x50 */ 0xB7A3, 0, 0xDDCD, 0xB7B0, 0, 0xDDDD, 0xDDC9, 0, /* 0x60 */ 0xB7A9, 0xDDE1, 0xDDD1, 0xB7AA, 0xDDDA, 0xB77E, 0xB4D8, 0xDDE3, /* 0x60 */ 0xD9BF, 0xDDCE, 0, 0, 0xDDE8, 0xB7A5, 0xDDE5, 0xB7A2, /* 0x70 */ 0xDDDF, 0xB7AD, 0xDDD6, 0xDDF3, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0xB7A7, 0xDEC6, 0, 0, 0xB7AE, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0xE24A, 0xE248, 0, /* 0x80 */ 0xE25E, 0xE246, 0, 0xE258, 0xB77D, 0xBA5F, 0xE242, 0xE25D, /* 0x90 */ 0, 0xE247, 0xE255, 0xBA64, 0xBA5D, 0, 0xE25B, 0, /* 0x90 */ 0xE240, 0xE25A, 0, 0xBA6F, 0xE251, 0xE261, 0xBA6D, 0xE249, /* 0xA0 */ 0xBA5E, 0xE24B, 0xE259, 0xBA67, 0xE244, 0xBA6B, 0xBA61, 0xE24D, /* 0xA0 */ 0xE243, 0xE1FC, 0, 0xE257, 0xBA68, 0xE260, 0xE1FD, 0xBA65, /* 0xB0 */ 0, 0xE253, 0, 0xBA66, 0xE245, 0xE250, 0xE24C, 0xE24E, /* 0xB0 */ 0, 0xBA60, 0xE25F, 0xBA6E, 0xE24F, 0, 0xE262, 0, /* 0xC0 */ 0, 0xE1FE, 0xE254, 0xBA63, 0xBA6C, 0xBA6A, 0xE241, 0xE256, /* 0xC0 */ 0xBA69, 0, 0, 0xBA62, 0xE252, 0, 0, 0, /* 0xD0 */ 0, 0xE25C, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0xE5D5, 0, 0xE5D1, 0xE5CD, 0xE5E1, 0xE5DE, /* 0xE0 */ 0xBCCD, 0, 0, 0xE5E5, 0xE5D4, 0xBCD8, 0xE5DB, 0, /* 0xE0 */ 0, 0xE5D0, 0xE5DA, 0xBCD5, 0xE5EE, 0, 0xE5EB, 0xE5DD, /* 0xF0 */ 0xE5CE, 0, 0, 0xE5E2, 0xE5E4, 0xBCD1, 0xE5D8, 0xE5D3 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_6A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE5CA, 0xBCCE, 0xBCD6, 0, 0xE5E7, 0xBCD7, 0xE5CB, 0xE5ED, /* 0x00 */ 0xE5E0, 0xE5E6, 0xBCD4, 0, 0, 0xE5E3, 0, 0xE5EA, /* 0x00 */ 0, 0xBCD9, 0, 0xBCD3, 0xE5DC, 0xE5CF, 0xE5EF, 0xE5CC, /* 0x10 */ 0xE5E8, 0xBCD0, 0, 0xE5D6, 0, 0xE5D7, 0xBCCF, 0xBCCC, /* 0x10 */ 0xE5D2, 0xBCD2, 0, 0xBCCB, 0, 0xE5E9, 0xE5EC, 0xE5D9, /* 0x20 */ 0xE9CA, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0xE9C2, 0, 0xE9BE, 0xBEF6, 0, 0, /* 0x30 */ 0xBEEB, 0xBEF0, 0xBEEC, 0xE9CC, 0xE9D7, 0xBEEA, 0xE9C4, 0xE9CD, /* 0x30 */ 0xE5DF, 0xE9CE, 0, 0, 0xBEF1, 0, 0xE9DD, 0xBEF5, /* 0x40 */ 0xBEF8, 0xE9C0, 0, 0xBEF4, 0, 0xE9DB, 0xE9DC, 0xE9D2, /* 0x40 */ 0xE9D1, 0xE9C9, 0, 0, 0xE9D3, 0xE9DA, 0xE9D9, 0, /* 0x50 */ 0xBEEF, 0xBEED, 0xE9CB, 0xE9C8, 0, 0xE9C5, 0xE9D8, 0xBEF7, /* 0x50 */ 0xE9D6, 0xBEF3, 0xBEF2, 0, 0xE9D0, 0, 0xE9BF, 0xE9C1, /* 0x60 */ 0xE9C3, 0xE9D5, 0xE9CF, 0xBEEE, 0, 0xE9C6, 0, 0xE9D4, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0xE9C7, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0xC0CF, 0xED45, /* 0x70 */ 0xC0C8, 0xECF5, 0, 0xED41, 0xC0CA, 0xED48, 0, 0xECFC, /* 0x80 */ 0, 0xECF7, 0, 0, 0xED49, 0xECF3, 0xECFE, 0, /* 0x80 */ 0xC0D1, 0xED44, 0xED4A, 0xECFD, 0xC0C9, 0xED40, 0xECF4, 0xC0D0, /* 0x90 */ 0, 0, 0xED47, 0xECF9, 0xC0CC, 0, 0xECFB, 0xECF8, /* 0x90 */ 0xC0D2, 0xECFA, 0xC0CB, 0xC0CE, 0xED43, 0xECF6, 0xED46, 0, /* 0xA0 */ 0xED42, 0, 0, 0, 0xC263, 0xEFE7, 0xC268, 0xC269, /* 0xA0 */ 0, 0, 0, 0xC262, 0xEFE6, 0, 0xEFE3, 0xEFE4, /* 0xB0 */ 0xC266, 0xEFDE, 0xEFE2, 0xC265, 0, 0xEFDF, 0, 0, /* 0xB0 */ 0, 0, 0xC267, 0xC264, 0, 0xEFDD, 0xEFE1, 0xEFE5, /* 0xC0 */ 0, 0, 0, 0xF251, 0xF24E, 0xF257, 0, 0xF256, /* 0xC0 */ 0xF254, 0xF24F, 0, 0xC372, 0, 0, 0, 0, /* 0xD0 */ 0, 0xF250, 0xC371, 0xC0CD, 0xF253, 0xC370, 0xF258, 0xF252, /* 0xD0 */ 0xF24D, 0xEFE0, 0, 0, 0, 0xC36F, 0, 0xF24C, /* 0xE0 */ 0xF456, 0, 0xF455, 0xF255, 0xC468, 0, 0xF459, 0xF45A, /* 0xE0 */ 0xF454, 0xF458, 0, 0xF453, 0, 0, 0, 0, /* 0xF0 */ 0xF5D1, 0xF457, 0xC4E7, 0xC4E5, 0xF5CF /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_6B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xF5D2, 0, 0xF5CE, 0xF5D0, 0xC4E6, 0, 0, 0, /* 0x00 */ 0xF6E5, 0xF6E6, 0xC576, 0xF6E4, 0, 0, 0, 0xF7E2, /* 0x00 */ 0xC5CF, 0xF7E0, 0xF7E1, 0xF8AC, 0, 0, 0xC656, 0xF8F3, /* 0x10 */ 0xF8F1, 0xF8F2, 0xF8F4, 0, 0, 0, 0xF9BB, 0, /* 0x10 */ 0xA4ED, 0xA6B8, 0, 0xAA59, 0, 0xCCE9, 0, 0, /* 0x20 */ 0xCF64, 0, 0, 0, 0xD1F5, 0xD1F7, 0, 0xD1F6, /* 0x20 */ 0, 0xD1F8, 0xB1FD, 0xD5D7, 0xD1F9, 0, 0xD5D6, 0xD5D8, /* 0x30 */ 0xD5D9, 0xD9DA, 0xB4DB, 0xD9DB, 0xD9DD, 0xB4DC, 0xB4DA, 0xD9DC, /* 0x30 */ 0, 0xDDFA, 0xDDF8, 0xDDF7, 0, 0xDDF6, 0xDDF5, 0xB7B2, /* 0x40 */ 0xDDF9, 0xBA70, 0xE263, 0xE265, 0xBA71, 0xE264, 0xBCDB, 0, /* 0x40 */ 0xBCDA, 0xE5F0, 0, 0, 0xE9DF, 0xE9DE, 0xE9E0, 0, /* 0x50 */ 0, 0xBEF9, 0, 0xED4B, 0xC0D3, 0, 0xEFE8, 0xC26A, /* 0x50 */ 0xF259, 0xC577, 0xA4EE, 0xA5BF, 0xA6B9, 0xA842, 0xAA5A, 0xAA5B, /* 0x60 */ 0, 0, 0xAC6E, 0, 0, 0xD1FA, 0, 0, /* 0x60 */ 0, 0, 0xB7B3, 0, 0, 0, 0xE6D1, 0xBEFA, /* 0x70 */ 0xC26B, 0xA4EF, 0, 0xA6BA, 0, 0, 0xCCEB, 0xAA5C, /* 0x70 */ 0xCCEA, 0, 0xCF65, 0xAC6F, 0xCF66, 0, 0xAC70, 0, /* 0x80 */ 0xD1FC, 0xAEEE, 0xAEED, 0, 0xD5DE, 0xD5DC, 0xD5DD, 0xD5DB, /* 0x80 */ 0, 0xD5DA, 0, 0, 0xD9DE, 0xD9E1, 0xB4DE, 0xD9DF, /* 0x90 */ 0xB4DD, 0xD9E0, 0, 0xDDFB, 0, 0, 0xE266, 0xE267, /* 0x90 */ 0xE268, 0, 0xE5F3, 0xE5F2, 0xBCDC, 0xE5F1, 0xE5F4, 0xE9E1, /* 0xA0 */ 0, 0, 0xE9E2, 0xE9E3, 0, 0xED4C, 0xC0D4, 0xC26C, /* 0xA0 */ 0xF25A, 0, 0xC4E8, 0xC95F, 0, 0xAC71, 0xCF67, 0xAEEF, /* 0xB0 */ 0, 0, 0xB1FE, 0, 0xB4DF, 0xD9E2, 0, 0xB7B5, /* 0xB0 */ 0xB7B4, 0, 0, 0xE269, 0xE26A, 0xBCDD, 0xBCDE, 0xE9E5, /* 0xC0 */ 0xE9E4, 0xEFE9, 0xF7E3, 0xA4F0, 0xC960, 0xA5C0, 0, 0xA843, /* 0xC0 */ 0xCB48, 0, 0xAC72, 0xB7B6, 0xA4F1, 0, 0xCF68, 0xAC73, /* 0xD0 */ 0xCF69, 0, 0xC0D5, 0xA4F2, 0, 0, 0xCCEC, 0, /* 0xD0 */ 0xCF6A, 0, 0xD242, 0xD241, 0xD1FE, 0, 0xD1FD, 0xD243, /* 0xE0 */ 0xD240, 0, 0, 0xB240, 0xB241, 0, 0, 0xB4E0, /* 0xE0 */ 0xD9E3, 0, 0xD9E4, 0xD9E5, 0, 0, 0, 0xDE41, /* 0xF0 */ 0xDE42, 0xDE40, 0, 0xDDFD, 0xDDFE, 0xB7B7, 0xE26B, 0xE5F7 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_6C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE5F6, 0xE5F5, 0xE5F8, 0xE9E7, 0xE9E6, 0xBEFB, 0xE9E8, 0, /* 0x00 */ 0xC0D6, 0xED4D, 0, 0xEFEA, 0xF25B, 0xF6E7, 0, 0xA4F3, /* 0x00 */ 0xA5C2, 0xA5C1, 0, 0xAA5D, 0xC961, 0xC97E, 0xA6BB, 0, /* 0x10 */ 0xC9F7, 0xCB49, 0xCB4A, 0xAA5E, 0, 0xCCED, 0, 0xAC74, /* 0x10 */ 0xCF6B, 0xCF6C, 0, 0xAEF0, 0xAEF4, 0xD244, 0xAEF3, 0xAEF1, /* 0x20 */ 0xAEF2, 0, 0xD5DF, 0xB242, 0xB4E3, 0, 0xB4E1, 0xB4E2, /* 0x20 */ 0xD9E6, 0, 0, 0xBA72, 0xA4F4, 0, 0xC9A1, 0, /* 0x30 */ 0xA5C3, 0, 0, 0xC9A4, 0, 0, 0xA5C6, 0xC9A3, /* 0x30 */ 0xA5C5, 0xA5C4, 0xA844, 0xC9A2, 0, 0, 0xC9F8, 0, /* 0x40 */ 0, 0, 0xC9FC, 0xC9FE, 0xCA40, 0xA6C5, 0xA6C6, 0xC9FB, /* 0x40 */ 0xA6C1, 0, 0xC9F9, 0, 0xC9FD, 0xA6C2, 0, 0xA6BD, /* 0x50 */ 0, 0xA6BE, 0, 0xA6C4, 0xC9FA, 0xA6BC, 0xA845, 0xA6BF, /* 0x50 */ 0xA6C0, 0xA6C3, 0, 0, 0, 0xCB5B, 0xCB59, 0xCB4C, /* 0x60 */ 0xA851, 0xCB53, 0xA84C, 0xCB4D, 0, 0xCB55, 0, 0xCB52, /* 0x60 */ 0xA84F, 0xCB51, 0xA856, 0xCB5A, 0xA858, 0, 0xA85A, 0, /* 0x70 */ 0xCB4B, 0, 0xA84D, 0xCB5C, 0, 0xA854, 0xA857, 0, /* 0x70 */ 0xCD45, 0xA847, 0xA85E, 0xA855, 0xCB4E, 0xA84A, 0xA859, 0xCB56, /* 0x80 */ 0xA848, 0xA849, 0xCD43, 0xCB4F, 0xA850, 0xA85B, 0xCB5D, 0xCB50, /* 0x80 */ 0xA84E, 0, 0xA853, 0xCCEE, 0xA85C, 0xCB57, 0xA852, 0, /* 0x90 */ 0xA85D, 0xA846, 0xCB54, 0xA84B, 0xCB58, 0xCD44, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0xAA6A, 0xAA7A, 0xCCF5, 0xAA71, 0, /* 0xA0 */ 0xCD4B, 0xAA62, 0, 0xAA65, 0xCD42, 0, 0xCCF3, 0xCCF7, /* 0xB0 */ 0xAA6D, 0xAA6F, 0xCCFA, 0xAA76, 0xAA68, 0xAA66, 0xAA67, 0xAA75, /* 0xB0 */ 0xCD47, 0xAA70, 0xCCF9, 0xCCFB, 0xAA6E, 0xAA73, 0xCCFC, 0xCD4A, /* 0xC0 */ 0, 0xAC75, 0xAA79, 0, 0xAA63, 0xCD49, 0, 0xCD4D, /* 0xC0 */ 0xCCF8, 0xCD4F, 0xCD40, 0xAA6C, 0xCCF4, 0xAA6B, 0xAA7D, 0xAA72, /* 0xD0 */ 0, 0xCCF2, 0xCF75, 0xAA78, 0xAA7C, 0xCD41, 0xCD46, 0, /* 0xD0 */ 0xAA7E, 0xAA77, 0xAA69, 0xAA5F, 0, 0xAA64, 0, 0xCCF6, /* 0xE0 */ 0xAA60, 0xCD4E, 0, 0xCCF0, 0xCCEF, 0xCCFD, 0xCCF1, 0xAA7B, /* 0xE0 */ 0xAEF5, 0xAA74, 0xCCFE, 0xAA61, 0, 0xACA6, 0, 0, /* 0xF0 */ 0, 0xCD4C /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_6D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xCF7C, 0xCFA1, 0, 0xCFA4, 0xCF77, 0, 0, 0xCFA7, /* 0x00 */ 0xCFAA, 0xCFAC, 0xCF74, 0xAC76, 0xAC7B, 0xD249, 0xACAD, 0xCFA5, /* 0x00 */ 0xCFAD, 0xCF7B, 0xCF73, 0, 0, 0, 0xD264, 0xAC7E, /* 0x10 */ 0xCFA2, 0xCF78, 0xCF7A, 0xACA5, 0, 0xCF7D, 0xAC7D, 0xCF70, /* 0x10 */ 0xCFA8, 0, 0xCFAB, 0, 0, 0xAC7A, 0, 0xACA8, /* 0x20 */ 0xCF6D, 0xACAA, 0xAC78, 0xACAE, 0xCFA9, 0xCF6F, 0xACAB, 0xD25E, /* 0x20 */ 0xCD48, 0xAC7C, 0xAC77, 0xCF76, 0xCF6E, 0xACAC, 0xACA4, 0xCFA3, /* 0x30 */ 0xACA9, 0xACA7, 0xCF79, 0xACA1, 0xCF71, 0xACA2, 0xACA3, 0xCF72, /* 0x30 */ 0xCFA6, 0xAC79, 0xCF7E, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0xD24C, 0xAEFD, 0xAF43, 0, 0, 0, 0xD255, 0xD25B, /* 0x50 */ 0xD257, 0xD24A, 0xD24D, 0xD246, 0xD247, 0xAF4A, 0xAEFA, 0xD256, /* 0x60 */ 0xD25F, 0xAF45, 0xAEF6, 0, 0xAF40, 0xD24E, 0xAF42, 0xD24F, /* 0x60 */ 0xD259, 0, 0, 0, 0xAF44, 0xD268, 0xD248, 0xAEFC, /* 0x70 */ 0xAEFB, 0xAF48, 0xD245, 0xD266, 0xD25A, 0xD267, 0xD261, 0xD253, /* 0x70 */ 0xD262, 0, 0xD25C, 0xD265, 0xD263, 0xAF49, 0xD254, 0xAEF9, /* 0x80 */ 0xAEF8, 0xAF41, 0xAF47, 0xD260, 0xAF46, 0xD251, 0xB243, 0, /* 0x80 */ 0xD269, 0xD250, 0xD24B, 0xAEFE, 0xAF4B, 0xAEF7, 0, 0xD258, /* 0x90 */ 0xD25D, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0xB265, 0xD5E1, 0xD5E5, 0, 0xB252, 0xB250, /* 0xA0 */ 0, 0, 0xB247, 0xD5E3, 0xD5E2, 0xB25B, 0, 0xD5E8, /* 0xB0 */ 0xB255, 0, 0xD5FA, 0xD647, 0xB244, 0xD5F7, 0xD5F0, 0xB267, /* 0xB0 */ 0xD5E0, 0, 0xD5FC, 0, 0xB264, 0xB258, 0xB263, 0xB24E, /* 0xC0 */ 0xD5EC, 0xD5FE, 0xD5F6, 0xB24F, 0xB249, 0xD645, 0, 0xD5FD, /* 0xC0 */ 0xD640, 0xB251, 0xB259, 0xD642, 0xD5EA, 0xD5FB, 0xD5EF, 0xD644, /* 0xD0 */ 0xB25E, 0xB246, 0xB25C, 0xD5F4, 0xD5F2, 0xD5F3, 0xB253, 0xD5EE, /* 0xD0 */ 0xD5ED, 0xB248, 0xD5E7, 0xD646, 0xB24A, 0xD5F1, 0xB268, 0, /* 0xE0 */ 0xB262, 0xD5E6, 0xB25F, 0xB25D, 0xB266, 0xD5F8, 0xB261, 0xD252, /* 0xE0 */ 0xD5F9, 0xB260, 0xD641, 0xB245, 0xD5F5, 0xB257, 0xD5E9, 0xB256, /* 0xF0 */ 0, 0xB254, 0xB24C, 0xB24B, 0xD9E7, 0xD643 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_6E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD5EB, 0, 0, 0xD9FC, 0, 0xB24D, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0xB541, 0xB25A, 0xB4EE, 0xD9F6, 0xB4FC, 0, 0xD9EA, /* 0x10 */ 0xB4EB, 0xB4E7, 0xDA49, 0xB4ED, 0xB4F1, 0xB4EC, 0xB4F5, 0xDA4D, /* 0x20 */ 0xDA44, 0, 0, 0xD9F1, 0xB4FA, 0xB4F4, 0xD9FD, 0xB4E4, /* 0x20 */ 0xDA4A, 0xDA43, 0xB4E8, 0xD9F7, 0xB4F7, 0xDA55, 0xDA56, 0, /* 0x30 */ 0xB4E5, 0xDA48, 0xB4F9, 0xD9FB, 0xD9ED, 0xD9EE, 0xB4FD, 0xD9F2, /* 0x30 */ 0xD9F9, 0xD9F3, 0, 0xB4FB, 0xB544, 0xD9EF, 0xD9E8, 0xD9E9, /* 0x40 */ 0, 0xD9EB, 0xB4EA, 0xD9F8, 0, 0xB4F8, 0xB542, 0, /* 0x40 */ 0, 0xD9FA, 0xDA53, 0xDA4B, 0xB4E6, 0xDA51, 0xB4F2, 0, /* 0x50 */ 0xB4F0, 0, 0xDA57, 0xB4EF, 0xDA41, 0xD9F4, 0xD9FE, 0xB547, /* 0x50 */ 0xDA45, 0xDA42, 0xD9F0, 0xB543, 0xDA4F, 0xDA4C, 0xDA54, 0xB4E9, /* 0x60 */ 0xDA40, 0xB546, 0, 0xDA47, 0, 0, 0xB4F3, 0xB4F6, /* 0x60 */ 0, 0xDA46, 0xB545, 0xD9F5, 0xD5E4, 0, 0, 0xDA50, /* 0x70 */ 0xDA4E, 0xDA52, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0xD9EC, 0xB540, 0, 0, 0, 0xDE61, 0xDE60, 0xDE46, /* 0x80 */ 0xB7BD, 0, 0xDE5F, 0xDE49, 0xDE4A, 0, 0xB7C7, 0xDE68, /* 0x90 */ 0xB7C2, 0xDE5E, 0, 0xDE43, 0xB7C8, 0xB7BE, 0xDE52, 0xDE48, /* 0x90 */ 0xDE4B, 0xDE63, 0xB7B8, 0xDE6A, 0xDE62, 0xB7C1, 0xDE57, 0xB7CC, /* 0xA0 */ 0, 0, 0xB7CB, 0xB7C5, 0, 0, 0xDE69, 0xB7B9, /* 0xA0 */ 0xDE55, 0xDE4C, 0xDE59, 0xDE65, 0xB7CD, 0, 0xB7BB, 0xDE54, /* 0xB0 */ 0, 0xDE4D, 0xB7C4, 0, 0xB7C3, 0xDE50, 0xDE5A, 0xDE64, /* 0xB0 */ 0xDE47, 0xDE51, 0xB7BC, 0xDE5B, 0xB7C9, 0xB7C0, 0xDE4E, 0xB7BF, /* 0xC0 */ 0xDE45, 0xDE53, 0xDE67, 0xB4FE, 0xBAB0, 0xDE56, 0xE26C, 0xDE58, /* 0xC0 */ 0xDE66, 0xB7C6, 0xDE4F, 0xB7BA, 0xB7CA, 0xBCF0, 0xDE44, 0, /* 0xD0 */ 0xDE5D, 0, 0, 0, 0xDE5C, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0xE2AA, 0xBAAD, 0xE27D, 0xE2A4, 0xBAA2, /* 0xE0 */ 0, 0xE26E, 0xBAAF, 0, 0xBA77, 0xE26D, 0xE2B0, 0xBAB1, /* 0xF0 */ 0xE271, 0xE2A3, 0, 0xE273, 0xE2B3, 0xE2AF, 0xBA75, 0xBAA1 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_6F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE653, 0xBAAE, 0xBA7D, 0xE26F, 0, 0xE2AE, 0xBAA3, 0xE2AB, /* 0x00 */ 0xE2B8, 0xE275, 0xE27E, 0, 0, 0xE2B6, 0xE2AC, 0xBA7C, /* 0x00 */ 0, 0, 0xE27C, 0xBA76, 0xBA74, 0xBAA8, 0, 0, /* 0x10 */ 0xE27A, 0xE277, 0xE278, 0, 0xE2B2, 0, 0xE2B7, 0xE2B5, /* 0x10 */ 0xBA7A, 0xE2B9, 0xBA7E, 0xBAA7, 0, 0xE270, 0xE5FA, 0xE279, /* 0x20 */ 0, 0xBA78, 0xBAAC, 0xBAA9, 0xBA7B, 0xE2A5, 0xE274, 0xBAAA, /* 0x20 */ 0xE2A7, 0xBAA4, 0xBAA6, 0xBA73, 0, 0xE2A9, 0xE2A1, 0xE272, /* 0x30 */ 0xBAA5, 0xE2B1, 0xE2B4, 0xE27B, 0xE2A8, 0, 0xBA79, 0xBCDF, /* 0x30 */ 0xE2A6, 0xE5F9, 0, 0xE2AD, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0xE276, 0xE644, /* 0x40 */ 0xE64E, 0xBCE2, 0xE64D, 0xE659, 0xBCE4, 0xE64B, 0, 0xE64F, /* 0x50 */ 0xBCEF, 0, 0xE646, 0xBCE7, 0, 0xE652, 0xE9F0, 0xBCF3, /* 0x50 */ 0xBCF2, 0xE654, 0xE643, 0xE65E, 0xBCED, 0, 0xBCE3, 0xE657, /* 0x60 */ 0, 0xE65B, 0xE660, 0xE655, 0xE649, 0xBCE6, 0xBCE9, 0xBCF1, /* 0x60 */ 0xBCEC, 0, 0xE64C, 0xE2A2, 0, 0, 0xE648, 0xE65F, /* 0x70 */ 0xBCE8, 0, 0xBCEB, 0xE661, 0xBCE0, 0xE656, 0xE5FB, 0xE65C, /* 0x70 */ 0xC0DF, 0, 0xE64A, 0, 0xBCE1, 0xE645, 0xBCE5, 0xE5FC, /* 0x80 */ 0xBAAB, 0xE641, 0, 0xE65A, 0xE642, 0xE640, 0xBCEA, 0, /* 0x80 */ 0xE658, 0, 0xE5FE, 0xE651, 0xE650, 0xE65D, 0xE647, 0xBCEE, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0xE9F3, 0, /* 0x90 */ 0xBF49, 0xBEFE, 0xEA40, 0xE9EB, 0xBF41, 0xE9F7, 0xBF48, 0xBF43, /* 0xA0 */ 0xE9F5, 0xED4F, 0xE9FB, 0xEA42, 0xE9FA, 0xE9E9, 0xE9F8, 0xEA44, /* 0xA0 */ 0xEA46, 0xBEFD, 0xEA45, 0xBF44, 0xBF4A, 0, 0xBF47, 0, /* 0xB0 */ 0xE9FE, 0xBF46, 0xE9F9, 0, 0xE9ED, 0xE9F2, 0, 0xE9FD, /* 0xB0 */ 0xBF45, 0xBF42, 0xBEFC, 0xBF40, 0xE9F1, 0, 0xE5FD, 0xE9EC, /* 0xC0 */ 0xE9EF, 0xEA41, 0xE9F4, 0xE9EA, 0xED4E, 0xEA43, 0xE9EE, 0xE9FC, /* 0xC0 */ 0, 0, 0, 0, 0xED51, 0xC0E3, 0, 0, /* 0xD0 */ 0xC0D7, 0, 0, 0xC0DB, 0xED53, 0xED59, 0xED57, 0xC0D9, /* 0xD0 */ 0xC0DA, 0xC0E1, 0xED5A, 0xED52, 0xC0DC, 0, 0xED56, 0xED55, /* 0xE0 */ 0xED5B, 0xC0E2, 0, 0xC0DD, 0xC0E0, 0xED54, 0xC0E4, 0xC0DE, /* 0xE0 */ 0xC0E5, 0xC0D8, 0xED58, 0, 0xED50, 0, 0, 0xEFF7, /* 0xF0 */ 0, 0, 0xC271, 0xEFF4, 0xEFF6, 0, 0xC26F, 0xEFF2 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_70[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xEFF3, 0xEFEE, 0, 0, 0xE9F6, 0xEFEF, 0xC270, 0xEFEB, /* 0x00 */ 0, 0xC26D, 0xEFF8, 0xC26E, 0xEFEC, 0xEFED, 0xEFF1, 0xC273, /* 0x00 */ 0, 0xC272, 0, 0, 0xEFF0, 0xC378, 0xF25F, 0xF265, /* 0x10 */ 0xC379, 0xF25C, 0xC376, 0xC373, 0xF267, 0xC377, 0, 0xC374, /* 0x10 */ 0xF25E, 0xF261, 0xF262, 0xF263, 0xF266, 0, 0xEFF5, 0xF25D, /* 0x20 */ 0xC375, 0xF264, 0xF268, 0xF260, 0, 0, 0, 0xF45D, /* 0x20 */ 0xC46A, 0xF460, 0xC46B, 0xF468, 0xF45F, 0xF45C, 0, 0xF45E, /* 0x30 */ 0xF462, 0xF465, 0xF464, 0xF467, 0xF45B, 0, 0xC469, 0xF463, /* 0x30 */ 0xF466, 0xF469, 0xF461, 0xF5D3, 0xF5D4, 0xF5D8, 0xF5D9, 0, /* 0x40 */ 0xF5D6, 0xF5D7, 0xF5D5, 0, 0xC4E9, 0, 0, 0, /* 0x40 */ 0, 0xC578, 0xF6EB, 0, 0, 0xF6E8, 0xF6E9, 0xF6EA, /* 0x50 */ 0xC579, 0, 0xF7E5, 0xF7E4, 0, 0xF8AF, 0xC5F4, 0xF8AD, /* 0x50 */ 0xF8B0, 0xF8AE, 0xF8F5, 0xC657, 0xC665, 0xF9A3, 0xF96C, 0, /* 0x60 */ 0xF9A2, 0xF9D0, 0xF9D1, 0xA4F5, 0, 0, 0, 0, /* 0x60 */ 0xA6C7, 0xCA41, 0, 0, 0xCB5E, 0, 0xA85F, 0, /* 0x70 */ 0xA862, 0, 0xCB5F, 0, 0xA860, 0xA861, 0, 0, /* 0x70 */ 0, 0, 0xCD58, 0xCD5A, 0xCD55, 0xCD52, 0xCD54, 0, /* 0x80 */ 0, 0, 0xAAA4, 0, 0, 0, 0xAAA2, 0, /* 0x80 */ 0, 0xCD56, 0xAAA3, 0xCD53, 0xCD50, 0xAAA1, 0xCD57, 0, /* 0x90 */ 0xCD51, 0xAAA5, 0xCD59, 0, 0, 0, 0, 0xCFAF, /* 0x90 */ 0, 0xCFB3, 0, 0, 0xACB7, 0, 0, 0, /* 0xA0 */ 0, 0xCFB6, 0, 0xACAF, 0xACB2, 0xACB4, 0xACB6, 0xACB3, /* 0xA0 */ 0xCFB2, 0xCFB1, 0, 0xACB1, 0xCFB4, 0xCFB5, 0, 0xCFAE, /* 0xB0 */ 0xACB5, 0, 0xACB0, 0, 0, 0, 0xCFB0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0xD277, 0xD278, 0xD279, /* 0xC0 */ 0xAF50, 0, 0xAF4C, 0xD26E, 0, 0xD276, 0xD27B, 0xAF51, /* 0xC0 */ 0, 0xD26C, 0xD272, 0xD26B, 0xD275, 0, 0, 0xD271, /* 0xD0 */ 0xAF4D, 0xAF4F, 0xD27A, 0, 0xD26A, 0xD26D, 0xD273, 0, /* 0xD0 */ 0xD274, 0xD27C, 0xD270, 0, 0xAF4E, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0xB26D, /* 0xE0 */ 0xD64E, 0, 0, 0xD650, 0xD64C, 0, 0xD658, 0xD64A, /* 0xF0 */ 0xD657, 0xB269, 0xD648, 0xDA5B, 0xD652, 0xB26C, 0, 0xD653 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_71[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD656, 0, 0xD65A, 0, 0xD64F, 0, 0xD654, 0, /* 0x00 */ 0, 0xB26A, 0xB26B, 0xD659, 0xD64D, 0xD649, 0xD65B, 0, /* 0x00 */ 0xD651, 0, 0, 0xD655, 0, 0, 0, 0xD64B, /* 0x10 */ 0, 0xB548, 0xB549, 0xDA65, 0xB54F, 0, 0xDA59, 0xDA62, /* 0x10 */ 0xDA58, 0xB54C, 0xDA60, 0xDA5E, 0, 0xDA5F, 0xB54A, 0, /* 0x20 */ 0xDA63, 0, 0, 0, 0, 0, 0xDA5C, 0xDA5A, /* 0x20 */ 0xB54B, 0xDA5D, 0xDA61, 0, 0, 0, 0xB54D, 0, /* 0x30 */ 0, 0, 0xDA64, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0xDE70, 0xDE77, 0xDE79, 0xDEA1, 0, 0xB7DA, 0xDE6B, /* 0x40 */ 0, 0xB7D2, 0, 0xDE7A, 0xB7D7, 0xDEA2, 0xB7CE, 0, /* 0x40 */ 0xDE7D, 0, 0xDE6D, 0xDE7E, 0xDE6C, 0, 0xB7DC, 0, /* 0x50 */ 0xDE78, 0xB7CF, 0xDEA3, 0, 0xB7D4, 0xDE71, 0xB7D9, 0xDE7C, /* 0x50 */ 0xDE6F, 0xDE76, 0xDE72, 0xDE6E, 0xB7D1, 0xB7D8, 0xB7D6, 0xB7D3, /* 0x60 */ 0xB7DB, 0xB7D0, 0xDE75, 0, 0xB7D5, 0, 0xB54E, 0, /* 0x60 */ 0xDE7B, 0, 0xDE73, 0, 0, 0, 0, 0, /* 0x70 */ 0xDE74, 0, 0, 0xE2C1, 0, 0xBAB4, 0, 0, /* 0x70 */ 0xE2BD, 0xE2C3, 0xE2BF, 0, 0xBAB6, 0xE2BE, 0xE2C2, 0xE2BA, /* 0x80 */ 0, 0xE2BC, 0xBAB5, 0, 0, 0, 0, 0xE2C0, /* 0x80 */ 0xE2BB, 0, 0xBAB7, 0, 0xBAB2, 0, 0, 0xE2C4, /* 0x90 */ 0, 0xBAB3, 0xE667, 0xE664, 0xE670, 0xE66A, 0xE66C, 0xBCF4, /* 0x90 */ 0xE666, 0xE66E, 0, 0, 0xE66D, 0xE66B, 0, 0xE671, /* 0xA0 */ 0xBCF7, 0xE668, 0xE66F, 0, 0xBCF5, 0, 0, 0xE663, /* 0xA0 */ 0xE665, 0xBCF6, 0xE662, 0xE672, 0, 0xE669, 0, 0, /* 0xB0 */ 0xEA4A, 0xBF51, 0, 0, 0xEA55, 0xEA53, 0xBF4B, 0xEA49, /* 0xB0 */ 0xEA4C, 0xEA4D, 0xEA48, 0xBF55, 0xBF56, 0xEA47, 0xEA56, 0xEA51, /* 0xC0 */ 0xBF4F, 0xBF4C, 0xEA50, 0xEA4E, 0, 0, 0xBF52, 0xEA52, /* 0xC0 */ 0xBF4D, 0, 0xBF4E, 0, 0xEA4F, 0xBF50, 0xEA4B, 0, /* 0xD0 */ 0xEA54, 0xBF53, 0xEA57, 0xEA58, 0xBF54, 0, 0, 0xC0E7, /* 0xD0 */ 0xC0EE, 0xED5C, 0xED62, 0, 0xED60, 0xC0EA, 0xC0E9, 0xC0E6, /* 0xE0 */ 0xED5E, 0, 0, 0, 0xC0EC, 0xC0EB, 0xC0E8, 0, /* 0xE0 */ 0xED61, 0xED5D, 0xED5F, 0, 0xC0ED, 0, 0, 0, /* 0xF0 */ 0xC277, 0xEFFB, 0, 0xC274, 0xC275, 0xEFFD, 0xC276, 0xEFFA /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_72[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xEFF9, 0xF26C, 0xEFFC, 0, 0xF26D, 0xC37A, 0xF26B, /* 0x00 */ 0, 0, 0xF26A, 0, 0xF269, 0xC37B, 0, 0, /* 0x00 */ 0xC46C, 0, 0, 0xF46A, 0xF46B, 0, 0, 0, /* 0x10 */ 0, 0xF5DC, 0xF5DB, 0xC4EA, 0, 0xF5DA, 0xF6EC, 0xF6ED, /* 0x10 */ 0, 0, 0xF7E6, 0xF8B1, 0, 0, 0xF8F6, 0xF9BC, /* 0x20 */ 0xC679, 0xF9C6, 0xA4F6, 0, 0xAAA6, 0xAAA7, 0, 0, /* 0x20 */ 0xACB8, 0, 0, 0, 0, 0xC0EF, 0xA4F7, 0, /* 0x30 */ 0xAAA8, 0xAF52, 0xB7DD, 0xA4F8, 0, 0xB26E, 0xBAB8, 0xC962, /* 0x30 */ 0, 0xCFB7, 0xD27D, 0, 0xE2C5, 0, 0xC0F0, 0xA4F9, /* 0x40 */ 0xAAA9, 0xCFB8, 0xCFB9, 0xDA66, 0xB550, 0, 0, 0xDEA4, /* 0x40 */ 0, 0, 0xB7DE, 0xE2C6, 0, 0, 0xBCF8, 0, /* 0x50 */ 0xC37C, 0xA4FA, 0xDA67, 0xA4FB, 0, 0xA6C9, 0xCA42, 0xA6C8, /* 0x50 */ 0xA865, 0xA864, 0xA863, 0xCB60, 0, 0, 0, 0xAAAA, /* 0x60 */ 0, 0xAAAB, 0xCD5B, 0, 0xCFBA, 0, 0xCFBD, 0xACBA, /* 0x60 */ 0xCFBB, 0, 0xACB9, 0xCFBC, 0xACBB, 0, 0xD2A2, 0xD2A1, /* 0x70 */ 0xD27E, 0xAF53, 0, 0xD65D, 0xD65E, 0xB26F, 0xD65C, 0xD65F, /* 0x70 */ 0xB552, 0xB270, 0, 0, 0xB551, 0xDA6B, 0xDA6A, 0, /* 0x80 */ 0xDA68, 0xDA69, 0, 0xDA6C, 0xDEA6, 0xDEA5, 0xDEA9, 0, /* 0x80 */ 0xDEA8, 0xDEA7, 0xBAB9, 0xE2C9, 0, 0xE2C8, 0xBABA, 0xE2C7, /* 0x90 */ 0xE673, 0, 0xE674, 0xBCF9, 0, 0xEA59, 0xEA5A, 0, /* 0x90 */ 0, 0xF272, 0xC37D, 0xF271, 0xF270, 0xF26E, 0xF26F, 0xC4EB, /* 0xA0 */ 0xF46C, 0xF6EE, 0xF8F7, 0, 0xA4FC, 0, 0xC9A5, 0xA5C7, /* 0xA0 */ 0xC9A6, 0, 0, 0, 0xCA43, 0xCA44, 0, 0, /* 0xB0 */ 0, 0, 0xCB66, 0, 0, 0xCB62, 0, 0xCB61, /* 0xB0 */ 0xAAAC, 0xCB65, 0xA867, 0xCB63, 0xA866, 0xCB67, 0xCB64, 0, /* 0xC0 */ 0, 0xCD5F, 0xCFBE, 0xCD5D, 0xCD64, 0, 0xAAAD, 0, /* 0xC0 */ 0xAAB0, 0xCD65, 0xCD61, 0, 0xCD62, 0, 0xCD5C, 0xAAAF, /* 0xD0 */ 0xCD5E, 0xAAAE, 0xCD63, 0, 0xCD60, 0, 0, 0xCFC2, /* 0xD0 */ 0xACBD, 0xACBE, 0, 0xCFC5, 0xCFBF, 0, 0xCFC4, 0, /* 0xE0 */ 0xCFC0, 0xACBC, 0xCFC3, 0xCFC1, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0xD2A8, 0xD2A5, 0, 0xD2A7, 0xAF58, /* 0xF0 */ 0xAF57, 0xAF55, 0xD2A4, 0xD2A9, 0xAF54, 0xAF56, 0xD2A6, 0xD667 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_73[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD2A3, 0xD2AA, 0, 0, 0, 0, 0, 0xD662, /* 0x00 */ 0xD666, 0, 0xD665, 0xDA6E, 0xDA79, 0, 0, 0xD668, /* 0x00 */ 0, 0xD663, 0xDA6D, 0xB274, 0, 0, 0xB273, 0xD661, /* 0x10 */ 0xD664, 0xB275, 0, 0xB272, 0xB271, 0xD660, 0xD669, 0, /* 0x10 */ 0, 0, 0xDA70, 0xDA77, 0, 0xB554, 0xDA76, 0xDA73, /* 0x20 */ 0, 0xB556, 0, 0, 0, 0xDA75, 0, 0, /* 0x20 */ 0xDA6F, 0xDA71, 0xDA74, 0xDA72, 0xB555, 0xDA78, 0xB553, 0xB7DF, /* 0x30 */ 0, 0, 0xDEAD, 0xDEAC, 0xDEAA, 0, 0xB7E2, 0xB7E1, /* 0x30 */ 0xDEAE, 0, 0xDEAB, 0xE2CA, 0xBABB, 0xB7E0, 0, 0, /* 0x40 */ 0, 0xDEB0, 0xDEAF, 0, 0xE2CD, 0xE2CB, 0xBCFA, 0, /* 0x40 */ 0xBABC, 0xE2CC, 0xE676, 0, 0, 0, 0, 0xBCFB, /* 0x50 */ 0xE675, 0xE67E, 0xE67D, 0xE67B, 0, 0xE67A, 0xE677, 0xE678, /* 0x50 */ 0xE679, 0xE67C, 0xE6A1, 0, 0, 0xEA5F, 0xEA5C, 0xEA5D, /* 0x60 */ 0xBF57, 0xEA5B, 0xEA61, 0xEA60, 0xEA5E, 0, 0xED64, 0xED65, /* 0x60 */ 0xC0F1, 0, 0xC0F2, 0xED63, 0, 0xC279, 0xEFFE, 0xC278, /* 0x70 */ 0xC37E, 0, 0xC3A1, 0xC46D, 0xF46E, 0xF46D, 0xF5DD, 0xF6EF, /* 0x70 */ 0xC57A, 0xF7E8, 0xF7E7, 0xF7E9, 0xA5C8, 0xCFC6, 0xAF59, 0xB276, /* 0x80 */ 0xD66A, 0xA5C9, 0xC9A7, 0xA4FD, 0, 0, 0xCA45, 0, /* 0x80 */ 0, 0, 0xCB6C, 0xCB6A, 0xCB6B, 0xCB68, 0xA868, 0xCB69, /* 0x90 */ 0, 0, 0, 0, 0, 0xCD6D, 0, 0xAAB3, /* 0x90 */ 0xCD6B, 0xCD67, 0xCD6A, 0, 0xCD66, 0xAAB5, 0xCD69, 0, /* 0xA0 */ 0xAAB2, 0xAAB1, 0, 0xAAB4, 0xCD6C, 0xCD68, 0, 0, /* 0xA0 */ 0, 0, 0xACC2, 0xACC5, 0xCFCE, 0xCFCD, 0xCFCC, 0xACBF, /* 0xB0 */ 0xCFD5, 0xCFCB, 0, 0xACC1, 0xD2AF, 0, 0xCFD2, 0xCFD0, /* 0xB0 */ 0xACC4, 0, 0xCFC8, 0xCFD3, 0, 0xCFCA, 0xCFD4, 0xCFD1, /* 0xC0 */ 0xCFC9, 0, 0xACC0, 0xCFD6, 0xCFC7, 0xACC3, 0, 0, /* 0xC0 */ 0, 0, 0xD2B4, 0xD2AB, 0xD2B6, 0, 0xD2AE, 0xD2B9, /* 0xD0 */ 0xD2BA, 0xD2AC, 0xD2B8, 0xD2B5, 0xD2B3, 0xD2B7, 0xAF5F, 0, /* 0xD0 */ 0xAF5D, 0, 0, 0xD2B1, 0, 0xD2AD, 0, 0xD2B0, /* 0xE0 */ 0xD2BB, 0xD2B2, 0xAF5E, 0xCFCF, 0, 0xAF5A, 0xAF5C, 0, /* 0xE0 */ 0, 0, 0, 0, 0xD678, 0xD66D, 0xD66B, 0, /* 0xF0 */ 0xD66C, 0, 0xD673, 0, 0xD674, 0xD670, 0xB27B, 0xD675 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_74[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD672, 0xD66F, 0, 0xB279, 0xD66E, 0xB277, 0xB27A, 0xD671, /* 0x00 */ 0xD679, 0xAF5B, 0xB278, 0xD677, 0xD676, 0xB27C, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0, 0, 0xDA7E, 0, /* 0x10 */ 0, 0, 0xDAA1, 0xB560, 0, 0xDAA7, 0, 0, /* 0x10 */ 0xDAA9, 0xDAA2, 0xB55A, 0xDAA6, 0xDAA5, 0xB55B, 0xB561, 0, /* 0x20 */ 0xB562, 0xDAA8, 0xB558, 0xDA7D, 0xDA7B, 0xDAA3, 0xDA7A, 0xB55F, /* 0x20 */ 0xDA7C, 0xDAA4, 0xDAAA, 0xB559, 0xB55E, 0xB55C, 0xB55D, 0, /* 0x30 */ 0, 0, 0xB557, 0, 0, 0, 0, 0xB7E9, /* 0x30 */ 0xDEB7, 0xB7E8, 0xDEBB, 0, 0xDEB1, 0, 0xDEBC, 0, /* 0x40 */ 0, 0, 0xDEB2, 0xDEB3, 0, 0xDEBD, 0xDEBA, 0xDEB8, /* 0x40 */ 0xDEB9, 0xDEB5, 0xDEB4, 0, 0xDEBE, 0xB7E5, 0, 0xDEB6, /* 0x50 */ 0, 0xB7EA, 0xB7E4, 0xB7EB, 0xB7EC, 0, 0xB7E7, 0xB7E6, /* 0x50 */ 0, 0, 0xE2CE, 0xBABE, 0xBABD, 0, 0, 0xE2D3, /* 0x60 */ 0, 0xBCFC, 0xBABF, 0, 0, 0xBAC1, 0xE2D4, 0xB7E3, /* 0x60 */ 0xBAC0, 0xE2D0, 0xE2D2, 0xE2CF, 0, 0xE2D1, 0, 0, /* 0x70 */ 0, 0xE6AB, 0, 0, 0xE6AA, 0xE6A7, 0xBD40, 0xEA62, /* 0x70 */ 0xBD41, 0xE6A6, 0, 0xBCFE, 0, 0xE6A8, 0xE6A5, 0xE6A2, /* 0x80 */ 0xE6A9, 0xE6A3, 0xE6A4, 0xBCFD, 0, 0, 0, 0, /* 0x80 */ 0xED69, 0, 0xEA66, 0, 0xEA65, 0xEA67, 0, 0xED66, /* 0x90 */ 0xBF5A, 0, 0xEA63, 0, 0xBF58, 0, 0xBF5C, 0xBF5B, /* 0x90 */ 0xEA64, 0xEA68, 0, 0xBF59, 0, 0xED6D, 0xC0F5, 0xC27A, /* 0xA0 */ 0xC0F6, 0xC0F3, 0xED6A, 0xED68, 0, 0xED6B, 0, 0xED6E, /* 0xA0 */ 0xC0F4, 0xED6C, 0xED67, 0, 0, 0xF042, 0xF045, 0xF275, /* 0xB0 */ 0xF040, 0, 0xF46F, 0xF046, 0, 0xC3A2, 0xF044, 0xC27B, /* 0xB0 */ 0xF041, 0xF043, 0xF047, 0xF276, 0, 0xF274, 0, 0, /* 0xC0 */ 0, 0, 0xC3A3, 0xF273, 0, 0, 0, 0xC46E, /* 0xC0 */ 0, 0, 0, 0, 0xC4ED, 0xF6F1, 0xC4EC, 0xF6F3, /* 0xD0 */ 0xF6F0, 0xF6F2, 0xC5D0, 0xF8B2, 0xA5CA, 0xCD6E, 0xD2BC, 0xD2BD, /* 0xD0 */ 0xB27D, 0xDEBF, 0xBF5D, 0xC3A4, 0xC57B, 0xF8B3, 0xA5CB, 0, /* 0xE0 */ 0xCD6F, 0xA260, 0, 0, 0xCFD7, 0, 0xCFD8, 0, /* 0xE0 */ 0, 0, 0, 0, 0xD2BE, 0xD2BF, 0xB27E, 0xB2A1, /* 0xF0 */ 0, 0, 0, 0xDAAB, 0, 0xDEC2, 0xDEC1, 0xDEC0 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_75[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE2D5, 0, 0xE2D6, 0xE2D7, 0xBAC2, 0, 0, 0xE6AD, /* 0x00 */ 0xE6AC, 0, 0, 0xEA69, 0xBF5E, 0xBF5F, 0, 0xED72, /* 0x00 */ 0xED6F, 0xED70, 0xED71, 0xF049, 0xF048, 0xC27C, 0xF277, 0xF5DE, /* 0x10 */ 0xA5CC, 0, 0xACC6, 0, 0xB2A2, 0xDEC3, 0, 0xA5CD, /* 0x10 */ 0, 0xD2C0, 0xB2A3, 0, 0, 0xB563, 0xB564, 0, /* 0x20 */ 0xA5CE, 0xA5CF, 0xCA46, 0xA86A, 0xA869, 0xACC7, 0xCFD9, 0xDAAC, /* 0x20 */ 0xA5D0, 0xA5D1, 0xA5D2, 0xA5D3, 0, 0, 0, 0xA86B, /* 0x30 */ 0xA86C, 0xCB6E, 0xCB6D, 0, 0, 0xAAB6, 0xCD72, 0xCD70, /* 0x30 */ 0xCD71, 0, 0, 0, 0, 0, 0, 0xCFDA, /* 0x40 */ 0xCFDB, 0, 0, 0xACCB, 0xACC9, 0, 0xACCA, 0xACC8, /* 0x40 */ 0, 0, 0, 0, 0xAF60, 0, 0, 0, /* 0x50 */ 0, 0xAF64, 0xAF63, 0xD2C1, 0xAF62, 0xAF61, 0, 0xD2C2, /* 0x50 */ 0, 0, 0xB2A6, 0xD67B, 0xD67A, 0xB2A4, 0xB2A5, 0, /* 0x60 */ 0, 0, 0xB566, 0xB565, 0xDAAE, 0, 0, 0xDAAD, /* 0x60 */ 0xB2A7, 0, 0, 0, 0, 0, 0xB7ED, 0xDEC5, /* 0x70 */ 0xB7EE, 0xDEC4, 0, 0, 0, 0xE2D8, 0xE6AE, 0xBD42, /* 0x70 */ 0xEA6A, 0, 0, 0, 0xED73, 0, 0xC3A6, 0xC3A5, /* 0x80 */ 0, 0, 0xC57C, 0xA5D4, 0xCD73, 0, 0, 0xB2A8, /* 0x80 */ 0xE2D9, 0xBAC3, 0, 0, 0xCB6F, 0xCB70, 0, 0, /* 0x90 */ 0xCD74, 0xAAB8, 0xAAB9, 0, 0, 0xAAB7, 0, 0, /* 0x90 */ 0, 0, 0xACCF, 0xACD0, 0xACCD, 0xACCE, 0, 0xCFDC, /* 0xA0 */ 0, 0, 0xCFDD, 0xACCC, 0, 0, 0, 0, /* 0xA0 */ 0xD2C3, 0, 0xAF68, 0xAF69, 0, 0xB2AB, 0xD2C9, 0, /* 0xB0 */ 0xAF6E, 0xAF6C, 0xD2CA, 0xD2C5, 0xAF6B, 0xAF6A, 0xAF65, 0xD2C8, /* 0xB0 */ 0xD2C7, 0xD2C4, 0xAF6D, 0, 0xD2C6, 0xAF66, 0, 0xAF67, /* 0xC0 */ 0, 0, 0xB2AC, 0xD6A1, 0xD6A2, 0xB2AD, 0xD67C, 0xD67E, /* 0xC0 */ 0xD6A4, 0xD6A3, 0xD67D, 0, 0xB2A9, 0xB2AA, 0, 0xDAB6, /* 0xD0 */ 0xB56B, 0xB56A, 0xDAB0, 0xB568, 0, 0xDAB3, 0xB56C, 0xDAB4, /* 0xD0 */ 0xB56D, 0xDAB1, 0xB567, 0xB569, 0xDAB5, 0, 0xDAB2, 0xDAAF, /* 0xE0 */ 0, 0, 0, 0, 0, 0xDED2, 0, 0xDEC7, /* 0xE0 */ 0xB7F0, 0xB7F3, 0xB7F2, 0xB7F7, 0xB7F6, 0xDED3, 0xDED1, 0xDECA, /* 0xF0 */ 0xDECE, 0xDECD, 0xB7F4, 0xDED0, 0xDECC, 0xDED4, 0xDECB, 0xB7F5 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_76[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xB7EF, 0xB7F1, 0, 0xDEC9, 0, 0, 0, 0, /* 0x00 */ 0xE2DB, 0xBAC7, 0xE2DF, 0xBAC6, 0xE2DC, 0xBAC5, 0, 0xDEC8, /* 0x00 */ 0xDECF, 0xE2DE, 0, 0xBAC8, 0xE2E0, 0xE2DD, 0xE2DA, 0, /* 0x10 */ 0, 0xE6B1, 0xE6B5, 0xE6B7, 0xE6B3, 0xE6B2, 0xE6B0, 0xBD45, /* 0x10 */ 0xBD43, 0xBD48, 0xBD49, 0xE6B4, 0xBD46, 0xE6AF, 0xBD47, 0xBAC4, /* 0x20 */ 0xE6B6, 0xBD44, 0, 0, 0, 0xEA6C, 0, 0xEA6B, /* 0x20 */ 0xEA73, 0xEA6D, 0xEA72, 0xEA6F, 0xBF60, 0xEA71, 0, 0, /* 0x30 */ 0xBF61, 0, 0xBF62, 0, 0xEA70, 0xEA6E, 0, 0, /* 0x30 */ 0, 0, 0xC0F8, 0xED74, 0, 0, 0xC0F7, 0xED77, /* 0x40 */ 0xED75, 0xED76, 0, 0, 0xC0F9, 0, 0, 0, /* 0x40 */ 0xF04D, 0, 0xC2A1, 0xF04E, 0, 0, 0xC27D, 0xF04F, /* 0x50 */ 0xC27E, 0xF04C, 0xF050, 0, 0xF04A, 0, 0, 0xC3A7, /* 0x50 */ 0xF278, 0xC3A8, 0xC46F, 0, 0xF04B, 0xC470, 0, 0, /* 0x60 */ 0, 0xC4EE, 0xF5DF, 0, 0xC57E, 0xF6F4, 0xC57D, 0, /* 0x60 */ 0xF7EA, 0xC5F5, 0xC5F6, 0, 0, 0xF9CC, 0, 0, /* 0x70 */ 0xACD1, 0xCFDE, 0, 0xB56E, 0xB56F, 0xA5D5, 0xA6CA, 0xCA47, /* 0x70 */ 0, 0xCB71, 0xA86D, 0, 0xAABA, 0, 0xACD2, 0xACD3, /* 0x80 */ 0xACD4, 0xD6A6, 0xD2CB, 0xAF6F, 0, 0, 0xB2AE, 0xD6A5, /* 0x80 */ 0, 0, 0xDAB8, 0xB571, 0, 0xDAB7, 0xB570, 0, /* 0x90 */ 0, 0xDED5, 0xBD4A, 0xE6BB, 0xE6B8, 0xE6B9, 0xE6BA, 0, /* 0x90 */ 0, 0, 0, 0, 0xED78, 0, 0xF051, 0, /* 0xA0 */ 0, 0, 0xF471, 0xF470, 0, 0xF6F5, 0xA5D6, 0xCD75, /* 0xA0 */ 0xAF70, 0, 0, 0, 0xB572, 0xDED6, 0, 0, /* 0xB0 */ 0xE2E1, 0, 0xBD4B, 0xEA74, 0, 0xF052, 0xF472, 0xA5D7, /* 0xB0 */ 0, 0, 0xAABB, 0xACD7, 0xCFDF, 0xACD8, 0xACD6, 0, /* 0xC0 */ 0xACD5, 0xD2CC, 0xAF71, 0, 0, 0xAF72, 0xAF73, 0, /* 0xC0 */ 0, 0, 0xB2B0, 0xD6A7, 0xB2AF, 0, 0, 0, /* 0xD0 */ 0, 0, 0xDAB9, 0xB2B1, 0xB573, 0xDED7, 0xB7F8, 0xB7F9, /* 0xD0 */ 0, 0xBAC9, 0, 0xBACA, 0xBD4C, 0xBF64, 0xEA75, 0xBF63, /* 0xE0 */ 0, 0xED79, 0xC0FA, 0, 0xF053, 0xF473, 0xA5D8, 0xA86E, /* 0xE0 */ 0xCD78, 0xCD77, 0xAABC, 0xCD76, 0xAABD, 0xCD79, 0, 0xCFE5, /* 0xF0 */ 0xACDB, 0xACDA, 0xCFE7, 0xCFE6, 0xACDF, 0, 0xACDE /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_77[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xACD9, 0, 0xCFE1, 0xCFE2, 0xCFE3, 0, 0xACE0, /* 0x00 */ 0xCFE0, 0xACDC, 0xCFE4, 0xACDD, 0, 0, 0, 0, /* 0x00 */ 0xD2CF, 0xD2D3, 0xD2D1, 0xD2D0, 0, 0xD2D4, 0, 0, /* 0x10 */ 0, 0xD2D5, 0xD2D6, 0xD2CE, 0, 0xD2CD, 0, 0xAF75, /* 0x10 */ 0xAF76, 0, 0xD2D7, 0xD2D2, 0, 0xD6B0, 0, 0xD2D8, /* 0x20 */ 0xAF77, 0xAF74, 0, 0, 0, 0xD6AA, 0, 0xD6A9, /* 0x20 */ 0, 0xD6AB, 0xD6AC, 0xD6AE, 0xD6AD, 0xD6B2, 0xB2B5, 0xB2B2, /* 0x30 */ 0xB2B6, 0xD6A8, 0xB2B7, 0xD6B1, 0xB2B4, 0xD6AF, 0xB2B3, 0, /* 0x30 */ 0, 0, 0, 0, 0xDABC, 0xDABE, 0xDABA, 0xDABB, /* 0x40 */ 0, 0, 0xDABF, 0xDAC1, 0xDAC2, 0xDABD, 0xDAC0, 0xB574, /* 0x40 */ 0, 0, 0xDEDB, 0, 0xDEE0, 0xDED8, 0xDEDC, 0, /* 0x50 */ 0, 0xDEE1, 0xDEDD, 0xB7FA, 0xB843, 0, 0xB7FD, 0xDED9, /* 0x50 */ 0xDEDA, 0xBACE, 0xB846, 0xB7FE, 0, 0xB844, 0xB7FC, 0xDEDF, /* 0x60 */ 0xB845, 0xDEDE, 0xB841, 0xB7FB, 0xB842, 0xDEE2, 0xE2E6, 0xE2E8, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0xB840, 0, 0, 0xE2E3, 0xBACC, 0xE2E9, 0xBACD, /* 0x70 */ 0xE2E7, 0xE2E2, 0xE2E5, 0xE2EA, 0xBACB, 0xE2E4, 0, 0xBD4E, /* 0x80 */ 0xE6BF, 0xE6BE, 0, 0xBD51, 0xBD4F, 0xE6BC, 0xBD4D, 0xE6BD, /* 0x80 */ 0, 0xBD50, 0, 0, 0, 0xEA7D, 0, 0xEAA1, /* 0x90 */ 0, 0xEA7E, 0xEA76, 0xEA7A, 0xEA79, 0xEA77, 0xBF66, 0xBF67, /* 0x90 */ 0xBF65, 0xEA78, 0xEA7B, 0xEA7C, 0, 0xBF68, 0, 0xC140, /* 0xA0 */ 0xEDA3, 0, 0xC0FC, 0xED7B, 0xC0FE, 0xC141, 0, 0, /* 0xA0 */ 0xC0FD, 0xEDA2, 0xED7C, 0xC0FB, 0xEDA1, 0xED7A, 0xED7E, 0xED7D, /* 0xB0 */ 0, 0, 0xF055, 0xC2A4, 0xC2A5, 0xC2A2, 0, 0xC2A3, /* 0xB0 */ 0, 0, 0xF054, 0, 0xF27B, 0, 0, 0xC3A9, /* 0xC0 */ 0, 0xF279, 0xF27A, 0, 0xF474, 0xF477, 0xF475, 0xF476, /* 0xC0 */ 0xF5E0, 0, 0, 0xC4EF, 0xF7EB, 0xF8B4, 0, 0xC5F7, /* 0xD0 */ 0xF8F8, 0xF8F9, 0xC666, 0xA5D9, 0xACE1, 0, 0xDAC3, 0, /* 0xD0 */ 0xDEE3, 0, 0xA5DA, 0xA86F, 0, 0xAABE, 0, 0xCFE8, /* 0xE0 */ 0xCFE9, 0xAF78, 0, 0, 0xDAC4, 0xB575, 0xB847, 0xC142, /* 0xE0 */ 0xEDA4, 0xF27C, 0xF478, 0xA5DB, 0, 0, 0, 0xCDA1, /* 0xF0 */ 0xCD7A, 0xCD7C, 0xCD7E, 0xCD7D, 0xCD7B, 0xAABF /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_78[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xACE2, 0xCFF2, 0, 0xCFED, 0xCFEA, 0, /* 0x00 */ 0, 0xCFF1, 0, 0, 0xACE4, 0xACE5, 0xCFF0, 0xCFEF, /* 0x00 */ 0xCFEE, 0xCFEB, 0xCFEC, 0xCFF3, 0xACE3, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0xAF7C, 0, 0xAFA4, /* 0x10 */ 0xAFA3, 0xD2E1, 0xD2DB, 0xD2D9, 0, 0xAFA1, 0xD6B9, 0xAF7A, /* 0x20 */ 0xD2DE, 0xD2E2, 0xD2E4, 0xD2E0, 0xD2DA, 0xAFA2, 0xD2DF, 0xD2DD, /* 0x20 */ 0xAF79, 0xD2E5, 0xAFA5, 0xD2E3, 0xAF7D, 0xD2DC, 0, 0xAF7E, /* 0x30 */ 0xAF7B, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0xB2B9, 0, 0xD6BA, 0, 0, /* 0x40 */ 0xD6B3, 0xD6B5, 0xD6B7, 0, 0xD6B8, 0xD6B6, 0xB2BA, 0, /* 0x40 */ 0xD6BB, 0, 0xD6B4, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0xDAC8, 0xB576, 0xDAD0, 0, /* 0x50 */ 0xDAC5, 0, 0xDAD1, 0, 0xDAC6, 0xDAC7, 0, 0, /* 0x60 */ 0xDACF, 0xDACE, 0xDACB, 0xB2B8, 0xB577, 0xDAC9, 0xDACC, 0xB578, /* 0x60 */ 0xDACD, 0xDACA, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0xDEEE, 0, 0xDEF2, 0xB84E, 0, 0xE2F0, 0xB851, /* 0x70 */ 0xDEF0, 0xF9D6, 0, 0xDEED, 0xDEE8, 0xDEEA, 0xDEEB, 0xDEE4, /* 0x80 */ 0, 0xB84D, 0, 0, 0xB84C, 0, 0xB848, 0xDEE7, /* 0x80 */ 0, 0xB84F, 0, 0xB850, 0xDEE6, 0xDEE9, 0xDEF1, 0xB84A, /* 0x90 */ 0xB84B, 0xDEEF, 0xDEE5, 0, 0, 0, 0xE2F2, 0xBAD0, /* 0x90 */ 0xE2F4, 0xDEEC, 0xE2F6, 0xBAD4, 0xE2F7, 0xE2F3, 0, 0xBAD1, /* 0xA0 */ 0xE2EF, 0xBAD3, 0xE2EC, 0xE2F1, 0xE2F5, 0xE2EE, 0, 0, /* 0xA0 */ 0xB849, 0, 0xE2EB, 0xBAD2, 0xE2ED, 0, 0, 0, /* 0xB0 */ 0, 0, 0xBD54, 0xE6C1, 0xBD58, 0, 0xBD56, 0, /* 0xB0 */ 0, 0xBACF, 0, 0xE6C8, 0xE6C9, 0xBD53, 0, 0, /* 0xC0 */ 0xE6C7, 0xE6CA, 0xBD55, 0xBD52, 0xE6C3, 0xE6C0, 0xE6C5, 0xE6C2, /* 0xC0 */ 0xBD59, 0xE6C4, 0, 0, 0xE6C6, 0xBD57, 0, 0, /* 0xD0 */ 0, 0, 0xBF6A, 0xEAA8, 0, 0xEAA2, 0xEAA6, 0xEAAC, /* 0xD0 */ 0xEAAD, 0xEAA9, 0xEAAA, 0xEAA7, 0, 0xEAA4, 0, 0xBF6C, /* 0xE0 */ 0xBF69, 0xEAA3, 0xEAA5, 0, 0xBF6B, 0xEAAB, 0, 0xC146, /* 0xE0 */ 0, 0, 0xEDAA, 0xEDA5, 0xC145, 0, 0, 0xC143, /* 0xF0 */ 0, 0xEDAC, 0xC144, 0xEDA8, 0xEDA9, 0xEDA6, 0xEDAD, 0xF056 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_79[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC147, 0xEDA7, 0, 0xEDAE, 0xEDAB, 0, 0, /* 0x00 */ 0, 0xF05A, 0, 0, 0xF057, 0, 0xC2A6, 0, /* 0x00 */ 0xF05B, 0xF05D, 0xF05C, 0xF058, 0xF059, 0, 0, 0xF2A3, /* 0x10 */ 0, 0xC3AA, 0, 0xF27E, 0xF2A2, 0xF27D, 0xF2A4, 0, /* 0x10 */ 0, 0xF2A1, 0, 0xF47A, 0xF47D, 0xF479, 0xC471, 0xF47B, /* 0x20 */ 0xF47C, 0xF47E, 0xC472, 0xC474, 0xC473, 0xF5E1, 0, 0xF5E3, /* 0x20 */ 0, 0xF5E2, 0, 0, 0, 0xF6F6, 0, 0, /* 0x30 */ 0xF8B5, 0xF8FA, 0xA5DC, 0, 0, 0xCB72, 0xAAC0, 0xCDA3, /* 0x30 */ 0xAAC1, 0xAAC2, 0xCDA2, 0, 0xCFF8, 0xCFF7, 0xACE6, 0xACE9, /* 0x40 */ 0xACE8, 0xACE7, 0xCFF4, 0xCFF6, 0xCFF5, 0, 0, 0xD2E8, /* 0x40 */ 0xAFA7, 0xD2EC, 0xD2EB, 0xD2EA, 0xD2E6, 0xAFA6, 0xAFAA, 0xAFAD, /* 0x50 */ 0, 0, 0xAFAE, 0xD2E7, 0xD2E9, 0xAFAC, 0xAFAB, 0xAFA9, /* 0x50 */ 0xAFA8, 0xD6C2, 0, 0xD6C0, 0xD6BC, 0xB2BB, 0, 0xD6BD, /* 0x60 */ 0xB2BC, 0xD6BE, 0xD6BF, 0xD6C1, 0, 0xB2BD, 0, 0, /* 0x60 */ 0xDAD5, 0, 0xDAD4, 0xDAD3, 0xDAD2, 0, 0, 0, /* 0x70 */ 0, 0xDEF6, 0xB852, 0, 0xDEF3, 0xDEF5, 0, 0xB853, /* 0x70 */ 0, 0xB854, 0xDEF4, 0, 0, 0, 0, 0, /* 0x80 */ 0xE341, 0, 0xE2F9, 0xE2FA, 0, 0xBAD7, 0xBAD5, 0xBAD6, /* 0x80 */ 0xE343, 0, 0xE342, 0xE2FE, 0xE2FD, 0xE2FC, 0xE2FB, 0xE340, /* 0x90 */ 0xE2F8, 0, 0xE6CB, 0xE6D0, 0xE6CE, 0, 0, 0, /* 0x90 */ 0xE6CD, 0xE6CC, 0xE6CF, 0, 0xEAAE, 0, 0xBF6D, 0xC148, /* 0xA0 */ 0xEDB0, 0, 0xC149, 0xEDAF, 0xF05F, 0xF05E, 0xC2A7, 0, /* 0xA0 */ 0xF2A5, 0xC3AB, 0xF4A1, 0xC5A1, 0xF6F7, 0, 0xF8B7, 0xF8B6, /* 0xB0 */ 0xC9A8, 0xACEA, 0xACEB, 0xD6C3, 0, 0xB856, 0xA5DD, 0xA872, /* 0xB0 */ 0xA871, 0xA870, 0, 0, 0, 0xCDA4, 0, 0, /* 0xC0 */ 0xAAC4, 0xAAC3, 0, 0xACEE, 0, 0xCFFA, 0xCFFD, 0xCFFB, /* 0xC0 */ 0, 0xACEC, 0xACED, 0, 0, 0xCFF9, 0xCFFC, 0, /* 0xD0 */ 0xAFB5, 0, 0, 0, 0xD2F3, 0xD2F5, 0xD2F4, 0xAFB2, /* 0xD0 */ 0xD2EF, 0, 0, 0xAFB0, 0xAFAF, 0, 0xAFB3, 0xAFB1, /* 0xE0 */ 0, 0xAFB4, 0xD2F2, 0xD2ED, 0xD2EE, 0xD2F1, 0xD2F0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0xD6C6, 0xD6C7, /* 0xF0 */ 0xD6C5, 0, 0xD6C4, 0xB2BE /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_7A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xB57D, 0, 0xDAD6, 0xDAD8, 0xDADA, 0xB57C, 0, 0, /* 0x00 */ 0xB57A, 0, 0xDAD7, 0xB57B, 0xDAD9, 0xB579, 0, 0, /* 0x00 */ 0xDF41, 0xDEF7, 0xDEFA, 0xDEFE, 0xB85A, 0xDEFC, 0, 0xDEFB, /* 0x10 */ 0xDEF8, 0xDEF9, 0xB858, 0xDF40, 0xB857, 0, 0xB85C, 0xB85B, /* 0x10 */ 0xB859, 0, 0xDEFD, 0, 0, 0, 0xE349, 0, /* 0x20 */ 0xE348, 0, 0, 0xE344, 0, 0, 0xBAD8, 0xE347, /* 0x20 */ 0xE346, 0xBAD9, 0, 0, 0, 0, 0, 0xBD5E, /* 0x30 */ 0, 0xE6D2, 0, 0xBD5F, 0xBD5B, 0xBD5D, 0, 0xBD5A, /* 0x30 */ 0xBD5C, 0, 0, 0, 0xEAAF, 0, 0xBF70, 0xEAB1, /* 0x40 */ 0xEAB0, 0, 0xE345, 0xBF72, 0xBF71, 0xBF6E, 0xBF6F, 0, /* 0x40 */ 0, 0, 0, 0, 0xEDB5, 0, 0xEDB3, 0xC14A, /* 0x50 */ 0xEDB4, 0, 0xEDB6, 0xEDB2, 0xEDB1, 0, 0, 0xF060, /* 0x50 */ 0xC2AA, 0xC2A8, 0xC2A9, 0, 0, 0, 0, 0xF2A6, /* 0x60 */ 0xF2A7, 0xC3AD, 0, 0xC3AC, 0xF4A3, 0xF4A4, 0xF4A2, 0, /* 0x60 */ 0xF6F8, 0xF6F9, 0, 0, 0xA5DE, 0xCA48, 0xA873, 0, /* 0x70 */ 0xCDA5, 0xAAC6, 0xAAC5, 0xCDA6, 0, 0, 0xD040, 0xACEF, /* 0x70 */ 0xCFFE, 0xACF0, 0, 0, 0xAFB6, 0xD2F8, 0xD2F6, 0xD2FC, /* 0x80 */ 0xAFB7, 0xD2F7, 0xD2FB, 0xD2F9, 0xD2FA, 0, 0, 0xD6C8, /* 0x80 */ 0xD6CA, 0, 0xB2BF, 0, 0xD6C9, 0xB2C0, 0xB5A2, 0xB5A1, /* 0x90 */ 0xB57E, 0xDADB, 0, 0, 0, 0, 0xDF44, 0xB85D, /* 0x90 */ 0xB85E, 0, 0xDF43, 0xDF42, 0, 0, 0, 0, /* 0xA0 */ 0xE34A, 0xBADB, 0xBADA, 0xE34B, 0xE34C, 0, 0xBD61, 0xBD60, /* 0xA0 */ 0, 0xEAB5, 0xE6D3, 0xE6D5, 0xE6D4, 0xEAB4, 0xEAB2, 0xEAB6, /* 0xB0 */ 0xEAB3, 0, 0xBF73, 0, 0, 0, 0xEDB7, 0xC14B, /* 0xB0 */ 0xEDB8, 0xEDB9, 0, 0, 0xC2AB, 0xC2AC, 0, 0xC475, /* 0xC0 */ 0, 0, 0xC5D1, 0xA5DF, 0, 0, 0, 0, /* 0xC0 */ 0, 0xD041, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0xD2FD, 0xAFB8, 0, 0, 0, 0, 0, 0xB3BA, /* 0xD0 */ 0xB3B9, 0, 0, 0xB5A4, 0xDADD, 0xB5A3, 0xDADC, 0, /* 0xE0 */ 0, 0, 0, 0xDF45, 0, 0xBADC, 0xE34D, 0xBADD, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0xC476, 0xF4A5, /* 0xF0 */ 0, 0xA6CB, 0xAAC7, 0xCDA7, 0, 0xACF2, 0, 0xACF1 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_7B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD042, 0xD043, 0, 0, 0xD340, 0xD342, 0xAFB9, 0, /* 0x00 */ 0xD344, 0xD347, 0xD345, 0, 0, 0, 0xD346, 0xD343, /* 0x00 */ 0xD2FE, 0xAFBA, 0xD348, 0xD341, 0, 0, 0, 0, /* 0x10 */ 0xD6D3, 0xB2C6, 0xD6DC, 0xB2C3, 0, 0xD6D5, 0xB2C7, 0, /* 0x10 */ 0xB2C1, 0, 0xD6D0, 0xD6DD, 0xD6D1, 0xD6CE, 0xB2C5, 0, /* 0x20 */ 0xB2C2, 0, 0xD6D4, 0xD6D7, 0xB2C4, 0xD6D8, 0xB2C8, 0xD6D9, /* 0x20 */ 0xD6CF, 0xD6D6, 0xD6DA, 0xD6D2, 0xD6CD, 0xD6CB, 0, 0, /* 0x30 */ 0xD6DB, 0, 0, 0xDADF, 0, 0, 0, 0, /* 0x30 */ 0xDAE4, 0, 0, 0, 0xDAE0, 0xDAE6, 0xB5A7, 0xD6CC, /* 0x40 */ 0xDAE1, 0xB5A5, 0xDADE, 0xB5AC, 0xDAE2, 0xB5AB, 0xDAE3, 0xB5AD, /* 0x40 */ 0xB5A8, 0xB5AE, 0xB5A9, 0, 0xB5AA, 0, 0xB5A6, 0, /* 0x50 */ 0xDAE5, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0xB861, 0xDF50, 0, 0xDF53, 0xDF47, 0xDF4C, 0xDF46, 0xB863, /* 0x60 */ 0, 0xDF4A, 0, 0, 0, 0xDF48, 0xB862, 0, /* 0x60 */ 0xDF4F, 0xDF4E, 0xDF4B, 0xDF4D, 0xDF49, 0xBAE1, 0xDF52, 0xB85F, /* 0x70 */ 0xDF51, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0xE35D, 0, 0xBAE8, 0xE358, 0, 0xBAE7, /* 0x80 */ 0xE34E, 0, 0xE350, 0xBAE0, 0xE355, 0xE354, 0xE357, 0xBAE5, /* 0x80 */ 0xE352, 0xE351, 0, 0, 0xBAE4, 0xBADF, 0xE353, 0xBAE2, /* 0x90 */ 0xE359, 0xE35B, 0, 0xE356, 0xE34F, 0xBAE3, 0, 0, /* 0x90 */ 0xBD69, 0xBADE, 0, 0, 0xE35C, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0xE6D9, 0xBD62, 0, 0xE6DB, /* 0xA0 */ 0, 0xBD63, 0, 0, 0xBD65, 0xE6DE, 0, 0xE6D6, /* 0xB0 */ 0xBAE6, 0xE6DC, 0, 0, 0, 0, 0xE6D8, 0, /* 0xB0 */ 0xB860, 0xBD68, 0, 0, 0xBD64, 0, 0xBD66, 0xBD67, /* 0xC0 */ 0, 0xBF76, 0xE6DD, 0xE6D7, 0xBD6A, 0, 0xE6DA, 0, /* 0xC0 */ 0, 0, 0, 0, 0xEAC0, 0xEABB, 0, 0, /* 0xD0 */ 0xEAC5, 0xBF74, 0xEABD, 0xBF78, 0xEAC3, 0xEABA, 0xEAB7, 0xEAC6, /* 0xD0 */ 0xC151, 0xBF79, 0xEAC2, 0xEAB8, 0xBF77, 0xEABC, 0xBF7B, 0xEAB9, /* 0xE0 */ 0xEABE, 0xBF7A, 0xEAC1, 0xEAC4, 0, 0, 0, 0, /* 0xE0 */ 0xEDCB, 0xEDCC, 0xEDBC, 0xEDC3, 0xEDC1, 0, 0, 0xC14F, /* 0xF0 */ 0xEDC8, 0xEABF, 0, 0xEDBF, 0, 0xEDC9, 0xC14E, 0xEDBE /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_7C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xEDBD, 0xEDC7, 0xEDC4, 0xEDC6, 0, 0xEDBA, 0xEDCA, 0xC14C, /* 0x00 */ 0, 0xEDC5, 0xEDCE, 0xEDC2, 0xC150, 0xC14D, 0xEDC0, 0xEDBB, /* 0x00 */ 0xEDCD, 0xBF75, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0, 0xF063, 0, 0, 0xF061, 0xF067, 0xC2B0, 0xF065, /* 0x10 */ 0xF064, 0xC2B2, 0xF06A, 0xC2B1, 0, 0xF06B, 0xF068, 0xC2AE, /* 0x20 */ 0xF069, 0xF062, 0xC2AF, 0xC2AD, 0xF2AB, 0xF066, 0, 0, /* 0x20 */ 0xF06C, 0, 0, 0xF2A8, 0, 0, 0, 0xC3B2, /* 0x30 */ 0xC3B0, 0xF2AA, 0, 0xF2AC, 0xF2A9, 0xC3B1, 0xC3AE, 0xC3AF, /* 0x30 */ 0xC3B3, 0, 0, 0xC478, 0, 0xF4AA, 0, 0xF4A9, /* 0x40 */ 0xF4A7, 0xF4A6, 0xF4A8, 0, 0xC477, 0xC479, 0, 0, /* 0x40 */ 0xC4F0, 0, 0, 0xF5E5, 0xF5E4, 0, 0, 0xF6FA, /* 0x50 */ 0, 0xF6FC, 0xF6FE, 0xF6FD, 0xF6FB, 0, 0, 0xC5A3, /* 0x50 */ 0xC5A2, 0, 0, 0xC5D3, 0xC5D2, 0xC5D4, 0xF7ED, 0xF7EC, /* 0x60 */ 0, 0xF8FB, 0xF8B8, 0xF8FC, 0xC658, 0, 0xC659, 0xF96D, /* 0x60 */ 0, 0, 0xC67E, 0xA6CC, 0, 0xCDA8, 0, 0, /* 0x70 */ 0xD045, 0xD046, 0xD044, 0, 0, 0xACF3, 0, 0xD047, /* 0x70 */ 0xD048, 0xD049, 0, 0, 0xD349, 0xD34F, 0, 0, /* 0x80 */ 0xD34D, 0xAFBB, 0xD34B, 0, 0xD34C, 0xD34E, 0, 0, /* 0x80 */ 0, 0xD34A, 0xB2C9, 0, 0xD6DE, 0xB2CB, 0xD6E0, 0xB2CA, /* 0x90 */ 0xD6DF, 0, 0, 0, 0, 0, 0xDAE8, 0xB5AF, /* 0x90 */ 0, 0xDAEA, 0xDAE7, 0xD6E1, 0, 0xB5B0, 0, 0xF9DB, /* 0xA0 */ 0xDAE9, 0, 0, 0, 0, 0, 0, 0xDF56, /* 0xA0 */ 0, 0xB864, 0xDF54, 0xB865, 0xDF55, 0xB866, 0, 0, /* 0xB0 */ 0, 0xBAE9, 0xE361, 0xE35E, 0xE360, 0xBAEA, 0xBAEB, 0xE35F, /* 0xB0 */ 0, 0, 0, 0, 0, 0xE6DF, 0, 0, /* 0xC0 */ 0xE6E0, 0, 0xBD6B, 0xE6E2, 0xE6E1, 0, 0xA261, 0, /* 0xC0 */ 0xEACA, 0xEACB, 0xEAC7, 0, 0xEAC8, 0xBF7C, 0xBF7D, 0xEAC9, /* 0xD0 */ 0, 0xC157, 0, 0, 0xC153, 0xC158, 0xC154, 0xC156, /* 0xD0 */ 0xC152, 0, 0xC155, 0, 0, 0, 0, 0xC2B3, /* 0xE0 */ 0xEDCF, 0, 0xF2AE, 0, 0xF2AD, 0, 0xF4AB, 0xC47A, /* 0xE0 */ 0xC47B, 0xF741, 0xF5E6, 0, 0xF740, 0, 0xF8FD, 0xF9A4, /* 0xF0 */ 0xA6CD, 0, 0, 0xA874, 0, 0xCDA9, 0xAAC8 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_7D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xACF6, 0xD04C, 0xACF4, 0xD04A, 0xACF9, 0xACF5, 0xACFA, 0xACF8, /* 0x00 */ 0xD04B, 0xACF7, 0xAFBF, 0xAFBE, 0xD35A, 0xAFC7, 0xD353, 0xD359, /* 0x00 */ 0xAFC3, 0xD352, 0xD358, 0xD356, 0xAFC2, 0xAFC4, 0xD355, 0xAFBD, /* 0x10 */ 0xD354, 0xAFC8, 0xAFC5, 0xAFC9, 0xAFC6, 0xD351, 0xD350, 0xD357, /* 0x10 */ 0xAFC0, 0xAFBC, 0xAFC1, 0, 0, 0, 0, 0, /* 0x20 */ 0xD6F0, 0xD6E9, 0, 0xB5B5, 0xD6E8, 0, 0xB2CF, 0xB2D6, /* 0x20 */ 0xB2D3, 0xB2D9, 0xB2D8, 0xB2D4, 0, 0xD6E2, 0xD6E5, 0, /* 0x30 */ 0xD6E4, 0xB2D0, 0xD6E6, 0xD6EF, 0xB2D1, 0xD6E3, 0xD6EC, 0xD6ED, /* 0x30 */ 0xB2D2, 0xD6EA, 0xB2D7, 0xB2CD, 0xB2D5, 0xD6E7, 0xB2CC, 0xD6EB, /* 0x40 */ 0, 0, 0xD6EE, 0, 0, 0, 0xDAFB, 0xDAF2, /* 0x40 */ 0xB5B2, 0xDAF9, 0xDAF6, 0xDAEE, 0xDAF7, 0xB5B4, 0xDAEF, 0, /* 0x50 */ 0xDAEB, 0, 0, 0xB86C, 0xDAF4, 0, 0xB5B1, 0xDAFA, /* 0x50 */ 0, 0xB5B8, 0xB5BA, 0xDAED, 0, 0, 0xB5B9, 0xDAF0, /* 0x60 */ 0xB5B3, 0xDAF8, 0xDAF1, 0xDAF5, 0, 0xDAF3, 0xB5B6, 0xDAEC, /* 0x60 */ 0xB5BB, 0xB2CE, 0xB5B7, 0xB5BC, 0, 0, 0, 0, /* 0x70 */ 0, 0xB868, 0xDF5D, 0xDF5F, 0xDF61, 0xDF65, 0, 0xDF5B, /* 0x70 */ 0xDF59, 0xB86A, 0, 0xDF60, 0xDF64, 0xDF5C, 0xDF58, 0, /* 0x80 */ 0xDF57, 0, 0, 0, 0xDF62, 0xDF5A, 0xDF5E, 0xB86B, /* 0x80 */ 0, 0xB869, 0xDF66, 0xB867, 0xDF63, 0, 0xE372, 0, /* 0x90 */ 0, 0, 0, 0, 0xBAEE, 0xE36A, 0xBD78, 0xE374, /* 0x90 */ 0xBAF1, 0xE378, 0xBAF7, 0xE365, 0, 0, 0xE375, 0xE362, /* 0xA0 */ 0, 0xE377, 0xE366, 0, 0xBAFE, 0xBAFB, 0xE376, 0xE370, /* 0xA0 */ 0xBAED, 0xBAF5, 0xBAF4, 0, 0xBAF3, 0xBAF9, 0, 0xE363, /* 0xB0 */ 0xBAFA, 0xE371, 0xBAF6, 0xBAEC, 0xE373, 0xBAEF, 0xBAF0, 0xBAF8, /* 0xB0 */ 0xE368, 0xE367, 0xE364, 0, 0xE36C, 0xE369, 0xE36D, 0xBAFD, /* 0xC0 */ 0, 0xE379, 0xBAF2, 0xE36E, 0xE36F, 0, 0xE36B, 0, /* 0xC0 */ 0, 0, 0xBAFC, 0, 0, 0, 0, 0xE6E7, /* 0xD0 */ 0xBD70, 0xBD79, 0xBD75, 0xE6E4, 0, 0xBD72, 0xBD76, 0xE6F0, /* 0xD0 */ 0xBD6C, 0xE6E8, 0, 0xBD74, 0, 0, 0xE6EB, 0xE6E6, /* 0xE0 */ 0xBD73, 0xBD77, 0xE6E5, 0, 0xBD71, 0, 0xE6EF, 0xBD6E, /* 0xE0 */ 0xE6EE, 0xE6ED, 0xBD7A, 0xE572, 0xBD6D, 0, 0xE6EC, 0xE6E3, /* 0xF0 */ 0, 0xBD7B, 0xE6EA, 0xBD6F /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_7E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE6E9, 0, 0, 0, 0, /* 0x00 */ 0xBFA2, 0xBFA7, 0xBF7E, 0xEAD8, 0xEACF, 0xEADB, 0xEAD3, 0xEAD9, /* 0x00 */ 0xBFA8, 0xBFA1, 0xEACC, 0xEAD2, 0xEADC, 0xEAD5, 0xEADA, 0xEACE, /* 0x10 */ 0, 0, 0xEAD6, 0xBFA3, 0xEAD4, 0xBFA6, 0xBFA5, 0xEAD0, /* 0x10 */ 0xEAD1, 0xEACD, 0xEAD7, 0xBFA4, 0xEADE, 0xEADD, 0, 0, /* 0x20 */ 0, 0xEDDA, 0xEDD6, 0xC15F, 0, 0xEDD0, 0xC159, 0xC169, /* 0x20 */ 0xEDDC, 0xC161, 0xC15D, 0xEDD3, 0xC164, 0xC167, 0xEDDE, 0xC15C, /* 0x30 */ 0xEDD5, 0xC165, 0xEDE0, 0xEDDD, 0xEDD1, 0xC160, 0xC15A, 0xC168, /* 0x30 */ 0xEDD8, 0xC163, 0xEDD2, 0xC15E, 0xEDDF, 0xC162, 0xC15B, 0xEDD9, /* 0x40 */ 0xC166, 0xEDD7, 0, 0, 0xEDDB, 0, 0, 0, /* 0x40 */ 0xF06E, 0xF074, 0xC2B9, 0xF077, 0xC2B4, 0xC2B5, 0xF06F, 0xF076, /* 0x50 */ 0xF071, 0xC2BA, 0xC2B7, 0, 0xF06D, 0, 0xC2B6, 0xF073, /* 0x50 */ 0xF075, 0xC2B8, 0xF072, 0xF070, 0, 0, 0, 0, /* 0x60 */ 0xF2B8, 0xC3B7, 0xC3B8, 0xC3B4, 0, 0xC3B5, 0, 0xF2B4, /* 0x60 */ 0xF2B2, 0, 0xF2B6, 0xC3BA, 0xF2B7, 0xF2B0, 0xF2AF, 0xF2B3, /* 0x70 */ 0xF2B1, 0xC3B6, 0xF2B5, 0xF4AC, 0xC47E, 0xC47D, 0xF4AD, 0, /* 0x70 */ 0xF4AF, 0xF4AE, 0xC4A1, 0, 0, 0, 0xF5EB, 0xF5E8, /* 0x80 */ 0xF5E9, 0, 0xF5E7, 0xF5EA, 0xC4F2, 0xF5EC, 0, 0xC4F1, /* 0x80 */ 0, 0xF742, 0, 0xC5D5, 0xC5D7, 0xF7EE, 0xC5D6, 0xF8B9, /* 0x90 */ 0xF940, 0xF942, 0xF8FE, 0xF941, 0xC66C /* 0x90 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_7F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA6CE, 0, /* 0x30 */ 0xACFB, 0xD26F, 0xAFCA, 0, 0, 0xB2DA, 0xDAFC, 0xDAFD, /* 0x30 */ 0, 0, 0, 0xEADF, 0xC16A, 0xEDE1, 0, 0, /* 0x40 */ 0xC2BB, 0, 0xF2BA, 0xF2B9, 0xC4A2, 0xF5ED, 0, 0xF743, /* 0x40 */ 0xC5F8, 0xCA49, 0, 0, 0xAAC9, 0xA875, 0, 0, /* 0x50 */ 0xD04D, 0, 0, 0xD360, 0xD35B, 0xD35F, 0xD35D, 0xAFCB, /* 0x50 */ 0xD35E, 0xD35C, 0, 0xD6F1, 0, 0xDAFE, 0xDB40, 0xDF69, /* 0x60 */ 0xDF6A, 0xB86E, 0xB86F, 0xDF68, 0xDF6B, 0xDF67, 0xB86D, 0, /* 0x60 */ 0xBB40, 0, 0xB870, 0xE37A, 0, 0xBD7C, 0xE6F1, 0xBD7D, /* 0x70 */ 0, 0xBFA9, 0xEAE2, 0xEAE0, 0xEAE1, 0xEDE4, 0xEDE3, 0xEDE2, /* 0x70 */ 0, 0, 0, 0xF2BB, 0, 0xC3B9, 0xF2BC, 0xF744, /* 0x80 */ 0xC5F9, 0xF8BA, 0xA6CF, 0xAACB, 0xAACA, 0xD04F, 0xACFC, 0, /* 0x80 */ 0, 0xD04E, 0xD362, 0, 0xAFCC, 0xD6F2, 0xD361, 0, /* 0x90 */ 0, 0, 0xB2DC, 0xD6F5, 0xD6F3, 0xD6F4, 0xB2DB, 0, /* 0x90 */ 0xDB42, 0xDB43, 0xDB41, 0, 0xB873, 0xDF6D, 0xDF6C, 0xDF6E, /* 0xA0 */ 0xB872, 0xB871, 0, 0, 0xE6F2, 0xE6F4, 0, 0xBD7E, /* 0xA0 */ 0xE6F3, 0xEAE3, 0xBFAA, 0xF079, 0, 0xF078, 0xC3BB, 0xF2BD, /* 0xB0 */ 0xC3BD, 0xC3BC, 0xF4B0, 0xF5EE, 0xC4F3, 0xA6D0, 0xD050, 0xACFD, /* 0xB0 */ 0xD365, 0xAFCE, 0xD364, 0xD363, 0, 0xAFCD, 0, 0xD6FB, /* 0xC0 */ 0, 0xD6FD, 0xD6F6, 0xD6F7, 0xB2DD, 0xD6F8, 0xB2DE, 0xD6FC, /* 0xC0 */ 0xD6F9, 0xD6FA, 0xB2DF, 0, 0xB5BE, 0xB5BF, 0, 0xDB44, /* 0xD0 */ 0, 0, 0, 0xDF6F, 0xDF70, 0, 0xE37E, 0xBB43, /* 0xD0 */ 0xBB41, 0xBB42, 0xE37B, 0xE37C, 0, 0xE37D, 0xE6F9, 0, /* 0xE0 */ 0xE6FA, 0xBDA1, 0xE6F7, 0xE6F6, 0xE6F8, 0xE6F5, 0xBFAD, 0xEAE4, /* 0xE0 */ 0xBFAB, 0xBFAC, 0xEDE6, 0xC16B, 0xEDE5, 0xEFA8, 0, 0xF07A, /* 0xF0 */ 0xF07B, 0xC2BC, 0, 0xC2BD, 0xC16C, 0xF2BE, 0xF2BF, 0xF4B1 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_80[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC4A3, 0xA6D1, 0, 0xA6D2, 0xACFE, 0xAACC, 0xAFCF, 0xD051, /* 0x00 */ 0, 0, 0, 0xB5C0, 0xA6D3, 0xAD41, 0xD052, 0xD053, /* 0x00 */ 0xAD40, 0xAD42, 0xA6D4, 0, 0xD054, 0xAFD1, 0xD366, 0xAFD3, /* 0x10 */ 0xAFD0, 0xAFD2, 0, 0xD741, 0xB2E0, 0, 0xD740, 0xD6FE, /* 0x10 */ 0, 0xDF71, 0, 0, 0xE3A1, 0, 0xBDA2, 0, /* 0x20 */ 0xBFAE, 0xEAE6, 0xEAE5, 0, 0xEDE7, 0, 0, 0, /* 0x20 */ 0xF5EF, 0, 0, 0xA6D5, 0xCB73, 0xCDAA, 0xAD43, 0xD055, /* 0x30 */ 0, 0xD368, 0, 0, 0, 0xAFD4, 0xD367, 0xAFD5, /* 0x30 */ 0, 0, 0, 0xD743, 0, 0, 0xB2E2, 0xD742, /* 0x40 */ 0xD744, 0, 0xB2E1, 0, 0, 0, 0, 0xDB46, /* 0x40 */ 0xDB47, 0xDB45, 0xB5C1, 0, 0, 0, 0xB874, 0, /* 0x50 */ 0xB875, 0, 0xBB45, 0, 0xE3A3, 0xE3A2, 0xBB44, 0, /* 0x50 */ 0, 0, 0, 0, 0xE6FB, 0, 0, 0xE6FC, /* 0x60 */ 0, 0, 0, 0, 0xEAE7, 0, 0, 0xC170, /* 0x60 */ 0xC16F, 0xC16D, 0xC16E, 0xC171, 0, 0xF07C, 0xC2BF, 0xC2BE, /* 0x70 */ 0xF2C0, 0xF4B2, 0, 0, 0, 0xC5A5, 0xC5A4, 0xA6D6, /* 0x70 */ 0, 0, 0xD1FB, 0, 0xB877, 0xB5C2, 0xB876, 0xBB46, /* 0x80 */ 0, 0xA6D7, 0xC9A9, 0xA6D8, 0xA6D9, 0, 0, 0xCDAB, /* 0x80 */ 0xCB76, 0, 0xCB77, 0xA877, 0, 0xCB74, 0xA876, 0, /* 0x90 */ 0xA879, 0xCB75, 0xA87B, 0xA87A, 0xCB78, 0xA878, 0, 0, /* 0x90 */ 0, 0xAAD1, 0xAACF, 0xCDAD, 0, 0xAACE, 0, 0, /* 0xA0 */ 0, 0xAAD3, 0xAAD5, 0xAAD2, 0, 0xCDB0, 0xCDAC, 0xAAD6, /* 0xA0 */ 0, 0xAAD0, 0xA87C, 0, 0xAAD4, 0xCDAF, 0, 0, /* 0xB0 */ 0xCDAE, 0, 0xAACD, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0xD05B, 0xAD47, 0xAD48, 0xD05D, 0, 0xD057, /* 0xC0 */ 0xD05A, 0xD063, 0xD061, 0, 0xAD49, 0xD067, 0xAD4C, 0xD064, /* 0xC0 */ 0xD05C, 0xD059, 0, 0, 0xDB49, 0xD062, 0xAD44, 0xD065, /* 0xD0 */ 0xD056, 0xD05F, 0xAD46, 0xAD4B, 0xD060, 0xAD4F, 0xAD4D, 0, /* 0xD0 */ 0xD058, 0xAD4A, 0, 0xD05E, 0xAD4E, 0xAD45, 0xD066, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0xAFDA, 0, 0xAFE3, /* 0xE0 */ 0xAFD8, 0xAFD6, 0xD36A, 0xAFDE, 0xAFDB, 0xD36C, 0, 0, /* 0xF0 */ 0xAFDD, 0xD36B, 0xD369, 0xD36E, 0xAFE2, 0xAFE0, 0xDB48 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_81[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD36F, 0xD36D, 0xAFD7, 0, 0, 0xAFD9, 0xAFDC, 0, /* 0x00 */ 0xAFDF, 0, 0xAFE1, 0, 0, 0, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0, 0xD74E, 0xB2E4, 0, /* 0x10 */ 0xD745, 0xD747, 0, 0xD748, 0, 0xD750, 0xD74C, 0xD74A, /* 0x10 */ 0, 0xD74D, 0xD751, 0xB2E5, 0xB2E9, 0xD746, 0, 0xD74F, /* 0x20 */ 0, 0xB2E7, 0, 0xB2E6, 0xD74B, 0xD749, 0, 0xB2E3, /* 0x20 */ 0xB2E8, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0xB5C8, 0xDB51, 0, 0, 0xDB4F, 0xB5CA, 0, /* 0x30 */ 0, 0, 0, 0xDB4A, 0xDFA1, 0, 0xB5C9, 0xDB4E, /* 0x40 */ 0, 0, 0xDB4B, 0xB5C5, 0xB5CB, 0xDB50, 0xB5C7, 0xDB4D, /* 0x40 */ 0xBB47, 0xB5C6, 0xDB4C, 0xB5CC, 0xB5C4, 0xB5C3, 0, 0, /* 0x50 */ 0, 0, 0, 0xDF77, 0xDF75, 0, 0xDF7B, 0, /* 0x50 */ 0xDF73, 0xDFA2, 0xDF78, 0, 0xDF72, 0xB87B, 0xB8A3, 0xDF7D, /* 0x60 */ 0, 0xDF76, 0, 0xB87E, 0, 0, 0xB87C, 0xDF7E, /* 0x60 */ 0xB879, 0xB878, 0xDF79, 0xB87D, 0xB5CD, 0, 0xDF7C, 0xDF74, /* 0x70 */ 0xB87A, 0xB8A1, 0xB8A2, 0, 0, 0, 0, 0xBB4C, /* 0x70 */ 0xBB48, 0, 0xBB4D, 0xE3A6, 0, 0, 0xE3A5, 0xE3A7, /* 0x80 */ 0xBB4A, 0xE3A4, 0xBB4B, 0xE3AA, 0xE3A9, 0xE3A8, 0, 0xBB49, /* 0x80 */ 0, 0, 0, 0, 0, 0xE741, 0, 0xE744, /* 0x90 */ 0xBDA8, 0xE743, 0xBDA7, 0xBDA3, 0xBDA4, 0xBDA5, 0xE740, 0xE6FE, /* 0x90 */ 0xBDA6, 0, 0xE742, 0xE6FD, 0, 0, 0xEAE9, 0xEAF3, /* 0xA0 */ 0xBFB1, 0xBFB0, 0, 0xEAED, 0xEAEF, 0, 0xEAEA, 0, /* 0xA0 */ 0xEAEE, 0xEAE8, 0xEAF1, 0xBFAF, 0xEAF0, 0xEAEC, 0, 0xEAF2, /* 0xB0 */ 0, 0xEAEB, 0xC174, 0xEDE8, 0xEDEE, 0xC178, 0xC17A, 0xC177, /* 0xB0 */ 0xC176, 0, 0xC175, 0xC173, 0xEDE9, 0xEDEC, 0xC172, 0xEDED, /* 0xC0 */ 0, 0xC179, 0xEDEB, 0, 0xEDEA, 0xC2C0, 0, 0xC2C1, /* 0xC0 */ 0xF0A1, 0xF07D, 0xF07E, 0, 0, 0xF2C2, 0, 0xF2C1, /* 0xD0 */ 0xC3BE, 0xF4B4, 0xC4A4, 0xF4B3, 0, 0xF5F0, 0xF745, 0xC5A6, /* 0xD0 */ 0xF943, 0xF944, 0xC5D8, 0xA6DA, 0, 0xAAD7, 0xDB52, 0xBB4E, /* 0xE0 */ 0xC17B, 0xEDEF, 0xA6DB, 0, 0xAFE5, 0xAFE4, 0xDB53, 0, /* 0xE0 */ 0, 0, 0xEAF4, 0xA6DC, 0xAD50, 0, 0, 0xDB54, /* 0xF0 */ 0xDB55, 0xDB56, 0xBB4F, 0xBFB2, 0xA6DD, 0, 0xAAD8, 0xD068 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_82[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xAFE6, 0xD370, 0xB2EA, 0, 0xDB57, 0xB8A4, 0, 0xBB50, /* 0x00 */ 0xBFB3, 0xC17C, 0xC2C2, 0xF4B5, 0xA6DE, 0xAAD9, 0, 0, /* 0x00 */ 0xAFE7, 0xD752, 0xB5CE, 0, 0xBB51, 0xE3AB, 0xE745, 0, /* 0x10 */ 0, 0, 0, 0xA6DF, 0xB5CF, 0xDFA3, 0xBB52, 0xA6E0, /* 0x10 */ 0xCDB1, 0xD069, 0xAD51, 0, 0, 0xD372, 0, 0, /* 0x20 */ 0xAFEA, 0, 0xAFE8, 0xAFE9, 0xAFEB, 0, 0, 0xD371, /* 0x20 */ 0, 0, 0xD757, 0xD754, 0xD756, 0xB2EB, 0xB2ED, 0xB2EC, /* 0x30 */ 0xD753, 0xB2EE, 0xD755, 0, 0xDB58, 0xDB59, 0, 0xDB5A, /* 0x30 */ 0xDFA6, 0, 0xDFA7, 0, 0xDFA5, 0xDFA8, 0, 0xB8A5, /* 0x40 */ 0, 0xDFA4, 0, 0xBB53, 0, 0, 0xE74A, 0xE746, /* 0x40 */ 0xE749, 0xE74B, 0xE748, 0xE747, 0, 0xEAF5, 0xEAF6, 0xEAF7, /* 0x50 */ 0xBFB4, 0xBFB5, 0xEDF1, 0xEDF0, 0xEDF2, 0, 0xF0A3, 0xF0A2, /* 0x50 */ 0, 0xF2C4, 0, 0xF2C5, 0xF2C3, 0, 0xC4A5, 0, /* 0x60 */ 0xF4B6, 0xF4B7, 0, 0xF746, 0xF7EF, 0xF8BB, 0xA6E1, 0xA87D, /* 0x60 */ 0, 0xC17D, 0xA6E2, 0, 0xD758, 0xDB5B, 0, 0xC641, /* 0x70 */ 0xCA4A, 0, 0, 0, 0xCA4B, 0xCA4D, 0xA6E3, 0xCA4E, /* 0x70 */ 0xCA4C, 0, 0, 0xCBA2, 0xCBA3, 0xCB7B, 0, 0, /* 0x80 */ 0, 0, 0xCBA1, 0xA8A1, 0, 0xA8A2, 0xCB7C, 0xCB7A, /* 0x80 */ 0xCB79, 0xCB7D, 0xA87E, 0xCB7E, 0xD06A, 0, 0, 0, /* 0x90 */ 0xCDB6, 0xAADC, 0xCDB5, 0xCDB7, 0, 0xAADB, 0xCDBC, 0xAADF, /* 0x90 */ 0xCDB2, 0xCDC0, 0xCDC6, 0xAAE6, 0xCDC3, 0xAAE3, 0, 0xCDB9, /* 0xA0 */ 0xCDBF, 0xCDC1, 0, 0xCDB4, 0xAAE2, 0xAADD, 0xCDBA, 0xAAE4, /* 0xA0 */ 0xAAE7, 0xAAE1, 0, 0xAADA, 0xCDBE, 0xCDB8, 0xCDC5, 0xAAE9, /* 0xB0 */ 0xAAE5, 0xAAE0, 0xCDBD, 0xAFEC, 0xCDBB, 0xAADE, 0xAAE8, 0, /* 0xB0 */ 0xCDB3, 0, 0xCDC2, 0xCDC4, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0xAD62, 0xAD5C, 0xAD64, 0xAD61, 0xD071, 0xD074, 0xAD5D, /* 0xD0 */ 0, 0xD06B, 0, 0xAD56, 0xAD60, 0, 0xAD63, 0xAD65, /* 0xD0 */ 0xD0A2, 0xD077, 0, 0xAD55, 0xD0A1, 0xAD59, 0xAD57, 0xAD52, /* 0xE0 */ 0xD06F, 0, 0xD07E, 0xD073, 0xD076, 0xD0A5, 0, 0xAD66, /* 0xE0 */ 0xD07D, 0xAD5E, 0xD078, 0xD0A4, 0xD075, 0xD079, 0xD07C, 0, /* 0xF0 */ 0, 0xD06D, 0xD0A3, 0xD07B, 0, 0, 0xD06C /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_83[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xD070, 0xAD5F, 0xAD5A, 0xAD53, 0xAD58, 0xAD54, 0xAD67, 0xD06E, /* 0x00 */ 0xD3A5, 0xAD5B, 0, 0, 0xD07A, 0xCE41, 0, 0, /* 0x00 */ 0, 0, 0, 0, 0, 0, 0xD3A8, 0xAFFA, /* 0x10 */ 0, 0xD376, 0, 0xD3A3, 0xD37D, 0, 0xD3B2, 0, /* 0x10 */ 0xD3AA, 0, 0xD37E, 0, 0xD3A9, 0xD378, 0xD37C, 0xD3B5, /* 0x20 */ 0xAFFD, 0xD3AD, 0xD3A4, 0xAFED, 0xD3B3, 0xD374, 0, 0xD3AC, /* 0x20 */ 0, 0xAFFC, 0xAFF7, 0xD373, 0xAFF5, 0xAFF4, 0xAFF9, 0xD3AB, /* 0x30 */ 0xAFF1, 0xAFF8, 0xD072, 0xDB5C, 0xD3A6, 0, 0, 0xD37A, /* 0x30 */ 0xAFFB, 0xD37B, 0xD3A1, 0xAFFE, 0xD375, 0xD3AF, 0, 0xD3AE, /* 0x40 */ 0xD3B6, 0xAFF3, 0xAFF0, 0xD3B4, 0xD3B0, 0xD3A7, 0xD3A2, 0xAFF6, /* 0x40 */ 0xAFF2, 0xD377, 0xAFEE, 0xD3B1, 0xAFEF, 0, 0xD379, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0xD75E, 0xD760, 0xD765, 0xD779, 0xB2FC, /* 0x70 */ 0xB2F2, 0, 0xD75D, 0xB2FD, 0xB2FE, 0xD768, 0xD76F, 0xD775, /* 0x70 */ 0, 0xD762, 0, 0xD769, 0, 0, 0xB340, 0xD777, /* 0x80 */ 0xD772, 0xB2FA, 0xB2F8, 0xD76E, 0xD76A, 0xD75C, 0xB2EF, 0xD761, /* 0x80 */ 0xD759, 0, 0xB2F7, 0xB2F9, 0xD766, 0xD763, 0xB2F4, 0xD773, /* 0x90 */ 0xB2F1, 0xD764, 0xD77A, 0xD76C, 0, 0xD76B, 0xB2F0, 0, /* 0x90 */ 0xB2FB, 0, 0xB2F3, 0xD75A, 0xD75F, 0xD770, 0xD776, 0xB341, /* 0xA0 */ 0xD75B, 0xD767, 0xD76D, 0xB2F6, 0, 0, 0xD778, 0xD771, /* 0xA0 */ 0xD774, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0xB2F5, 0, 0xDB6C, /* 0xB0 */ 0xDB60, 0xB5D7, 0xDB7D, 0xDBA7, 0xDBAA, 0xB5D5, 0xDB68, 0xDBA3, /* 0xC0 */ 0xDB69, 0xDB77, 0xB5E2, 0xDB73, 0xB5DF, 0, 0xDB74, 0xDB5D, /* 0xC0 */ 0, 0xDBA4, 0, 0, 0xB5E8, 0xDBA1, 0xDB75, 0xDBAC, /* 0xD0 */ 0xDB70, 0xDFC8, 0, 0xDBAF, 0xB5E6, 0xDB6E, 0xDB7A, 0xB5E9, /* 0xD0 */ 0xB5D4, 0xDB72, 0xDBAD, 0xDB6B, 0xDB64, 0xDB6F, 0, 0xDB63, /* 0xE0 */ 0xDB61, 0xB5D0, 0xDBA5, 0xDB6A, 0xDBA8, 0, 0xDBA9, 0xB5D8, /* 0xE0 */ 0xB5DD, 0xB5D9, 0xB5E1, 0xDB7E, 0xB5DA, 0xDB76, 0xDB66, 0, /* 0xF0 */ 0xB5D2, 0xDB5E, 0xDBA2, 0xDBAB, 0xDB65, 0xB5E0, 0xDBB0, 0xDB71 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_84[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xDB6D, 0, 0xB5D1, 0xB5E5, 0, 0xDB7C, 0xB5E7, /* 0x00 */ 0, 0xDB78, 0xB5DC, 0xB5D6, 0xB5DE, 0xB5D3, 0xB5E4, 0xDB79, /* 0x00 */ 0xDB67, 0xDB7B, 0xDB62, 0xDBA6, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0xDBAE, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0xDB5F, 0, 0, 0, 0, /* 0x20 */ 0, 0xDFC7, 0, 0xDFDD, 0xB855, 0xDFCC, 0, 0xDFCA, /* 0x20 */ 0xDFB5, 0xB8A9, 0xDFC5, 0xDFD9, 0xDFC1, 0xB8B1, 0xDFD8, 0xDFBF, /* 0x30 */ 0xB5E3, 0xDFCF, 0xDFC0, 0xDFD6, 0xB8B0, 0xB8A8, 0, 0xDFAA, /* 0x30 */ 0xDFB2, 0, 0xDFCB, 0xDFC3, 0xDFDC, 0xDFC6, 0xB8B6, 0xDFD7, /* 0x40 */ 0, 0xB8AD, 0, 0xDFC9, 0xDFD1, 0xDFB6, 0xDFD0, 0, /* 0x40 */ 0xDFE1, 0xDFB1, 0xDFD2, 0, 0xDFDF, 0, 0xDFAB, 0xB5DB, /* 0x50 */ 0, 0xDFB9, 0xDFB8, 0xB8AF, 0, 0xDFBC, 0xDFBE, 0xDFCD, /* 0x50 */ 0xDFDE, 0xB8B2, 0, 0xB8B3, 0, 0xDFB0, 0xB8AB, 0xDFB4, /* 0x60 */ 0xDFDA, 0xB8B4, 0, 0xB8AC, 0xB8AE, 0xB8B5, 0xDFE0, 0xDFD3, /* 0x60 */ 0xDFCE, 0, 0, 0xDFBB, 0xDFBA, 0xB8AA, 0xDFAC, 0xB8A7, /* 0x70 */ 0xDFC4, 0xDFAD, 0xDFC2, 0, 0, 0xDFB7, 0xDFDB, 0, /* 0x70 */ 0, 0, 0xB8A6, 0, 0, 0, 0xDFB3, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0xDFAF, 0xDFD5, 0xDFAE, /* 0x80 */ 0xBB60, 0xE3D3, 0, 0, 0xE3C2, 0, 0, 0xE3AC, /* 0x90 */ 0xE3CA, 0xBB58, 0xE3BB, 0xE3C5, 0xBB5B, 0xE3BE, 0xBB59, 0xE3AF, /* 0x90 */ 0xE3CD, 0xE3AE, 0xE3C1, 0, 0xE3AD, 0, 0, 0xE3BF, /* 0xA0 */ 0xE3C8, 0xE3C6, 0xE3BA, 0xE3B5, 0xE3B3, 0, 0xE3B4, 0xE3C7, /* 0xA0 */ 0xE3D2, 0xE3BC, 0xBB5A, 0, 0xE3B7, 0, 0xE3CB, 0, /* 0xB0 */ 0xBB5D, 0xE3B6, 0xE3B0, 0xE3C0, 0xBB61, 0, 0, 0xBB55, /* 0xB0 */ 0xBB5E, 0xE3B8, 0xE3B2, 0, 0xBB57, 0xDFD4, 0xBB56, 0xE3C3, /* 0xC0 */ 0, 0xBB54, 0xBB63, 0xBB5C, 0xE3C4, 0xE3B9, 0xE3B1, 0xE3CC, /* 0xC0 */ 0xE3BD, 0xBB62, 0xE3D0, 0xBB5F, 0xE3CF, 0, 0xE3C9, 0xE3CE, /* 0xD0 */ 0, 0, 0, 0xE3D1, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0xE773, /* 0xE0 */ 0xE774, 0xE767, 0xE766, 0xE762, 0xBDB4, 0, 0xBDAC, 0xE776, /* 0xE0 */ 0xE775, 0xDFA9, 0xE75F, 0xE763, 0xE75D, 0, 0xE770, 0xE761, /* 0xF0 */ 0, 0xE777, 0xE75A, 0xE758, 0xE764, 0xE76E, 0xE769, 0xBDB6 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_85[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE74F, 0, 0xE76D, 0, 0, 0, 0xBDB7, 0xDFBD, /* 0x00 */ 0xE75B, 0xE752, 0xE755, 0xE77B, 0xE75C, 0xE753, 0xE751, 0xE74E, /* 0x00 */ 0, 0xBDB0, 0xE765, 0xBDAF, 0xBDB3, 0xE760, 0xE768, 0xBDA9, /* 0x10 */ 0xE778, 0xE77C, 0xBDAB, 0, 0xE757, 0xE76B, 0xE76F, 0xE754, /* 0x10 */ 0xE779, 0xBDB2, 0, 0xBDB1, 0xE74C, 0xBDB5, 0xE772, 0xE756, /* 0x20 */ 0xE76A, 0xE750, 0xE75E, 0xE759, 0xBDAD, 0xBDAE, 0xE76C, 0xE77D, /* 0x20 */ 0xE77A, 0xE771, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0xE74D, 0, 0xBDAA, 0xEB49, 0, /* 0x30 */ 0xEB40, 0xEB43, 0, 0xBFBB, 0xEB45, 0xEAF9, 0xEB41, 0xEB47, /* 0x40 */ 0xBFB8, 0xBFBC, 0xBFB6, 0, 0, 0xEAFB, 0xEB4C, 0, /* 0x40 */ 0, 0xEB46, 0, 0xEAFC, 0xEB55, 0xEB4F, 0xEAF8, 0xEE46, /* 0x50 */ 0xEAFE, 0xBFB7, 0, 0xEB4A, 0, 0xEB54, 0xBFBF, 0, /* 0x50 */ 0xEB51, 0xEAFD, 0xEB44, 0xEB48, 0xEB42, 0xEB56, 0xEB53, 0xEB50, /* 0x60 */ 0xBFB9, 0xBFBA, 0xBFBE, 0xEAFA, 0xEB57, 0xBFBD, 0xEB4D, 0, /* 0x60 */ 0, 0xEB4B, 0, 0, 0, 0xEB4E, 0xEE53, 0xEE40, /* 0x70 */ 0xEE45, 0xEE52, 0xEE44, 0xEDFB, 0xEE41, 0, 0xC1A2, 0, /* 0x70 */ 0xEDF4, 0xEE4D, 0xEE4F, 0xEDF3, 0xC1A1, 0xEE51, 0xEE49, 0xC1A8, /* 0x80 */ 0xEE50, 0xEE42, 0xC1AA, 0xEDF9, 0xEB52, 0xEE4A, 0xEE47, 0xEDF5, /* 0x80 */ 0xEE55, 0xC1A4, 0, 0, 0xC1A5, 0xEDF7, 0xEE48, 0, /* 0x90 */ 0xEE54, 0xEE4B, 0xEDFD, 0xC1A7, 0xC1A3, 0xEE4C, 0xEDFE, 0xEE56, /* 0x90 */ 0xEDF8, 0xEE43, 0xEE4E, 0xEDFA, 0xEDFC, 0, 0xC2CB, 0xEDF6, /* 0xA0 */ 0xC1A9, 0xC2C4, 0xC17E, 0, 0, 0, 0, 0xC1A6, /* 0xA0 */ 0xC2C8, 0xF0B3, 0, 0xF0A9, 0xF0A4, 0xF0AA, 0xF0B4, 0xF0B8, /* 0xB0 */ 0xF0B7, 0xC2CA, 0xC2C9, 0, 0, 0xF0AB, 0xF0B9, 0xF0AE, /* 0xB0 */ 0xF0A6, 0, 0xF0A8, 0xF0A7, 0xF0AD, 0xF0B2, 0xF0A5, 0xF0AC, /* 0xC0 */ 0xF0B1, 0xC2C7, 0, 0xF0AF, 0, 0xC2C5, 0xF0B0, 0xC2C3, /* 0xC0 */ 0xC2C6, 0xF2D5, 0xF0B5, 0, 0, 0xC3C2, 0, 0xF2CD, /* 0xD0 */ 0xF2D1, 0xF2C9, 0xF2CC, 0, 0xF2D4, 0xC3C0, 0xF2D9, 0xF2D2, /* 0xD0 */ 0, 0xF2CA, 0xF2DA, 0xF2D3, 0xC3C3, 0xC3C4, 0xF2D7, 0, /* 0xE0 */ 0xF2CB, 0xC3BF, 0xC3C1, 0xF2C6, 0xF2CE, 0xF2C8, 0, 0xF2D8, /* 0xE0 */ 0xF2D6, 0xF2C7, 0xF2CF, 0, 0, 0, 0xF4BE, 0xC3C5, /* 0xF0 */ 0xF2D0, 0xC4A7, 0xC4A9, 0xC4A6, 0, 0xF4C3, 0xF4BB, 0xF4B9 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_86[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xF4BD, 0xF4BA, 0, 0, 0xF4BF, 0xF4C1, 0xC4AA, 0xC4AC, /* 0x00 */ 0, 0xF4C0, 0xC4AD, 0xC4AB, 0xF4C2, 0, 0, 0, /* 0x00 */ 0, 0xC4A8, 0, 0, 0, 0, 0, 0xC4F4, /* 0x10 */ 0xF5F1, 0xF5F7, 0xC4F6, 0xF4BC, 0xF5F6, 0, 0xF5FD, 0xF5F4, /* 0x10 */ 0xF5FB, 0xF5FA, 0xF4B8, 0xF5F5, 0xF0B6, 0xF5FE, 0xF5F3, 0xF5F8, /* 0x20 */ 0, 0xF5FC, 0xF5F2, 0, 0xF74A, 0xC4F5, 0xF5F9, 0, /* 0x20 */ 0, 0xF7F4, 0xF74B, 0xF749, 0xF747, 0xF748, 0xF74C, 0, /* 0x30 */ 0xC5D9, 0xF7F2, 0xF7F0, 0xF7F5, 0xF7F3, 0, 0xF7F6, 0xC5DA, /* 0x30 */ 0xF7F1, 0, 0, 0xF8BC, 0, 0, 0xF945, 0xF946, /* 0x40 */ 0xF947, 0, 0, 0xF9C7, 0xF9BD, 0xCA4F, 0xAAEA, 0, /* 0x40 */ 0xAD68, 0, 0xD3B8, 0xD3B7, 0xB040, 0xB342, 0xD77C, 0, /* 0x50 */ 0, 0xD77B, 0, 0xB5EA, 0xB8B8, 0, 0xB8B7, 0xB8B9, /* 0x50 */ 0, 0xE3D4, 0xE77E, 0xEB58, 0xEB5A, 0xEB59, 0, 0xC1AB, /* 0x60 */ 0xEE57, 0xF0BA, 0xF9A5, 0xA6E4, 0, 0xCDC9, 0xCDCA, 0xCDC8, /* 0x60 */ 0xCDC7, 0xAAEB, 0, 0xD0A9, 0xD0A7, 0, 0, 0xD0A6, /* 0x70 */ 0, 0xAD69, 0xAD6B, 0xAD6A, 0xD0A8, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0xD3C4, 0xD3C1, 0xD3BF, /* 0x80 */ 0, 0, 0xB041, 0xD3C2, 0xB046, 0xD3BC, 0xD3CB, 0, /* 0x80 */ 0xD3CD, 0xD3BD, 0, 0xB043, 0xD3CE, 0xD3C9, 0xD3BB, 0xD3C0, /* 0x90 */ 0xD3CA, 0xD3C6, 0xD3C3, 0, 0xB048, 0xD3CC, 0xD3BE, 0, /* 0x90 */ 0, 0xD3C7, 0xD3B9, 0xB047, 0xB044, 0xD3C5, 0, 0xD3C8, /* 0xA0 */ 0xD3BA, 0xB045, 0xB042, 0, 0, 0, 0, 0xB34C, /* 0xA0 */ 0xD7A5, 0xB34B, 0, 0xD7A8, 0xD7AB, 0xB348, 0xB346, 0xD77E, /* 0xB0 */ 0xD7A9, 0xD7A7, 0xD7A4, 0xD7AC, 0xD7AD, 0xD7AF, 0xD7B0, 0xD77D, /* 0xB0 */ 0xB345, 0xD7A2, 0xD7A1, 0xD7AE, 0xB347, 0xD7A3, 0xB349, 0xB344, /* 0xC0 */ 0xD7A6, 0xB34D, 0, 0xB34A, 0xD7AA, 0, 0, 0, /* 0xC0 */ 0xB5F1, 0xDBBF, 0, 0xDBB4, 0xB5EE, 0, 0xDFE7, 0xDBBD, /* 0xD0 */ 0xDBB1, 0xB5EC, 0xDBB6, 0xB5EF, 0xDBBA, 0xDBB8, 0xB5F2, 0xB5EB, /* 0xD0 */ 0, 0, 0xDBB2, 0xDBB5, 0xB5F0, 0, 0xDBB3, 0, /* 0xE0 */ 0xDBBE, 0xDBBC, 0xDBB7, 0xDBB9, 0xDBBB, 0xB5ED, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0xDFE8, 0xDFEE, 0xDFE4, /* 0xF0 */ 0xDFEA, 0xB8BA, 0xDFE6, 0xB8C0, 0, 0, 0xB8BF /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_87[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xB8BE, 0xDFED, 0xB8C1, 0xB8C2, 0xDFE3, 0xDFF0, 0xB8C3, 0xB8BD, /* 0x00 */ 0xB8BC, 0xDFEC, 0xB8C4, 0xDFE2, 0xDFE5, 0xDFEF, 0xDFEB, 0, /* 0x00 */ 0, 0xE3F4, 0xE3E9, 0xB8BB, 0, 0, 0, 0, /* 0x10 */ 0xBB6A, 0xE3DD, 0xE3F2, 0xE3DE, 0xBB65, 0, 0xE3DB, 0, /* 0x10 */ 0xE3E4, 0xE3DC, 0xBB67, 0xE3D6, 0xE3F1, 0xBB68, 0xE3EE, 0xE3EF, /* 0x20 */ 0xE3D7, 0xBB6D, 0xE3E6, 0, 0xE3E0, 0xE3E7, 0xE3DA, 0, /* 0x20 */ 0xE3F3, 0xE3EB, 0xE3E5, 0xE3D5, 0xBB69, 0xE3EC, 0, 0xBB6C, /* 0x30 */ 0xE3F0, 0, 0xE3EA, 0xBB66, 0xE3E8, 0, 0xE3E2, 0xBB64, /* 0x30 */ 0xE3D9, 0xE3E1, 0xE3ED, 0xE3DF, 0, 0, 0xE3E3, 0, /* 0x40 */ 0, 0, 0, 0, 0xBDC1, 0xDFE9, 0xE7B2, 0xE7BB, /* 0x40 */ 0xE7B1, 0xE7AD, 0xE7AA, 0xBDC2, 0xE7A8, 0xBB6B, 0xE7A1, 0xBDC0, /* 0x50 */ 0xE7A7, 0xBDBF, 0xE7AC, 0xE7A9, 0xE7B9, 0xE7B4, 0xE7AE, 0xE7B3, /* 0x50 */ 0xBDBB, 0xE7AB, 0xE7BE, 0xE7A2, 0xE7A3, 0xE7BA, 0xBDBC, 0xE7BF, /* 0x60 */ 0xBDBE, 0xE7C0, 0xE7B0, 0xE3D8, 0xE7B6, 0xE7AF, 0xE7B8, 0xE7B5, /* 0x60 */ 0, 0, 0, 0xE7A6, 0xBDB9, 0xE7BD, 0xBDBA, 0xE7A4, /* 0x70 */ 0xBDBD, 0xEB64, 0xE7B7, 0xE7BC, 0, 0, 0, 0, /* 0x70 */ 0, 0xEB61, 0xBDB8, 0xBFC0, 0xEB6B, 0xEB67, 0, 0xEB65, /* 0x80 */ 0xEB60, 0xEB6F, 0, 0, 0, 0xBFC4, 0, 0xEB5C, /* 0x80 */ 0xEB68, 0xEB69, 0xEB5F, 0xEB5E, 0xEB6C, 0, 0xEB62, 0xEB5D, /* 0x90 */ 0xEB63, 0, 0xEB6E, 0xEB5B, 0xEB6D, 0xEB6A, 0xBFC2, 0xBFC1, /* 0x90 */ 0, 0, 0xBFC3, 0xEB66, 0xF0CB, 0, 0, 0, /* 0xA0 */ 0, 0, 0xEE59, 0xC1B1, 0xEE5D, 0xEE5A, 0xEE61, 0xEE67, /* 0xA0 */ 0xEE5C, 0, 0xEE70, 0xC1AE, 0xEE6A, 0xEE5F, 0xEE6B, 0xEE66, /* 0xB0 */ 0xEE6D, 0xEE5E, 0xC1B3, 0xC1B2, 0xEE60, 0xEE6E, 0xEE58, 0xEE6C, /* 0xB0 */ 0xC1AC, 0, 0xEE64, 0xEE63, 0xEE68, 0xEE5B, 0xC1B0, 0, /* 0xC0 */ 0xC1B4, 0xEE62, 0xEE69, 0xC1B5, 0xEE65, 0, 0, 0, /* 0xC0 */ 0, 0xC1AD, 0xC1AF, 0xF0C7, 0xF0C5, 0, 0, 0xF0CC, /* 0xD0 */ 0xF0C9, 0xF0CD, 0, 0xF0BE, 0xF0C6, 0xF0D1, 0xEE6F, 0xF0C2, /* 0xD0 */ 0xC2CF, 0xE7A5, 0xF0BD, 0xF0CA, 0xF0C4, 0xF0C1, 0xF0BC, 0xF0BB, /* 0xE0 */ 0xF0D0, 0, 0xF0C0, 0xF0BF, 0xC2CD, 0xF0C8, 0, 0xC2CC, /* 0xE0 */ 0, 0, 0xC2CE, 0xF0C3, 0xF0CF, 0, 0xF2DE, 0xF2DF, /* 0xF0 */ 0, 0xC3C9, 0xF2DC, 0xC3C6, 0xF2E4, 0, 0xC3CA, 0xF2E6 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_88[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xF2DB, 0xF0CE, 0xF2E8, 0xF2DD, 0, 0xC3C7, 0xF2E3, 0, /* 0x00 */ 0xF2E5, 0xF2E0, 0xF2E7, 0xF2E2, 0xF2E1, 0xC3C8, 0, 0, /* 0x00 */ 0xF4C5, 0xF4C6, 0, 0xF4C8, 0xC4AE, 0xC4AF, 0xF4C9, 0xF4C7, /* 0x10 */ 0, 0xF4C4, 0, 0xF642, 0xF645, 0xF641, 0, 0xC4FA, /* 0x10 */ 0xF643, 0xC4F9, 0xC4F8, 0xC4F7, 0xF644, 0xF751, 0xF74F, 0, /* 0x20 */ 0xF74E, 0xF640, 0xF750, 0xF646, 0xF74D, 0, 0xF7F9, 0xF7D7, /* 0x20 */ 0xF7F7, 0xC5DB, 0xF7F8, 0xF7FA, 0, 0xF8BF, 0xC5FA, 0xF8BE, /* 0x30 */ 0xF8BD, 0xC5FB, 0, 0xC65A, 0xF96E, 0xF9A7, 0xF9A6, 0xF9A8, /* 0x30 */ 0xA6E5, 0xD0AA, 0, 0xD3CF, 0xD3D0, 0, 0, 0, /* 0x40 */ 0xDBC0, 0, 0xF647, 0xF8C0, 0xA6E6, 0xAD6C, 0xD0AB, 0, /* 0x40 */ 0, 0, 0xD7B1, 0xB34E, 0, 0xDBC2, 0xDBC1, 0xB5F3, /* 0x50 */ 0, 0xB8C5, 0xE7C1, 0xBDC3, 0, 0xBDC4, 0, 0, /* 0x50 */ 0, 0xBFC5, 0xC5FC, 0xA6E7, 0, 0, 0, 0xD0AC, /* 0x60 */ 0xAAED, 0xD0AE, 0xD0AD, 0xAD6D, 0, 0xD3D1, 0, 0xD3D8, /* 0x60 */ 0xB049, 0xD3D6, 0xD3D4, 0, 0xD3DB, 0xD3D2, 0xD3D3, 0xB04A, /* 0x70 */ 0, 0xB04E, 0, 0, 0xD3DC, 0xB04D, 0xD3DA, 0xD3D7, /* 0x70 */ 0xD3D5, 0xB04B, 0xB04C, 0xD3D9, 0, 0, 0, 0, /* 0x80 */ 0xB350, 0xD7B2, 0, 0xB355, 0xD7C2, 0xB354, 0xD7C4, 0, /* 0x80 */ 0, 0xD7B8, 0xB352, 0xD7C3, 0, 0xD7B3, 0xB353, 0xD7BF, /* 0x90 */ 0xD7BB, 0xD7BD, 0xD7B7, 0xD7BE, 0, 0, 0xB34F, 0xD7BA, /* 0x90 */ 0, 0xD7B9, 0xD7B5, 0, 0xD7C0, 0, 0, 0xD7BC, /* 0xA0 */ 0xD7B4, 0, 0xD7B6, 0xB351, 0xD7C1, 0, 0, 0, /* 0xA0 */ 0, 0xB5F6, 0xDBCD, 0, 0, 0, 0xDBC9, 0xDBCB, /* 0xB0 */ 0xDBC6, 0xDBC5, 0xDBC3, 0, 0xDBCA, 0xDBCC, 0xDBC8, 0, /* 0xB0 */ 0xDBC7, 0xB5F4, 0xB5F5, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0xDBCF, 0xB8CD, 0xDFF2, 0xDFF8, 0xDFF3, 0xDFF4, 0xF9D8, /* 0xC0 */ 0xDFF9, 0, 0xB8CF, 0, 0xB8C7, 0xB8CE, 0xDFF1, 0xDBC4, /* 0xD0 */ 0xB8CA, 0xB8C8, 0xDFF7, 0xDFF6, 0xB8C9, 0xB8CB, 0xDFF5, 0xB8C6, /* 0xD0 */ 0, 0xB8CC, 0, 0, 0, 0, 0, 0xE3F6, /* 0xE0 */ 0xBB74, 0, 0, 0xE442, 0xE441, 0, 0xE3FB, 0xBB76, /* 0xE0 */ 0xE440, 0xE3F7, 0xE3F8, 0xBB6E, 0xBB70, 0, 0xE3FD, 0xE3F5, /* 0xF0 */ 0xBB72, 0xBB71, 0xE3F9, 0xE3FE, 0xE3FC, 0xBB73, 0xE3FA /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_89[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xDBCE, 0xBB6F, 0, 0, 0xE7C2, 0xE7C9, 0xBDC6, /* 0x00 */ 0, 0xE7CD, 0xBDCA, 0xE7C5, 0xE7C3, 0, 0xE7CC, 0, /* 0x00 */ 0xBDC5, 0xE7CB, 0xBDC7, 0xBDC8, 0xE7C4, 0xBDC9, 0xE7CA, 0xE7C6, /* 0x10 */ 0xE7C7, 0xE7C8, 0xBB75, 0, 0, 0, 0xEB70, 0xEB7C, /* 0x10 */ 0, 0xBFCA, 0xEB77, 0xEB79, 0, 0xBFC8, 0xEB71, 0xEB75, /* 0x20 */ 0, 0xEB78, 0xBFC6, 0xBFC9, 0xEB7B, 0xEB73, 0xEB74, 0xEB7A, /* 0x20 */ 0xEB72, 0xEB76, 0xBFC7, 0xEE72, 0, 0xEE71, 0xC1B7, 0xEE77, /* 0x30 */ 0xC1B9, 0, 0, 0xC1B6, 0xEE73, 0xC1BA, 0xEE74, 0, /* 0x30 */ 0, 0xEE75, 0xEE78, 0, 0xC1B8, 0, 0xF0D6, 0, /* 0x40 */ 0, 0xF0D9, 0, 0xF0D3, 0xF0D5, 0, 0, 0xF0D4, /* 0x40 */ 0xF0D7, 0xF0D8, 0xEE76, 0xF0D2, 0, 0, 0xC3CD, 0xF2EC, /* 0x50 */ 0xF2EF, 0xF2F1, 0xF2EA, 0xF2EB, 0xF2EE, 0xF2F0, 0xC3CE, 0xC3CC, /* 0x50 */ 0xC3CB, 0xF2ED, 0xF2E9, 0xF4CA, 0xC4B0, 0, 0xF4CB, 0, /* 0x60 */ 0, 0xF649, 0xC4FB, 0xF64B, 0xC4FC, 0xF648, 0xF64A, 0xC5A8, /* 0x60 */ 0, 0xF752, 0xC5A7, 0xF7FD, 0xF7FC, 0, 0xF7FB, 0, /* 0x70 */ 0, 0xF948, 0xF949, 0xF94B, 0xF94A, 0, 0xCA50, 0xA6E8, /* 0x70 */ 0, 0xAD6E, 0xD7C5, 0xB5F7, 0, 0xDFFA, 0xC2D0, 0, /* 0x80 */ 0xF2F2, 0, 0, 0xA8A3, 0, 0, 0, 0xB357, /* 0x80 */ 0, 0, 0, 0xB356, 0, 0xDBD0, 0xB5F8, 0xDBD2, /* 0x90 */ 0xDBD1, 0, 0, 0xDFFB, 0xB8D0, 0xE443, 0xE446, 0xE445, /* 0x90 */ 0, 0xE444, 0xE7CE, 0xE7D0, 0xE7CF, 0, 0xBFCC, 0, /* 0xA0 */ 0, 0, 0xBFCB, 0, 0xC1BB, 0xEE79, 0xEE7B, 0xEE7A, /* 0xA0 */ 0, 0, 0xC2D1, 0, 0, 0, 0xF2F4, 0xF2F3, /* 0xB0 */ 0, 0xF4CC, 0xC4B1, 0, 0, 0xC4FD, 0xF754, 0xF753, /* 0xB0 */ 0xC65B, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0xA8A4, 0xD0AF, 0xAD6F, 0xD7C8, 0xD7C6, 0, /* 0xD0 */ 0, 0xD7C7, 0xDBD4, 0xDBD5, 0xE043, 0xDBD3, 0, 0xDFFC, /* 0xD0 */ 0xE041, 0xE040, 0xE042, 0xB8D1, 0xDFFE, 0xDFFD, 0xE044, 0, /* 0xE0 */ 0xE449, 0xE447, 0, 0xE448, 0xE7D3, 0xE7D1, 0, 0, /* 0xE0 */ 0xE7D2, 0xEB7D, 0xEE7C, 0xEE7D, 0xC2D2, 0, 0xF2F5, 0xF4CD, /* 0xF0 */ 0xC4B2, 0, 0xF64C, 0xF755, 0xC5A9, 0, 0xF7FE, 0xF94C /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_8A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA8A5, 0, 0xAD71, 0xAD72, 0xD0B0, 0, 0, 0xD0B1, /* 0x00 */ 0xAD70, 0, 0xB054, 0, 0xB052, 0, 0xB051, 0xB058, /* 0x00 */ 0xB050, 0xB059, 0xD3DD, 0xB056, 0, 0xB053, 0xB057, 0xB055, /* 0x10 */ 0xB04F, 0, 0, 0xB35F, 0, 0xB359, 0xD7CC, 0xB35E, /* 0x10 */ 0, 0, 0xB360, 0xB35A, 0, 0xB35B, 0, 0xD7CA, /* 0x20 */ 0, 0, 0xB358, 0, 0xD7CB, 0xB35D, 0, 0, /* 0x20 */ 0xD7C9, 0xB35C, 0, 0, 0xB644, 0, 0xB646, 0, /* 0x30 */ 0, 0xDBD8, 0xB645, 0xB5F9, 0xB5FD, 0, 0xB8E4, 0xE049, /* 0x30 */ 0xDBDA, 0xB5FE, 0, 0, 0xDBDD, 0xDBDE, 0xB643, 0, /* 0x40 */ 0xDBE0, 0, 0xDBE2, 0, 0xDBE3, 0xDBD7, 0xDBD6, 0xDBE4, /* 0x40 */ 0xB642, 0xDBE1, 0xDBDF, 0, 0xB640, 0xB5FB, 0xB647, 0xDBDB, /* 0x50 */ 0xDBDC, 0xDBD9, 0, 0xB641, 0, 0, 0xB5FC, 0, /* 0x50 */ 0xB5FA, 0xE048, 0xB8DF, 0xB8DA, 0, 0, 0xB8D5, 0, /* 0x60 */ 0xB8E5, 0xB8D6, 0, 0xB8D2, 0xB8E1, 0xB8DE, 0xB8E0, 0, /* 0x60 */ 0xB8D7, 0xB8DC, 0xB8D3, 0xB8D4, 0xE050, 0xE04D, 0xE045, 0xE04A, /* 0x70 */ 0, 0xB8E2, 0xE051, 0xB8E3, 0xB8D9, 0, 0, 0xE047, /* 0x70 */ 0, 0xE04F, 0xE04B, 0xE04E, 0xE04C, 0xB8DD, 0xE046, 0xB8D8, /* 0x80 */ 0, 0, 0, 0xE44C, 0xBB78, 0xBB7B, 0, 0xE44E, /* 0x80 */ 0, 0xBBA5, 0xE44D, 0xBB7D, 0, 0xBDCF, 0xE44F, 0, /* 0x90 */ 0xBBA4, 0xE44B, 0xBBA6, 0, 0, 0, 0xBB79, 0, /* 0x90 */ 0xB8DB, 0xBB7C, 0, 0xBB7A, 0xBB7E, 0xBBA2, 0xBB77, 0xBBA7, /* 0xA0 */ 0xBBA3, 0, 0xBBA1, 0xE44A, 0, 0, 0, 0, /* 0xA0 */ 0xBDD6, 0, 0xBDD2, 0, 0, 0, 0xBDD9, 0, /* 0xB0 */ 0xE7D6, 0xBDDA, 0xE7E2, 0xE7DB, 0xBDCB, 0xE7E3, 0xE7DD, 0xBDD5, /* 0xB0 */ 0xE7DE, 0, 0xBDD4, 0xE7E1, 0xBDCE, 0xE7DF, 0xE7D5, 0xBDCD, /* 0xC0 */ 0xEBAA, 0xBDD3, 0, 0xBDD0, 0, 0xBDD8, 0, 0xE7D4, /* 0xC0 */ 0, 0xE7D8, 0xBDCC, 0xE7D7, 0xE7D9, 0xE7DA, 0xBDD7, 0xE7DC, /* 0xD0 */ 0xE7E0, 0xE7E4, 0, 0xBDDB, 0xBFD2, 0xEBA5, 0xEBAB, 0xEBA8, /* 0xD0 */ 0xEB7E, 0xEBAC, 0xEBA1, 0, 0xEBA7, 0, 0xBFCD, 0xBFD3, /* 0xE0 */ 0xEBAD, 0, 0, 0xBFCF, 0, 0xBFD9, 0xBFD4, 0xEBAF, /* 0xE0 */ 0xEBA9, 0xBFD0, 0xEBA2, 0xBFDA, 0xEBA3, 0xEBA4, 0xBFDB, 0xBFD8, /* 0xF0 */ 0xBDD1, 0, 0xBFCE, 0xEBB0, 0xBFDC, 0, 0xBFD5, 0xEBAE /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_8B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xBFD1, 0xBFD6, 0xBFD7, 0, 0xC1C3, 0xEEA4, 0xEEAD, 0xEEAA, /* 0x00 */ 0xEEAC, 0, 0xC1C0, 0xEEA5, 0, 0xEEAB, 0xC1BC, 0xEEA7, /* 0x00 */ 0xC1C4, 0xEEA3, 0xEEA8, 0xEEAF, 0xEBA6, 0xEEA9, 0xEEA2, 0xC1BD, /* 0x10 */ 0xEEA1, 0xC1BE, 0xEEB0, 0xC1BF, 0xEEAE, 0xC1C2, 0xEE7E, 0, /* 0x10 */ 0xC1C1, 0, 0xEEA6, 0xF0DC, 0xF0EA, 0xF0E5, 0xF0E7, 0xF0DB, /* 0x20 */ 0xC2D3, 0, 0xF0DA, 0xC2D6, 0xC2D5, 0, 0xF0E9, 0xF0E1, /* 0x20 */ 0xF0DE, 0xF0E4, 0, 0xF0DD, 0, 0xF0DF, 0xF0E8, 0xF0E6, /* 0x30 */ 0, 0xC2D4, 0xF0ED, 0xF0EB, 0xF0E2, 0xF0EC, 0xF0E3, 0, /* 0x30 */ 0xF2F9, 0xC3CF, 0xF341, 0, 0, 0xF64F, 0xC3D6, 0xF0E0, /* 0x40 */ 0xF2F7, 0xC3D2, 0xF2F8, 0xF2FD, 0, 0, 0xC3D4, 0xC3D5, /* 0x40 */ 0xF2F6, 0xF340, 0xF342, 0xF2FA, 0xF2FC, 0xF2FE, 0xF2FB, 0xF343, /* 0x50 */ 0xC3D1, 0xC3D7, 0xC3D3, 0, 0xC3D0, 0xF4D0, 0, 0xC4B7, /* 0x50 */ 0xF4CE, 0, 0, 0xF4D2, 0, 0xF4D3, 0xC4B5, 0xF4D4, /* 0x60 */ 0xF4D1, 0, 0xF4CF, 0xC4B8, 0xC4B4, 0xF4D5, 0, 0xC4B6, /* 0x60 */ 0xC4B3, 0, 0, 0, 0xC4FE, 0, 0, 0xC540, /* 0x70 */ 0xF64E, 0xF64D, 0xF650, 0xF651, 0, 0xC541, 0xF756, 0xF75B, /* 0x70 */ 0xC5AA, 0, 0xF758, 0, 0xF757, 0xF75A, 0xF759, 0, /* 0x80 */ 0xF843, 0, 0xC5DC, 0xF842, 0xF840, 0, 0xF841, 0, /* 0x80 */ 0, 0, 0xC5FE, 0xC5FD, 0xF8C1, 0xF8C2, 0xC640, 0, /* 0x90 */ 0xF94D, 0xF94E, 0xC667, 0, 0xC66D, 0, 0xF9A9, 0xF9C8, /* 0x90 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_8C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA8A6, /* 0x30 */ 0, 0xD7CD, 0, 0xD7CE, 0xE052, 0xE450, 0xE7E5, 0xC1C6, /* 0x30 */ 0, 0xC1C5, 0xF0EE, 0xF344, 0, 0xF844, 0xA8A7, 0xD3DE, /* 0x40 */ 0xB05A, 0xB361, 0xE054, 0xE053, 0xBDDC, 0xE7E6, 0xBDDD, 0xEEB1, /* 0x40 */ 0xC2D7, 0, 0, 0, 0xC676, 0xA8A8, 0xCDCB, 0xD3DF, /* 0x50 */ 0, 0, 0xB362, 0, 0xD7CF, 0xD7D0, 0, 0xDBE5, /* 0x50 */ 0, 0xB648, 0xB8E6, 0, 0xE056, 0xE055, 0xE057, 0, /* 0x60 */ 0xE451, 0xE452, 0xBBA8, 0xBFDD, 0xBDDE, 0xBFDE, 0, 0xEEB5, /* 0x60 */ 0xEEB2, 0xEEB4, 0xEEB3, 0xC1C7, 0, 0xF0EF, 0xF346, 0xF345, /* 0x70 */ 0xCBA4, 0xB05C, 0xB05B, 0xD3E0, 0, 0xD7D1, 0, 0, /* 0x70 */ 0xDBE7, 0xDBE6, 0xB649, 0, 0xE059, 0xE05A, 0xE058, 0, /* 0x80 */ 0, 0xB8E8, 0xB8E7, 0, 0xBBAA, 0xBBA9, 0, 0xE7E7, /* 0x80 */ 0xEBB3, 0xEBB1, 0xEBB2, 0xBFDF, 0xEEB7, 0xEEB6, 0, 0xF0F2, /* 0x90 */ 0xF0F1, 0xF0F0, 0xF347, 0, 0xF9AA, 0xA8A9, 0xAD73, 0, /* 0x90 */ 0xAD74, 0xB05D, 0xB05E, 0xD3E2, 0xD3E1, 0xD7D2, 0, 0xB368, /* 0xA0 */ 0xB366, 0xB363, 0xB367, 0xB365, 0xB364, 0, 0, 0xB64A, /* 0xA0 */ 0xDBEA, 0, 0xB8ED, 0xB64C, 0xB651, 0xDBEC, 0xB653, 0xB652, /* 0xB0 */ 0xB655, 0xDBEB, 0xDBE8, 0xB64F, 0xB64B, 0xB64D, 0xDBE9, 0xB654, /* 0xB0 */ 0xB650, 0xB64E, 0xB8EF, 0xB8EE, 0xB8EC, 0xB8F0, 0, 0xB8EA, /* 0xC0 */ 0xB8EB, 0, 0xB8E9, 0, 0xE05B, 0, 0, 0xE454, /* 0xC0 */ 0, 0xBBAC, 0xBBAD, 0xBBAB, 0, 0xE453, 0, 0xE455, /* 0xD0 */ 0, 0xE7EA, 0xE7EC, 0, 0xBDE7, 0xE7ED, 0xBDE0, 0xE7E9, /* 0xD0 */ 0xBDDF, 0xBDE9, 0xBDE5, 0xBDE6, 0xBDE2, 0xE7E8, 0xBDE1, 0xE7EE, /* 0xE0 */ 0xE7EB, 0, 0xBDE8, 0, 0xBDE3, 0xBDE4, 0xEBB5, 0, /* 0xE0 */ 0xEBB7, 0xEBB6, 0, 0xEBB8, 0xBFE0, 0xEBB4, 0, 0, /* 0xF0 */ 0xC1CB, 0xEEB8, 0xC1C8, 0xC1CC, 0xC1CA, 0xC1C9, 0xF0F3 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_8D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xF0F6, 0, 0xF0F5, 0, 0xF0F4, 0xC2D8, 0xF348, 0xF349, /* 0x00 */ 0xC3D8, 0xF34A, 0xC3D9, 0, 0, 0xC4BA, 0, 0xC4B9, /* 0x00 */ 0xF652, 0, 0, 0xC542, 0xF653, 0xF75C, 0xC5AB, 0xC5AC, /* 0x10 */ 0, 0xF845, 0, 0xC642, 0, 0, 0, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0xA8AA, 0, 0xB36A, 0xB369, /* 0x60 */ 0xE05C, 0xE05D, 0, 0xBBAE, 0xEBB9, 0xBDEA, 0xEBBA, 0xEEB9, /* 0x60 */ 0xA8AB, 0, 0xD0B2, 0xAD76, 0xAD75, 0, 0xD3E3, 0xB05F, /* 0x70 */ 0xD3E4, 0xD7D5, 0, 0xD7D4, 0, 0xD7D3, 0, 0, /* 0x70 */ 0xDBEE, 0xB658, 0, 0, 0xDBED, 0xB657, 0, 0, /* 0x80 */ 0, 0xDBEF, 0xB656, 0, 0xE05F, 0xE062, 0xE060, 0xE061, /* 0x80 */ 0xE065, 0xE05E, 0xE066, 0xE063, 0xE064, 0xBBB0, 0xE456, 0, /* 0x90 */ 0, 0xBBAF, 0, 0xE7F2, 0xE7F0, 0, 0, 0xBDEB, /* 0x90 */ 0xE7EF, 0xE7F1, 0, 0xBDEC, 0, 0xEBBB, 0, 0xEBBC, /* 0xA0 */ 0xC1CD, 0, 0xF34C, 0xF34E, 0xF34B, 0xF34D, 0xF4D6, 0xF654, /* 0xA0 */ 0, 0, 0xF96F, 0xA8AC, 0xAD77, 0xD3E5, 0xD3E7, 0xD3E6, /* 0xB0 */ 0, 0xD7D8, 0xB36C, 0, 0xD7D6, 0, 0xB36B, 0xD7D9, /* 0xB0 */ 0, 0xD7DA, 0xD7D7, 0, 0, 0xDBFB, 0xB660, 0xDBF3, /* 0xC0 */ 0xDBF9, 0, 0, 0xB65B, 0xB65E, 0xDBF2, 0xB659, 0xDBF6, /* 0xC0 */ 0xE06C, 0xB65D, 0, 0xDBF1, 0, 0xDBF7, 0xDBF4, 0xDBFA, /* 0xD0 */ 0xDBF0, 0xDBF8, 0xB65C, 0xB65F, 0xDBF5, 0xB65A, 0, 0xB8F2, /* 0xD0 */ 0xE068, 0xB8F1, 0xE06F, 0xE06E, 0xB8F8, 0, 0xB8F9, 0xE070, /* 0xE0 */ 0xB8F3, 0xE06D, 0xB8F7, 0xE072, 0xE069, 0, 0xE06B, 0xB8F4, /* 0xE0 */ 0xE067, 0xE06A, 0xE071, 0xB8F5, 0xE073, 0, 0, 0, /* 0xF0 */ 0, 0, 0xB8F6, 0, 0xBBB1, 0xE45B, 0xE461, 0xE459 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_8E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE462, 0, 0xE458, 0xE45D, 0xE463, 0xE460, 0xE45F, 0xE45E, /* 0x00 */ 0, 0xE457, 0xE45C, 0, 0, 0xE45A, 0, 0xBDF1, /* 0x00 */ 0xBDEE, 0xE7FB, 0xE841, 0xE843, 0xE840, 0xE7F8, 0xE7FA, 0xE845, /* 0x10 */ 0xE842, 0xE7FC, 0xE846, 0xE7F9, 0xE844, 0xBDEF, 0xBDF5, 0xBDF3, /* 0x10 */ 0xE7F3, 0xBDF4, 0xBDF0, 0xE7F4, 0xE7F6, 0xE7F5, 0xE7FD, 0xE7FE, /* 0x20 */ 0, 0xBDF2, 0, 0xBDED, 0, 0, 0xE7F7, 0, /* 0x20 */ 0xEBC6, 0xBFE2, 0, 0xEBBD, 0xBFE3, 0xBFE6, 0xEBC2, 0, /* 0x30 */ 0xEBBF, 0xBFE5, 0, 0, 0xEBC3, 0xEBC4, 0xEBBE, 0xEBC7, /* 0x30 */ 0xEBC0, 0xEBC5, 0xBFE4, 0, 0xBFE1, 0xEBC1, 0, 0xEEBF, /* 0x40 */ 0xC1D0, 0xC1CE, 0xC1D1, 0xC1CF, 0xEEBE, 0xEEBB, 0xEEBA, 0, /* 0x40 */ 0xEEBD, 0, 0, 0xEEBC, 0xF145, 0xC2DE, 0xF0FB, 0xF0FA, /* 0x50 */ 0, 0xC2D9, 0xF141, 0xF140, 0xF0F7, 0xF143, 0xF0FC, 0xC2DD, /* 0x50 */ 0xF0F9, 0xF142, 0xF0F8, 0xC2DA, 0xC2DC, 0xF0FD, 0xC2DB, 0xF0FE, /* 0x60 */ 0, 0xF144, 0xF352, 0, 0xC3DE, 0xF34F, 0, 0xF353, /* 0x60 */ 0, 0, 0xC3DB, 0xF351, 0xC3E0, 0, 0xC3DD, 0, /* 0x70 */ 0xF350, 0, 0xC3DF, 0xF354, 0xC3DA, 0, 0, 0, /* 0x70 */ 0, 0xC4BC, 0xC4BE, 0, 0xF4D9, 0xC4BD, 0xF4D7, 0xC3DC, /* 0x80 */ 0xF4D8, 0xC4BB, 0xC543, 0xC545, 0xF656, 0xC544, 0xF655, 0, /* 0x80 */ 0xF761, 0xC5AD, 0xF760, 0xC5AE, 0xF75E, 0xF75D, 0xF762, 0xF763, /* 0x90 */ 0xF846, 0, 0xF75F, 0, 0, 0xF8C6, 0xF8C3, 0xF8C4, /* 0x90 */ 0xF8C5, 0xC65C, 0, 0xF951, 0xF950, 0xF94F, 0xF970, 0, /* 0xA0 */ 0xF9BE, 0xF9AB, 0xC66E, 0xA8AD, 0xB060, 0, 0, 0, /* 0xA0 */ 0, 0, 0xB8FA, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0xBDF6, 0, 0, 0xEBC8, 0, 0, /* 0xB0 */ 0xC2DF, 0, 0xF355, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0xF9AC, 0xA8AE, 0xAAEE, 0xAD79, 0xAD78, 0, 0xB063, /* 0xC0 */ 0, 0xD3E8, 0xB061, 0xD3E9, 0xB062, 0, 0, 0xD7DF, /* 0xD0 */ 0xD7DB, 0, 0, 0xB36D, 0xD7DE, 0xD7DD, 0xD7DC, 0xB36E, /* 0xD0 */ 0xD7E0, 0xD7E1, 0, 0, 0, 0xDC43, 0xDC41, 0xDC45, /* 0xE0 */ 0xDC46, 0xDC4C, 0, 0xDC48, 0xDC4A, 0, 0xDC42, 0xDBFC, /* 0xE0 */ 0, 0xDC49, 0, 0, 0xDC4B, 0xDC44, 0xDC47, 0xDBFD, /* 0xF0 */ 0xB662, 0xDC40, 0xDBFE, 0xB661, 0xB663, 0, 0xB8FD, 0xE075 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_8F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE077, 0xE076, 0xE07B, 0xB8FB, 0, 0xE078, 0xE074, 0xE079, /* 0x00 */ 0xE07A, 0xB8FC, 0xB8FE, 0xE07C, 0, 0xE467, 0xE466, 0, /* 0x00 */ 0xE464, 0xE465, 0xBBB3, 0xBBB5, 0xBBB2, 0xBBB4, 0xE84D, 0xE84E, /* 0x10 */ 0xE849, 0, 0xE84A, 0xBDF8, 0xBDFD, 0xBDF7, 0xBDFE, 0xBDF9, /* 0x10 */ 0xE84B, 0, 0, 0xE84C, 0xE848, 0xBE40, 0xBDFB, 0, /* 0x20 */ 0, 0xBDFA, 0xBDFC, 0, 0xE847, 0, 0xEBCA, 0xBFE8, /* 0x20 */ 0, 0, 0xEBCC, 0xBFEA, 0xEBCF, 0xEBCB, 0xEBC9, 0xEBCE, /* 0x30 */ 0xBFE9, 0xEBCD, 0, 0xBFE7, 0, 0, 0xC1D3, 0xC1D6, /* 0x30 */ 0xEEC1, 0, 0xC1D4, 0xEEC0, 0xC1D2, 0xC1D5, 0xF146, 0xF147, /* 0x40 */ 0xF148, 0xC2E0, 0, 0xF149, 0, 0xC2E1, 0xC3E2, 0xF358, /* 0x40 */ 0xF359, 0xF357, 0xF356, 0xF35A, 0xC3E1, 0xF4DD, 0xF4DB, 0xF4DC, /* 0x50 */ 0xF4DE, 0xF4DA, 0xF4DF, 0xF658, 0, 0xF659, 0xF657, 0xC546, /* 0x50 */ 0xF764, 0xC5AF, 0xF765, 0xF848, 0xF847, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0xA8AF, 0xB664, 0, 0, 0xB940, /* 0x90 */ 0, 0, 0, 0xBBB6, 0, 0, 0xBFEC, 0, /* 0xA0 */ 0xBFEB, 0, 0, 0, 0, 0xC3E3, 0xC47C, 0xC547, /* 0xA0 */ 0xA8B0, 0xB064, 0xB941, 0, 0xF35B, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0xCBA6, /* 0xB0 */ 0, 0, 0xA8B1, 0, 0xA8B4, 0xA8B3, 0xA8B2, 0, /* 0xC0 */ 0, 0xCBA5, 0, 0xCDCD, 0, 0xCDCF, 0xAAEF, 0, /* 0xC0 */ 0, 0xAAF1, 0xCDCC, 0xCDCE, 0xAAF0, 0xCDD1, 0xCDD0, 0xCDD2, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0xD0B6, 0xD0B4, 0xAD7C, 0xD0B3, 0xADA3, 0xAD7E, 0xAD7B, 0, /* 0xE0 */ 0xADA4, 0, 0xAD7D, 0xADA2, 0, 0xADA1, 0xD0B5, 0, /* 0xE0 */ 0xAD7A, 0, 0, 0, 0xB06A, 0xD3EB, 0xD3F1, 0xB067, /* 0xF0 */ 0xB06E, 0, 0xB069, 0xD3EE, 0xD3F0, 0xB06C, 0xD3EA, 0xD3ED /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_90[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xB068, 0xB065, 0xD3EC, 0xB06B, 0xD3EF, 0xB06D, 0xB066, 0, /* 0x00 */ 0, 0, 0, 0xD7E3, 0xD7E6, 0xB370, 0, 0xB37A, /* 0x00 */ 0xB376, 0xD7E4, 0, 0, 0xB37E, 0xB377, 0xB37C, 0xB372, /* 0x10 */ 0, 0xB36F, 0xB371, 0xB37D, 0xD7E5, 0xB375, 0xB378, 0xB374, /* 0x10 */ 0xB379, 0xD7E7, 0xB37B, 0xB373, 0xD7E2, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0xDC4D, 0xB665, 0xDC4F, /* 0x20 */ 0, 0xB667, 0xB669, 0, 0xDC4E, 0xB666, 0xB66A, 0, /* 0x30 */ 0xB668, 0, 0, 0, 0xB947, 0xE0A3, 0xB94F, 0xE07E, /* 0x30 */ 0, 0xB950, 0xB945, 0, 0xE0A1, 0, 0, 0xB94A, /* 0x40 */ 0, 0xE0A2, 0xB943, 0xB942, 0, 0xB94D, 0xB94C, 0xB94B, /* 0x40 */ 0xB949, 0xB94E, 0xE07D, 0xB944, 0xB946, 0xB948, 0, 0, /* 0x50 */ 0xBBB8, 0xBBBB, 0, 0xBBBF, 0xBBB9, 0xBBBE, 0xBBBC, 0, /* 0x50 */ 0xBBB7, 0, 0xBBBD, 0xBBBA, 0, 0, 0, 0xE852, /* 0x60 */ 0xBE43, 0xBE41, 0, 0xE853, 0, 0xBE44, 0xBE42, 0xE851, /* 0x60 */ 0xE850, 0, 0xBFF0, 0xE84F, 0xBFEE, 0xBFED, 0xEBD0, 0xBE45, /* 0x70 */ 0xBFEF, 0xEBD1, 0xBFF2, 0xEBD2, 0xBFF1, 0xC1D8, 0xEEC3, 0xC1D7, /* 0x70 */ 0xC1DC, 0xC1DA, 0xC1DB, 0xC2E3, 0xC1D9, 0xEEC2, 0xEBD3, 0xC2E2, /* 0x80 */ 0xC2E4, 0, 0xC3E4, 0xC3E5, 0, 0xF4E0, 0, 0xC5DE, /* 0x80 */ 0xC5DD, 0xA8B6, 0, 0, 0xCA55, 0xB06F, 0, 0xCA52, /* 0x90 */ 0xCA53, 0xCA51, 0, 0xCA54, 0, 0, 0xCBAA, 0xCBA7, /* 0x90 */ 0xCBAC, 0xCBA8, 0xA8B7, 0xA8BA, 0, 0xCBA9, 0xA8B9, 0xCBAB, /* 0xA0 */ 0, 0, 0xA8B8, 0, 0, 0, 0, 0xCDD5, /* 0xA0 */ 0xCDD7, 0xAAF4, 0xCDD3, 0xCDD6, 0xCDD4, 0xAAF2, 0xAAF5, 0, /* 0xB0 */ 0xAAF3, 0, 0, 0, 0, 0xD0B8, 0xD0BC, 0xD0B9, /* 0xB0 */ 0, 0xADA7, 0, 0xADA8, 0, 0xD0BB, 0, 0xD0BD, /* 0xC0 */ 0xD0BF, 0, 0xADA5, 0xD0BE, 0, 0, 0xADA6, 0, /* 0xC0 */ 0, 0, 0, 0, 0xD7EE, 0xD0BA, 0xD3F2, 0xD3FB, /* 0xD0 */ 0xD3F9, 0xD3F4, 0xD3F5, 0xD3FA, 0xD3FC, 0xB071, 0, 0xD3F7, /* 0xD0 */ 0xD3F3, 0xB070, 0xB072, 0xD3F6, 0xD3FD, 0xD3F8, 0, 0, /* 0xE0 */ 0xB3A1, 0xD7F1, 0xD7E9, 0xD7EF, 0xD7F0, 0xB3A2, 0, 0xD7E8, /* 0xE0 */ 0xD7EA, 0xD0B7, 0xD7EC, 0xD7ED, 0xD7EB, 0xB66C, 0, 0, /* 0xF0 */ 0, 0xDC56, 0xEBD4, 0xDC57, 0xDC54, 0xB3A3, 0xB66E, 0xDC53 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_91[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xDC59, 0xDC58, 0xB66B, 0xDC5C, 0xDC52, 0xDC5B, 0xDC50, 0xDC5A, /* 0x00 */ 0xDC55, 0xB66D, 0, 0xE0AA, 0, 0xE0A5, 0xE0AB, 0xE0A6, /* 0x00 */ 0xE0A4, 0xE0A7, 0xB951, 0, 0xE0A9, 0, 0xE0A8, 0xB952, /* 0x10 */ 0xBBC1, 0xBBC0, 0xE46E, 0xE471, 0xE469, 0xE46D, 0xBBC2, 0xE46C, /* 0x10 */ 0xE46A, 0xE470, 0xE46B, 0xE468, 0xE46F, 0, 0xE859, 0xBE48, /* 0x20 */ 0xF14A, 0xE856, 0xE857, 0xE855, 0xDC51, 0xBE47, 0xE85A, 0xE854, /* 0x20 */ 0xBE46, 0xBE49, 0xE858, 0xEBD5, 0xBFF3, 0xEBD6, 0xEBD7, 0, /* 0x30 */ 0xEEC4, 0xC1DD, 0xF14B, 0xF14C, 0, 0, 0xF14D, 0xF35D, /* 0x30 */ 0xF35C, 0xF4E2, 0, 0xF4E1, 0xF65B, 0xF65C, 0xF65A, 0xF766, /* 0x40 */ 0xC5B0, 0xA8BB, 0xADAA, 0xADA9, 0xB075, 0xB074, 0xD440, 0xD441, /* 0x40 */ 0xD3FE, 0, 0xB073, 0xD7F5, 0, 0xD7F6, 0xD7F2, 0xB3A4, /* 0x50 */ 0xD7F3, 0, 0xD7F4, 0, 0, 0, 0, 0xDC5F, /* 0x50 */ 0xDC61, 0xDC5D, 0xDC60, 0xB66F, 0xDC5E, 0xB670, 0, 0, /* 0x60 */ 0xDD73, 0xB955, 0xB954, 0, 0xB953, 0, 0xE0AC, 0xE0AD, /* 0x60 */ 0, 0, 0xE473, 0xE475, 0xBBC6, 0xBBC3, 0, 0xBBC5, /* 0x70 */ 0xBBC4, 0xE474, 0xE472, 0, 0, 0, 0, 0, /* 0x70 */ 0xE861, 0xE85E, 0xE85F, 0xBE4D, 0xE860, 0xE85B, 0xE85C, 0xBE4A, /* 0x80 */ 0, 0xBE4B, 0xE85D, 0xBE4C, 0, 0xEBDB, 0, 0xEBDC, /* 0x80 */ 0xEBD9, 0xEBDA, 0xBFF4, 0xEBD8, 0, 0, 0, 0, /* 0x90 */ 0, 0xEEC8, 0xEEC5, 0xEEC7, 0xC1E0, 0xEECB, 0xC1DF, 0xEEC9, /* 0x90 */ 0xEECC, 0xEECA, 0xEEC6, 0xC1DE, 0, 0xF14F, 0, 0xF150, /* 0xA0 */ 0xF14E, 0, 0xF152, 0xC2E5, 0xC2E6, 0xF35F, 0xC3E7, 0xF151, /* 0xA0 */ 0xF35E, 0xC3E6, 0xF4E5, 0xF4E6, 0xC4BF, 0xF4E4, 0, 0xF4E3, /* 0xB0 */ 0, 0xF65D, 0xC548, 0, 0xF849, 0xF8C8, 0xF8C7, 0, /* 0xB0 */ 0xC643, 0xC65D, 0xF8C9, 0xF971, 0, 0xC66F, 0xA8BC, 0xAAF6, /* 0xC0 */ 0, 0xB956, 0, 0xC4C0, 0xA8BD, 0xADAB, 0xB3A5, 0xB671, /* 0xC0 */ 0xC2E7, 0xAAF7, 0, 0xD0C1, 0xD0C0, 0xD442, 0, 0xB078, /* 0xD0 */ 0xB076, 0xB07A, 0xD444, 0, 0xB079, 0xB077, 0, 0, /* 0xD0 */ 0, 0, 0xD443, 0xB3A8, 0xD7FC, 0, 0xB3A7, 0xB3A9, /* 0xE0 */ 0xD842, 0xB3AB, 0xD7FE, 0xD840, 0xD7F7, 0xB3AA, 0xD843, 0, /* 0xE0 */ 0, 0xD7F9, 0, 0xD7FA, 0xD7F8, 0xB3A6, 0, 0xD841, /* 0xF0 */ 0xD7FB, 0xD7FD, 0, 0, 0, 0xDC6D, 0, 0xDC6C /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_92[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xDC6A, 0xDC62, 0xDC71, 0xDC65, 0xDC6F, 0xDC76, 0xDC6E, 0xB679, /* 0x00 */ 0, 0xB675, 0xDC63, 0, 0xDC69, 0xB677, 0, 0xDC68, /* 0x00 */ 0xB678, 0xB67A, 0xDC6B, 0, 0xB672, 0xB673, 0xDC77, 0xDC75, /* 0x10 */ 0, 0xDC74, 0xDC66, 0, 0xDC72, 0, 0xB676, 0, /* 0x10 */ 0, 0, 0, 0xB674, 0xDC73, 0xDC64, 0xDC67, 0xDC70, /* 0x20 */ 0, 0, 0, 0, 0, 0xE4BA, 0xE0B7, 0, /* 0x20 */ 0xE0B0, 0xE0C3, 0xE0CC, 0xE0B3, 0xB961, 0, 0xE0C0, 0xB957, /* 0x30 */ 0xB959, 0xB965, 0xE0B1, 0, 0, 0xB95A, 0xB95C, 0xB966, /* 0x30 */ 0xB95B, 0, 0, 0, 0, 0xB964, 0xE0B9, 0, /* 0x40 */ 0xE0AE, 0xB962, 0xE0B8, 0xB95E, 0xE0CA, 0xB963, 0xE0C8, 0xE0BC, /* 0x40 */ 0xE0C6, 0xB960, 0xE0AF, 0xE0C9, 0xE0C4, 0, 0xE0CB, 0xB958, /* 0x50 */ 0, 0, 0xB967, 0xB95D, 0, 0, 0xE0B5, 0, /* 0x50 */ 0xE0BD, 0xE0C1, 0, 0xE0C5, 0xB95F, 0xE0B4, 0xE0B2, 0xE0BE, /* 0x60 */ 0, 0, 0, 0, 0xE0BB, 0xE0BA, 0, 0xE0BF, /* 0x60 */ 0xE0C2, 0, 0xE0C7, 0, 0, 0, 0xE478, 0, /* 0x70 */ 0xBBC7, 0xE4A4, 0xE47A, 0xBBCC, 0xBBD0, 0xE4AD, 0xE4B5, 0xE4A6, /* 0x70 */ 0xBBC8, 0, 0xE4AA, 0xE0B6, 0, 0xBBC9, 0xE4B1, 0xE4B6, /* 0x80 */ 0xE4AE, 0, 0xE4B0, 0xE4B9, 0xE4B2, 0xE47E, 0xE4A9, 0, /* 0x80 */ 0, 0xBBD1, 0, 0xBBCD, 0xE47C, 0xE4AB, 0xBBCB, 0xE4A5, /* 0x90 */ 0xBBCA, 0xE4B3, 0xE4A2, 0xE479, 0xBBCE, 0xE4B8, 0, 0, /* 0x90 */ 0xE47B, 0xE4AF, 0xE4AC, 0xE4A7, 0xE477, 0xE476, 0xE4A1, 0xE4B4, /* 0xA0 */ 0xBBCF, 0xE4B7, 0xE47D, 0xE4A3, 0xBE52, 0, 0, 0, /* 0xA0 */ 0, 0, 0xBE5A, 0xBE55, 0xE8A4, 0xE8A1, 0xE867, 0xBE50, /* 0xB0 */ 0, 0xF9D7, 0, 0xBE4F, 0xBE56, 0, 0, 0, /* 0xB0 */ 0xE865, 0xBE54, 0xE871, 0xE863, 0xE864, 0xBE4E, 0xE8A3, 0xBE58, /* 0xC0 */ 0xE874, 0xE879, 0xE873, 0xEBEE, 0xE86F, 0xE877, 0xE875, 0xE868, /* 0xC0 */ 0xE862, 0xE87D, 0xBE57, 0xE87E, 0, 0xE878, 0, 0xE86D, /* 0xD0 */ 0xE86B, 0xE866, 0, 0, 0, 0xE86E, 0xE87B, 0xE86A, /* 0xD0 */ 0xE87A, 0xE8A2, 0, 0, 0xBE53, 0, 0xE876, 0xE87C, /* 0xE0 */ 0xE872, 0xE86C, 0xBE51, 0, 0, 0, 0xE4A8, 0xE870, /* 0xE0 */ 0xBE59, 0xE869, 0, 0, 0, 0, 0, 0xEBF4, /* 0xF0 */ 0xBFF7, 0xEBF3, 0xEBF0, 0xEC44, 0xBFFB, 0, 0xEC41, 0xEBF8 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_93[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xEC43, 0xEBE9, 0xEBF6, 0, 0xBFFD, 0, 0xEBE1, 0, /* 0x00 */ 0xEBDF, 0xEC42, 0, 0xEC40, 0xEBFE, 0xEBED, 0xEBEC, 0xEBE2, /* 0x00 */ 0xC040, 0, 0xEBE8, 0xEBF2, 0xEBFD, 0xC043, 0xEC45, 0, /* 0x10 */ 0xC1E8, 0xC045, 0xBFFE, 0xEBE6, 0, 0xEBEF, 0xEBDE, 0xEBE0, /* 0x10 */ 0xBFF5, 0xC042, 0xBFFA, 0xEBE7, 0xEBF7, 0xEBF1, 0xC041, 0xEBDD, /* 0x20 */ 0xC1E3, 0xEBF9, 0xEBFC, 0xBFFC, 0, 0xEBEB, 0xC044, 0xBFF9, /* 0x20 */ 0, 0, 0, 0xBFF8, 0xEBF5, 0xEBFB, 0xBFF6, 0, /* 0x30 */ 0xEBE4, 0xEBFA, 0, 0, 0xEBE5, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0xEBEA, 0xEED2, /* 0x40 */ 0, 0xEED7, 0xC1E5, 0xC1E7, 0xEEDD, 0xC1E1, 0xEEEC, 0xEEE3, /* 0x40 */ 0xEED8, 0xEED9, 0xEEE2, 0, 0xC1EE, 0xEEE1, 0xEED1, 0xEEE0, /* 0x50 */ 0xEED4, 0xEEED, 0xC1ED, 0xC1EB, 0xEED5, 0, 0xEEE8, 0, /* 0x50 */ 0xEEDA, 0xEEE7, 0, 0xEEE9, 0xEED0, 0xC1E6, 0, 0xEEEA, /* 0x60 */ 0, 0, 0xEEDE, 0, 0xC1EA, 0xEEDB, 0, 0, /* 0x60 */ 0xC1EC, 0xEEE4, 0, 0, 0, 0xC1E4, 0xEED6, 0xEEE5, /* 0x70 */ 0, 0xEEDF, 0xEBE3, 0xEEE6, 0xEED3, 0, 0xC1E9, 0, /* 0x70 */ 0xEEEB, 0, 0xC1E2, 0xEECE, 0, 0, 0, 0, /* 0x80 */ 0xF160, 0xF159, 0xC2E9, 0, 0xF154, 0xF163, 0xF15B, 0xEEDC, /* 0x80 */ 0, 0xF165, 0xF155, 0, 0xC2E8, 0xF15F, 0xC2EA, 0xC2F2, /* 0x90 */ 0xC2F0, 0xF161, 0xC2F1, 0xF157, 0, 0xF158, 0xF15D, 0xF162, /* 0x90 */ 0, 0xEECD, 0xC2EB, 0xF16A, 0xF167, 0xF16B, 0xF15E, 0xF15A, /* 0xA0 */ 0xF168, 0xF36A, 0xF15C, 0, 0xC2EE, 0, 0xC2ED, 0xEECF, /* 0xA0 */ 0xC2EF, 0xF164, 0xF166, 0xC2EC, 0xF169, 0xF153, 0, 0xF156, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0xF373, 0, 0xF363, 0xC3EB, 0xF371, 0, 0, 0xF361, /* 0xC0 */ 0xC3EC, 0, 0xF36C, 0, 0xF368, 0xC3F1, 0xF372, 0xF362, /* 0xC0 */ 0xF365, 0xC3E9, 0xF374, 0, 0xF36D, 0xF370, 0xC3EF, 0xC3F4, /* 0xD0 */ 0xC3F2, 0xF369, 0xF364, 0, 0xC3ED, 0xC3EE, 0xF360, 0xC3EA, /* 0xD0 */ 0, 0xC3E8, 0xC3F0, 0xF36F, 0xC3F3, 0, 0xF36B, 0xF375, /* 0xE0 */ 0xC3F5, 0, 0, 0, 0xF367, 0, 0xF36E, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0xF4F3, 0xF542, 0xF4F5, /* 0xF0 */ 0xF4FC, 0xF366, 0xF4FA, 0xF4E9, 0xF540, 0xC4C3, 0xF4ED, 0xF4FE /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_94[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xF4F4, 0, 0, 0xC4C2, 0, 0, 0xF544, 0xF4F6, /* 0x00 */ 0, 0xF4FB, 0xF4FD, 0xF4E7, 0xF541, 0xF4F2, 0xF4F7, 0xF4EB, /* 0x00 */ 0xF4EF, 0xF543, 0xF4F9, 0xF4E8, 0xF4EC, 0xF4EE, 0xF4F8, 0, /* 0x10 */ 0xC4C1, 0xF4F1, 0, 0, 0, 0, 0, 0, /* 0x10 */ 0xF4EA, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0xF4F0, 0xF661, 0xF666, 0xC54F, 0xF668, 0, 0xC549, 0, /* 0x20 */ 0xF664, 0xF66A, 0xC54E, 0xC54A, 0, 0xC54B, 0xF660, 0xF667, /* 0x30 */ 0xC54D, 0xF665, 0xC54C, 0xF65F, 0xF663, 0xF662, 0, 0xF65E, /* 0x30 */ 0xF669, 0, 0, 0, 0xC5B1, 0xF76D, 0xF770, 0xF76C, /* 0x40 */ 0xF76E, 0xF76F, 0xF769, 0xF76A, 0xF767, 0, 0, 0xF76B, /* 0x40 */ 0xF768, 0xC5B2, 0xC5B3, 0, 0, 0xF84B, 0, 0xF84D, /* 0x50 */ 0, 0, 0, 0, 0, 0xF84C, 0xF84E, 0, /* 0x50 */ 0xC5E0, 0, 0xF84A, 0xC5DF, 0xC5E1, 0, 0, 0, /* 0x60 */ 0xF8CB, 0xF8CC, 0xC644, 0xF8CA, 0, 0xF953, 0xF952, 0xF954, /* 0x60 */ 0xC65F, 0xF955, 0xC65E, 0xF956, 0xF972, 0xF975, 0xF974, 0xC668, /* 0x70 */ 0xF973, 0, 0, 0, 0xC672, 0xC670, 0xC671, 0xC677, /* 0x70 */ 0xF9C0, 0xF9C1, 0xF9BF, 0xF9C9 /* 0x80 */ /* 0x80 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_95[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xAAF8, /* 0x70 */ 0, 0, 0xD844, 0xDC78, 0xE8A5, 0xF376, 0, 0, /* 0x70 */ 0xAAF9, 0, 0xADAC, 0xB07B, 0, 0, 0xD845, 0, /* 0x80 */ 0xD846, 0xB3AC, 0, 0xB67D, 0xDC7A, 0xDC79, 0xB6A3, 0xB67C, /* 0x80 */ 0xDC7B, 0xB67E, 0xB6A2, 0xB6A1, 0xB67B, 0, 0, 0, /* 0x90 */ 0xB968, 0, 0, 0xE0D0, 0xE0CE, 0, 0xE0CF, 0xE0CD, /* 0x90 */ 0, 0xBBD2, 0, 0xBBD5, 0xBBD7, 0xBBD6, 0, 0, /* 0xA0 */ 0xBBD3, 0xBBD4, 0, 0xE8A7, 0xE8A6, 0xBE5B, 0xE8A8, 0, /* 0xA0 */ 0xE8A9, 0xBE5C, 0, 0, 0, 0xEC4D, 0xEC4B, 0xEEF3, /* 0xB0 */ 0, 0xEC49, 0xEC4A, 0xC046, 0xEC46, 0xEC4E, 0xEC48, 0xEC4C, /* 0xB0 */ 0xEEEF, 0, 0, 0xEEF1, 0, 0xEEF2, 0xC1F3, 0xEEEE, /* 0xC0 */ 0xC1F2, 0xEEF0, 0xC1EF, 0xC1F0, 0xC1F1, 0xEC47, 0, 0, /* 0xC0 */ 0xC2F5, 0xF16E, 0xF16C, 0xF16D, 0xC2F3, 0xC2F6, 0xC2F4, 0, /* 0xD0 */ 0, 0, 0xF377, 0xF378, 0xC3F6, 0, 0xF545, 0xF547, /* 0xD0 */ 0xF546, 0xC4C4, 0xC550, 0xF66D, 0xF66C, 0xF66B /* 0xE0 */ /* 0xE0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_96[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ /* 0x10 */ 0xAAFA, 0, 0xC9AA, 0, /* 0x10 */ 0xCA58, 0xA6E9, 0xCA56, 0xCA59, 0xCA57, 0, 0, 0, /* 0x20 */ 0xCBAE, 0, 0xA8C1, 0, 0xA8C2, 0xCBB0, 0xA8BF, 0xCBAF, /* 0x20 */ 0xCBAD, 0xA8C0, 0xA8BE, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0xCDD8, 0xCDDB, 0xAAFD, 0xCDDA, 0xCDD9, 0, 0xAAFC, /* 0x30 */ 0xAAFB, 0, 0xAB40, 0xCDDC, 0xAAFE, 0, 0, 0, /* 0x40 */ 0, 0, 0xD0C6, 0xADAE, 0xADAF, 0xADB0, 0xD0C7, 0xD0C3, /* 0x40 */ 0xADAD, 0xD0C4, 0, 0xD0C5, 0xD0C2, 0, 0, 0, /* 0x50 */ 0xB0A4, 0, 0, 0xB0A1, 0xD445, 0xB0A2, 0xB0A5, 0xD446, /* 0x50 */ 0, 0xB07E, 0xB07C, 0xB07D, 0xB0A3, 0, 0, 0, /* 0x60 */ 0, 0, 0xB3AD, 0xD849, 0xB3B5, 0xD848, 0, 0xD84B, /* 0x60 */ 0xB3B1, 0xD84A, 0xB6AB, 0xB3AF, 0xB3B2, 0xB3AE, 0xB3B3, 0xB3B4, /* 0x70 */ 0xB3B0, 0, 0, 0, 0xD847, 0xB6A7, 0xDC7D, 0, /* 0x70 */ 0xDCA3, 0, 0, 0xDCA2, 0xB6AC, 0xB6A8, 0xB6A9, 0xDC7C, /* 0x80 */ 0xDC7E, 0xDCA1, 0xB6A4, 0xB6A6, 0, 0xB6AA, 0xB6A5, 0, /* 0x80 */ 0, 0xE0D3, 0xE0D1, 0xE0D2, 0xB96A, 0xB96B, 0, 0xE0D4, /* 0x90 */ 0xB969, 0xBBD8, 0, 0xBBDA, 0xBBD9, 0, 0xE4BB, 0, /* 0x90 */ 0, 0xE4BC, 0xE8AB, 0, 0xE8AA, 0, 0, 0xC047, /* 0xA0 */ 0xC048, 0xEC4F, 0xC049, 0, 0xEEF6, 0, 0xEEF4, 0, /* 0xA0 */ 0xEEF5, 0xC1F4, 0, 0xF16F, 0xC3F7, 0, 0, 0, /* 0xB0 */ 0xC1F5, 0xAB41, 0, 0xB0A6, 0xD447, 0, 0, 0xD84C, /* 0xB0 */ 0xB3B6, 0xB6AD, 0xDCA4, 0xDCA6, 0xB6AF, 0xB6AE, 0xB6B0, 0xB6B1, /* 0xC0 */ 0xDCA5, 0xB96E, 0xB96F, 0xB96D, 0xBBDB, 0xB96C, 0xE0D5, 0, /* 0xC0 */ 0, 0, 0xBBDC, 0xE8AC, 0xEC50, 0xC04A, 0xC1F6, 0xF170, /* 0xD0 */ 0xF174, 0xC2F9, 0xF171, 0xC2FA, 0xC2F8, 0xF175, 0xC2FB, 0xF173, /* 0xD0 */ 0, 0xF379, 0xC2F7, 0xC3F8, 0, 0xF8CD, 0, 0, /* 0xE0 */ 0xAB42, 0xB3B8, 0xB3B7, 0, 0, 0, 0, 0xB6B2, /* 0xE0 */ 0xDCA8, 0xDCA7, 0xB6B3, 0, 0, 0xE0D9, 0xB973, 0xB970, /* 0xF0 */ 0xE0D8, 0xB972, 0xE0D6, 0xB971, 0, 0xE0D7, 0, 0xE4BD /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_97[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xBBDD, 0, 0xE8AF, 0, 0xBE5D, 0xE8AD, 0xBE5E, 0xBE5F, /* 0x00 */ 0xE8AE, 0xBE60, 0, 0xEC51, 0, 0xC04E, 0xC04B, 0xC050, /* 0x00 */ 0xEC53, 0xC04C, 0xEC52, 0xC04F, 0, 0, 0xC04D, 0, /* 0x10 */ 0xEEF9, 0xEEFB, 0, 0, 0xC1F7, 0xEEFA, 0xC1F8, 0xEEF8, /* 0x10 */ 0xEEF7, 0, 0xF177, 0xF176, 0xC2FC, 0xF178, 0xF37E, 0xC3FA, /* 0x20 */ 0xF37D, 0xF37A, 0xC3F9, 0xF37B, 0xF37C, 0, 0xF548, 0xF549, /* 0x20 */ 0xC4C5, 0, 0xC553, 0, 0, 0xF66E, 0, 0, /* 0x30 */ 0xC551, 0xC552, 0xF66F, 0, 0, 0xC5B4, 0xC5B5, 0xF771, /* 0x30 */ 0, 0, 0xC645, 0xF8CF, 0xC647, 0, 0xF8CE, 0xF8D0, /* 0x40 */ 0xC646, 0xF957, 0, 0xF9AD, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0xAB43, 0, 0, 0, 0xB974, 0, /* 0x50 */ 0xE4BE, 0, 0xE8B0, 0xC051, 0xC052, 0, 0xAB44, 0, /* 0x50 */ 0xBE61, 0xC3FB, 0xADB1, 0, 0, 0, 0xC053, 0, /* 0x60 */ 0xC5E2, 0xADB2, 0xD84D, 0, 0xDCA9, 0, 0xDCAB, 0, /* 0x60 */ 0xDCAA, 0, 0xE0DD, 0xE0DA, 0xB975, 0, 0xB976, 0xE0DB, /* 0x70 */ 0xE0DC, 0, 0xE4C0, 0xE4C5, 0xBBDE, 0xE4BF, 0xE4C1, 0xE4C8, /* 0x70 */ 0xE4C3, 0xE4C7, 0xE4C4, 0xE4C2, 0xE4C6, 0xBBDF, 0, 0, /* 0x80 */ 0xE8B3, 0, 0xE8B1, 0xBE63, 0, 0xBE62, 0xE8B2, 0xBE64, /* 0x80 */ 0, 0, 0, 0, 0xEC56, 0, 0, 0xEC55, /* 0x90 */ 0xC054, 0xEC54, 0xEEFC, 0, 0xEEFE, 0xEF41, 0xEF40, 0, /* 0x90 */ 0xC1F9, 0xEEFD, 0xF1A1, 0xC2FD, 0xF17D, 0xF1A2, 0xC2FE, 0, /* 0xA0 */ 0xF17B, 0, 0xF17E, 0xF17C, 0xF179, 0xC340, 0xF17A, 0, /* 0xA0 */ 0, 0, 0, 0xF3A1, 0, 0, 0xF3A3, 0xF3A2, /* 0xB0 */ 0, 0xF54A, 0, 0xF54B, 0, 0, 0, 0xF670, /* 0xB0 */ 0, 0xC5B7, 0, 0xC5B6, 0xF84F, 0xF850, 0xC648, 0xF8D1, /* 0xC0 */ 0, 0xC669, 0, 0xADB3, 0xB6B4, 0xE4CA, 0xE4C9, 0xE8B5, /* 0xC0 */ 0xE8B4, 0, 0, 0xC1FA, 0xEF43, 0xEF42, 0xF1A5, 0xF1A3, /* 0xD0 */ 0xF1A6, 0xF1A4, 0, 0, 0xC3FC, 0xF3A4, 0xF3A5, 0xF3A6, /* 0xD0 */ 0, 0xF671, 0, 0xF772, 0, 0xF8D2, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0xADB4, 0, 0, /* 0xE0 */ 0xEC57, 0xEF44, 0, 0xADB5, 0, 0, 0xBBE0, 0, /* 0xF0 */ 0xEC58, 0xC341, 0xF1A7, 0xC3FD, 0, 0xF54C, 0xF54D, 0xC554 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_98[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xF851, 0xADB6, 0xB3BB, 0xB3BC, 0xD84E, 0xB6B5, 0xB6B6, 0xDCAC, /* 0x00 */ 0xB6B7, 0, 0xB97A, 0, 0xB97C, 0xE0DF, 0xE0E0, 0xE0DE, /* 0x00 */ 0xB977, 0xB978, 0xB97B, 0xB979, 0, 0, 0xE4CB, 0xBBE1, /* 0x10 */ 0xBBE2, 0, 0, 0xE8BC, 0xBE67, 0xE8B7, 0xE8B6, 0, /* 0x10 */ 0xE8BB, 0xBE65, 0, 0, 0xC05B, 0, 0xE8B8, 0xE8BD, /* 0x20 */ 0xE8BA, 0xE8B9, 0, 0xBE66, 0, 0xC059, 0, 0xEC5A, /* 0x20 */ 0xC055, 0, 0xEC5B, 0, 0, 0xEC59, 0, 0xC058, /* 0x30 */ 0xC056, 0xC05A, 0, 0xC057, 0, 0, 0, 0, /* 0x30 */ 0, 0xEF45, 0, 0xEF4A, 0xEF46, 0xEF49, 0xC1FB, 0, /* 0x40 */ 0xEDD4, 0xEF48, 0xEF47, 0, 0xC344, 0xC342, 0xC345, 0xC343, /* 0x40 */ 0xF1A8, 0xF1A9, 0xF1AA, 0xC346, 0, 0, 0, 0xF3AA, /* 0x50 */ 0xC440, 0xF3A8, 0, 0xC441, 0xF3A7, 0xF3A9, 0xC3FE, 0xF551, /* 0x50 */ 0xF54E, 0, 0xF54F, 0xF550, 0xF672, 0xC556, 0, 0xC555, /* 0x60 */ 0, 0xF774, 0xF773, 0xC5B8, 0, 0, 0, 0xC5E3, /* 0x60 */ 0xC649, 0xC660, 0xF958, 0xF9AE, 0xF9AF, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0xADB7, 0xDCAD, 0, 0, 0xE0E1, 0xE4CC, 0xE4CD, 0xBBE3, /* 0xA0 */ 0, 0xBBE4, 0xE8BE, 0xBE68, 0, 0, 0xC1FC, 0, /* 0xB0 */ 0xF1AB, 0, 0xC347, 0xF3AD, 0xC442, 0xF3AC, 0xF3AE, 0xF3AB, /* 0xB0 */ 0xF675, 0xF552, 0xF553, 0, 0xC4C6, 0, 0xF674, 0, /* 0xC0 */ 0, 0xF673, 0, 0xF775, 0xF9B0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0xADB8, 0, 0, 0, 0xADB9, /* 0xD0 */ 0, 0, 0xB0A7, 0xD448, 0, 0xD84F, 0, 0xB6B8, /* 0xE0 */ 0, 0xB6BB, 0xB6B9, 0xDCAE, 0, 0xB6BD, 0, 0xB6BA, /* 0xE0 */ 0, 0, 0xB6BC, 0, 0xB97E, 0, 0xE0E2, 0, /* 0xF0 */ 0, 0xE0E3, 0xE8C0, 0, 0xB97D, 0xB9A1, 0xB9A2 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_99[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE4CF, 0, 0xE4CE, 0xBBE5, 0, 0xBBE6, 0, 0xE4D0, /* 0x00 */ 0xE8BF, 0xBBE8, 0xBE69, 0, 0xBBE7, 0, 0, 0, /* 0x00 */ 0xC05C, 0xE8C1, 0xBE6B, 0xBE6A, 0xE8C2, 0xE8C5, 0xE8C3, 0xE8C4, /* 0x10 */ 0xBE6C, 0, 0xC061, 0xC05F, 0, 0, 0xC05E, 0xEC5D, /* 0x10 */ 0, 0xC060, 0, 0, 0xEC5C, 0xEF4B, 0, 0xEC5E, /* 0x20 */ 0xC05D, 0xEC5F, 0xEF4E, 0xEF4C, 0xEF4D, 0xEF52, 0xC34B, 0xEF51, /* 0x20 */ 0xEF54, 0xEF53, 0xEF50, 0xEF4F, 0, 0xC1FD, 0, 0, /* 0x30 */ 0, 0, 0xF1AE, 0, 0xF1AD, 0xC34A, 0xC348, 0xC349, /* 0x30 */ 0, 0xF1AC, 0, 0xF3B1, 0, 0xC443, 0, 0xF3B0, /* 0x40 */ 0xF3AF, 0xC444, 0, 0xF558, 0xF557, 0, 0xF555, 0, /* 0x40 */ 0xF554, 0xC4C8, 0xC4C7, 0xF559, 0xF776, 0xC5B9, 0xF677, 0xC557, /* 0x50 */ 0xF676, 0xF556, 0, 0xF777, 0xC5E4, 0, 0xC661, 0xF959, /* 0x50 */ 0, 0xF9B1, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0xADBA, 0xD850, /* 0x90 */ 0xEF55, 0xADBB, 0, 0, 0xE4D2, 0xE4D1, 0xEC60, 0, /* 0x90 */ 0, 0xEF57, 0, 0xEF56, 0, 0xC34C, 0xF3B2, 0xF3B3, /* 0xA0 */ 0xC4C9, 0, 0, 0xF9B2, 0xB0A8, 0xB6BF, 0xB6BE, 0xE0E4, /* 0xA0 */ 0xE0E6, 0xB9A4, 0xE0E5, 0xB9A3, 0xB9A5, 0xE0E7, 0, 0, /* 0xB0 */ 0, 0xE4D4, 0xE4D6, 0xE4D5, 0, 0xE4D8, 0, 0, /* 0xB0 */ 0, 0xBBE9, 0xE4D7, 0xE4D3, 0, 0, 0, 0xE4D9, /* 0xC0 */ 0, 0xE8CC, 0, 0xE8CF, 0xE8D1, 0xE8C7, 0xE8CB, 0xE8C8, /* 0xC0 */ 0xBE6E, 0xBE71, 0xBE73, 0xE8C9, 0xE8CA, 0xBE72, 0xE8CD, 0xE8D0, /* 0xD0 */ 0xE8CE, 0xBE74, 0, 0xBE70, 0xE8C6, 0xBE6D, 0, 0xBE6F, /* 0xD0 */ 0, 0, 0xC063, 0xEC66, 0xEC64, 0xEC63, 0, 0xEC69, /* 0xE0 */ 0, 0xEC68, 0xEC67, 0, 0xEC62, 0xC062, 0xEC61, 0, /* 0xE0 */ 0xEC65, 0xC064, 0, 0, 0xEF5A, 0, 0xEF5E, 0xEF5B, /* 0xF0 */ 0xEF5D, 0xEF5C, 0xEF59, 0xEF5F, 0xEF62, 0xEF60, 0xEF61, 0xC240 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_9A[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xC1FE, 0xEF58, 0xEF63, 0xF1B3, 0xF1B6, 0xF1B8, 0xF1B7, /* 0x00 */ 0, 0xF1B1, 0xF1B5, 0xF1B0, 0, 0xF1B2, 0xC34D, 0xF1AF, /* 0x00 */ 0, 0xF1B4, 0, 0, 0xF3C0, 0xF3B5, 0xC445, 0, /* 0x10 */ 0, 0xC446, 0xF3B4, 0xF3B9, 0xF3BF, 0xF3B7, 0xF3BE, 0, /* 0x10 */ 0xF3BB, 0, 0xF3BA, 0xF3BD, 0xF3B8, 0xF3B6, 0, 0xF3BC, /* 0x20 */ 0, 0xF560, 0xF55E, 0xC4CA, 0xF55D, 0xF563, 0xF561, 0, /* 0x20 */ 0xC4CB, 0xF55C, 0xF55A, 0, 0xF55B, 0xC4CD, 0xF55F, 0xC4CC, /* 0x30 */ 0xF562, 0xF678, 0xF67E, 0, 0, 0xF679, 0xC55B, 0xF6A1, /* 0x30 */ 0xC55A, 0xF67D, 0xF67C, 0xC559, 0xF67B, 0xC558, 0xF67A, 0, /* 0x40 */ 0xF77D, 0xF7A1, 0xF77E, 0, 0xF77B, 0xC5BB, 0xF778, 0xF77C, /* 0x40 */ 0xF7A3, 0, 0xF7A2, 0xF779, 0xF77A, 0xC5BA, 0xF852, 0xC5E7, /* 0x50 */ 0, 0xF853, 0xC5E5, 0xC5E6, 0, 0, 0xF8D3, 0xC64A, /* 0x50 */ 0xF976, 0, 0xC66A, 0, 0xF9B3, 0xC66B, 0xF9B4, 0xF9B5, /* 0x60 */ 0xF9C3, 0xF9C2, 0xC67A, 0xF9CD, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0xB0A9, 0, 0, 0xE0E9, 0, 0xE0E8, 0, 0xBBEA, /* 0xA0 */ 0xBBEB, 0xE4DA, 0, 0xE8D2, 0xEC6C, 0, 0, 0xBE75, /* 0xB0 */ 0xC065, 0xEC6A, 0, 0xEC6D, 0xC066, 0, 0xEF64, 0xEC6B, /* 0xB0 */ 0xF1B9, 0xC34E, 0xF3C1, 0, 0, 0, 0xF566, 0xF564, /* 0xC0 */ 0, 0, 0xF565, 0, 0, 0xF6A2, 0, 0xC55C, /* 0xC0 */ 0xF7A4, 0xC5EA, 0xC5BC, 0xC5E8, 0xC5E9, 0xF8D4, 0xC662, 0, /* 0xD0 */ 0xB0AA, 0, 0, 0, 0xF1BA, 0, 0, 0xD449, /* 0xD0 */ 0, 0xB9A6, 0, 0xE4DB, 0, 0, 0xBBEC, 0xE4DC, /* 0xE0 */ 0, 0, 0, 0xE8D4, 0xE8D3, 0xC068, 0xBE76, 0xBE77, /* 0xE0 */ 0, 0xE8D7, 0xE8D6, 0xE8D5, 0, 0, 0xEC6E, 0xEC71, /* 0xF0 */ 0, 0xEC70, 0xEC6F, 0xC067, 0xEF68, 0xEF66, 0xEF65 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_9B[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xEF67, 0, 0xC34F, 0xF1BC, 0xF1BD, 0xC350, 0, /* 0x00 */ 0xF1BB, 0, 0xF3C3, 0xF3C2, 0xF3C5, 0xC447, 0xF3C4, 0, /* 0x00 */ 0xF567, 0xF569, 0xF568, 0, 0, 0xF6A3, 0xF6A6, 0xF6A4, /* 0x10 */ 0xF6A5, 0xF7A5, 0xC5BD, 0, 0, 0, 0xF854, 0xF855, /* 0x10 */ 0xF856, 0, 0xC64B, 0xC663, 0xF9B6, 0xB0AB, 0, 0xBE78, /* 0x20 */ 0xC069, 0xF1BE, 0, 0xF7A6, 0, 0, 0xF9C4, 0xD44A, /* 0x20 */ 0, 0xC67B, 0xB0AC, 0xEC72, 0, 0xF1BF, 0, 0xF3C6, /* 0x30 */ 0, 0, 0xF6A7, 0xF7A7, 0xB0AD, 0, 0xE4DD, 0xE4DE, /* 0x30 */ 0, 0xBBED, 0xBBEE, 0xE8D9, 0xBE7A, 0xBE79, 0xE8D8, 0, /* 0x40 */ 0xEF69, 0, 0xF1C0, 0xF1C2, 0xF1C1, 0xC353, 0xC352, 0xC351, /* 0x40 */ 0, 0xC55E, 0xF6A8, 0, 0xC55D, 0xF7A9, 0xF7A8, 0, /* 0x50 */ 0xC64C, 0xF8D5, 0xB3BD, 0xE0EA, 0, 0, 0, 0xE4E1, /* 0x50 */ 0xE4DF, 0xE4E0, 0, 0, 0xE8E2, 0, 0xE8DD, 0xE8DA, /* 0x60 */ 0xE8E1, 0, 0, 0, 0xE8E3, 0, 0, 0xBE7C, /* 0x60 */ 0xE8E0, 0xE8DC, 0, 0, 0xE8DB, 0xE8DF, 0xE8DE, 0xBE7B, /* 0x70 */ 0, 0, 0xEC7D, 0xEC78, 0xEC76, 0xECA1, 0xEC77, 0, /* 0x70 */ 0xEC73, 0, 0xEC79, 0, 0, 0xEC74, 0xEF72, 0xEC75, /* 0x80 */ 0xECA2, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0xEC7C, 0xC06A, 0xEC7B, 0xEC7A, 0, 0xEC7E, 0, 0, /* 0x90 */ 0, 0, 0xEF6A, 0xEF6D, 0, 0, 0xEF6C, 0, /* 0x90 */ 0xEF74, 0xEF6F, 0xEF73, 0, 0xEF71, 0xEF70, 0xEF6E, 0, /* 0xA0 */ 0xEF6B, 0, 0xC243, 0xC242, 0, 0xC244, 0xC241, 0xEF75, /* 0xA0 */ 0, 0, 0, 0, 0, 0xF1C8, 0xF1CB, 0, /* 0xB0 */ 0xF1C9, 0xF1CD, 0, 0, 0, 0xF1CE, 0, 0xF1C6, /* 0xB0 */ 0xC358, 0xF1C7, 0, 0xF1C5, 0xF1CC, 0, 0xF1C4, 0xF1C3, /* 0xC0 */ 0xC357, 0xC355, 0xC354, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0xF1CA, 0xF3CF, 0xF3D5, 0xC44A, 0xF3D0, /* 0xD0 */ 0, 0xF3D3, 0xF3D7, 0xC44B, 0xF3D2, 0, 0xF3CA, 0, /* 0xD0 */ 0xF3C9, 0xF3D6, 0xF3CD, 0, 0xF3CB, 0xF3D4, 0xF3CC, 0xC449, /* 0xE0 */ 0xC448, 0, 0xF3C7, 0xF3C8, 0xF3D1, 0, 0, 0, /* 0xE0 */ 0xF3CE, 0, 0, 0, 0, 0, 0, 0xF56C, /* 0xF0 */ 0xF56F, 0, 0, 0, 0, 0xC356 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_9C[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xF56D, 0xF573, 0xF571, /* 0x00 */ 0xF56B, 0xF576, 0, 0xF56A, 0, 0xC4CF, 0xF572, 0, /* 0x00 */ 0, 0, 0xF56E, 0xC4CE, 0xF575, 0, 0, 0xF574, /* 0x10 */ 0, 0, 0, 0, 0xF6AB, 0xF6AA, 0, 0, /* 0x10 */ 0, 0xF6B1, 0, 0xF6AD, 0xF6B0, 0xC560, 0, 0, /* 0x20 */ 0xF6AE, 0xF6AF, 0, 0xF6A9, 0xF6AC, 0xC55F, 0, 0, /* 0x20 */ 0, 0xC5BF, 0xF7B4, 0xF7AF, 0xF7B3, 0, 0xF7B6, 0xF7B2, /* 0x30 */ 0, 0xF7AE, 0, 0xC5C1, 0xF7B1, 0xF7B5, 0xC5C0, 0xF7AC, /* 0x30 */ 0xF570, 0xF7B0, 0, 0, 0xF7AD, 0, 0xF7AA, 0, /* 0x40 */ 0xF7AB, 0xC5BE, 0xF85A, 0xF85C, 0xF85F, 0xF85B, 0xF860, 0, /* 0x40 */ 0xF859, 0, 0xF857, 0, 0xC5EB, 0xF85D, 0xC5ED, 0xC5EC, /* 0x50 */ 0xF858, 0xF85E, 0, 0, 0, 0, 0xF8DA, 0xC64D, /* 0x50 */ 0xF8DB, 0, 0xF8D9, 0xF8D6, 0, 0, 0xF8D8, 0xF8D7, /* 0x60 */ 0xF95A, 0, 0, 0, 0, 0xF95C, 0xF95B, 0, /* 0x60 */ 0, 0xF979, 0, 0xF978, 0xF977, 0xF97A, 0, 0xC673, /* 0x70 */ 0xC674, 0xF9CA, 0xF9CE, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0xB3BE, 0xDCAF, 0xE0ED, /* 0xE0 */ 0, 0xB9A7, 0xE0EB, 0, 0, 0xE0EC, 0, 0, /* 0xE0 */ 0, 0xE4E2, 0xE4E3, 0xBBF1, 0xBBEF, 0xE4E4, 0xBBF0, 0xE8E8, /* 0xF0 */ 0, 0xE8EB, 0xE8E5, 0xE8EC, 0xE8E4, 0xE8E6, 0, 0xE8E7 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_9D[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xE8EA, 0, 0, 0xBEA1, 0xE8EF, 0xE8EE, 0xBE7D, 0xE8E9, /* 0x00 */ 0xE8ED, 0xBE7E, 0, 0, 0, 0, 0, 0, /* 0x00 */ 0xECAC, 0, 0xC06F, 0, 0xECA7, 0xC06B, 0, 0xECA4, /* 0x10 */ 0xECAA, 0xECAD, 0, 0xC070, 0, 0xECA9, 0xECA6, 0xECAE, /* 0x10 */ 0xECA5, 0, 0xECAB, 0xC06C, 0, 0xECA3, 0xC06D, 0, /* 0x20 */ 0xC06E, 0xECA8, 0, 0, 0, 0xEFA9, 0xEF7A, 0xEF7B, /* 0x20 */ 0xEF7E, 0xEF7C, 0, 0xEF76, 0, 0, 0xEF79, 0xEFA5, /* 0x30 */ 0xEF7D, 0, 0, 0xC245, 0, 0xEFA7, 0xEFA4, 0xC246, /* 0x30 */ 0xEFA6, 0xEF77, 0xEFA2, 0xEFA3, 0, 0xEFA1, 0, 0, /* 0x40 */ 0, 0, 0xF1D2, 0xF1D4, 0xF1D7, 0, 0, 0xF1D1, /* 0x40 */ 0, 0xC359, 0xF1D9, 0xF1D0, 0xF1DA, 0, 0xF1D6, 0xF1D8, /* 0x50 */ 0xF1DC, 0xF1D5, 0xF1DD, 0xF1D3, 0xF1CF, 0xC35A, 0, 0xF1DB, /* 0x50 */ 0xC35B, 0xC44D, 0, 0, 0, 0, 0, 0xEF78, /* 0x60 */ 0xF3F1, 0xF3E8, 0xC44F, 0xF3E4, 0xC450, 0, 0, 0xF3ED, /* 0x60 */ 0xF3E7, 0xF3DD, 0xC44E, 0xF3EA, 0xF3E5, 0xF3E6, 0, 0xF3D8, /* 0x70 */ 0xF3DF, 0xF3EE, 0, 0xF3EB, 0, 0xF3E3, 0, 0xF3EF, /* 0x70 */ 0xF3DE, 0xF3D9, 0xF3EC, 0, 0xF3DB, 0xF3E9, 0xF3E0, 0xF3F0, /* 0x80 */ 0xF3DC, 0xC44C, 0xF3DA, 0xF3E1, 0xF3E2, 0, 0, 0, /* 0x80 */ 0xF57D, 0, 0xF57B, 0, 0xF5A2, 0, 0xF5AE, 0xF5A5, /* 0x90 */ 0xF57C, 0xF578, 0xF5A7, 0xF57E, 0xF5A3, 0xF57A, 0xF5AA, 0xF577, /* 0x90 */ 0xF5A1, 0xF5A6, 0xF5A8, 0xF5AB, 0xF579, 0, 0xF5AF, 0xF5B0, /* 0xA0 */ 0xF5A9, 0xF5AD, 0xF5A4, 0, 0xF6C1, 0xF6C4, 0, 0xC561, /* 0xA0 */ 0, 0xF6C3, 0xF6C8, 0xF6C6, 0xC562, 0xF6BD, 0xF6B3, 0xF6B2, /* 0xB0 */ 0xC564, 0xF6BF, 0xF6C0, 0xF6BC, 0xF6B4, 0, 0xF6B9, 0xF5AC, /* 0xB0 */ 0, 0xF6B5, 0xC563, 0xF6BB, 0, 0xF6BA, 0, 0xF6B6, /* 0xC0 */ 0xF6C2, 0, 0xF6B7, 0xF7BB, 0xF6C5, 0xF6C7, 0xF6BE, 0xF6B8, /* 0xC0 */ 0xF7BC, 0xF7BE, 0xF7B8, 0xC5C2, 0, 0xF7C5, 0xF7C3, 0xC5C3, /* 0xD0 */ 0xF7C2, 0xF7C1, 0xF7BA, 0xF7B7, 0xF7BD, 0xF7C6, 0xF7B9, 0xF7BF, /* 0xD0 */ 0, 0xF869, 0xF86E, 0xF864, 0xF867, 0xC5EE, 0xF86B, 0, /* 0xE0 */ 0xF872, 0xF7C0, 0, 0xF865, 0xF86F, 0xF873, 0xF86A, 0xF863, /* 0xE0 */ 0xF86D, 0, 0xF86C, 0xF871, 0xF870, 0xF7C4, 0xF868, 0xF862, /* 0xF0 */ 0xF866, 0xC64E, 0xC64F, 0xF861, 0, 0xF8E6, 0xF8DD, 0xF8E5 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_9E[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xF8E2, 0xF8E3, 0xF8DC, 0xF8DF, 0xF8E7, 0xF8E1, 0xF8E0, 0xF8DE, /* 0x00 */ 0, 0xF8E4, 0, 0xF95D, 0, 0xF95E, 0, 0xF960, /* 0x00 */ 0xF95F, 0xF962, 0xF961, 0xF97C, 0xF97B, 0xF9B7, 0, 0xF9B8, /* 0x10 */ 0, 0xF9C5, 0xC678, 0xC67C, 0, 0xF9CF, 0xC67D, 0, /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0xB3BF, 0, 0, /* 0x70 */ 0, 0xC4D0, 0xF6C9, 0, 0xC650, 0xC651, 0, 0xB3C0, /* 0x70 */ 0xE0EE, 0, 0xB9A8, 0xE8F0, 0, 0, 0xECB0, 0xECB1, /* 0x80 */ 0xECAF, 0xEFAB, 0xEFAA, 0xC247, 0xF1DF, 0xEFAC, 0xF1DE, 0, /* 0x80 */ 0, 0xF3F3, 0xC451, 0xC453, 0xF3F2, 0, 0, 0xC452, /* 0x90 */ 0, 0xF5B1, 0xF5B3, 0xF5B2, 0xF6CA, 0xC565, 0, 0xC5EF, /* 0x90 */ 0xF8E8, 0xF963, 0, 0, 0xF9D2, 0xB3C1, 0, 0xE4E5, /* 0xA0 */ 0, 0xBEA2, 0, 0, 0, 0xECB3, 0xECB2, 0, /* 0xA0 */ 0xEFAD, 0, 0, 0, 0xC454, 0xC4D1, 0xF7C7, 0xF9CB, /* 0xB0 */ 0, 0, 0, 0xB3C2, 0xBBF2, 0, 0xBEA3, 0, /* 0xB0 */ 0xF3F4, 0, 0xF874, 0xB6C0, 0, 0, 0, 0, /* 0xC0 */ 0xEFAE, 0, 0, 0, 0xC664, 0xB6C1, 0xBEA4, 0xC248, /* 0xC0 */ 0xF875, 0xB6C2, 0, 0xE8F1, 0xC072, 0xECB4, 0xECB5, 0, /* 0xD0 */ 0xC071, 0, 0xEFAF, 0xC24C, 0xC24A, 0xC24B, 0xC249, 0xF1E0, /* 0xD0 */ 0xC35C, 0, 0, 0, 0xF5B5, 0xF5B4, 0xF5B7, 0xF5B6, /* 0xE0 */ 0xC4D2, 0, 0, 0xF6CB, 0, 0xF6CD, 0xF6CC, 0xC566, /* 0xE0 */ 0xF7C8, 0, 0xF876, 0xF877, 0xC5F0, 0xF964, 0xF97D, 0xC675, /* 0xF0 */ 0, 0xDCB0, 0xECB6, 0xEFB0, 0xF3F5, 0xE0EF, 0, 0xEFB1 /* 0xF0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_9F[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xF1E2, 0xF1E1, 0, 0, 0, 0, 0xF878, 0xC652, /* 0x00 */ 0, 0xF965, 0xF97E, 0, 0, 0, 0xB9A9, 0xE8F2, /* 0x00 */ 0xE8F3, 0, 0xECB7, 0xB9AA, 0, 0xC35D, 0xF1E3, 0, /* 0x10 */ 0xF6CF, 0xC567, 0xF6D0, 0xF6CE, 0xF879, 0, 0xF8E9, 0, /* 0x10 */ 0xB9AB, 0, 0xEFB4, 0xEFB3, 0xEFB2, 0xF1E4, 0, 0, /* 0x20 */ 0xF1E8, 0xF1E7, 0xF1E6, 0xF1E5, 0xC35E, 0xF3F6, 0xF5B9, 0xC4D3, /* 0x20 */ 0xF5B8, 0xF6D1, 0xF7CB, 0xF7CA, 0xC5C4, 0xF7C9, 0xF87C, 0xF87B, /* 0x30 */ 0xF87A, 0, 0, 0xBBF3, 0, 0xECB8, 0xC24D, 0, /* 0x30 */ 0xF3F7, 0xF3F8, 0xF7CC, 0xF87D, 0, 0, 0xF8EA, 0xF966, /* 0x40 */ 0xF9B9, 0xF9D4, 0xBBF4, 0xC24E, 0xF1E9, 0xF3F9, 0xF6D2, 0xF87E, /* 0x40 */ 0, 0, 0xBEA6, 0, 0xEFB5, 0xF1EA, 0xF3FA, 0xF3FB, /* 0x50 */ 0xF3FC, 0xF5BE, 0, 0xF5BA, 0xC568, 0xF5BD, 0xF5BC, 0xC4D4, /* 0x50 */ 0xF5BB, 0xC4D6, 0, 0xC4D5, 0xF6D4, 0xF6D3, 0xC569, 0xC56A, /* 0x60 */ 0, 0, 0xC5C6, 0xF7CD, 0xC5C5, 0, 0xF8A3, 0xF8A4, /* 0x60 */ 0xF8A2, 0xF8A1, 0xC654, 0, 0xF8EB, 0xF8EC, 0xF8ED, 0xC653, /* 0x70 */ 0xF967, 0xF96A, 0xF969, 0xF968, 0, 0, 0xF9D3, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0xC073, 0, 0, /* 0x80 */ 0xC365, 0xF5BF, 0xF6D5, 0, 0xC5C7, 0xF7CE, 0, 0, /* 0x90 */ 0xF9D5, 0, 0, 0, 0xC074, 0, 0, 0, /* 0x90 */ 0xEFB6, 0, 0xF7CF, 0, 0xF9A1 /* 0xA0 */ /* 0xA0 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_APPLECHINTRAD_F8[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0x0081, 0x0082 /* 0x80 */ /* 0x80 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_FA[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ /* 0x00 */ 0xC94A, 0xDDFC /* 0x00 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_FE[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA14A, 0xA157, 0, 0xA159, 0xA15B, 0xA15F, 0xA160, 0xA163, /* 0x30 */ 0xA164, 0xA167, 0xA168, 0xA16B, 0xA16C, 0xA16F, 0xA170, 0xA173, /* 0x30 */ 0xA174, 0xA177, 0xA178, 0xA17B, 0xA17C, 0, 0, 0, /* 0x40 */ 0, 0xA1C6, 0xA1C7, 0xA1CA, 0xA1CB, 0xA1C8, 0xA1C9, 0xA15C, /* 0x40 */ 0xA14D, 0xA14E, 0xA14F, 0, 0xA151, 0xA152, 0xA153, 0xA154, /* 0x50 */ 0, 0xA17D, 0xA17E, 0xA1A1, 0xA1A2, 0xA1A3, 0xA1A4, 0xA1CC, /* 0x50 */ 0xA1CD, 0xA1CE, 0xA1DE, 0xA1DF, 0xA1E0, 0xA1E1, 0xA1E2, 0, /* 0x60 */ 0xA242, 0xA24C, 0xA24D, 0xA24E /* 0x60 */ }; /* ----------------------------------------------------------------------- */ static sal_uInt16 const aImplUniToDBCSTab_BIG5_FF[] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ 0xA149, 0, 0xA1AD, 0xA243, 0xA248, 0xA1AE, 0, /* 0x00 */ 0xA15D, 0xA15E, 0xA1AF, 0xA1CF, 0xA141, 0xA1D0, 0xA144, 0xA1FE, /* 0x00 */ 0xA2AF, 0xA2B0, 0xA2B1, 0xA2B2, 0xA2B3, 0xA2B4, 0xA2B5, 0xA2B6, /* 0x10 */ 0xA2B7, 0xA2B8, 0xA147, 0xA146, 0xA1D5, 0xA1D7, 0xA1D6, 0xA148, /* 0x10 */ 0xA249, 0xA2CF, 0xA2D0, 0xA2D1, 0xA2D2, 0xA2D3, 0xA2D4, 0xA2D5, /* 0x20 */ 0xA2D6, 0xA2D7, 0xA2D8, 0xA2D9, 0xA2DA, 0xA2DB, 0xA2DC, 0xA2DD, /* 0x20 */ 0xA2DE, 0xA2DF, 0xA2E0, 0xA2E1, 0xA2E2, 0xA2E3, 0xA2E4, 0xA2E5, /* 0x30 */ 0xA2E6, 0xA2E7, 0xA2E8, 0, 0xA240, 0, 0, 0xA1C4, /* 0x30 */ 0, 0xA2E9, 0xA2EA, 0xA2EB, 0xA2EC, 0xA2ED, 0xA2EE, 0xA2EF, /* 0x40 */ 0xA2F0, 0xA2F1, 0xA2F2, 0xA2F3, 0xA2F4, 0xA2F5, 0xA2F6, 0xA2F7, /* 0x40 */ 0xA2F8, 0xA2F9, 0xA2FA, 0xA2FB, 0xA2FC, 0xA2FD, 0xA2FE, 0xA340, /* 0x50 */ 0xA341, 0xA342, 0xA343, 0xA161, 0xA155, 0xA162, 0xA1E3, 0, /* 0x50 */ 0, 0, 0, 0, 0xA14E, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 */ 0xA246, 0xA247, 0, 0xA1C3, 0, 0xA244, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 */ 0, 0, 0, 0, 0, 0xA1C5 /* 0xF0 */ };
the_stack
-- Transact-SQL script to create table structure for SNOMED terminology tables -- Copyright Chris Tillman 2018, licensed under GPL any version -- Cannot drop database if you're already in it USE master GO DROP DATABASE snomedct -- Avoid individual DROP TABLES GO CREATE DATABASE snomedct GO USE snomedct CREATE TABLE sct2_concept ( id bigint NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_C_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_C_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_C_MODULEID DEFAULT 0, definitionStatusId bigint NOT NULL CONSTRAINT DF_C_DEF_STATUSID DEFAULT 0, CONSTRAINT PK_CONCEPT PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_description ( id bigint NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_D_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_D_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_D_MODULEID DEFAULT 0, conceptId bigint NOT NULL , languageCode varchar (3) NOT NULL CONSTRAINT DF_D_LANG_CODE DEFAULT '', typeId bigint NOT NULL CONSTRAINT DF_D_TYPE DEFAULT 0, term varchar (255) NOT NULL CONSTRAINT DF_D_TERM DEFAULT '', caseSignificanceId bigint NOT NULL CONSTRAINT DF_D_CASE_SIGNIF DEFAULT 0, CONSTRAINT PK_SCT2_DESCRIPTION PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_identifier ( identifierSchemeId bigint NOT NULL , alternateIdentifier varchar (255) NOT NULL CONSTRAINT DF_I_ALT_ID DEFAULT '', effectiveTime int NOT NULL CONSTRAINT DF_I_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_I_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_I_MODULEID DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_I_REF_COMP DEFAULT 0, CONSTRAINT PK_SCT2_IDENTIFIER PRIMARY KEY (identifierSchemeId,alternateIdentifier,effectiveTime) ) GO CREATE TABLE sct2_relationship ( id bigint NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_R_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_R_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_R_MODULEID DEFAULT 0, sourceId bigint NOT NULL CONSTRAINT DF_R_SOURCE DEFAULT 0, destinationId bigint NOT NULL CONSTRAINT DF_R_DEST DEFAULT 0, relationshipGroup int NOT NULL CONSTRAINT DF_R_GROUP DEFAULT 0, typeId bigint NOT NULL CONSTRAINT DF_R_TYPE DEFAULT 0, characteristictypeId bigint NOT NULL CONSTRAINT DF_R_CHAR_TYPE DEFAULT 0, modifierId bigint NOT NULL CONSTRAINT DF_R_MODIFIER DEFAULT 0, CONSTRAINT PK_RELATIONSHIP PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_statedrelationship ( id bigint NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_SR_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_SR_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_SR_MODULEID DEFAULT 0, sourceId bigint NOT NULL CONSTRAINT DF_SR_SOURCE DEFAULT 0, destinationId bigint NOT NULL CONSTRAINT DF_SR_DEST DEFAULT 0, relationshipGroup int NOT NULL CONSTRAINT DF_SR_GROUP DEFAULT 0, typeId bigint NOT NULL CONSTRAINT DF_SR_TYPE DEFAULT 0, characteristictypeId bigint NOT NULL CONSTRAINT DF_SR_CHAR_TYPE DEFAULT 0, modifierId bigint NOT NULL CONSTRAINT DF_SR_MODIFIER DEFAULT 0, CONSTRAINT PK_STATED_RELATIONSHIP PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_textdefinition ( id bigint NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_TD_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_TD_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_TD_MODULEID DEFAULT 0, conceptId bigint NOT NULL CONSTRAINT DF_TD_CONCEPT DEFAULT 0, languageCode varchar (3) NOT NULL CONSTRAINT DF_TD_LANG_CODE DEFAULT '', typeId bigint NOT NULL CONSTRAINT DF_TD_TYPE DEFAULT 0, term varchar (4096) NOT NULL CONSTRAINT DF_TD_TERM DEFAULT '', caseSignificanceId bigint NOT NULL CONSTRAINT DF_TD_CASE_SIGNIF DEFAULT 0, CONSTRAINT PK_TEXT_DEFINITION PRIMARY KEY (id,effectiveTime) ) GO -- ICD Mapping table -- tls_Icd10cmHumanReadableMap_US1000124_20180301.tsv -- DROP TABLE tls_Icd10cmHumanReadableMap -- GO CREATE TABLE tls_Icd10cmHumanReadableMap ( id_in uniqueidentifier NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_TI_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_TI_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_TI_MODULEID DEFAULT 0, refsetId bigint NOT NULL CONSTRAINT DF_TI_REFSET DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_TI_REF_COMP DEFAULT 0, referencedComponentName varchar (512) NOT NULL CONSTRAINT DF_REF_COMP_NAME DEFAULT '', mapGroup tinyint NOT NULL CONSTRAINT DF_TI_MAPGRP DEFAULT 0, mapPriority tinyint NOT NULL CONSTRAINT DF_TI_MAPPRI DEFAULT 0, mapRule varchar (512) NOT NULL CONSTRAINT DF_TI_MAPRULE DEFAULT '', mapAdvice varchar (512) NOT NULL CONSTRAINT DF_TI_MAPADVICE DEFAULT '', mapTarget varchar (10) NOT NULL CONSTRAINT DF_TI_MAPTARGET DEFAULT '', mapTargetName varchar (255) NOT NULL CONSTRAINT DF_TI_MAP_TRG_NAME DEFAULT '', correlationId bigint NOT NULL CONSTRAINT DF_TI_CORR_ID DEFAULT 0, mapCategoryId bigint NOT NULL CONSTRAINT DF_TI_CATEGORY_ID DEFAULT 0, mapCategoryName varchar (255) NOT NULL CONSTRAINT DF_TI_CATEGORY_NAME DEFAULT '', CONSTRAINT PK_TLS_ICD PRIMARY KEY (id_in,effectiveTime) ) GO -- I didn't do the refsets, the file names don't quite correspond to the -- table names from the original MYSQL script ... probably have changed /* CREATE TABLE sct2_refset_c ( id uniqueidentifier NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_RS_C_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_RS_C_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_RS_C_MODULEID DEFAULT 0, refSetId bigint NOT NULL CONSTRAINT DF_RS_C_RS_ID DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_RS_C_REF_COMP DEFAULT 0, attribute1 bigint NOT NULL CONSTRAINT DF_RS_C_ATTR1 DEFAULT 0, CONSTRAINT PK_REFSET_C PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_refset ( id uniqueidentifier NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_RS_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_RS_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_RS_MODULEID DEFAULT 0, refSetId bigint NOT NULL CONSTRAINT DF_RS_RS_ID DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_RS_REF_COMP DEFAULT 0, CONSTRAINT PK_REFSET PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_refset_iissscc ( id uniqueidentifier NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_RS_I_CC_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_RS_I_CC_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_RS_I_CC_MODULEID DEFAULT 0, refSetId bigint NOT NULL CONSTRAINT DF_RS_I_CC_RS_ID DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_RS_I_CC_REF_COMP DEFAULT 0, attribute1 int NOT NULL CONSTRAINT DF_RS_I_CC_ATTR1 DEFAULT 0, attribute2 int NOT NULL CONSTRAINT DF_RS_I_CC_ATTR2 DEFAULT 0, attribute3 varchar (255) NOT NULL CONSTRAINT DF_RS_I_CC_ATTR3 DEFAULT '', attribute4 varchar (255) NOT NULL CONSTRAINT DF_RS_I_CC_ATTR4 DEFAULT '', attribute5 varchar (255) NOT NULL CONSTRAINT DF_RS_I_CC_ATTR5 DEFAULT '', attribute6 bigint NOT NULL CONSTRAINT DF_RS_I_CC_ATTR6 DEFAULT 0, attribute7 bigint NOT NULL CONSTRAINT DF_RS_I_CC_ATTR7 DEFAULT 0, CONSTRAINT PK_REFSET_IISSSCC PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_refset_iisssc ( id uniqueidentifier NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_RS_I_C_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_RS_I_C_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_RS_I_C_MODULEID DEFAULT 0, refSetId bigint NOT NULL CONSTRAINT DF_RS_I_C_RS_ID DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_RS_I_C_REF_COMP DEFAULT 0, attribute1 int NOT NULL CONSTRAINT DF_RS_I_C_ATTR1 DEFAULT 0, attribute2 int NOT NULL CONSTRAINT DF_RS_I_C_ATTR2 DEFAULT 0, attribute3 varchar (255) NOT NULL CONSTRAINT DF_RS_I_C_ATTR3 DEFAULT '', attribute4 varchar (255) NOT NULL CONSTRAINT DF_RS_I_C_ATTR4 DEFAULT '', attribute5 varchar (255) NOT NULL CONSTRAINT DF_RS_I_C_ATTR5 DEFAULT '', attribute6 bigint NOT NULL CONSTRAINT DF_RS_I_C_ATTR6 DEFAULT 0, CONSTRAINT PK_REFSET_IISSSC PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_refset_s ( id uniqueidentifier NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_RS_S_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_RS_S_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_RS_S_MODULEID DEFAULT 0, refSetId bigint NOT NULL CONSTRAINT DF_RS_S_RS DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_RS_S_REF_COMP DEFAULT 0, attribute1 varchar (255) NOT NULL CONSTRAINT DF_RS_S_ATTR1 DEFAULT '', CONSTRAINT PK_REFSET_S PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_refset_cci ( id uniqueidentifier NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_RS_CCI_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_RS_CCI_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_RS_CCI_MODULEID DEFAULT 0, refSetId bigint NOT NULL CONSTRAINT DF_RS_CCI_RS_ID DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_RS_CCI_REF_COMP DEFAULT 0, attribute1 bigint NOT NULL CONSTRAINT DF_RS_CCI_ATTR1 DEFAULT 0, attribute2 bigint NOT NULL CONSTRAINT DF_RS_CCI_ATTR2 DEFAULT 0, attribute3 int NOT NULL CONSTRAINT DF_RS_CCI_ATTR3 DEFAULT 0, CONSTRAINT PK_REFSET_CCI PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_refset_ci ( id uniqueidentifier NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_RS_CI_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_RS_CI_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_RS_CI_MODULEID DEFAULT 0, refSetId bigint NOT NULL CONSTRAINT DF_RS_CI_RS_ID DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_RS_CI_REF_COMP DEFAULT 0, attribute1 bigint NOT NULL CONSTRAINT DF_RS_CI_ATTR1 DEFAULT 0, attribute2 int NOT NULL CONSTRAINT DF_RS_CI_ATTR2 DEFAULT 0, CONSTRAINT PK_REFSET_CI PRIMARY KEY (id,effectiveTime) ) GO CREATE TABLE sct2_refset_ss ( id uniqueidentifier NOT NULL , effectiveTime int NOT NULL CONSTRAINT DF_RS_SS_EFF_TIME DEFAULT 0, active tinyint NOT NULL CONSTRAINT DF_RS_SS_ACTIVE DEFAULT 0, moduleId bigint NOT NULL CONSTRAINT DF_RS_SS_MODULEID DEFAULT 0, refSetId bigint NOT NULL CONSTRAINT DF_RS_SS_RS_ID DEFAULT 0, referencedComponentId bigint NOT NULL CONSTRAINT DF_RS_SS_REF_COMP DEFAULT 0, attribute1 varchar(255) NOT NULL CONSTRAINT DF_RS_SS_ATTR1 DEFAULT '', attribute2 varchar(255) NOT NULL CONSTRAINT DF_RS_SS_ATTR2 DEFAULT '', CONSTRAINT PK_REFSET_SS PRIMARY KEY (id , effectiveTime) ) GO */
the_stack
-- -- Licensed to the Apache Software Foundation (ASF) under one -- or more contributor license agreements. See the NOTICE file -- distributed with this work for additional information -- regarding copyright ownership. The ASF licenses this file -- to you under the Apache License, Version 2.0 (the -- "License"); you may not use this file except in compliance -- with the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, -- software distributed under the License is distributed on an -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -- KIND, either express or implied. See the License for the -- specific language governing permissions and limitations -- under the License. -- /* Leaving as out-of-box (but non-core reports) for now could be removed later if people think too many non-generic reports are being added used in quipo TEVI dashboard (landing pages) */ DELETE FROM `stretchy_report` where report_name = 'FieldAgentStats'; DELETE FROM `stretchy_report` where report_name = 'FieldAgentPrograms'; DELETE FROM `stretchy_report` where report_name = 'ProgramDetails'; DELETE FROM `stretchy_report` where report_name = 'ChildrenStaffList'; DELETE FROM `stretchy_report` where report_name = 'CoordinatorStats'; DELETE FROM `stretchy_report` where report_name = 'BranchManagerStats'; DELETE FROM `stretchy_report` where report_name = 'ProgramDirectorStats'; DELETE FROM `stretchy_report` where report_name = 'ProgramStats'; DELETE FROM `m_permission` where entity_name = 'FieldAgentStats'; DELETE FROM `m_permission` where entity_name = 'FieldAgentPrograms'; DELETE FROM `m_permission` where entity_name = 'ProgramDetails'; DELETE FROM `m_permission` where entity_name = 'ChildrenStaffList'; DELETE FROM `m_permission` where entity_name = 'CoordinatorStats'; DELETE FROM `m_permission` where entity_name = 'BranchManagerStats'; DELETE FROM `m_permission` where entity_name = 'ProgramDirectorStats'; DELETE FROM `m_permission` where entity_name = 'ProgramStats'; INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('FieldAgentStats', 'Table', 'Quipo', false, false, 'Field Agent Statistics', " select ifnull(cur.display_symbol, l.currency_code) as Currency, /*This query will return more than one entry if more than one currency is used */ count(distinct(c.id)) as activeClients, count(*) as activeLoans, sum(l.principal_disbursed_derived) as disbursedAmount, sum(l.principal_outstanding_derived) as loanOutstandingAmount, round((sum(l.principal_outstanding_derived) * 100) / sum(l.principal_disbursed_derived),2) as loanOutstandingPC, sum(ifnull(lpa.principal_in_advance_derived,0.0)) as LoanPaidInAdvance, sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) as portfolioAtRisk, round((sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) * 100) / sum(l.principal_outstanding_derived), 2) as portfolioAtRiskPC, count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) as clientsInDefault, round((count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) * 100) / count(distinct(c.id)),2) as clientsInDefaultPC, (sum(l.principal_disbursed_derived) / count(*)) as averageLoanAmount from m_staff fa join m_office o on o.id = fa.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code left join m_loan_arrears_aging laa on laa.loan_id = l.id left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where fa.id = ${staffId} and l.loan_status_id = 300 group by l.currency_code "); INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('FieldAgentPrograms', 'Table', 'Quipo', false, false, 'List of Field Agent Programs', " select pgm.id, pgm.display_name as `name`, sts.enum_message_property as status from m_group pgm join m_office o on o.id = pgm.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') left join r_enum_value sts on sts.enum_name = 'status_enum' and sts.enum_id = pgm.status_enum where pgm.staff_id = ${staffId} "); INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ProgramDetails', 'Table', 'Quipo', false, false, 'List of Loans in a Program', " select l.id as loanId, l.account_no as loanAccountNo, c.id as clientId, c.account_no as clientAccountNo, pgm.display_name as programName, (select count(*) from m_loan cy where cy.group_id = pgm.id and cy.client_id =c.id and cy.disbursedon_date <= l.disbursedon_date) as loanCycleNo, c.display_name as clientDisplayName, ifnull(cur.display_symbol, l.currency_code) as Currency, ifnull(l.principal_repaid_derived,0.0) as loanRepaidAmount, ifnull(l.principal_outstanding_derived, 0.0) as loanOutstandingAmount, sum(ifnull(lpa.principal_in_advance_derived,0.0)) as LoanPaidInAdvance, ifnull(laa.principal_overdue_derived, 0.0) as loanInArrearsAmount, if(ifnull(laa.principal_overdue_derived, 0.00) > 0, 'Yes', 'No') as inDefault, if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0) as portfolioAtRisk from m_group pgm join m_office o on o.id = pgm.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code join m_client c on c.id = l.client_id left join m_loan_arrears_aging laa on laa.loan_id = l.id left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id where pgm.id = ${programId} and l.loan_status_id = 300 order by c.display_name, l.account_no "); INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ChildrenStaffList', 'Table', 'Quipo', false, false, 'Get Next Level Down Staff', " select s.id, s.display_name, s.firstname, s.lastname, s.organisational_role_enum, s.organisational_role_parent_staff_id, sp.display_name as `organisational_role_parent_staff_display_name` from m_staff s join m_staff sp on s.organisational_role_parent_staff_id = sp.id where s.organisational_role_parent_staff_id = ${staffId} "); INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('CoordinatorStats', 'Table', 'Quipo', false, false, 'Coordinator Statistics', " select ifnull(cur.display_symbol, l.currency_code) as Currency, /*This query will return more than one entry if more than one currency is used */ count(distinct(c.id)) as activeClients, count(*) as activeLoans, sum(l.principal_disbursed_derived) as disbursedAmount, sum(l.principal_outstanding_derived) as loanOutstandingAmount, round((sum(l.principal_outstanding_derived) * 100) / sum(l.principal_disbursed_derived),2) as loanOutstandingPC, sum(ifnull(lpa.principal_in_advance_derived,0.0)) as LoanPaidInAdvance, sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) as portfolioAtRisk, round((sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) * 100) / sum(l.principal_outstanding_derived), 2) as portfolioAtRiskPC, count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) as clientsInDefault, round((count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) * 100) / count(distinct(c.id)),2) as clientsInDefaultPC, (sum(l.principal_disbursed_derived) / count(*)) as averageLoanAmount from m_staff coord join m_staff fa on fa.organisational_role_parent_staff_id = coord.id join m_office o on o.id = fa.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code left join m_loan_arrears_aging laa on laa.loan_id = l.id left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where coord.id = ${staffId} and l.loan_status_id = 300 group by l.currency_code "); INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('BranchManagerStats', 'Table', 'Quipo', false, false, 'Branch Manager Statistics', " select ifnull(cur.display_symbol, l.currency_code) as Currency, /*This query will return more than one entry if more than one currency is used */ count(distinct(c.id)) as activeClients, count(*) as activeLoans, sum(l.principal_disbursed_derived) as disbursedAmount, sum(l.principal_outstanding_derived) as loanOutstandingAmount, round((sum(l.principal_outstanding_derived) * 100) / sum(l.principal_disbursed_derived),2) as loanOutstandingPC, sum(ifnull(lpa.principal_in_advance_derived,0.0)) as LoanPaidInAdvance, sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) as portfolioAtRisk, round((sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) * 100) / sum(l.principal_outstanding_derived), 2) as portfolioAtRiskPC, count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) as clientsInDefault, round((count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) * 100) / count(distinct(c.id)),2) as clientsInDefaultPC, (sum(l.principal_disbursed_derived) / count(*)) as averageLoanAmount from m_staff bm join m_staff coord on coord.organisational_role_parent_staff_id = bm.id join m_staff fa on fa.organisational_role_parent_staff_id = coord.id join m_office o on o.id = fa.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code left join m_loan_arrears_aging laa on laa.loan_id = l.id left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where bm.id = ${staffId} and l.loan_status_id = 300 group by l.currency_code "); INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ProgramDirectorStats', 'Table', 'Quipo', false, false, 'Program DirectorStatistics', " select ifnull(cur.display_symbol, l.currency_code) as Currency, /*This query will return more than one entry if more than one currency is used */ count(distinct(c.id)) as activeClients, count(*) as activeLoans, sum(l.principal_disbursed_derived) as disbursedAmount, sum(l.principal_outstanding_derived) as loanOutstandingAmount, round((sum(l.principal_outstanding_derived) * 100) / sum(l.principal_disbursed_derived),2) as loanOutstandingPC, sum(ifnull(lpa.principal_in_advance_derived,0.0)) as LoanPaidInAdvance, sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) as portfolioAtRisk, round((sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) * 100) / sum(l.principal_outstanding_derived), 2) as portfolioAtRiskPC, count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) as clientsInDefault, round((count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) * 100) / count(distinct(c.id)),2) as clientsInDefaultPC, (sum(l.principal_disbursed_derived) / count(*)) as averageLoanAmount from m_staff pd join m_staff bm on bm.organisational_role_parent_staff_id = pd.id join m_staff coord on coord.organisational_role_parent_staff_id = bm.id join m_staff fa on fa.organisational_role_parent_staff_id = coord.id join m_office o on o.id = fa.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code left join m_loan_arrears_aging laa on laa.loan_id = l.id left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where pd.id = ${staffId} and l.loan_status_id = 300 group by l.currency_code "); INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ProgramStats', 'Table', 'Quipo', false, false, 'Program Statistics', " select ifnull(cur.display_symbol, l.currency_code) as Currency, /*This query will return more than one entry if more than one currency is used */ count(distinct(c.id)) as activeClients, count(*) as activeLoans, sum(l.principal_disbursed_derived) as disbursedAmount, sum(l.principal_outstanding_derived) as loanOutstandingAmount, round((sum(l.principal_outstanding_derived) * 100) / sum(l.principal_disbursed_derived),2) as loanOutstandingPC, sum(ifnull(lpa.principal_in_advance_derived,0.0)) as LoanPaidInAdvance, sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) as portfolioAtRisk, round((sum( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), l.principal_outstanding_derived,0)) * 100) / sum(l.principal_outstanding_derived), 2) as portfolioAtRiskPC, count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) as clientsInDefault, round((count(distinct( if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), c.id,null))) * 100) / count(distinct(c.id)),2) as clientsInDefaultPC, (sum(l.principal_disbursed_derived) / count(*)) as averageLoanAmount from m_group pgm join m_office o on o.id = pgm.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code left join m_loan_arrears_aging laa on laa.loan_id = l.id left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where pgm.id = ${programId} and l.loan_status_id = 300 group by l.currency_code "); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_FieldAgentStats', 'FieldAgentStats', 'READ', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_FieldAgentPrograms', 'FieldAgentPrograms', 'READ', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ProgramDetails', 'ProgramDetails', 'READ', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ChildrenStaffList', 'ChildrenStaffList', 'READ', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_CoordinatorStats', 'CoordinatorStats', 'READ', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_BranchManagerStats', 'BranchManagerStats', 'READ', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ProgramDirectorStats', 'ProgramDirectorStats', 'READ', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ProgramStats', 'ProgramStats', 'READ', 0);
the_stack
-------------------------------------------------------------------------------- -- postgresql-table_version - PostgreSQL database patch change management extension -- -- Copyright 2016 Crown copyright (c) -- Land Information New Zealand and the New Zealand Government. -- All rights reserved -- -- This software is released under the terms of the new BSD license. See the -- LICENSE file for more information. -- -------------------------------------------------------------------------------- -- Add support for the user who created the revision ALTER TABLE @extschema@.revision ADD COLUMN user_name TEXT; ALTER TABLE @extschema@.revision ALTER COLUMN user_name SET DEFAULT CURRENT_USER; -- Provide public select right to metadata tables GRANT SELECT ON TABLE revision TO public; GRANT SELECT ON TABLE versioned_tables TO public; GRANT SELECT ON TABLE tables_changed TO public; -- Add support returning for the user_name from the get revision functions. -- Need to drop and recreate the functions due to the return type changes. DROP FUNCTION @extschema@.ver_get_revisions(INTEGER[]); DROP FUNCTION @extschema@.ver_get_revision(INTEGER); CREATE OR REPLACE FUNCTION ver_get_revision( p_revision INTEGER, OUT id INTEGER, OUT revision_time TIMESTAMP, OUT start_time TIMESTAMP, OUT schema_change BOOLEAN, OUT comment TEXT, OUT user_name TEXT ) AS $$ SELECT id, revision_time, start_time, schema_change, comment, user_name FROM @extschema@.revision WHERE id = $1 $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION ver_get_revisions(p_revisions INTEGER[]) RETURNS TABLE( id INTEGER, revision_time TIMESTAMP, start_time TIMESTAMP, schema_change BOOLEAN, comment TEXT, user_name TEXT ) AS $$ SELECT id, revision_time, start_time, schema_change, comment, user_name FROM @extschema@.revision WHERE id = ANY($1) ORDER BY revision DESC; $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION ver_enable_versioning( p_schema NAME, p_table NAME ) RETURNS BOOLEAN AS $$ DECLARE v_table_oid REGCLASS; v_key_col NAME; v_revision_table TEXT; v_sql TEXT; v_table_id @extschema@.versioned_tables.id%TYPE; v_revision @extschema@.revision.id%TYPE; v_revision_exists BOOLEAN; v_table_has_data BOOLEAN; v_role TEXT; v_privilege TEXT; BEGIN IF NOT EXISTS (SELECT * FROM pg_tables WHERE tablename = p_table AND schemaname = p_schema) THEN RAISE EXCEPTION 'Table %.% does not exists', quote_ident(p_schema), quote_ident(p_table); END IF; IF @extschema@.ver_is_table_versioned(p_schema, p_table) THEN RAISE EXCEPTION 'Table %.% is already versioned', quote_ident(p_schema), quote_ident(p_table); END IF; SELECT CLS.oid INTO v_table_oid FROM pg_namespace NSP, pg_class CLS WHERE NSP.nspname = p_schema AND CLS.relname = p_table AND NSP.oid = CLS.relnamespace; SELECT ATT.attname as col INTO v_key_col FROM pg_index IDX, pg_attribute ATT WHERE IDX.indrelid = v_table_oid AND ATT.attrelid = v_table_oid AND ATT.attnum = ANY(IDX.indkey) AND ATT.attnotnull = TRUE AND IDX.indisunique = TRUE AND IDX.indexprs IS NULL AND IDX.indpred IS NULL AND format_type(ATT.atttypid, NULL) IN ('integer', 'bigint', 'text', 'character varying') AND array_length(IDX.indkey::INTEGER[], 1) = 1 ORDER BY IDX.indisprimary DESC LIMIT 1; IF v_key_col IS NULL THEN RAISE EXCEPTION 'Table %.% does not have a unique non-compostite integer, bigint, text, or varchar column', quote_ident(p_schema), quote_ident(p_table); END IF; v_revision_table := @extschema@.ver_get_version_table_full(p_schema, p_table); v_sql := 'CREATE TABLE ' || v_revision_table || '(' || '_revision_created INTEGER NOT NULL REFERENCES @extschema@.revision,' || '_revision_expired INTEGER REFERENCES @extschema@.revision,' || 'LIKE ' || quote_ident(p_schema) || '.' || quote_ident(p_table) || ');'; EXECUTE v_sql; v_sql := 'ALTER TABLE ' || v_revision_table || ' OWNER TO ' || @extschema@._ver_get_table_owner(v_table_oid); EXECUTE v_sql; -- replicate permissions from source table to revision history table FOR v_role, v_privilege IN SELECT g.grantee, g.privilege_type FROM information_schema.role_table_grants g WHERE g.table_name = p_table AND g.table_schema = p_schema LOOP EXECUTE 'GRANT ' || v_privilege || ' ON TABLE ' || v_revision_table || ' TO ' || v_role; END LOOP; v_sql := ( SELECT 'ALTER TABLE ' || v_revision_table || ' ALTER COLUMN ' || attname || ' SET STATISTICS ' || attstattarget FROM pg_attribute WHERE attrelid = v_table_oid AND attname = v_key_col AND attisdropped IS FALSE AND attnum > 0 AND attstattarget > 0 ); IF v_sql IS NOT NULL THEN EXECUTE v_sql; END IF; -- insert base data into table using a revision that is currently in -- progress, or if one does not exist create one. v_revision_exists := FALSE; EXECUTE 'SELECT EXISTS (SELECT * FROM ' || CAST(v_table_oid AS TEXT) || ' LIMIT 1)' INTO v_table_has_data; IF v_table_has_data THEN IF @extschema@._ver_get_reversion_temp_table('_changeset_revision') THEN SELECT max(VER.revision) INTO v_revision FROM _changeset_revision VER; v_revision_exists := TRUE; ELSE SELECT @extschema@.ver_create_revision( 'Initial revisioning of ' || CAST(v_table_oid AS TEXT) ) INTO v_revision; END IF; v_sql := 'INSERT INTO ' || v_revision_table || ' SELECT ' || v_revision || ', NULL, * FROM ' || CAST(v_table_oid AS TEXT); EXECUTE v_sql; IF NOT v_revision_exists THEN PERFORM @extschema@.ver_complete_revision(); END IF; END IF; v_sql := 'ALTER TABLE ' || v_revision_table || ' ADD CONSTRAINT ' || quote_ident('pkey_' || v_revision_table) || ' PRIMARY KEY(_revision_created, ' || quote_ident(v_key_col) || ')'; EXECUTE v_sql; v_sql := 'CREATE INDEX ' || quote_ident('idx_' || p_table) || '_' || quote_ident(v_key_col) || ' ON ' || v_revision_table || '(' || quote_ident(v_key_col) || ')'; EXECUTE v_sql; v_sql := 'CREATE INDEX ' || quote_ident('fk_' || p_table) || '_expired ON ' || v_revision_table || '(_revision_expired)'; EXECUTE v_sql; v_sql := 'CREATE INDEX ' || quote_ident('fk_' || p_table) || '_created ON ' || v_revision_table || '(_revision_created)'; EXECUTE v_sql; EXECUTE 'ANALYSE ' || v_revision_table; -- Add dependency of the revision table on the newly versioned table -- to avoid simple drop. Some people might forget that the table is -- versioned! INSERT INTO pg_catalog.pg_depend( classid, objid, objsubid, refclassid, refobjid, refobjsubid, deptype ) SELECT cat.oid, fobj.oid, 0, cat.oid, tobj.oid, 0, 'n' FROM pg_class cat, pg_namespace fnsp, pg_class fobj, pg_namespace tnsp, pg_class tobj WHERE cat.relname = 'pg_class' AND fnsp.nspname = 'table_version' AND fnsp.oid = fobj.relnamespace AND fobj.relname = @extschema@.ver_get_version_table(p_schema, p_table) AND tnsp.nspname = p_schema AND tnsp.oid = tobj.relnamespace AND tobj.relname = p_table; SELECT id INTO v_table_id FROM @extschema@.versioned_tables WHERE schema_name = p_schema AND table_name = p_table; IF v_table_id IS NOT NULL THEN UPDATE @extschema@.versioned_tables SET versioned = TRUE WHERE schema_name = p_schema AND table_name = p_table; ELSE INSERT INTO @extschema@.versioned_tables(schema_name, table_name, key_column, versioned) VALUES (p_schema, p_table, v_key_col, TRUE) RETURNING id INTO v_table_id; END IF; IF v_table_id IS NOT NULL AND v_table_has_data THEN INSERT INTO @extschema@.tables_changed( revision, table_id ) SELECT v_revision, v_table_id WHERE NOT EXISTS ( SELECT * FROM @extschema@.tables_changed WHERE table_id = v_table_id AND revision = v_revision ); END IF; PERFORM @extschema@.ver_create_table_functions(p_schema, p_table, v_key_col); PERFORM @extschema@.ver_create_version_trigger(p_schema, p_table, v_key_col); RETURN TRUE; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION ver_create_revision( p_comment TEXT, p_revision_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, p_schema_change BOOLEAN DEFAULT FALSE ) RETURNS INTEGER AS $$ DECLARE v_revision @extschema@.revision.id%TYPE; BEGIN IF @extschema@._ver_get_reversion_temp_table('_changeset_revision') THEN RAISE EXCEPTION 'A revision changeset is still in progress. Please complete the revision before starting a new one'; END IF; INSERT INTO @extschema@.revision (revision_time, schema_change, comment, user_name) VALUES (p_revision_time, p_schema_change, p_comment, SESSION_USER) RETURNING id INTO v_revision; CREATE TEMP TABLE _changeset_revision( revision INTEGER NOT NULL PRIMARY KEY ); INSERT INTO _changeset_revision(revision) VALUES (v_revision); ANALYSE _changeset_revision; RETURN v_revision; END; $$ LANGUAGE plpgsql SECURITY DEFINER; -- remove security definer from sll functions and functions that create fuunctions DO $$ DECLARE v_pcid TEXT; v_schema TEXT = '@extschema@'; BEGIN FOR v_pcid IN SELECT v_schema || '.' || proname || '(' || pg_get_function_identity_arguments(oid) || ')' FROM pg_proc WHERE pronamespace=(SELECT oid FROM pg_namespace WHERE nspname = v_schema) AND proname NOT IN ('ver_create_revision', 'ver_complete_revision') AND pg_get_function_result(oid) <> 'trigger' LOOP EXECUTE 'ALTER FUNCTION ' || v_pcid || ' SECURITY INVOKER'; END LOOP; END; $$; CREATE OR REPLACE FUNCTION ver_create_table_functions( p_schema NAME, p_table NAME, p_key_col NAME ) RETURNS BOOLEAN AS $$ DECLARE v_revision_table TEXT; v_sql TEXT; v_col_cur refcursor; v_column_name NAME; v_column_type TEXT; v_table_columns TEXT; v_select_columns_diff TEXT; v_select_columns_rev TEXT; BEGIN IF NOT @extschema@.ver_is_table_versioned(p_schema, p_table) THEN RAISE EXCEPTION 'Table %.% is not versioned', quote_ident(p_schema), quote_ident(p_table); END IF; v_revision_table := @extschema@.ver_get_version_table_full(p_schema, p_table); v_table_columns := ''; v_select_columns_diff := ''; v_select_columns_rev := ''; OPEN v_col_cur FOR SELECT att_name AS column_name, att_type AS column_type FROM unnest(@extschema@._ver_get_table_columns(p_schema || '.' || p_table)); FETCH FIRST IN v_col_cur INTO v_column_name, v_column_type; LOOP v_select_columns_rev := v_select_columns_rev || REPEAT(' ', 16) || 'T.' || quote_ident(v_column_name); v_select_columns_diff := v_select_columns_diff || REPEAT(' ', 16) || 'TL.' || quote_ident(v_column_name); v_table_columns := v_table_columns || ' ' || quote_ident(v_column_name) || ' ' || v_column_type; FETCH v_col_cur INTO v_column_name, v_column_type; IF FOUND THEN v_select_columns_rev := v_select_columns_rev || ', ' || E'\n'; v_select_columns_diff := v_select_columns_diff || ', ' || E'\n'; v_table_columns := v_table_columns || ', ' || E'\n'; ELSE v_table_columns := v_table_columns || E'\n'; EXIT; END IF; END LOOP; CLOSE v_col_cur; -- Create difference function for table called: -- ver_get_$schema$_$table$_diff(p_revision1 integer, p_revision2 integer) v_sql := $template$ CREATE OR REPLACE FUNCTION %func_sig% RETURNS TABLE( _diff_action CHAR(1), %table_columns% ) AS $FUNC$ DECLARE v_revision1 INTEGER; v_revision2 INTEGER; v_temp INTEGER; v_base_version INTEGER; v_revision_table TEXT; BEGIN IF NOT @extschema@.ver_is_table_versioned(%schema_name%, %table_name%) THEN RAISE EXCEPTION 'Table %full_table_name% is not versioned'; END IF; v_revision1 := p_revision1; v_revision2 := p_revision2; IF v_revision1 = v_revision2 THEN RETURN; END IF; IF v_revision1 > v_revision2 THEN RAISE EXCEPTION 'Revision 1 (%) is greater than revision 2 (%)', v_revision1, v_revision2; END IF; SELECT @extschema@.ver_get_table_base_revision(%schema_name%, %table_name%) INTO v_base_version; IF v_base_version > v_revision2 THEN RETURN; END IF; RETURN QUERY EXECUTE @extschema@.ver_ExpandTemplate( $sql$ WITH changed_within_range AS ( SELECT T.%key_col%, min(T._revision_created) <= %1% AS existed, max(T._revision_created) AS last_update_revision FROM %revision_table% AS T WHERE ( (T._revision_created <= %1% AND T._revision_expired > %1% AND T._revision_expired <= %2%) OR (T._revision_created > %1% AND T._revision_created <= %2%) ) GROUP BY T.%key_col% ) SELECT CAST( CASE WHEN TL._revision_expired <= %2% THEN 'D' WHEN C.existed THEN 'U' ELSE 'I' END AS CHAR(1)) AS action, %select_columns% FROM changed_within_range C JOIN %revision_table% AS TL ON TL.%key_col% = C.%key_col% AND TL._revision_created = C.last_update_revision WHERE C.existed OR (TL._revision_expired IS NULL OR TL._revision_expired > %2%); $sql$, ARRAY[ v_revision1::TEXT, v_revision2::TEXT ] ); RETURN; END; $FUNC$ LANGUAGE plpgsql; $template$; v_sql := REPLACE(v_sql, '%func_sig%', @extschema@._ver_get_diff_function(p_schema, p_table)); v_sql := REPLACE(v_sql, '%table_columns%', v_table_columns); v_sql := REPLACE(v_sql, '%schema_name%', quote_literal(p_schema)); v_sql := REPLACE(v_sql, '%table_name%', quote_literal(p_table)); v_sql := REPLACE(v_sql, '%full_table_name%', quote_ident(p_schema) || '.' || quote_ident(p_table)); v_sql := REPLACE(v_sql, '%select_columns%', v_select_columns_diff); v_sql := REPLACE(v_sql, '%key_col%', quote_ident(p_key_col)); v_sql := REPLACE(v_sql, '%revision_table%', v_revision_table); EXECUTE 'DROP FUNCTION IF EXISTS ' || @extschema@._ver_get_diff_function(p_schema, p_table); EXECUTE v_sql; -- Create get version function for table called: -- ver_get_$schema$_$table$_revision(p_revision integer) v_sql := $template$ CREATE OR REPLACE FUNCTION %func_sig% RETURNS TABLE( %table_columns% ) AS $FUNC$ BEGIN RETURN QUERY EXECUTE @extschema@.ver_ExpandTemplate( $sql$ SELECT %select_columns% FROM %revision_table% AS T WHERE _revision_created <= %1% AND (_revision_expired > %1% OR _revision_expired IS NULL) $sql$, ARRAY[ p_revision::TEXT ] ); END; $FUNC$ LANGUAGE plpgsql; $template$; v_sql := REPLACE(v_sql, '%func_sig%', @extschema@._ver_get_revision_function(p_schema, p_table)); v_sql := REPLACE(v_sql, '%table_columns%', v_table_columns); v_sql := REPLACE(v_sql, '%select_columns%', v_select_columns_rev); v_sql := REPLACE(v_sql, '%revision_table%', v_revision_table); EXECUTE 'DROP FUNCTION IF EXISTS ' || @extschema@._ver_get_revision_function(p_schema, p_table); EXECUTE v_sql; RETURN TRUE; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION ver_create_version_trigger( p_schema NAME, p_table NAME, p_key_col NAME ) RETURNS BOOLEAN AS $$ DECLARE v_revision_table TEXT; v_sql TEXT; v_trigger_name VARCHAR; v_column_name NAME; v_column_update TEXT; BEGIN IF NOT @extschema@.ver_is_table_versioned(p_schema, p_table) THEN RAISE EXCEPTION 'Table %.% is not versioned', quote_ident(p_schema), quote_ident(p_table); END IF; v_revision_table := @extschema@.ver_get_version_table_full(p_schema, p_table); v_column_update := ''; FOR v_column_name IN SELECT att_name AS column_name FROM unnest(@extschema@._ver_get_table_columns(p_schema || '.' || p_table)) LOOP IF v_column_name = p_key_col THEN CONTINUE; END IF; IF v_column_update != '' THEN v_column_update := v_column_update || E',\n '; END IF; v_column_update := v_column_update || quote_ident(v_column_name) || ' = NEW.' || quote_ident(v_column_name); END LOOP; v_sql := $template$ CREATE OR REPLACE FUNCTION %revision_table%() RETURNS trigger AS $TRIGGER$ DECLARE v_revision @extschema@.revision.id%TYPE; v_last_revision @extschema@.revision.id%TYPE; v_table_id @extschema@.versioned_tables.id%TYPE; BEGIN BEGIN SELECT max(VER.revision) INTO v_revision FROM _changeset_revision VER; IF v_revision IS NULL THEN RAISE EXCEPTION 'Versioning system information is missing'; END IF; EXCEPTION WHEN undefined_table THEN RAISE EXCEPTION 'To begin editing %full_table_name% you need to create a revision'; END; SELECT VTB.id INTO v_table_id FROM @extschema@.versioned_tables VTB WHERE VTB.table_name = %table_name% AND VTB.schema_name = %schema_name%; IF v_table_id IS NULL THEN RAISE EXCEPTION 'Table versioning system information is missing for %full_table_name%'; END IF; IF NOT EXISTS ( SELECT TRUE FROM @extschema@.tables_changed WHERE table_id = v_table_id AND revision = v_revision ) THEN INSERT INTO @extschema@.tables_changed(revision, table_id) VALUES (v_revision, v_table_id); END IF; IF (TG_OP <> 'INSERT') THEN SELECT _revision_created INTO v_last_revision FROM %revision_table% WHERE %key_col% = OLD.%key_col% AND _revision_expired IS NULL; IF v_last_revision = v_revision THEN IF TG_OP = 'UPDATE' AND OLD.%key_col% = NEW.%key_col% THEN UPDATE %revision_table% SET %revision_update_cols% WHERE %key_col% = NEW.%key_col% AND _revision_created = v_revision AND _revision_expired IS NULL; RETURN NEW; ELSE DELETE FROM %revision_table% WHERE %key_col% = OLD.%key_col% AND _revision_created = v_last_revision; END IF; ELSE UPDATE %revision_table% SET _revision_expired = v_revision WHERE %key_col% = OLD.%key_col% AND _revision_created = v_last_revision; END IF; END IF; IF( TG_OP <> 'DELETE') THEN INSERT INTO %revision_table% SELECT v_revision, NULL, NEW.*; RETURN NEW; END IF; RETURN NULL; END; $TRIGGER$ LANGUAGE plpgsql SECURITY DEFINER; $template$; v_sql := REPLACE(v_sql, '%schema_name%', quote_literal(p_schema)); v_sql := REPLACE(v_sql, '%table_name%', quote_literal(p_table)); v_sql := REPLACE(v_sql, '%full_table_name%', quote_ident(p_schema) || '.' || quote_ident(p_table)); v_sql := REPLACE(v_sql, '%key_col%', quote_ident(p_key_col)); v_sql := REPLACE(v_sql, '%revision_table%', v_revision_table); v_sql := REPLACE(v_sql, '%revision_update_cols%', v_column_update); EXECUTE v_sql; SELECT @extschema@._ver_get_version_trigger(p_schema, p_table) INTO v_trigger_name; EXECUTE 'DROP TRIGGER IF EXISTS ' || v_trigger_name || ' ON ' || quote_ident(p_schema) || '.' || quote_ident(p_table); EXECUTE 'CREATE TRIGGER ' || v_trigger_name || ' AFTER INSERT OR UPDATE OR DELETE ON ' || quote_ident(p_schema) || '.' || quote_ident(p_table) || ' FOR EACH ROW EXECUTE PROCEDURE ' || v_revision_table || '()'; EXECUTE 'ALTER FUNCTION ' || v_revision_table || '() ' || 'OWNER TO ' || @extschema@._ver_get_table_owner((p_schema || '.' || p_table)::REGCLASS); RETURN TRUE; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION ver_ExecuteTemplate( p_template TEXT, p_params TEXT[]) RETURNS BIGINT AS $$ DECLARE v_sql TEXT; v_count BIGINT; BEGIN v_sql := @extschema@.ver_ExpandTemplate( p_template, p_params ); BEGIN EXECUTE v_sql; EXCEPTION WHEN others THEN RAISE EXCEPTION E'Error executing template SQL: %\nError: %', v_sql, SQLERRM; END; GET DIAGNOSTICS v_count=ROW_COUNT; RETURN v_count; END; $$ LANGUAGE plpgsql; DROP FUNCTION table_version._ver_get_table_cols(NAME, NAME); CREATE OR REPLACE FUNCTION _ver_get_table_owner( p_table REGCLASS ) RETURNS TEXT AS $$ SELECT quote_ident(r.rolname) FROM pg_catalog.pg_class c JOIN pg_catalog.pg_roles r on (c.relowner = r.oid) WHERE c.oid = p_table $$ LANGUAGE sql; CREATE TYPE ATTRIBUTE AS ( att_name NAME, att_type NAME, att_not_null BOOLEAN ); CREATE OR REPLACE FUNCTION ver_get_table_differences( p_table1 REGCLASS, p_table2 REGCLASS, p_compare_key NAME ) RETURNS SETOF RECORD AS $$ DECLARE v_table_1_cols @extschema@.ATTRIBUTE[]; v_table_1_uniq @extschema@.ATTRIBUTE[]; v_table_2_cols @extschema@.ATTRIBUTE[]; v_common_cols @extschema@.ATTRIBUTE[]; v_unique_cols @extschema@.ATTRIBUTE[]; v_sql TEXT; v_table_cur1 REFCURSOR; v_table_cur2 REFCURSOR; v_table_record1 RECORD; v_table_record2 RECORD; v_i INT8; v_diff_count INT8; v_error TEXT; v_return RECORD; BEGIN IF p_table1 = p_table2 THEN RETURN; END IF; v_sql := ''; IF NOT @extschema@.ver_table_key_is_valid(p_table1, p_compare_key) THEN RAISE EXCEPTION '''%'' is not a unique non-compostite integer, bigint, text, or varchar column for %', p_compare_key, CAST(p_table1 AS TEXT); END IF; IF NOT @extschema@.ver_table_key_is_valid(p_table2, p_compare_key) THEN RAISE EXCEPTION '''%'' is not a unique non-compostite integer, bigint, text, or varchar column for %', p_compare_key, CAST(p_table2 AS TEXT); END IF; SELECT @extschema@._ver_get_table_columns(p_table1) INTO v_table_1_cols; SELECT @extschema@._ver_get_table_columns(p_table2) INTO v_table_2_cols; SELECT @extschema@._ver_get_table_unique_constraint_columns(p_table1) INTO v_table_1_uniq; SELECT ARRAY( SELECT ROW(ATT.att_name, ATT.att_type, ATT.att_not_null) FROM unnest(v_table_1_cols) AS ATT WHERE ATT.att_name IN (SELECT (unnest(v_table_2_cols)).att_name) AND ATT.att_name NOT IN (SELECT (unnest(v_table_1_uniq)).att_name) AND ATT.att_name <> p_compare_key ) INTO v_common_cols; SELECT ARRAY( SELECT ROW(ATT.att_name, ATT.att_type, ATT.att_not_null) FROM unnest(v_table_1_cols) AS ATT WHERE ATT.att_name IN (SELECT (unnest(v_table_2_cols)).att_name) AND ATT.att_name IN (SELECT (unnest(v_table_1_uniq)).att_name) AND ATT.att_name <> p_compare_key ) INTO v_unique_cols; SELECT @extschema@._ver_get_compare_select_sql( p_table1, p_compare_key, v_common_cols, v_unique_cols ) INTO v_sql; OPEN v_table_cur1 NO SCROLL FOR EXECUTE v_sql; SELECT @extschema@._ver_get_compare_select_sql( p_table2, p_compare_key, v_common_cols, v_unique_cols ) INTO v_sql; OPEN v_table_cur2 NO SCROLL FOR EXECUTE v_sql; v_sql := ''; FETCH FIRST FROM v_table_cur1 INTO v_table_record1; FETCH FIRST FROM v_table_cur2 INTO v_table_record2; v_i := 0; v_diff_count := 0; WHILE v_table_record1 IS NOT NULL AND v_table_record2 IS NOT NULL LOOP IF v_table_record1.id < v_table_record2.id THEN SELECT 'D'::CHAR(1) AS action, v_table_record1.id INTO v_return; v_diff_count := v_diff_count + 1; RETURN NEXT v_return; FETCH NEXT FROM v_table_cur1 INTO v_table_record1; CONTINUE; ELSIF v_table_record2.id < v_table_record1.id THEN SELECT 'I'::CHAR(1) AS action, v_table_record2.id INTO v_return; v_diff_count := v_diff_count + 1; RETURN NEXT v_return; FETCH NEXT FROM v_table_cur2 INTO v_table_record2; CONTINUE; ELSIF v_table_record1.check_uniq <> v_table_record2.check_uniq THEN SELECT 'X'::CHAR(1) AS action, v_table_record1.id INTO v_return; v_diff_count := v_diff_count + 1; RETURN NEXT v_return; ELSIF v_table_record1.check_sum <> v_table_record2.check_sum THEN SELECT 'U'::CHAR(1) AS action, v_table_record1.id INTO v_return; v_diff_count := v_diff_count + 1; RETURN NEXT v_return; END IF; FETCH NEXT FROM v_table_cur1 INTO v_table_record1; FETCH NEXT FROM v_table_cur2 INTO v_table_record2; v_i := v_i + 1; IF (v_i % 100000 = 0) THEN RAISE DEBUG 'Compared % records, % differences', v_i, v_diff_count; END IF; END LOOP; WHILE v_table_record1 IS NOT NULL LOOP SELECT 'D'::CHAR(1) AS action, v_table_record1.id INTO v_return; RETURN NEXT v_return; FETCH NEXT FROM v_table_cur1 INTO v_table_record1; END LOOP; WHILE v_table_record2 IS NOT NULL LOOP SELECT 'I'::CHAR(1) AS action, v_table_record2.id INTO v_return; RETURN NEXT v_return; FETCH NEXT FROM v_table_cur2 INTO v_table_record2; END LOOP; CLOSE v_table_cur1; CLOSE v_table_cur2; RETURN; EXCEPTION WHEN others THEN GET STACKED DIAGNOSTICS v_error = PG_EXCEPTION_CONTEXT; RAISE EXCEPTION E'Failed comparing tables\n%\nERROR: %', v_error, SQLERRM; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION ver_apply_table_differences( p_original_table REGCLASS, p_new_table REGCLASS, p_key_column NAME, OUT number_inserts BIGINT, OUT number_deletes BIGINT, OUT number_updates BIGINT ) AS $$ DECLARE v_nuniqf BIGINT DEFAULT 0; BEGIN RAISE NOTICE 'Generating difference data for %', p_original_table; PERFORM @extschema@.ver_ExecuteTemplate( $sql$ CREATE TEMP TABLE table_diff AS SELECT T.id, T.action FROM @extschema@.ver_get_table_differences( '%1%', '%2%', '%3%' ) AS T (action CHAR(1), id %4%) ORDER BY T.action, T.id; $sql$, ARRAY[ p_original_table::TEXT, p_new_table::TEXT, p_key_column::TEXT, @extschema@.ver_table_key_datatype(p_original_table, p_key_column) ] ); RAISE NOTICE 'Completed generating difference data for %', p_original_table; ALTER TABLE table_diff ADD PRIMARY KEY (id); ANALYSE table_diff; SELECT * FROM @extschema@._ver_apply_changes( p_original_table, p_new_table, 'table_diff', p_key_column ) INTO number_deletes, number_inserts, number_updates; DROP TABLE table_diff; RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _ver_apply_changes( p_original_table REGCLASS, p_new_table REGCLASS, p_diff_table NAME, p_key_column NAME, OUT number_inserts BIGINT, OUT number_deletes BIGINT, OUT number_updates BIGINT ) AS $$ DECLARE v_nuniqf BIGINT DEFAULT 0; v_count BIGINT; BEGIN number_inserts := 0; number_deletes := 0; number_updates := 0; EXECUTE 'SELECT 1 FROM ' || p_diff_table || ' LIMIT 1' INTO v_count; IF v_count THEN EXECUTE 'SELECT count(*) FROM ' || p_diff_table || ' WHERE action=' || quote_literal('X') INTO v_nuniqf; IF v_nuniqf > 0 THEN RAISE NOTICE '% updates changed to delete/insert in % to avoid potential uniqueness constraint errors', v_nuniqf, p_original_table; END IF; RAISE NOTICE 'Deleting from % using difference data', p_original_table; number_deletes := @extschema@._ver_apply_inc_delete( p_original_table, p_diff_table, p_key_column ); RAISE NOTICE 'Updating % using difference data', p_original_table; number_updates := @extschema@._ver_apply_inc_update( p_original_table, p_diff_table, p_new_table, p_key_column ); RAISE NOTICE 'Inserting into % using difference data', p_original_table; number_inserts := @extschema@._ver_apply_inc_insert( p_original_table, p_diff_table, p_new_table, p_key_column ); RAISE NOTICE 'Finished updating % using difference data', p_original_table; number_deletes := number_deletes - v_nuniqf; number_inserts := number_inserts - v_nuniqf; number_updates := number_updates + v_nuniqf; END IF; RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _ver_apply_inc_delete( p_delete_table REGCLASS, p_inc_change_table NAME, p_key_column NAME ) RETURNS BIGINT AS $$ BEGIN RETURN @extschema@.ver_ExecuteTemplate( $sql$ DELETE FROM %1% AS T USING %2% AS INC WHERE T.%3% = INC.id AND INC.action IN ('D','X') $sql$, ARRAY[p_delete_table::text,p_inc_change_table,quote_ident(p_key_column)] ); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _ver_apply_inc_update( p_update_table REGCLASS, p_inc_change_table NAME, p_inc_data_table REGCLASS, p_key_column NAME ) RETURNS BIGINT AS $$ DECLARE v_sql TEXT; v_update_col_txt TEXT; v_table_cols @extschema@.ATTRIBUTE[]; v_col @extschema@.ATTRIBUTE; BEGIN v_table_cols := @extschema@._ver_get_table_columns(p_update_table); IF v_table_cols IS NULL THEN RAISE EXCEPTION 'Could not find any table columns for %', p_update_table; END IF; v_update_col_txt := ''; FOR v_col IN SELECT * FROM unnest(v_table_cols) LOOP IF v_update_col_txt != '' THEN v_update_col_txt := v_update_col_txt || ','; END IF; v_update_col_txt := v_update_col_txt || quote_ident(v_col.att_name) || ' = NEW_DAT.' || quote_ident(v_col.att_name); END LOOP; RETURN @extschema@.ver_ExecuteTemplate( $sql$ UPDATE %1% AS CUR SET %2% FROM %3% AS NEW_DAT, %4% AS INC WHERE INC.id = CUR.%5% AND NEW_DAT.%5% = CUR.%5% AND INC.action = 'U' $sql$, ARRAY[ p_update_table::text, v_update_col_txt, p_inc_data_table::text, p_inc_change_table, quote_ident(p_key_column) ] ); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _ver_apply_inc_insert( p_insert_table REGCLASS, p_inc_change_table NAME, p_inc_data_table REGCLASS, p_key_column NAME ) RETURNS BIGINT AS $$ DECLARE v_table_cols text; BEGIN SELECT array_to_string(array_agg(quote_ident(att_name)), ',') INTO v_table_cols FROM unnest(@extschema@._ver_get_table_columns(p_insert_table)); IF v_table_cols = '' THEN RAISE EXCEPTION 'Could not find any table columns for %', p_insert_table; END IF; RETURN @extschema@.ver_ExecuteTemplate( $sql$ INSERT INTO %1% (%2%) SELECT %2% FROM %3% WHERE %4% IN (SELECT id FROM %5% WHERE action IN ('I','X')) $sql$, ARRAY[ p_insert_table::text, v_table_cols, p_inc_data_table::text, quote_ident(p_key_column), p_inc_change_table ] ); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION ver_table_key_datatype( p_table REGCLASS, p_key_column NAME ) RETURNS TEXT AS $$ SELECT format_type(ATT.atttypid, NULL) FROM pg_index IDX, pg_attribute ATT WHERE IDX.indrelid = $1 AND ATT.attrelid = $1 AND ATT.attnum = ANY(IDX.indkey) AND ATT.attnotnull = TRUE AND IDX.indisunique = TRUE AND IDX.indexprs IS NULL AND IDX.indpred IS NULL AND array_length(IDX.indkey::INTEGER[], 1) = 1 AND LOWER(ATT.attname) = LOWER($2) ORDER BY IDX.indisprimary DESC; $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION ver_table_key_is_valid( p_table REGCLASS, p_key_column NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS ( SELECT TRUE FROM pg_index IDX, pg_attribute ATT WHERE IDX.indrelid = $1 AND ATT.attrelid = $1 AND ATT.attnum = ANY(IDX.indkey) AND ATT.attnotnull = TRUE AND IDX.indisunique = TRUE AND IDX.indexprs IS NULL AND IDX.indpred IS NULL AND format_type(ATT.atttypid, NULL) IN ( 'integer', 'bigint', 'text', 'character varying' ) AND array_length(IDX.indkey::INTEGER[], 1) = 1 AND LOWER(ATT.attname) = LOWER($2) ORDER BY IDX.indisprimary DESC ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _ver_get_compare_select_sql( p_table REGCLASS, p_key_column NAME, p_columns @extschema@.ATTRIBUTE[], p_unique_cols @extschema@.ATTRIBUTE[] ) RETURNS TEXT AS $$ BEGIN RETURN @extschema@.ver_ExpandTemplate( $sql$ SELECT %1% AS ID, CAST(%2% AS TEXT) AS check_sum, CAST(%3% AS TEXT) AS check_uniq FROM %4% AS T ORDER BY %1% ASC $sql$, ARRAY[ quote_ident(p_key_column), @extschema@._ver_get_compare_sql(p_columns,'T'), @extschema@._ver_get_compare_sql(p_unique_cols,'T'), p_table::text ]); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _ver_get_compare_sql( p_columns @extschema@.ATTRIBUTE[], p_table_alias TEXT ) RETURNS TEXT AS $$ DECLARE v_sql TEXT; v_col_name NAME; v_col_type TEXT; v_col_not_null BOOLEAN; BEGIN IF array_ndims(p_columns) IS NULL THEN RETURN quote_literal(''); END IF; v_sql := ''; FOR v_col_name, v_col_type, v_col_not_null IN SELECT att_name, att_type, att_not_null FROM unnest(p_columns) ORDER BY att_name, att_type, att_not_null LOOP IF v_sql != '' THEN v_sql := v_sql || ' || '; END IF; IF v_col_not_null THEN v_sql := v_sql || '''|V'' || ' || 'CAST(' || p_table_alias || '.' || quote_ident(v_col_name) || ' AS TEXT)'; ELSE v_sql := v_sql || 'COALESCE(''V|'' || CAST(' || p_table_alias || '.' || quote_ident(v_col_name) || ' AS TEXT), ''|N'')'; END IF; END LOOP; RETURN v_sql; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _ver_get_table_unique_constraint_columns( p_table REGCLASS, p_key_column NAME = NULL, p_return_comp_keys BOOLEAN = TRUE ) RETURNS @extschema@.ATTRIBUTE[] AS $$ SELECT array_agg( CAST((attname, type, attnotnull) AS @extschema@.ATTRIBUTE) ) FROM ( SELECT ATT.attname, format_type(ATT.atttypid, ATT.atttypmod) as type, ATT.attnotnull FROM pg_index IDX, pg_attribute ATT WHERE ATT.attrelid = $1 AND (p_key_column IS NULL OR ATT.attname <> $2) AND IDX.indrelid = ATT.attrelid AND IDX.indisunique = TRUE AND IDX.indexprs IS NULL AND IDX.indpred IS NULL AND ATT.attnum IN ( SELECT IDX.indkey[i] FROM generate_series(0, IDX.indnatts) AS i WHERE ($3 OR array_length(IDX.indkey,1) = 1) ) UNION SELECT ATT.attname, format_type(ATT.atttypid, ATT.atttypmod) as type, ATT.attnotnull FROM pg_attribute ATT WHERE ATT.attnum > 0 AND (p_key_column IS NULL OR ATT.attname <> $2) AND NOT ATT.attisdropped AND ATT.attrelid = $1 AND ATT.attnum IN (SELECT unnest(conkey) FROM pg_constraint WHERE conrelid = p_table AND contype in ('p','u') AND ($3 OR array_length(conkey,1) = 1)) ) AS ATT $$ LANGUAGE sql; -- Return a list of columns for a table as an array of ATTRIBUTE entries CREATE OR REPLACE FUNCTION _ver_get_table_columns( p_table REGCLASS ) RETURNS @extschema@.ATTRIBUTE[] AS $$ SELECT array_agg( CAST((ATT.attname, format_type(ATT.atttypid, ATT.atttypmod), ATT.attnotnull) AS @extschema@.ATTRIBUTE)) FROM pg_attribute ATT WHERE ATT.attnum > 0 AND NOT ATT.attisdropped AND ATT.attrelid = p_table; $$ LANGUAGE sql;
the_stack
SELECT * FROM employees LIMIT 10; /* How many departments? */ SELECT COUNT(*) FROM departments; /* How many times has Employee 10001 has a raise? */ SELECT COUNT(*) AS Number_of_raises FROM salaries WHERE emp_no = 10001; /* What title has 10006 has? */ SELECT title FROM titles WHERE emp_no = 10006; /***************** 5) Column Concat *****************/ SELECT CONCAT(emp_no, ' is a ', title) AS "EmpTitle" FROM titles LIMIT 5; SELECT emp_no, CONCAT(first_name, ' ', last_name) AS "Full Name" FROM employees LIMIT 5; /************** 6) Types of Functions in SQL *************/ /* Aggerate - operate on MANY records to produce ONE value, example: SUM of salaries Scalar - operate on EACH record Independently, example: CONCAT , it doesn't return result of concat values as one value. */ /*********** 7) Aggregate Functions ************/ /* AVG() COUNT() MIN() MAX() SUM() */ SELECT COUNT(*) FROM employees; SELECT MIN(emp_no) FROM employees; /* Get the highest salary avaliable */ SELECT MAX(salary) AS Max_Salary FROM salaries; /* Get the total amount of salaries paid */ SELECT SUM(salary) AS Total_Salary_Paid FROM salaries; /********** 9) Commenting your queries *******/ SELECT * FROM employees WHERE first_name='Mayumi' AND last_name='Schueller'; /*********** 11) Filtering Data ***********/ /* Get the list of all female employees */ SELECT * FROM employees WHERE gender = 'F' LIMIT 10; /********** 12) AND OR *************/ SELECT * FROM employees WHERE (first_name = 'Georgi' AND last_name='Facello' AND hire_date='1986-06-26') OR (first_name='Bezalel' AND last_name='Simmel'); /* 13) How many female customers do we have from state of Oregon or New York? */ SELECT COUNT(*) AS "NumberOfFemaleCustomers" FROM customers WHERE gender='F' AND (state LIKE 'OR' OR state LIKE 'NY'); /******** 15) NOT ***********/ /* How many customers aren't 55? */ SELECT COUNT(age) FROM customers WHERE NOT age=55; /***** 16) Comparison Operators *******/ /* 17) Exercises */ /* How many female customers do we have from the state of Oregon (OR)? */ SELECT COUNT(*) FROM customers WHERE gender='F' AND state='OR'; /* Who over the age of 44 has an income of 100 000 or more? */ SELECT * FROM customers WHERE age > 44 AND income=100000; /* Who between the ages of 30 and 50 has an income of less than 50 000? */ SELECT * FROM customers WHERE age BETWEEN 30 AND 50 AND income < 50000; /* What is the average income between the ages of 20 and 50? */ SELECT AVG(income) FROM customers WHERE age BETWEEN 20 AND 50; /***** 18) Logical Operators AND OR NOT *****/ /* Order of Operations FROM => WEHRE => SELECT */ /***** 19) Operator Precedence ******/ /* (most importance to least importance) Parentheses Multiplication / Division Subtraction / Addition NOT AND OR If operators have equal precedence, then the operators are evaluated directionally. From Left to Right or Right to Left. check Operators Precedence.png */ SELECT state, gender FORM customers WHERE gender ='F' AND (state='NY' OR state='OR'); /****** 20) Operator Precedence 2 ********/ SELECT * FROM customers WHERE ( income > 10000 AND state='NY' OR ( (age > 20 AND age < 30) AND income <=20000 ) ) AND gender='F'; /*Select people either under 30 or over 50 with an income above 50000 that are from either Japan or Australia*/ SELECT * FROM customers WHERE (age < 30 OR age > 50) AND income > 50000 AND (country = 'Japan' OR country = 'Australia'); /*What was our total sales in June of 2004 for orders over 100 dollars?*/ SELECT SUM(totalamount) FROM orders WHERE totalamount > 100 AND orderdate='2004/06'; /***** 22) Checking for NULL Values ****/ /* NULL = NULL (output: NULL) NULL != NULL (output: NULL) No Matter what you do with NULL, it will always be NULL (subtract, add, equal, etc) */ SELECT NULL=NULL; SELECT NULL <> NULL; -- returns true SELECT 1=1; /******** 23) IS Keyword *********/ SELECT * FROM departments WHERE dept_name = '' IS FALSE; -- meaning FALSE, but not a good way to write it. SELECT * FROM departments WHERE dept_name = '' IS NOT FALSE; -- meaning TRUE, but not a good way to write it. SELECT * FROM salaries WHERE salary < 150000 IS FALSE; -- basically saying > 150000 /******* 24) NULL Value Substituion NULL Coalesce *****/ /* SELECT coalesce(<column>, 'Empty') AS column_alias FROM <table> SELECT coalesce( <column1>, <column2>, <column3>, 'Empty') AS combined_columns FROM <table> Coalsece returns first NON NULL value. */ -- default age at 20, if there is no age avaliable SELECT SUM(COALESCE(age, 20)) FROM students; /*Assuming a student's minimum age for the class is 15, what is the average age of a student?*/ SELECT AVG(COALESCE(age, 15)) AS avg_age FROM students; /*Replace all empty first or last names with a default*/ SELECT COALESCE(first_name, 'DEFAULT') AS first_name, COALESCE(last_name, 'DEFAULT') AS last_name FROM students; /******* 28) BETWEEN AND ********/ /* SELECT <column> FROM <table> WHERE <column> BETWEEN X AND Y */ /******* 29) IN Keyword *******/ /* SELECT * FROM <table> WHERE <column> IN (value1, vlaue2, ...) */ SELECT * FROM employees WHERE emp_no IN (100001, 100006, 11008); /******* 31) LIKE ***********/ SELECT first_name FROM employees WHERE first_name LIKE 'M%'; /* PATTERN MATCHING LIKE '%2' : Fields that end with 2 LIKE '%2%' : Fields that have 2 anywhere in the value LIKE '_00%' : Fields that have 2 zero's as the second and third character and anything after LIKE '%200%' : Fields that have 200 anywhere in the value LIKE '2_%_%' : Fields any values that start with 2 and are at least 3 characters in length LIKE '2___3' : Find any values in a five-digit number that start with 2 and end with 3 */ /****** CAST *******/ /* Postgres LIKE ONLY does text comparison so we must CAST whatever we use to TEXT */ CAST (salary AS text); -- method 1 salary::text -- method 2 /******** Case Insensitive Matching ILIKE *********/ name ILIKE 'BR%'; -- matching for br, BR, Br, bR SELECT * FROM employees WHERE first_name ILIKE 'G%GER'; SELECT * FROM employees WHERE first_name LIKE 'g%'; -- returns nothing because casesensitive SELECT * FROM employees WHERE first_name ILIKE 'g%'; /*********** 33) Dates and Timezones **********/ /* Set current postgres's session to UTC */ SHOW TIMEZONE; SET TIME ZONE UTC; /********* 34) Setting up Timezones ***********/ ALTER USER postgres SET TIMEZONE='UTC'; /******** 35) How do we format Date and Time *********/ /* Postgres uses IS0-8601 YYYY-MM-DDTHH:MM:SS 2021-05-04T11:01:45+08:00 */ /******* 36) Timestamps ***********/ /* A timestamp is a date with time and timezone info */ SELECT NOW(); -- 2021-05-04 11:05:37.567804+08 CREATE TABLE timezones_tmp( ts TIMESTAMP WITHOUT TIME ZONE, tz TIMESTAMP WITH TIME ZONE ); INSERT INTO timezones_tmp VALUES( TIMESTAMP WITHOUT TIME ZONE '2000-01-01 10:00:00', TIMESTAMP WITH TIME ZONE '2000-01-01 10:00:00+00' ); SELECT * FROM timezones_tmp; /********* 37) Date Functions **********/ SELECT NOW(); /* 2021-05-04 11:17:30.418998+08 */ SELECT NOW()::date; /* 2021-05-04 */ SELECT NOW()::time; /* 11:18:22.483492 */ SELECT CURRENT_DATE; /* 2021-05-04 */ SELECT CURRENT_TIME; /* 11:19:11.726931+08:00 */ /********* Format Modifier *********/ /* D : Day M : Month Y : Year Check postgres doc for full details. */ SELECT TO_CHAR(CURRENT_DATE, 'dd/mm/yyyy'); /* 04/05/2021 */ SELECT TO_CHAR(CURRENT_DATE, 'ddd'); /* 124 */ /*********** 38) Date Difference and Casting ***********/ SELECT NOW() - '1800/01/01'; /* 80842 days 10:11:08.965674 */ SELECT DATE '1800/01/01'; /* 1800-01-01 */ SELECT AGE(DATE '1800/01/01'); /* 221 years 4 mons 3 days */ SELECT AGE(DATE '1990/06/30'); /* difference between two dates */ SELECT AGE(DATE '1992/11/13', DATE '1800/01/01'); /* 192 years 10 mons 12 days */ /*********** 40) Extracting Information ************/ SELECT EXTRACT (DAY FROM DATE '1992/11/13') AS DAY; /* 13 */ SELECT EXTRACT (MONTH FROM DATE '1992/11/13') AS MONTH; SELECT EXTRACT (YEAR FROM DATE '1992/11/13') AS YEAR; /******** ROUND A DATE (Date_Trunc) **********/ SELECT DATE_TRUNC('year', DATE '1992/11/13'); /* 1992-01-01 00:00:00+08 */ SELECT DATE_TRUNC('month', DATE '1992/11/13'); /* 1992-11-01 00:00:00+08 */ SELECT DATE_TRUNC('day', DATE '1992/11/13'); /* 1992-11-13 00:00:00+08 */ /********* 41) Intervals *********/ /* It can store and manipulate a period of time in years, months, days, hours, minutes, seconds, etc */ INTERVAL '1 year 2 months 3 days' INTERVAL '2 weeks ago' INTERVAL '1 year 3 hours 20 minutes' /* <30 days before the given date */ SELECT * FROM orders WHERE purchaseDate <= NOW() - INTERVAL '30 days'; SELECT NOW() - INTERVAL '30 days'; /* 2021-04-04 11:46:09.447478+08 */ SELECT NOW() - INTERVAL '1 year 2 months 3 days'; SELECT NOW() + INTERVAL '1 year'; /* Extracting intervals data */ -- returns 6 because nearly 6 years SELECT EXTRACT ( YEAR FROM INTERVAL '5 years 20 months' ); -- returns 8, because nearest rounded months is 8 (20 months % 12) SELECT EXTRACT ( MONTH FROM INTERVAL '5 years 20 months' ); /********** 43) DISTINCT *************/ /* remove duplicates SELECT DISTINCT <col1>, <col2> FROM <table> */ SELECT DISTINCT salary, from_date FROM salaries ORDER BY salary DESC; /********* 45) Sorting Data ********/ /* SELECT * FROM Customers ORDER BY <column> [ASC/DESC] */ SELECT first_name, last_name FROM employees ORDER BY first_name, last_name DESC LIMIT 10; /******** Using Expressions *******/ SELECT DISTINCT last_name, LENGTH(last_name) FROM employees ORDER BY LENGTH(last_name) DESC; /********* 46) Multi Tables SELECT *********/ SELECT e.emp_no, CONCAT(e.first_name, e.last_name) AS full_name, s.salary, s.from_date, s.to_date FROM employees as e, salaries as s WHERE e.emp_no = s.emp_no ORDER BY e.emp_no; /******** 47) Inner JOIN ************/ SELECT e.emp_no, CONCAT(e.first_name, e.last_name) AS full_name, s.salary, s.from_date, s.to_date FROM employees as e JOIN salaries as s ON s.emp_no = e.emp_no ORDER BY e.emp_no; /* we want to know the latest salary after title change of the employee salary raise happen only after 2 days of title change */ SELECT e.emp_no, CONCAT(e.first_name, e.last_name) AS "Name", s.salary, t.title, t.from_date AS "Promoted on" FROM employees e JOIN salaries s ON e.emp_no = s.emp_no JOIN titles t ON e.emp_no = t.emp_no AND t.from_date = (s.from_date + INTERVAL '2 days') ORDER BY e.emp_no ASC, s.from_date ASC; /* we want to know the original salary and also the salary at a promotion */ SELECT e.emp_no, CONCAT(e.first_name, e.last_name) AS "Name", s.salary, COALESCE(t.title, 'no title change'), COALESCE(t.from_date::text, '-') AS "title take on" FROM employees e JOIN salaries s ON e.emp_no = s.emp_no JOIN titles t ON e.emp_no = t.emp_no AND ( s.from_date = t.from_date -- original salary OR t.from_date = (s.from_date + INTERVAL '2 days') -- promoted salary ) ORDER BY e.emp_no ASC, s.from_date ASC; /********* 48) Self Join *********/ /* This usually can be done when a table has a foreign key referencing to its primary key | id | name | startDate | supervisorId| | 1 | David| 1990/01/01| 2 | | 2 | Ric | 1980/06/03| | */ /* we want to see employee info with supervisor name */ SELECT a.id, a.name AS employee_name, a.startDate, b.name AS supervisor_name FROM employees a JOIN employees b ON a.supervisorId = b.id; /********* 49) OUTER JOIN **********/ /* Which employees are manager ? */ SELECT emp.emp_no, dept.emp_no FROM employees emp LEFT JOIN dept_manager dept ON emp.emp_no = dept.emp_no WHERE dept.emp_no IS NOT NULL; /* How many employees are NOT manager? */ SELECT COUNT(emp.emp_no) FROM employees emp LEFT JOIN dept_manager dept ON emp.emp_no = dept.emp_no WHERE dept.emp_no IS NULL; /* We want to know every salary raise and also know which ones were a promotion */ SELECT e.emp_no, s.salary, COALESCE(t.title, 'No Title Change'), COALESCE(t.from_date::text, '-') AS "Title taken on" FROM employees e JOIN salaries s ON e.emp_no = s.emp_no LEFT JOIN titles t ON e.emp_no = t.emp_no AND ( t.from_date = s.from_date OR t.from_date = s.from_date + INTERVAL '2 days' ) ORDER BY e.emp_no, s.from_date; /******** 50) Less Common Joins ************/ /***** Cross Join ******/ /* Create a combination of every row */ CREATE TABLE "cartesianA" (id INT); CREATE TABLE "cartesianB" (id INT); INSERT INTO "cartesianA" VALUES (1); INSERT INTO "cartesianA" VALUES (2); INSERT INTO "cartesianA" VALUES (3); INSERT INTO "cartesianB" VALUES (1); INSERT INTO "cartesianB" VALUES (2); INSERT INTO "cartesianB" VALUES (4); INSERT INTO "cartesianB" VALUES (5); INSERT INTO "cartesianB" VALUES (20); INSERT INTO "cartesianB" VALUES (30); SELECT * FROM "cartesianA" CROSS JOIN "cartesianB"; /******** Full Outer Join ********/ /* Return results from Both whether they match or not */ SELECT * FROM "cartesianA" a FULL JOIN "cartesianB" b ON a.id = b.id; /*********** 52) USING Keyword ************/ /* Simplying the JOIN syntax */ SELECT emp.emp_no, emp.first_name, emp.last_name, d.dept_name FROM employees emp JOIN dept_emp dept USING(emp_no) -- same as ON emp.emp_no = dept.emp_no JOIN departments d USING(dept_no)
the_stack
-- -- Test access privileges -- -- Clean up in case a prior regression run failed -- Suppress NOTICE messages when users/groups don't exist SET client_min_messages TO 'warning'; DROP ROLE IF EXISTS regress_priv_group1; DROP ROLE IF EXISTS regress_priv_group2; DROP ROLE IF EXISTS regress_priv_user1; DROP ROLE IF EXISTS regress_priv_user2; DROP ROLE IF EXISTS regress_priv_user3; DROP ROLE IF EXISTS regress_priv_user4; DROP ROLE IF EXISTS regress_priv_user5; DROP ROLE IF EXISTS regress_priv_user6; RESET client_min_messages; -- test proper begins here CREATE USER regress_priv_user1; CREATE USER regress_priv_user2; CREATE USER regress_priv_user3; CREATE USER regress_priv_user4; CREATE USER regress_priv_user5; CREATE USER regress_priv_user5; -- duplicate CREATE GROUP regress_priv_group1; CREATE GROUP regress_priv_group2 WITH USER regress_priv_user1, regress_priv_user2; ALTER GROUP regress_priv_group1 ADD USER regress_priv_user4; ALTER GROUP regress_priv_group2 ADD USER regress_priv_user2; -- duplicate ALTER GROUP regress_priv_group2 DROP USER regress_priv_user2; GRANT regress_priv_group2 TO regress_priv_user4 WITH ADMIN OPTION; -- test owner privileges SET SESSION AUTHORIZATION regress_priv_user1; SELECT session_user, current_user; DROP TABLE if exists atest1; CREATE TABLE atest1 ( a int, b text ); SELECT * FROM atest1; INSERT INTO atest1 VALUES (1, 'one'); DELETE FROM atest1; UPDATE atest1 SET a = 1 WHERE b = 'blech'; delete from atest1; BEGIN; LOCK atest1 IN ACCESS EXCLUSIVE MODE; COMMIT; REVOKE ALL ON atest1 FROM PUBLIC; SELECT * FROM atest1; GRANT ALL ON atest1 TO regress_priv_user2; GRANT SELECT ON atest1 TO regress_priv_user3, regress_priv_user4; SELECT * FROM atest1; drop table if exists atest2; CREATE TABLE atest2 (col1 varchar(10), col2 boolean); GRANT SELECT ON atest2 TO regress_priv_user2; GRANT UPDATE ON atest2 TO regress_priv_user3; GRANT INSERT ON atest2 TO regress_priv_user4; SET SESSION AUTHORIZATION regress_priv_user2; SELECT session_user, current_user; -- try various combinations of queries on atest1 and atest2 SELECT * FROM atest1; -- ok SELECT * FROM atest2; -- ok INSERT INTO atest1 VALUES (2, 'two'); -- ok INSERT INTO atest2 VALUES ('foo', true); -- fail INSERT INTO atest1 SELECT 1, b FROM atest1; -- ok UPDATE atest1 SET a = 1 WHERE a = 2; -- ok UPDATE atest2 SET col2 = NOT col2; -- fail DELETE FROM atest2; -- fail delete from atest2; -- fail BEGIN; LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- fail COMMIT; COPY atest2 FROM stdin; -- fail GRANT ALL ON atest1 TO PUBLIC; -- fail -- checks in subquery, both ok SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) ); SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) ); SET SESSION AUTHORIZATION regress_priv_user3; SELECT session_user, current_user; SELECT * FROM atest1; -- ok SELECT * FROM atest2; -- fail INSERT INTO atest1 VALUES (2, 'two'); -- fail INSERT INTO atest2 VALUES ('foo', true); -- fail INSERT INTO atest1 SELECT 1, b FROM atest1; -- fail UPDATE atest1 SET a = 1 WHERE a = 2; -- fail UPDATE atest2 SET col2 = NULL; -- ok UPDATE atest2 SET col2 = NOT col2; -- fails; requires SELECT on atest2 delete from atest2; -- fail BEGIN; LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- ok COMMIT; -- checks in subquery, both fail SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) ); SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) ); SET SESSION AUTHORIZATION regress_priv_user4; SELECT * FROM atest1; -- ok -- test leaky-function protections in selfuncs -- regress_priv_user1 will own a table and provide views for it. SET SESSION AUTHORIZATION regress_priv_user1; drop table if exists atest12; create table atest12(a int, b int); insert into atest12 SELECT x AS a, 10001 - x AS b FROM generate_series(1,10000) x; CREATE INDEX ON atest12 (a); CREATE FUNCTION leak(integer,integer) RETURNS boolean AS $$begin return $1 < $2; end$$ LANGUAGE plpgsql immutable; CREATE OPERATOR <<< (procedure = leak, leftarg = integer, rightarg = integer, restrict = scalarltsel); -- views with leaky operator CREATE VIEW atest12v AS SELECT * FROM atest12 WHERE b <<< 5; CREATE VIEW atest12sbv AS SELECT * FROM atest12 WHERE b <<< 5; GRANT SELECT ON atest12v TO PUBLIC; GRANT SELECT ON atest12sbv TO PUBLIC; -- This plan should use nestloop, knowing that few rows will be selected. EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b; -- And this one. EXPLAIN (COSTS OFF) SELECT * FROM atest12 x, atest12 y WHERE x.a = y.b and abs(y.a) <<< 5; -- This should also be a nestloop, but the security barrier forces the inner -- scan to be materialized EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b; -- Check if regress_priv_user2 can break security. SET SESSION AUTHORIZATION regress_priv_user2; CREATE FUNCTION leak2(integer,integer) RETURNS boolean AS $$begin raise notice 'leak % %', $1, $2; return $1 > $2; end$$ LANGUAGE plpgsql immutable; CREATE OPERATOR >>> (procedure = leak2, leftarg = integer, rightarg = integer, restrict = scalargtsel); -- This should not show any "leak" notices before failing. EXPLAIN (COSTS OFF) SELECT * FROM atest12 WHERE a >>> 0; -- These plans should continue to use a nestloop, since they execute with the -- privileges of the view owner. EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b; EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b; -- A non-security barrier view does not guard against information leakage. EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b and abs(y.a) <<< 5; -- But a security barrier view isolates the leaky operator. EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b and abs(y.a) <<< 5; -- Now regress_priv_user1 grants sufficient access to regress_priv_user2. SET SESSION AUTHORIZATION regress_priv_user1; GRANT SELECT (a, b) ON atest12 TO PUBLIC; SET SESSION AUTHORIZATION regress_priv_user2; -- regress_priv_user2 should continue to get a good row estimate. EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b; -- But not for this, due to lack of table-wide permissions needed -- to make use of the expression index's statistics. EXPLAIN (COSTS OFF) SELECT * FROM atest12 x, atest12 y WHERE x.a = y.b and abs(y.a) <<< 5; -- clean up (regress_priv_user1's objects are all dropped later) DROP FUNCTION leak2(integer, integer) CASCADE; -- groups SET SESSION AUTHORIZATION regress_priv_user3; drop table if exists atest3; CREATE TABLE atest3 (one int, two int, three int); GRANT DELETE ON atest3 TO GROUP regress_priv_group2; SET SESSION AUTHORIZATION regress_priv_user1; SELECT * FROM atest3; -- fail DELETE FROM atest3; -- ok -- views SET SESSION AUTHORIZATION regress_priv_user3; CREATE VIEW atestv1 AS SELECT * FROM atest1; -- ok /* The next *should* fail, but it's not implemented that way yet. */ CREATE VIEW atestv2 AS SELECT * FROM atest2; CREATE VIEW atestv3 AS SELECT * FROM atest3; -- ok /* Empty view is a corner case that failed in 9.2. */ CREATE VIEW atestv0 AS SELECT 0 as x WHERE false; -- ok SELECT * FROM atestv1; -- ok SELECT * FROM atestv2; -- fail GRANT SELECT ON atestv1, atestv3 TO regress_priv_user4; GRANT SELECT ON atestv2 TO regress_priv_user2; SET SESSION AUTHORIZATION regress_priv_user4; SELECT * FROM atestv1; -- ok SELECT * FROM atestv2; -- fail SELECT * FROM atestv3; -- ok SELECT * FROM atestv0; -- fail -- Appendrels excluded by constraints failed to check permissions in 8.4-9.2. select * from ((select a.q1 as x from int8_tbl a offset 0) union all (select b.q2 as x from int8_tbl b offset 0)) ss where false; set constraint_exclusion = on; select * from ((select a.q1 as x, random() from int8_tbl a where q1 > 0) union all (select b.q2 as x, random() from int8_tbl b where q2 > 0)) ss where x < 0; reset constraint_exclusion; CREATE VIEW atestv4 AS SELECT * FROM atestv3; -- nested view SELECT * FROM atestv4; -- ok GRANT SELECT ON atestv4 TO regress_priv_user2; SET SESSION AUTHORIZATION regress_priv_user2; -- Two complex cases: SELECT * FROM atestv3; -- fail SELECT * FROM atestv4; -- ok (even though regress_priv_user2 cannot access underlying atestv3) SELECT * FROM atest2; -- ok SELECT * FROM atestv2; -- fail (even though regress_priv_user2 can access underlying atest2) -- Test column level permissions SET SESSION AUTHORIZATION regress_priv_user1; drop table if exists atest5; CREATE TABLE atest5 (one int, two int unique, three int, four int unique); drop table if exists atest6; CREATE TABLE atest6 (one int, two int, blue int); GRANT SELECT (one), INSERT (two), UPDATE (three) ON atest5 TO regress_priv_user4; GRANT ALL (one) ON atest5 TO regress_priv_user3; INSERT INTO atest5 VALUES (1,2,3); SET SESSION AUTHORIZATION regress_priv_user4; SELECT * FROM atest5; -- fail SELECT one FROM atest5; -- ok SELECT two FROM atest5; -- fail SELECT atest5 FROM atest5; -- fail SELECT 1 FROM atest5; -- ok SELECT 1 FROM atest5 a JOIN atest5 b USING (one); -- ok SELECT 1 FROM atest5 a JOIN atest5 b USING (two); -- fail SELECT 1 FROM atest5 a NATURAL JOIN atest5 b; -- fail SELECT (j.*) IS NULL FROM (atest5 a JOIN atest5 b USING (one)) j; -- fail SELECT 1 FROM atest5 WHERE two = 2; -- fail SELECT * FROM atest1, atest5; -- fail SELECT atest1.* FROM atest1, atest5; -- ok SELECT atest1.*,atest5.one FROM atest1, atest5; -- ok SELECT atest1.*,atest5.one FROM atest1 JOIN atest5 ON (atest1.a = atest5.two); -- fail SELECT atest1.*,atest5.one FROM atest1 JOIN atest5 ON (atest1.a = atest5.one); -- ok SELECT one, two FROM atest5; -- fail SET SESSION AUTHORIZATION regress_priv_user1; GRANT SELECT (one,two) ON atest6 TO regress_priv_user4; SET SESSION AUTHORIZATION regress_priv_user4; SELECT one, two FROM atest5 NATURAL JOIN atest6; -- fail still SET SESSION AUTHORIZATION regress_priv_user1; GRANT SELECT (two) ON atest5 TO regress_priv_user4; SET SESSION AUTHORIZATION regress_priv_user4; SELECT one, two FROM atest5 NATURAL JOIN atest6; -- ok now -- test column-level privileges for INSERT and UPDATE INSERT INTO atest5 (two) VALUES (3); -- ok INSERT INTO atest5 (three) VALUES (4); -- fail INSERT INTO atest5 VALUES (5,5,5); -- fail UPDATE atest5 SET three = 10; -- ok UPDATE atest5 SET one = 8; -- fail UPDATE atest5 SET three = 5, one = 2; -- fail -- Check that column level privs are enforced in RETURNING -- Check that the columns in the inference require select privileges INSERT INTO atest5(four) VALUES (4); -- fail SET SESSION AUTHORIZATION regress_priv_user1; GRANT INSERT (four) ON atest5 TO regress_priv_user4; SET SESSION AUTHORIZATION regress_priv_user4; INSERT INTO atest5(four) VALUES (4); -- ok SET SESSION AUTHORIZATION regress_priv_user1; GRANT SELECT (four) ON atest5 TO regress_priv_user4; SET SESSION AUTHORIZATION regress_priv_user4; SET SESSION AUTHORIZATION regress_priv_user1; REVOKE ALL (one) ON atest5 FROM regress_priv_user4; GRANT SELECT (one,two,blue) ON atest6 TO regress_priv_user4; SET SESSION AUTHORIZATION regress_priv_user4; SELECT one FROM atest5; -- fail UPDATE atest5 SET one = 1; -- fail -- check error reporting with column privs SET SESSION AUTHORIZATION regress_priv_user1; drop table if exists t1; CREATE TABLE t1 (c1 int, c2 int, c3 int, primary key (c1, c2)); GRANT SELECT (c1) ON t1 TO regress_priv_user2; GRANT INSERT (c1, c2, c3) ON t1 TO regress_priv_user2; GRANT UPDATE (c1, c2, c3) ON t1 TO regress_priv_user2; -- seed data INSERT INTO t1 VALUES (1, 1, 1); INSERT INTO t1 VALUES (1, 2, 1); INSERT INTO t1 VALUES (2, 1, 2); INSERT INTO t1 VALUES (2, 2, 2); INSERT INTO t1 VALUES (3, 1, 3); SET SESSION AUTHORIZATION regress_priv_user2; INSERT INTO t1 (c1, c2) VALUES (1, 1); -- fail, but row not shown UPDATE t1 SET c2 = 1; -- fail, but row not shown INSERT INTO t1 (c1, c2) VALUES (null, null); -- fail, but see columns being inserted INSERT INTO t1 (c3) VALUES (null); -- fail, but see columns being inserted or have SELECT INSERT INTO t1 (c1) VALUES (5); -- fail, but see columns being inserted or have SELECT UPDATE t1 SET c3 = 10; -- fail, but see columns with SELECT rights, or being modified SET SESSION AUTHORIZATION regress_priv_user1; DROP TABLE t1; -- test column-level privileges when involved with DELETE SET SESSION AUTHORIZATION regress_priv_user1; ALTER TABLE atest6 ADD COLUMN three integer; GRANT DELETE ON atest5 TO regress_priv_user3; GRANT SELECT (two) ON atest5 TO regress_priv_user3; REVOKE ALL (one) ON atest5 FROM regress_priv_user3; GRANT SELECT (one) ON atest5 TO regress_priv_user4; SET SESSION AUTHORIZATION regress_priv_user4; SELECT atest6 FROM atest6; -- fail SELECT one FROM atest5 NATURAL JOIN atest6; -- fail SET SESSION AUTHORIZATION regress_priv_user1; ALTER TABLE atest6 DROP COLUMN three; SET SESSION AUTHORIZATION regress_priv_user4; SELECT one FROM atest5 NATURAL JOIN atest6; -- ok SET SESSION AUTHORIZATION regress_priv_user1; ALTER TABLE atest6 DROP COLUMN two; REVOKE SELECT (one,blue) ON atest6 FROM regress_priv_user4; SET SESSION AUTHORIZATION regress_priv_user4; SELECT * FROM atest6; -- fail SELECT 1 FROM atest6; -- fail SET SESSION AUTHORIZATION regress_priv_user3; DELETE FROM atest5 WHERE one = 1; -- fail DELETE FROM atest5 WHERE two = 2; -- ok -- privileges on functions, languages -- switch to superuser \c - REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC; GRANT USAGE ON LANGUAGE sql TO regress_priv_user1; -- ok GRANT USAGE ON LANGUAGE c TO PUBLIC; -- fail SET SESSION AUTHORIZATION regress_priv_user1; GRANT USAGE ON LANGUAGE sql TO regress_priv_user2; -- fail CREATE FUNCTION priv_testfunc1(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql; CREATE FUNCTION priv_testfunc2(int) RETURNS int AS 'select 3 * $1;' LANGUAGE sql; CREATE AGGREGATE priv_testagg1(int) (sfunc = int4pl, stype = int4); CREATE PROCEDURE priv_testproc1(int) AS 'select $1;' LANGUAGE sql; REVOKE ALL ON FUNCTION priv_testfunc1(int), priv_testfunc2(int), priv_testagg1(int) FROM PUBLIC; GRANT EXECUTE ON FUNCTION priv_testfunc1(int), priv_testfunc2(int), priv_testagg1(int) TO regress_priv_user2; REVOKE ALL ON FUNCTION priv_testproc1(int) FROM PUBLIC; -- fail, not a function REVOKE ALL ON PROCEDURE priv_testproc1(int) FROM PUBLIC; GRANT EXECUTE ON PROCEDURE priv_testproc1(int) TO regress_priv_user2; GRANT USAGE ON FUNCTION priv_testfunc1(int) TO regress_priv_user3; -- semantic error GRANT USAGE ON FUNCTION priv_testagg1(int) TO regress_priv_user3; -- semantic error GRANT USAGE ON PROCEDURE priv_testproc1(int) TO regress_priv_user3; -- semantic error GRANT ALL PRIVILEGES ON FUNCTION priv_testfunc1(int) TO regress_priv_user4; GRANT ALL PRIVILEGES ON FUNCTION priv_testfunc_nosuch(int) TO regress_priv_user4; GRANT ALL PRIVILEGES ON FUNCTION priv_testagg1(int) TO regress_priv_user4; GRANT ALL PRIVILEGES ON PROCEDURE priv_testproc1(int) TO regress_priv_user4; CREATE FUNCTION priv_testfunc4(boolean) RETURNS text AS 'select col1 from atest2 where col2 = $1;' LANGUAGE sql SECURITY DEFINER; GRANT EXECUTE ON FUNCTION priv_testfunc4(boolean) TO regress_priv_user3; SET SESSION AUTHORIZATION regress_priv_user2; SELECT priv_testfunc1(5), priv_testfunc2(5); -- ok CREATE FUNCTION priv_testfunc3(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql; -- fail SELECT priv_testagg1(x) FROM (VALUES (1), (2), (3)) _(x); -- ok CALL priv_testproc1(6); -- ok SET SESSION AUTHORIZATION regress_priv_user3; SELECT priv_testfunc1(5); -- fail SELECT priv_testagg1(x) FROM (VALUES (1), (2), (3)) _(x); -- fail CALL priv_testproc1(6); -- fail SELECT col1 FROM atest2 WHERE col2 = true; -- fail SELECT priv_testfunc4(true); -- ok SET SESSION AUTHORIZATION regress_priv_user4; SELECT priv_testfunc1(5); -- ok SELECT priv_testagg1(x) FROM (VALUES (1), (2), (3)) _(x); -- ok CALL priv_testproc1(6); -- ok DROP FUNCTION priv_testfunc1(int); -- fail DROP AGGREGATE priv_testagg1(int); -- fail DROP PROCEDURE priv_testproc1(int); -- fail \c - DROP FUNCTION priv_testfunc1(int); -- ok -- restore to sanity GRANT ALL PRIVILEGES ON LANGUAGE sql TO PUBLIC; -- verify privilege checks on array-element coercions BEGIN; SELECT '{1}'::int4[]::int8[]; REVOKE ALL ON FUNCTION int8(integer) FROM PUBLIC; SELECT '{1}'::int4[]::int8[]; --superuser, suceed SET SESSION AUTHORIZATION regress_priv_user4; SELECT '{1}'::int4[]::int8[]; --other user, fail ROLLBACK; -- privileges on types -- switch to superuser \c - SET SESSION AUTHORIZATION regress_priv_user5; delete from atest2; -- ok delete from atest3; -- fail -- has_table_privilege function -- bad-input checks select has_table_privilege(NULL,'pg_authid','select'); select has_table_privilege('pg_shad','select'); select has_table_privilege('nosuchuser','pg_authid','select'); select has_table_privilege('pg_authid','sel'); select has_table_privilege(-999999,'pg_authid','update'); select has_table_privilege(1,'select'); -- superuser \c - select has_table_privilege(current_user,'pg_authid','select'); select has_table_privilege(current_user,'pg_authid','insert'); select has_table_privilege(t2.oid,'pg_authid','update') from (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege(t2.oid,'pg_authid','delete') from (select oid from pg_roles where rolname = current_user) as t2; -- 'rule' privilege no longer exists, but for backwards compatibility -- has_table_privilege still recognizes the keyword and says FALSE select has_table_privilege(current_user,t1.oid,'rule') from (select oid from pg_class where relname = 'pg_authid') as t1; select has_table_privilege(current_user,t1.oid,'references') from (select oid from pg_class where relname = 'pg_authid') as t1; select has_table_privilege(t2.oid,t1.oid,'select') from (select oid from pg_class where relname = 'pg_authid') as t1, (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege(t2.oid,t1.oid,'insert') from (select oid from pg_class where relname = 'pg_authid') as t1, (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege('pg_authid','update'); select has_table_privilege('pg_authid','delete'); select has_table_privilege(t1.oid,'select') from (select oid from pg_class where relname = 'pg_authid') as t1; select has_table_privilege(t1.oid,'trigger') from (select oid from pg_class where relname = 'pg_authid') as t1; -- non-superuser SET SESSION AUTHORIZATION regress_priv_user3; select has_table_privilege(current_user,'pg_class','select'); select has_table_privilege(current_user,'pg_class','insert'); select has_table_privilege(t2.oid,'pg_class','update') from (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege(t2.oid,'pg_class','delete') from (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege(current_user,t1.oid,'references') from (select oid from pg_class where relname = 'pg_class') as t1; select has_table_privilege(t2.oid,t1.oid,'select') from (select oid from pg_class where relname = 'pg_class') as t1, (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege(t2.oid,t1.oid,'insert') from (select oid from pg_class where relname = 'pg_class') as t1, (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege('pg_class','update'); select has_table_privilege('pg_class','delete'); select has_table_privilege(t1.oid,'select') from (select oid from pg_class where relname = 'pg_class') as t1; select has_table_privilege(t1.oid,'trigger') from (select oid from pg_class where relname = 'pg_class') as t1; select has_table_privilege(current_user,'atest1','select'); select has_table_privilege(current_user,'atest1','insert'); select has_table_privilege(t2.oid,'atest1','update') from (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege(t2.oid,'atest1','delete') from (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege(current_user,t1.oid,'references') from (select oid from pg_class where relname = 'atest1') as t1; select has_table_privilege(t2.oid,t1.oid,'select') from (select oid from pg_class where relname = 'atest1') as t1, (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege(t2.oid,t1.oid,'insert') from (select oid from pg_class where relname = 'atest1') as t1, (select oid from pg_roles where rolname = current_user) as t2; select has_table_privilege('atest1','update'); select has_table_privilege('atest1','delete'); select has_table_privilege(t1.oid,'select') from (select oid from pg_class where relname = 'atest1') as t1; select has_table_privilege(t1.oid,'trigger') from (select oid from pg_class where relname = 'atest1') as t1; -- has_column_privilege function -- bad-input checks (as non-super-user) select has_column_privilege('pg_authid',NULL,'select'); select has_column_privilege('pg_authid','nosuchcol','select'); select has_column_privilege(9999,'nosuchcol','select'); select has_column_privilege(9999,99::int2,'select'); select has_column_privilege('pg_authid',99::int2,'select'); select has_column_privilege(9999,99::int2,'select'); create temp table mytable(f1 int, f2 int, f3 int); alter table mytable drop column f2; select has_column_privilege('mytable','f2','select'); select has_column_privilege('mytable','........pg.dropped.2........','select'); select has_column_privilege('mytable',2::int2,'select'); revoke select on table mytable from regress_priv_user3; select has_column_privilege('mytable',2::int2,'select'); drop table mytable; -- Grant options SET SESSION AUTHORIZATION regress_priv_user1; drop table if exists atest4; CREATE TABLE atest4 (a int); GRANT SELECT ON atest4 TO regress_priv_user2 WITH GRANT OPTION; GRANT UPDATE ON atest4 TO regress_priv_user2; GRANT SELECT ON atest4 TO GROUP regress_priv_group1 WITH GRANT OPTION; SET SESSION AUTHORIZATION regress_priv_user2; GRANT SELECT ON atest4 TO regress_priv_user3; GRANT UPDATE ON atest4 TO regress_priv_user3; -- fail SET SESSION AUTHORIZATION regress_priv_user1; REVOKE SELECT ON atest4 FROM regress_priv_user3; -- does nothing SELECT has_table_privilege('regress_priv_user3', 'atest4', 'SELECT'); -- true REVOKE SELECT ON atest4 FROM regress_priv_user2; -- fail REVOKE GRANT OPTION FOR SELECT ON atest4 FROM regress_priv_user2 CASCADE; -- ok SELECT has_table_privilege('regress_priv_user2', 'atest4', 'SELECT'); -- true SELECT has_table_privilege('regress_priv_user3', 'atest4', 'SELECT'); -- false SELECT has_table_privilege('regress_priv_user1', 'atest4', 'SELECT WITH GRANT OPTION'); -- true -- Admin options SET SESSION AUTHORIZATION regress_priv_user4; CREATE FUNCTION dogrant_ok() RETURNS void LANGUAGE sql SECURITY DEFINER AS 'GRANT regress_priv_group2 TO regress_priv_user5'; GRANT regress_priv_group2 TO regress_priv_user5; -- ok: had ADMIN OPTION SET ROLE regress_priv_group2; GRANT regress_priv_group2 TO regress_priv_user5; -- fails: SET ROLE suspended privilege SET SESSION AUTHORIZATION regress_priv_user1; GRANT regress_priv_group2 TO regress_priv_user5; -- fails: no ADMIN OPTION SELECT dogrant_ok(); -- ok: SECURITY DEFINER conveys ADMIN SET ROLE regress_priv_group2; GRANT regress_priv_group2 TO regress_priv_user5; -- fails: SET ROLE did not help SET SESSION AUTHORIZATION regress_priv_group2; GRANT regress_priv_group2 TO regress_priv_user5; -- ok: a role can self-admin CREATE FUNCTION dogrant_fails() RETURNS void LANGUAGE sql SECURITY DEFINER AS 'GRANT regress_priv_group2 TO regress_priv_user5'; SELECT dogrant_fails(); -- fails: no self-admin in SECURITY DEFINER DROP FUNCTION dogrant_fails(); SET SESSION AUTHORIZATION regress_priv_user4; DROP FUNCTION dogrant_ok(); REVOKE regress_priv_group2 FROM regress_priv_user5; -- has_sequence_privilege tests \c - CREATE SEQUENCE x_seq; GRANT USAGE on x_seq to regress_priv_user2; SELECT has_sequence_privilege('regress_priv_user1', 'atest1', 'SELECT'); SELECT has_sequence_privilege('regress_priv_user1', 'x_seq', 'INSERT'); SELECT has_sequence_privilege('regress_priv_user1', 'x_seq', 'SELECT'); SET SESSION AUTHORIZATION regress_priv_user2; SELECT has_sequence_privilege('x_seq', 'USAGE'); -- largeobject privilege tests \c - SET SESSION AUTHORIZATION regress_priv_user1; SELECT lo_create(1001); SELECT lo_create(1002); SELECT lo_create(1003); SELECT lo_create(1004); SELECT lo_create(1005); GRANT ALL ON LARGE OBJECT 1001 TO PUBLIC; GRANT SELECT ON LARGE OBJECT 1003 TO regress_priv_user2; GRANT SELECT,UPDATE ON LARGE OBJECT 1004 TO regress_priv_user2; GRANT ALL ON LARGE OBJECT 1005 TO regress_priv_user2; GRANT SELECT ON LARGE OBJECT 1005 TO regress_priv_user2 WITH GRANT OPTION; GRANT SELECT, INSERT ON LARGE OBJECT 1001 TO PUBLIC; -- to be failed GRANT SELECT, UPDATE ON LARGE OBJECT 1001 TO nosuchuser; -- to be failed GRANT SELECT, UPDATE ON LARGE OBJECT 999 TO PUBLIC; -- to be failed \c - SET SESSION AUTHORIZATION regress_priv_user2; SELECT lo_create(2001); SELECT lo_create(2002); SELECT loread(lo_open(1001, x'20000'::int), 32); -- allowed, for now SELECT lowrite(lo_open(1001, x'40000'::int), 'abcd'); -- fail, wrong mode SELECT loread(lo_open(1001, x'40000'::int), 32); SELECT loread(lo_open(1002, x'40000'::int), 32); -- to be denied SELECT loread(lo_open(1003, x'40000'::int), 32); SELECT loread(lo_open(1004, x'40000'::int), 32); SELECT lowrite(lo_open(1001, x'20000'::int), 'abcd'); SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); -- to be denied SELECT lowrite(lo_open(1003, x'20000'::int), 'abcd'); -- to be denied SELECT lowrite(lo_open(1004, x'20000'::int), 'abcd'); GRANT SELECT ON LARGE OBJECT 1005 TO regress_priv_user3; GRANT UPDATE ON LARGE OBJECT 1006 TO regress_priv_user3; -- to be denied REVOKE ALL ON LARGE OBJECT 2001, 2002 FROM PUBLIC; GRANT ALL ON LARGE OBJECT 2001 TO regress_priv_user3; SELECT lo_unlink(1001); -- to be denied SELECT lo_unlink(2002); \c - -- confirm ACL setting SELECT oid, pg_get_userbyid(lomowner) ownername, lomacl FROM pg_largeobject_metadata WHERE oid >= 1000 AND oid < 3000 ORDER BY oid; SET SESSION AUTHORIZATION regress_priv_user3; SELECT loread(lo_open(1001, x'40000'::int), 32); SELECT loread(lo_open(1003, x'40000'::int), 32); -- to be denied SELECT loread(lo_open(1005, x'40000'::int), 32); SELECT lo_truncate(lo_open(1005, x'20000'::int), 10); -- to be denied SELECT lo_truncate(lo_open(2001, x'20000'::int), 10); -- compatibility mode in largeobject permission \c - SET lo_compat_privileges = false; -- default setting SET SESSION AUTHORIZATION regress_priv_user4; SELECT loread(lo_open(1002, x'40000'::int), 32); -- to be denied SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); -- to be denied SELECT lo_truncate(lo_open(1002, x'20000'::int), 10); -- to be denied SELECT lo_put(1002, 1, 'abcd'); -- to be denied SELECT lo_unlink(1002); -- to be denied SELECT lo_export(1001, '/dev/null'); -- to be denied SELECT lo_import('/dev/null'); -- to be denied SELECT lo_import('/dev/null', 2003); -- to be denied \c - SET lo_compat_privileges = true; -- compatibility mode SET SESSION AUTHORIZATION regress_priv_user4; SELECT loread(lo_open(1002, x'40000'::int), 32); SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); SELECT lo_truncate(lo_open(1002, x'20000'::int), 10); SELECT lo_unlink(1002); SELECT lo_export(1001, '/dev/null'); -- to be denied -- don't allow unpriv users to access pg_largeobject contents \c - SELECT * FROM pg_largeobject LIMIT 0; SET SESSION AUTHORIZATION regress_priv_user1; SELECT * FROM pg_largeobject LIMIT 0; -- to be denied -- test default ACLs \c - CREATE SCHEMA testns; GRANT ALL ON SCHEMA testns TO regress_priv_user1; CREATE TABLE testns.acltest1 (x int); SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- no SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT SELECT ON TABLES TO public; SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- no SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no DROP TABLE testns.acltest1; CREATE TABLE testns.acltest1 (x int); SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- yes SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT INSERT ON TABLES TO regress_priv_user1; DROP TABLE testns.acltest1; CREATE TABLE testns.acltest1 (x int); SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- yes SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- yes ALTER DEFAULT PRIVILEGES IN SCHEMA testns REVOKE INSERT ON TABLES FROM regress_priv_user1; DROP TABLE testns.acltest1; CREATE TABLE testns.acltest1 (x int); SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- yes SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no ALTER DEFAULT PRIVILEGES FOR ROLE regress_priv_user1 REVOKE EXECUTE ON FUNCTIONS FROM public; ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT USAGE ON SCHEMAS TO regress_priv_user2; -- error SET ROLE regress_priv_user1; CREATE FUNCTION testns.foo() RETURNS int AS 'select 1' LANGUAGE sql; CREATE AGGREGATE testns.agg1(int) (sfunc = int4pl, stype = int4); CREATE PROCEDURE testns.bar() AS 'select 1' LANGUAGE sql; SELECT has_function_privilege('regress_priv_user2', 'testns.foo()', 'EXECUTE'); -- no SELECT has_function_privilege('regress_priv_user2', 'testns.agg1(int)', 'EXECUTE'); -- no SELECT has_function_privilege('regress_priv_user2', 'testns.bar()', 'EXECUTE'); -- no ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT EXECUTE ON ROUTINES to public; DROP FUNCTION testns.foo(); CREATE FUNCTION testns.foo() RETURNS int AS 'select 1' LANGUAGE sql; DROP AGGREGATE testns.agg1(int); CREATE AGGREGATE testns.agg1(int) (sfunc = int4pl, stype = int4); DROP PROCEDURE testns.bar(); CREATE PROCEDURE testns.bar() AS 'select 1' LANGUAGE sql; SELECT has_function_privilege('regress_priv_user2', 'testns.foo()', 'EXECUTE'); -- yes SELECT has_function_privilege('regress_priv_user2', 'testns.agg1(int)', 'EXECUTE'); -- yes SELECT has_function_privilege('regress_priv_user2', 'testns.bar()', 'EXECUTE'); -- yes (counts as function here) DROP FUNCTION testns.foo(); DROP AGGREGATE testns.agg1(int); DROP PROCEDURE testns.bar(); ALTER DEFAULT PRIVILEGES FOR ROLE regress_priv_user1 REVOKE USAGE ON TYPES FROM public; RESET ROLE; SELECT count(*) FROM pg_default_acl d LEFT JOIN pg_namespace n ON defaclnamespace = n.oid WHERE nspname = 'testns'; DROP TABLE testns.acltest1; DROP SCHEMA testns CASCADE; SELECT d.* -- check that entries went away FROM pg_default_acl d LEFT JOIN pg_namespace n ON defaclnamespace = n.oid WHERE nspname IS NULL AND defaclnamespace != 0; -- Grant on all objects of given type in a schema \c - CREATE SCHEMA testns; CREATE TABLE testns.t1 (f1 int); CREATE TABLE testns.t2 (f1 int); SELECT has_table_privilege('regress_priv_user1', 'testns.t1', 'SELECT'); -- false GRANT ALL ON ALL TABLES IN SCHEMA testns TO regress_priv_user1; SELECT has_table_privilege('regress_priv_user1', 'testns.t1', 'SELECT'); -- true SELECT has_table_privilege('regress_priv_user1', 'testns.t2', 'SELECT'); -- true REVOKE ALL ON ALL TABLES IN SCHEMA testns FROM regress_priv_user1; SELECT has_table_privilege('regress_priv_user1', 'testns.t1', 'SELECT'); -- false SELECT has_table_privilege('regress_priv_user1', 'testns.t2', 'SELECT'); -- false CREATE FUNCTION testns.priv_testfunc(int) RETURNS int AS 'select 3 * $1;' LANGUAGE sql; CREATE AGGREGATE testns.priv_testagg(int) (sfunc = int4pl, stype = int4); CREATE PROCEDURE testns.priv_testproc(int) AS 'select 3' LANGUAGE sql; SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testfunc(int)', 'EXECUTE'); -- true by default SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testagg(int)', 'EXECUTE'); -- true by default SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- true by default REVOKE ALL ON ALL FUNCTIONS IN SCHEMA testns FROM PUBLIC; SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testfunc(int)', 'EXECUTE'); -- false SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testagg(int)', 'EXECUTE'); -- false SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- still true, not a function REVOKE ALL ON ALL PROCEDURES IN SCHEMA testns FROM PUBLIC; SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- now false GRANT ALL ON ALL ROUTINES IN SCHEMA testns TO PUBLIC; SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testfunc(int)', 'EXECUTE'); -- true SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testagg(int)', 'EXECUTE'); -- true SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- true \set VERBOSITY terse \\ -- suppress cascade details drop table testns.t1 cascade; drop table testns.t2 cascade; DROP SCHEMA testns CASCADE; \set VERBOSITY default -- Change owner of the schema & and rename of new schema owner \c - CREATE ROLE regress_schemauser1 superuser login; CREATE ROLE regress_schemauser2 superuser login; SET SESSION ROLE regress_schemauser1; CREATE SCHEMA testns; SELECT nspname, rolname FROM pg_namespace, pg_roles WHERE pg_namespace.nspname = 'testns' AND pg_namespace.nspowner = pg_roles.oid; ALTER SCHEMA testns OWNER TO regress_schemauser2; ALTER ROLE regress_schemauser2 RENAME TO regress_schemauser_renamed; SELECT nspname, rolname FROM pg_namespace, pg_roles WHERE pg_namespace.nspname = 'testns' AND pg_namespace.nspowner = pg_roles.oid; set session role regress_schemauser_renamed; \set VERBOSITY terse \\ -- suppress cascade details DROP SCHEMA testns CASCADE; \set VERBOSITY default -- clean up \c - DROP ROLE regress_schemauser1; drop table testns.t1 cascade; drop schema testns; DROP ROLE regress_schemauser_renamed; -- test that dependent privileges are revoked (or not) properly \c - set session role regress_priv_user1; create table dep_priv_test (a int); grant select on dep_priv_test to regress_priv_user2 with grant option; grant select on dep_priv_test to regress_priv_user3 with grant option; set session role regress_priv_user2; grant select on dep_priv_test to regress_priv_user4 with grant option; set session role regress_priv_user3; grant select on dep_priv_test to regress_priv_user4 with grant option; set session role regress_priv_user4; grant select on dep_priv_test to regress_priv_user5; \dp dep_priv_test set session role regress_priv_user2; revoke select on dep_priv_test from regress_priv_user4 cascade; \dp dep_priv_test set session role regress_priv_user3; revoke select on dep_priv_test from regress_priv_user4 cascade; \dp dep_priv_test set session role regress_priv_user1; drop table dep_priv_test; -- clean up \c drop sequence x_seq; DROP AGGREGATE priv_testagg1(int); DROP FUNCTION priv_testfunc2(int); DROP FUNCTION priv_testfunc4(boolean); DROP PROCEDURE priv_testproc1(int); DROP VIEW atestv0; DROP VIEW atestv1; DROP VIEW atestv2; -- this should cascade to drop atestv4 DROP VIEW atestv3 CASCADE; -- this should complain "does not exist" DROP VIEW atestv4; DROP TABLE atest1 cascade; DROP TABLE atest2 cascade; DROP TABLE atest3 cascade; DROP TABLE atest4 cascade; DROP TABLE atest5 cascade; DROP TABLE atest6 cascade; SELECT lo_unlink(oid) FROM pg_largeobject_metadata WHERE oid >= 1000 AND oid < 3000 ORDER BY oid; DROP GROUP regress_priv_group1; DROP GROUP regress_priv_group2; -- these are needed to clean up permissions REVOKE USAGE ON LANGUAGE sql FROM regress_priv_user1; drop table atest12 cascade; drop function leak(integer,integer) cascade; ALTER DEFAULT PRIVILEGES FOR ROLE regress_priv_user1 grant EXECUTE ON FUNCTIONS to public; ALTER DEFAULT PRIVILEGES FOR ROLE regress_priv_user1 grant USAGE ON TYPES to public; DROP USER regress_priv_user1; DROP USER regress_priv_user2; DROP USER regress_priv_user3; DROP USER regress_priv_user4; DROP USER regress_priv_user5; DROP USER regress_priv_user6; -- permissions with LOCK TABLE CREATE USER regress_locktable_user; CREATE TABLE lock_table (a int); -- LOCK TABLE and SELECT permission GRANT SELECT ON lock_table TO regress_locktable_user; SET SESSION AUTHORIZATION regress_locktable_user; BEGIN; LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should fail ROLLBACK; BEGIN; LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should pass COMMIT; BEGIN; LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should fail ROLLBACK; \c REVOKE SELECT ON lock_table FROM regress_locktable_user; -- LOCK TABLE and INSERT permission GRANT INSERT ON lock_table TO regress_locktable_user; SET SESSION AUTHORIZATION regress_locktable_user; BEGIN; LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass COMMIT; BEGIN; LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail ROLLBACK; BEGIN; LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should fail ROLLBACK; \c REVOKE INSERT ON lock_table FROM regress_locktable_user; -- LOCK TABLE and UPDATE permission GRANT UPDATE ON lock_table TO regress_locktable_user; SET SESSION AUTHORIZATION regress_locktable_user; BEGIN; LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass COMMIT; BEGIN; LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail ROLLBACK; BEGIN; LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should pass COMMIT; \c REVOKE UPDATE ON lock_table FROM regress_locktable_user; -- LOCK TABLE and DELETE permission GRANT DELETE ON lock_table TO regress_locktable_user; SET SESSION AUTHORIZATION regress_locktable_user; BEGIN; LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass COMMIT; BEGIN; LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail ROLLBACK; BEGIN; LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should pass COMMIT; \c REVOKE DELETE ON lock_table FROM regress_locktable_user; SET SESSION AUTHORIZATION regress_locktable_user; BEGIN; LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass COMMIT; BEGIN; LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail ROLLBACK; BEGIN; LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should pass COMMIT; \c -- clean up DROP TABLE lock_table; DROP USER regress_locktable_user;
the_stack
use DBProject go /*----------------------------------------------------------------*/ /*-----------------------------Patient-----------------------------*/ /*----------------------------------------------------------------*/ --------------------------PatientHome------------------------- ----------------------------(1)------------------------------- /* Takes PatientID and returns its data */ create procedure RetrievePatientData @ID int, @name varchar(30) output, @phone char(11) output, @address varchar(40) output, @birthDate varchar (10) output, @age int output, @gender char(1) output as begin select @name=Name, @phone=Phone, @address=Address, @gender=Gender, @age=DATEDIFF(YEAR, BirthDate, GETDATE()), @birthDate = BirthDate from Patient where PatientID = @ID end --------------------------BillsHistory------------------------- ----------------------------(1)------------------------------- GO create procedure RetrieveBillHistory @pID int, @count int OUTPUT as begin select CONVERT(VARCHAR(11),[date],106) as [Date], [Name] as [Doctor's Name], Bill_Amount as [Bill Amount], Bill_Status as [Bill Status] from Appointment A join Doctor D on A.DoctorID = D.DoctorID where PatientID = @pID AND Appointment_Status = 3 select @count = count(*) from Appointment where PatientID = @pID and Appointment_Status = 3 end --------------------------CurrentAppointment------------------------- ----------------------------(1)------------------------------- GO create procedure RetrieveCurrentAppointment @pID int, @dName varchar(30) OUTPUT, @timings varchar(30) OUTPUT, @count int OUTPUT as begin --If there was an appointment whose status was pending and the doctor didn't check it on the day the appointment was requested --then since its the next day now, so that appointment will be deleted. if (exists (select* from Appointment where PatientID = @pID AND Appointment_Status = 2)) begin declare @day datetime, @month datetime, @year datetime set @day = datepart (day,getdate()) set @month = datepart (month, getdate()) set @year = datepart (year, getdate()) declare @Aday datetime, @Amonth datetime, @Ayear datetime select @Aday = datepart(day,[date]), @Amonth = datepart(MONTH,[date]), @Ayear = datepart(YEAR,[date]) from Appointment where PatientID = @pID AND Appointment_Status = 2 select @dName = name, @timings = CONVERT(VARCHAR(19),[date]) from Appointment A join Doctor D on A.DoctorID = D.DoctorID where PatientID = @pID AND appointment_Status = 2 --If the appointment is outdated then delete it if (@Aday != @day OR @Amonth != @month OR @Ayear != @year) begin delete from Appointment where PatientID = @pID AND Appointment_Status = 2 set @count = 3 end else begin set @count = 2 end end else begin if (exists (select * from Appointment where PatientID = @pid and Appointment_Status = 1)) begin select @dName = name, @timings = CONVERT(VARCHAR(19),[date]) from Appointment A join Doctor D on A.DoctorID = D.DoctorID where PatientID = @pID AND appointment_Status = 1 set @count = 1 end else begin set @count = 0 end end end --------------------------TreatmentHistory------------------------- ----------------------------(1)------------------------------- GO create procedure RetrieveTreatmentHistory @pID int, @count int OUTPUT as begin select CONVERT(VARCHAR(11),[date],106) as [Date], [Name] as [Doctor's Name], Disease as [Diagnosed Disease], Progress as [Progress Made], Prescription from Appointment A join Doctor D on A.DoctorID = D.DoctorID where PatientID = @pID and Appointment_Status = 3 select @count = count(*) from Appointment where PatientID = @pID and Appointment_Status = 3 end --------------------------TakeAppointment------------------------- ----------------------------(1)------------------------------- GO create view deptInfo as select DeptName, [Description], count(Dept.deptNo) as [Number of Doctors] from Department Dept join Doctor D on Dept.DeptNo = D.DeptNo where D.status != 0 group by Dept.DeptNo, DeptName, [Description] --------------------------ViewDoctors------------------------- ----------------------------(1)------------------------------- GO create procedure RetrieveDeptDoctorInfo @deptName varchar(30) as begin select DoctorID, [Name] as [Doctor's Name], Specialization, deptName as [DeptName] from Department Dept join Doctor D on Dept.DeptNo = D.DeptNo where DeptName = @deptName AND D.status != 0 end --------------------------DoctorProfile------------------------- ----------------------------(1)------------------------------- /* Takes DoctorID and returns its data */ GO create procedure RetrieveDoctorData @dID int, @name varchar(30) output, @phone char(11) output, @gender varchar(2) output, @charges float output, @RI float output, @PTreated int output, @qualification varchar(100) output, @specialization varchar(100) output, @workE int output, @age int output as begin select @name=Name, @phone=Phone, @gender=Gender,@charges = charges_per_visit, @RI = ReputeIndex, @PTreated = Patients_Treated, @qualification = qualification, @specialization = specialization, @workE = Work_Experience, @age=DATEDIFF(YEAR, BirthDate, GETDATE()) from Doctor where DoctorID = @dID end -------------------------------------------------------------------------------------- ----------------------------------Split Function-------------------------------------- GO create FUNCTION [dbo].[fnSplitString] ( @string NVARCHAR(MAX), @delimiter CHAR(1) ) RETURNS @output TABLE(splitdata NVARCHAR(MAX) ) BEGIN DECLARE @start INT, @end INT SELECT @start = 1, @end = CHARINDEX(@delimiter, @string) WHILE @start < LEN(@string) + 1 BEGIN IF @end = 0 SET @end = LEN(@string) + 1 INSERT INTO @output (splitdata) VALUES(SUBSTRING(@string, @start, @end - @start)) SET @start = @end + 1 SET @end = CHARINDEX(@delimiter, @string, @start) END RETURN END ----------------------------------------------------------------- --------------------------AppointmentTaker------------------------- ----------------------------(1)------------------------------- --The slots are from 9 AM to 5 PM each today and each slot is of one hour GO create procedure RetrieveFreeSlots @dID int, @pID int, @count int OUTPUT as begin declare @month int, @year int, @day int declare @hoursList varchar(100) set @month = DATEPART(MONTH, GETDATE()) set @year = DATEPART(YEAR, GETDATE()) set @day = DATEPART(DAY, GETDATE()) declare @currentHour int set @currentHour = 9 set @count = 0 set @hoursList = '' declare @tempT varchar (10) declare @tempHour int set @tempHour = 0 while (@currentHour != 18) begin if ( not exists (select* from Appointment where DATEPART(YEAR, [DATE]) = @year AND DATEPART(MONTH, [DATE]) = @month AND DATEPART(DAY, [DATE]) = @day AND DoctorID = @dID AND DATEPART(Hour, [DATE]) = @currentHour ) ) begin set @count = @count + 1 if (@currentHour < 12) begin set @tempT = ':00 AM' set @tempHour = @currentHour end else if (@currentHour = 12) begin set @tempT = ':00 PM' set @tempHour = @currentHour end else begin set @tempT = ':00 PM' set @tempHour = @currentHour - 12 end SELECT @hoursList = @hoursList + CAST(@tempHour AS VARCHAR(5)) + @tempT + ',' end set @currentHour = @currentHour + 1 end select convert (varchar(100), splitdata) as [Free Slots] from dbo.fnSplitString(@hoursList,',') end --------------------------AppointmentRequestSent------------------------- ----------------------------(1)------------------------------- GO create procedure insertInAppointmentTable @pid int, @dId int, @freeSlot int as begin if (@freeSlot < 9) set @freeSlot = @freeSlot + 12 declare @date varchar (100) select @date = CONVERT(VARCHAR(11),GETDATE(),6) select @date = @date + ' ' + cast (@freeSlot as varchar(30)) + ':00' declare @dateA datetime select @dateA = CONVERT(datetime, @date) insert into Appointment values (@dId,@pId,@dateA,2,NULL,NULL,2,1,NULL,NULL,NULL,NULL) --Trigger (1) will be called here. end --------------------------PatientNotifications------------------------- ----------------------------(1)------------------------------- GO create procedure RetrievePatientNotifications @pID int, @dName varchar(30) OUTPUT, @timings varchar(30) OUTPUT, @count int OUTPUT as begin if (exists (select* from Appointment where PatientID = @pID AND PatientNotification = 2)) begin declare @aStatus int, @aID int select @aStatus = Appointment_Status, @aID = AppointID from Appointment where PatientID = @pID AND PatientNotification = 2 if(@aStatus = 1 or @aStatus = 3) begin if (@aStatus = 3) begin set @count = 3 end else begin set @count = 1 end select @dName = name, @timings = CONVERT(VARCHAR(19),[date]) from Appointment A join Doctor D on A.DoctorID = D.DoctorID where @aID = AppointID --Mark that notification as Seen update Appointment set patientNotification = 1 where AppointID = @aID end else if (@aStatus = 4) begin select @dName = name, @timings = CONVERT(VARCHAR(19),[date]) from Appointment A join Doctor D on A.DoctorID = D.DoctorID where @aID = AppointID set @count = 2 --Delete the rejected appointment delete from Appointment where AppointID = @aID end else begin set @count = 0 end end else begin set @count = 0 end end --------------------------PatientFeedback------------------------- ----------------------------(1)------------------------------- GO create procedure retrievePendingFeedback @pID int, @dName varchar(30) OUTPUT, @timings varchar(30) OUTPUT, @aID int OUTPUT, @count int OUTPUT as begin if (exists (select* from Appointment where PatientID=@pID AND feedbackStatus = 2 AND Appointment_Status = 3)) begin set @count = 1 select @dName = name, @timings = CONVERT(VARCHAR(19),[date]), @aID = AppointID from Appointment A join Doctor D on A.DoctorID = D.DoctorID where PatientID = @pID AND (feedbackStatus = 2) AND Appointment_Status = 3 end else begin set @count = 0 end end ----------------------------(2)------------------------------- GO create procedure storeFeedback @aID int as begin declare @dID int select @dID = DoctorID from Appointment where AppointID = @aID declare @RI float, @PT int select @RI = ReputeIndex, @PT = Patients_Treated from Doctor where DoctorID = @dID declare @avg float select @avg = (@RI * (@PT-1)) / @PT update Doctor set ReputeIndex = @avg where DoctorID = @dID update Appointment set FeedbackStatus = 1 where AppointID = @aID end ---------------------------------Triggers------------------------------------------ ----------------------------------(1)----------------------------------------------------- ---If there is already one pending appointment for a patient, then he isn't allowed to take another appointment GO create trigger OneAppointment on Appointment instead of insert as begin declare @dID int, @pID int, @d datetime select @dID = DoctorID, @pID = PatientID, @d = [Date] from inserted if (not exists (select * from Appointment where PatientID = @pID AND (Appointment_Status = 2 OR Appointment_Status = 1 ))) begin insert into Appointment values (@dId,@pId,@d,2,NULL,NULL,2,1,NULL,NULL,NULL,NULL) print ('Request sent for the appointment :)') end else print ('You have already requested for an Appointment. You cannot request for one more!') end
the_stack
begin; /* temporarily create the table so that the line structure type exists */ create table if not exists line_structure ( line_id integer ); drop function if exists derive_line_structure(integer); drop function if exists join_line_structure(integer, integer array); drop function if exists merge_line_structure(integer, integer array); drop function if exists line_structure_majority(integer, line_structure array, boolean); drop function if exists line_structure_distance(line_structure, line_structure); drop function if exists line_structure_classify(integer, line_structure array, integer); drop function if exists line_structure_set(integer, line_structure array); drop table if exists line_structure; create table line_structure ( line_id integer, part_nr integer, -- properties voltage integer, frequency float, cables integer, wires integer, -- counts num_objects integer, num_conflicts integer array[4], num_classes integer, primary key (line_id, part_nr) ); create function derive_line_structure (i integer) returns line_structure array as $$ declare r line_structure array; d derived_objects; begin r = array(select row(l.*) from line_structure l where line_id = i); if array_length(r, 1) is not null then return r; end if; select * into d from derived_objects where derived_id = i and derived_type = 'l'; if d.derived_id is null then raise exception 'No derived object for line_id %', i; elsif d.operation = 'join' then r = join_line_structure(i, d.source_id); elsif d.operation = 'merge' then r = merge_line_structure(i, d.source_id); elsif d.operation = 'split' then r = derive_line_structure(d.source_id[1]); end if; if array_length(r, 1) is null then raise exception 'Could not derive line_structure for %', i; end if; -- store and return insert into line_structure (line_id, part_nr, voltage, frequency, cables, wires, num_objects, num_conflicts, num_classes) select * from line_structure_set(i, r); return array(select row(l.*) from line_structure_set(i, r) l); end; $$ language plpgsql; create function line_structure_set(i integer, r line_structure array) returns setof line_structure as $$ begin return query select i, s, (l).voltage, (l).frequency, (l).cables, (l).wires, (l).num_objects, (l).num_conflicts, (l).num_classes from (select unnest(r), generate_subscripts(r, 1)) f(l, s); end; $$ language plpgsql; create function join_line_structure(i integer, j integer array) returns line_structure array as $$ declare r line_structure array; n integer; begin r = array(select unnest(derive_line_structure(line_id)) from unnest(j) line_id); n = max((e).num_classes) from unnest(r) as e; if n > 1 then return array(select line_structure_majority(i, array_agg(l), false) from line_structure_classify(i, r, n) c join unnest(r) l on (l).line_id = c.source_id and (l).part_nr = c.part_nr group by c.class_key); else return array[line_structure_majority(i, r, false)]; end if; end; $$ language plpgsql; create function merge_line_structure(i integer, j integer array) returns line_structure array as $$ declare r line_structure array; n integer; begin r = array(select unnest(derive_line_structure(line_id)) from unnest(j) line_id); -- if we have multiple classes, multiple voltages, or frequencies, choose to treat them as s n = greatest(max((e).num_classes::bigint), count(distinct (e).voltage), count(distinct (e).frequency)) from unnest(r) as e; if n > 1 then -- divide over c classes return array(select line_structure_majority(i, array_agg(l), true) from line_structure_classify(i, r, n) c join unnest(r) l on (l).line_id = c.source_id and (l).part_nr = c.part_nr group by c.class_key); else return array[line_structure_majority(i, r, true)]; end if; end; $$ language plpgsql; create function line_structure_majority(i integer, d line_structure array, sum_cables boolean) returns line_structure as $$ declare r line_structure; begin with raw_data (line_id, part_nr, voltage, frequency, cables, wires, num_objects, num_conflicts, num_classes) as ( select (e).* from unnest(d) e ), cnt_t (n) as ( select sum(num_objects) from raw_data ), cnt_v (n) as ( select sum(num_objects) from raw_data where voltage is not null ), cnt_f (n) as ( select sum(num_objects) from raw_data where frequency is not null ), cnt_c (n) as ( select sum(num_objects) from raw_data where cables is not null ), cnt_w (n) as ( select sum(num_objects) from raw_data where wires is not null ), num_c (n) as ( select max(num_classes) from raw_data ), vlt(voltage, conflicts) as ( select voltage, coalesce(n - score, 0) from ( select voltage, sum(num_objects) - sum(num_conflicts[1]) from raw_data group by voltage ) _t (voltage, score), cnt_v order by voltage is not null desc, score desc, voltage asc limit 1 ), frq(frequency, conflicts) as ( select frequency, coalesce(n - score, 0) from ( select frequency, sum(num_objects) - sum(num_conflicts[2]) from raw_data group by frequency ) _t (frequency, score), cnt_f order by frequency is not null desc, score desc, frequency asc limit 1 ), cbl(cables, conflicts) as ( select cables, coalesce(n - score, 0) from ( select cables, sum(num_objects) - sum(num_conflicts[3]) from raw_data group by cables ) _t (cables, score), cnt_c order by cables is not null desc, score desc, cables asc limit 1 ), wrs(wires, conflicts) as ( select wires, coalesce(n - score, 0) from ( select wires, sum(num_objects) - sum(num_conflicts[4]) from raw_data group by wires ) _t (wires, score), cnt_w order by wires is not null desc, score desc, wires asc limit 1 ), _sum (cables) as ( select sum(cables) from raw_data where cables is not null ) select null, null, vlt.voltage, frq.frequency, case when sum_cables then _sum.cables else cbl.cables end, wrs.wires, cnt_t.n, array[vlt.conflicts, frq.conflicts, cbl.conflicts, wrs.conflicts], num_c.n into r from vlt, frq, cbl, wrs, cnt_t, num_c, _sum; return r; end; $$ language plpgsql; create function line_structure_distance(a line_structure, b line_structure) returns numeric as $$ begin return case when a.voltage is null or b.voltage is null then 1 when a.voltage = b.voltage then 0 when least(a.voltage, b.voltage) = 0 then 4 else 2*greatest(a.voltage, b.voltage)::float / least(a.voltage, b.voltage)::float end + case when a.frequency is null or b.frequency is null then 1 when a.frequency = b.frequency then 0 when least(a.frequency, b.frequency) = 0 then 4 else 2*greatest(a.frequency, b.frequency) / least(a.frequency, b.frequency) end + case when a.cables is null or b.cables is null then 1 when a.cables = b.cables then 0 when least(a.cables, b.cables) = 0 then 2 else 0.7*greatest(a.cables, b.cables)::float / least(a.cables, b.cables)::float end + case when a.wires is null or b.wires is null then 1 when a.wires = b.wires then 0 when least(a.wires, b.wires) = 0 then 2 else 0.7*greatest(a.wires, b.wires)::float / least(a.wires, b.wires)::float end; end; $$ language plpgsql; -- TODO this needs a structure_id of sorts... (OR we can introduce link_id here, but that means we need two tables) drop table if exists line_structure_class; create table line_structure_class ( line_id integer, source_id integer, part_nr integer, class_key integer, primary key (line_id, source_id, part_nr) ); create index line_structure_class_key_idx on line_structure_class (line_id, class_key); create function line_structure_classify (i integer, r line_structure array, n integer) returns setof line_structure_class as $$ declare edge record; src_key integer; dst_key integer; num_edges integer; begin num_edges = 0; insert into line_structure_class (line_id, source_id, part_nr, class_key) select i, (unnest(r)).line_id, (unnest(r)).part_nr, generate_subscripts(r, 1); for edge in with pairs (src_id, src_pt, dst_id, dst_pt, cost) as ( select a_id, a_pt, b_id, b_pt, line_structure_distance(_s, _t) from unnest(r) _s(a_id, a_pt), unnest(r) _t(b_id, b_pt) -- line id is the first column where a_id < b_id order by line_structure_distance(_s, _t) asc ) select * from pairs loop src_key := class_key from line_structure_class where line_id = i and source_id = edge.src_id and part_nr = edge.src_pt; dst_key := class_key from line_structure_class where line_id = i and source_id = edge.dst_id and part_nr = edge.dst_pt; if src_key = dst_key then continue; elsif num_edges + n = array_length(r, 1) then exit; else update line_structure_class set class_key = least(src_key, dst_key) where line_id = i and class_key = greatest(src_key, dst_key); num_edges = num_edges + 1; end if; end loop; return query select line_id, source_id, part_nr, class_key from line_structure_class where line_id = i; end; $$ language plpgsql; insert into line_structure (line_id, part_nr, voltage, frequency, cables, wires, num_objects, num_conflicts, num_classes) select line_id, generate_series(1, num_classes), case when voltage is not null then unnest(voltage) end, case when frequency is not null then unnest(frequency) end, case when cables is not null then unnest(cables) end, case when wires is not null then unnest(wires) end, 1, array[0,0,0,0], num_classes from line_tags; do $$ declare i integer; c integer; begin -- todo, we may want to split this into partial queries, because -- a single run takes a /very/ long time... i = 0; loop c = count(*) from topology_edges e where not exists ( select 1 from line_structure l where l.line_id = e.line_id ); i := i + 1; exit when c = 0; raise notice 'Iteration %, % left', i, c; perform derive_line_structure(derived_id) from derived_objects j join topology_edges e on e.line_id = j.derived_id where derived_type = 'l' and not exists (select 1 from line_structure l where l.line_id = e.line_id) order by line_id asc limit 1000; end loop; end; $$ language plpgsql; commit;
the_stack
-- 2017-11-15T07:00:47.338 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lagerort Von',Updated=TO_TIMESTAMP('2017-11-15 07:00:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560524 ; -- 2017-11-15T07:01:02.073 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lager von',Updated=TO_TIMESTAMP('2017-11-15 07:01:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560533 ; -- 2017-11-15T07:02:57.327 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET Name='Lagerort Von',Updated=TO_TIMESTAMP('2017-11-15 07:02:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53950 ; -- 2017-11-15T07:02:57.333 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lagerort Von', Description='Warehouse Locator', Help='The Locator indicates where in a Warehouse a product is located.' WHERE AD_Column_ID=53950 AND IsCentrallyMaintained='Y' ; -- 2017-11-15T07:03:20.013 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET Name='Lager Von',Updated=TO_TIMESTAMP('2017-11-15 07:03:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557833 ; -- 2017-11-15T07:03:20.018 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lager Von', Description='Lager oder Ort für Dienstleistung', Help='Das Lager identifiziert ein einzelnes Lager für Artikel oder einen Standort an dem Dienstleistungen geboten werden.' WHERE AD_Column_ID=557833 AND IsCentrallyMaintained='Y' ; -- 2017-11-15T07:04:23.264 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,543474,0,'M_WarehouseTo_ID',TO_TIMESTAMP('2017-11-15 07:04:23','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Lager Nach','Lager Nach',TO_TIMESTAMP('2017-11-15 07:04:23','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-15T07:04:23.272 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=543474 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2017-11-15T07:04:39.757 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-15 07:04:39','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Warehouse To',PrintName='Warehouse To' WHERE AD_Element_ID=543474 AND AD_Language='en_US' ; -- 2017-11-15T07:04:39.780 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543474,'en_US') ; -- 2017-11-15T07:05:00.888 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,ColumnSQL,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,557839,543474,0,19,53038,'N','M_WarehouseTo_ID','(select l.M_Warehouse_ID from M_Locator l where l.M_Locator_ID = DD_OrderLine.M_LocatorTo_ID)',TO_TIMESTAMP('2017-11-15 07:05:00','YYYY-MM-DD HH24:MI:SS'),100,'N','EE01',10,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Lager Nach',0,0,TO_TIMESTAMP('2017-11-15 07:05:00','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2017-11-15T07:05:00.891 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=557839 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2017-11-15T07:07:10.581 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,557839,560534,0,540890,0,TO_TIMESTAMP('2017-11-15 07:07:10','YYYY-MM-DD HH24:MI:SS'),100,10,'U',0,'Y','Y','Y','Y','N','N','N','N','N','Lager Nach',220,210,0,1,1,TO_TIMESTAMP('2017-11-15 07:07:10','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-15T07:07:10.582 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=560534 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2017-11-15T07:07:39.918 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Lager von',Updated=TO_TIMESTAMP('2017-11-15 07:07:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549205 ; -- 2017-11-15T07:07:51.937 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,560534,0,540890,541222,549206,'F',TO_TIMESTAMP('2017-11-15 07:07:51','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Lager nach',60,0,0,TO_TIMESTAMP('2017-11-15 07:07:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-15T07:08:06.445 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Lagerort von',Updated=TO_TIMESTAMP('2017-11-15 07:08:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549188 ; -- 2017-11-15T07:08:18.239 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Lagerort nach',Updated=TO_TIMESTAMP('2017-11-15 07:08:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549189 ; -- 2017-11-15T07:08:24.326 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=25,Updated=TO_TIMESTAMP('2017-11-15 07:08:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549206 ; -- 2017-11-15T07:08:31.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-11-15 07:08:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549206 ; -- 2017-11-15T07:08:33.400 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-11-15 07:08:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549189 ; -- 2017-11-15T07:08:35.028 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-11-15 07:08:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549192 ; -- 2017-11-15T07:08:38.978 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-11-15 07:08:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549204 ; -- 2017-11-15T07:08:53.380 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-11-15 07:08:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549206 ; -- 2017-11-15T07:08:53.389 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-11-15 07:08:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549189 ; -- 2017-11-15T07:08:53.394 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-11-15 07:08:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549179 ; -- 2017-11-15T07:08:53.399 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-11-15 07:08:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549204 ; -- 2017-11-15T07:08:53.407 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-11-15 07:08:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549186 ; -- 2017-11-15T07:08:53.410 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2017-11-15 07:08:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549202 ; -- 2017-11-15T07:09:01.213 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549177 ; -- 2017-11-15T07:09:01.219 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549178 ; -- 2017-11-15T07:09:01.225 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549190 ; -- 2017-11-15T07:09:01.234 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549180 ; -- 2017-11-15T07:09:01.238 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549201 ; -- 2017-11-15T07:09:01.241 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549181 ; -- 2017-11-15T07:09:01.244 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549182 ; -- 2017-11-15T07:09:01.250 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549205 ; -- 2017-11-15T07:09:01.252 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549188 ; -- 2017-11-15T07:09:01.254 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549206 ; -- 2017-11-15T07:09:01.256 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549189 ; -- 2017-11-15T07:09:01.257 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549179 ; -- 2017-11-15T07:09:01.259 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549204 ; -- 2017-11-15T07:09:01.260 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549186 ; -- 2017-11-15T07:09:01.261 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2017-11-15 07:09:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549202 ; -- 2017-11-15T07:13:44.462 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=-1.000000000000,Updated=TO_TIMESTAMP('2017-11-15 07:13:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560514 ; -- 2017-11-15T07:13:55.997 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:13:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560512 ; -- 2017-11-15T07:13:57.313 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:13:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560513 ; -- 2017-11-15T07:13:58.228 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:13:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560515 ; -- 2017-11-15T07:13:58.951 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:13:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560516 ; -- 2017-11-15T07:13:59.599 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:13:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560517 ; -- 2017-11-15T07:14:00.404 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560518 ; -- 2017-11-15T07:14:00.926 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560519 ; -- 2017-11-15T07:14:01.788 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560520 ; -- 2017-11-15T07:14:02.457 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560521 ; -- 2017-11-15T07:14:03.164 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560524 ; -- 2017-11-15T07:14:03.709 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560525 ; -- 2017-11-15T07:14:04.428 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560526 ; -- 2017-11-15T07:14:05.644 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560527 ; -- 2017-11-15T07:14:06.578 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560534 ; -- 2017-11-15T07:14:07.078 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560497 ; -- 2017-11-15T07:14:07.627 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560498 ; -- 2017-11-15T07:14:08.118 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560495 ; -- 2017-11-15T07:14:08.646 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560494 ; -- 2017-11-15T07:14:09.383 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560499 ; -- 2017-11-15T07:14:10.083 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560500 ; -- 2017-11-15T07:14:10.635 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560501 ; -- 2017-11-15T07:14:11.774 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560502 ; -- 2017-11-15T07:14:12.435 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560503 ; -- 2017-11-15T07:14:13.047 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560504 ; -- 2017-11-15T07:14:13.967 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560505 ; -- 2017-11-15T07:14:14.891 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560506 ; -- 2017-11-15T07:14:15.484 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560507 ; -- 2017-11-15T07:14:16.088 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560508 ; -- 2017-11-15T07:14:16.893 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560493 ; -- 2017-11-15T07:14:17.605 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560492 ; -- 2017-11-15T07:14:18.454 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560491 ; -- 2017-11-15T07:14:21.285 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560490 ; -- 2017-11-15T07:14:22.365 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560487 ; -- 2017-11-15T07:14:22.974 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560489 ; -- 2017-11-15T07:14:23.460 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560488 ; -- 2017-11-15T07:14:24.468 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560511 ; -- 2017-11-15T07:14:25.021 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560510 ; -- 2017-11-15T07:14:25.833 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560496 ; -- 2017-11-15T07:14:32.958 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-11-15 07:14:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560509 ; -- 2017-11-15T07:15:21.471 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET AD_Reference_ID=30, IsUpdateable='N',Updated=TO_TIMESTAMP('2017-11-15 07:15:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53930 ; -- 2017-11-15T07:16:09.993 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2017-11-15 07:16:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53940 ; -- 2017-11-15T07:16:26.965 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=40,Updated=TO_TIMESTAMP('2017-11-15 07:16:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53940 ; -- 2017-11-15T07:16:26.969 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', IsUpdateable='N', SelectionColumnSeqNo=50,Updated=TO_TIMESTAMP('2017-11-15 07:16:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53930 ; -- 2017-11-15T07:16:26.971 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=60,Updated=TO_TIMESTAMP('2017-11-15 07:16:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53964 ; -- 2017-11-15T07:17:32.741 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lagerort nach',Updated=TO_TIMESTAMP('2017-11-15 07:17:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560525 ; -- 2017-11-15T07:17:37.625 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lagerort von',Updated=TO_TIMESTAMP('2017-11-15 07:17:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560524 ; -- 2017-11-15T07:18:17.009 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lager nach',Updated=TO_TIMESTAMP('2017-11-15 07:18:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560534 ; -- 2017-11-15T07:18:20.952 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Lager von',Updated=TO_TIMESTAMP('2017-11-15 07:18:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560533 ; -- 2017-11-15T07:19:37.302 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnSQL='(select l.M_Warehouse_ID from M_Locator l1 where l1.M_Locator_ID = DD_OrderLine.M_LocatorTo_ID)',Updated=TO_TIMESTAMP('2017-11-15 07:19:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557839 ; -- 2017-11-15T07:19:44.982 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnSQL='(select l1.M_Warehouse_ID from M_Locator l1 where l1.M_Locator_ID = DD_OrderLine.M_LocatorTo_ID)',Updated=TO_TIMESTAMP('2017-11-15 07:19:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557839 ; -- 2017-11-15T07:21:33.914 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnSQL='',Updated=TO_TIMESTAMP('2017-11-15 07:21:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557839 ; -- 2017-11-15T07:21:36.811 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('DD_OrderLine','ALTER TABLE public.DD_OrderLine ADD COLUMN M_WarehouseTo_ID NUMERIC(10)') ; -- 2017-11-15T07:21:42.249 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnSQL='(select l.M_Warehouse_ID from M_Locator l where l.M_Locator_ID = DD_OrderLine.M_LocatorTo_ID)',Updated=TO_TIMESTAMP('2017-11-15 07:21:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557839 ; -- 2017-11-15T07:37:05.830 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2017-11-15 07:37:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=550563 ; -- 2017-11-15T07:37:19.319 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2017-11-15 07:37:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557839 ; -- 2017-11-15T07:37:53.221 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=20,Updated=TO_TIMESTAMP('2017-11-15 07:37:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=557839 ; -- 2017-11-15T07:37:53.227 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=30,Updated=TO_TIMESTAMP('2017-11-15 07:37:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=550563 ; -- 2017-11-15T07:37:53.234 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=40,Updated=TO_TIMESTAMP('2017-11-15 07:37:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53929 ; -- 2017-11-15T07:37:53.238 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=50,Updated=TO_TIMESTAMP('2017-11-15 07:37:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=551476 ; -- 2017-11-15T07:37:53.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=60,Updated=TO_TIMESTAMP('2017-11-15 07:37:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53940 ; -- 2017-11-15T07:37:53.243 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', IsUpdateable='N', SelectionColumnSeqNo=70,Updated=TO_TIMESTAMP('2017-11-15 07:37:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53930 ; -- 2017-11-15T07:37:53.245 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=80,Updated=TO_TIMESTAMP('2017-11-15 07:37:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53964 ; -- 2017-11-15T07:43:23.439 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-15 07:43:23','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Warehouse from' WHERE AD_Field_ID=560534 AND AD_Language='en_US' ; -- 2017-11-15T07:43:44.813 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-15 07:43:44','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Warehouse from',Description='',Help='' WHERE AD_Field_ID=560533 AND AD_Language='en_US' ; -- 2017-11-15T07:43:52.842 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-15 07:43:52','YYYY-MM-DD HH24:MI:SS'),Name='Warehouse to' WHERE AD_Field_ID=560534 AND AD_Language='en_US' ; -- 2017-11-15T07:44:13.700 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-15 07:44:13','YYYY-MM-DD HH24:MI:SS'),Name='Locator from' WHERE AD_Field_ID=560524 AND AD_Language='en_US' ; -- 2017-11-15T07:44:21.462 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-15 07:44:21','YYYY-MM-DD HH24:MI:SS'),Name='Locator to' WHERE AD_Field_ID=560525 AND AD_Language='en_US' ; -- 2017-11-15T07:46:04.717 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541223, SeqNo=150,Updated=TO_TIMESTAMP('2017-11-15 07:46:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549204 ; -- 2017-11-15T07:46:23.763 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-11-15 07:46:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549204 ; -- 2017-11-15T07:46:26.328 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-11-15 07:46:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549179 ; -- 2017-11-15T07:46:27.855 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-11-15 07:46:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549183 ; -- 2017-11-15T07:46:29.495 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-11-15 07:46:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549184 ; -- 2017-11-15T07:46:31.101 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-11-15 07:46:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549185 ; -- 2017-11-15T07:46:32.546 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-11-15 07:46:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549195 ; -- 2017-11-15T07:46:34.168 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-11-15 07:46:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549196 ; -- 2017-11-15T07:46:35.561 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-11-15 07:46:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549186 ; -- 2017-11-15T07:46:37.178 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-11-15 07:46:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549187 ; -- 2017-11-15T07:46:38.817 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-11-15 07:46:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549194 ; -- 2017-11-15T07:46:43.505 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-11-15 07:46:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549193 ;
the_stack
-- 2018-07-26T20:25:06.968 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Tab_ID,IsDisplayed,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,IsActive,CreatedBy,IsReadOnly,EntityType,AD_Field_ID,AD_Column_ID,AD_Org_ID,Name,UpdatedBy,DisplayLength,Created,Updated) VALUES (404,'Y','N','N','N','N',0,'Y',100,'N','D',565134,560719,0,'Break Value Type',100,1,TO_TIMESTAMP('2018-07-26 20:25:06','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-07-26 20:25:06','YYYY-MM-DD HH24:MI:SS')) ; -- 2018-07-26T20:25:07.011 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=565134 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2018-07-26T20:25:17.730 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Tab_ID,IsDisplayed,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,IsActive,CreatedBy,IsReadOnly,EntityType,Help,AD_Field_ID,AD_Column_ID,Description,AD_Org_ID,Name,UpdatedBy,DisplayLength,Created,Updated) VALUES (404,'Y','N','N','N','N',0,'Y',100,'N','D','',565135,560720,'',0,'Merkmal',100,10,TO_TIMESTAMP('2018-07-26 20:25:17','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-07-26 20:25:17','YYYY-MM-DD HH24:MI:SS')) ; -- 2018-07-26T20:25:17.734 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=565135 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2018-07-26T20:25:44.316 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110,Updated=TO_TIMESTAMP('2018-07-26 20:25:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565134 ; -- 2018-07-26T20:25:44.335 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=120,Updated=TO_TIMESTAMP('2018-07-26 20:25:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565135 ; -- 2018-07-26T20:25:44.353 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130,Updated=TO_TIMESTAMP('2018-07-26 20:25:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5241 ; -- 2018-07-26T20:25:44.373 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140,Updated=TO_TIMESTAMP('2018-07-26 20:25:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5242 ; -- 2018-07-26T20:25:44.400 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150,Updated=TO_TIMESTAMP('2018-07-26 20:25:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558692 ; -- 2018-07-26T20:25:53.013 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2018-07-26 20:25:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565134 ; -- 2018-07-26T20:25:53.019 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2018-07-26 20:25:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565135 ; -- 2018-07-26T20:25:53.025 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2018-07-26 20:25:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5241 ; -- 2018-07-26T20:25:53.031 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2018-07-26 20:25:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5242 ; -- 2018-07-26T20:25:53.038 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2018-07-26 20:25:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=558692 ; -- 2018-07-26T20:26:55.407 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@BreakValueType@=T',Updated=TO_TIMESTAMP('2018-07-26 20:26:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565135 ; -- 2018-07-26T20:27:21.164 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@DiscountType@=B',Updated=TO_TIMESTAMP('2018-07-26 20:27:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565134 ; -- 2018-07-26T20:27:39.132 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@DiscountType/X@=B & @BreakValueType/X@=T',Updated=TO_TIMESTAMP('2018-07-26 20:27:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565135 ; -- 2018-07-26T20:27:46.583 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@DiscountType/X@=B',Updated=TO_TIMESTAMP('2018-07-26 20:27:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565134 ; -- 2018-07-26T20:30:08.333 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=545455 ; -- 2018-07-26T20:31:01.058 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (IsAllowFiltering,AD_UI_Element_ID,AD_Field_ID,IsAdvancedField,UpdatedBy,AD_Client_ID,CreatedBy,IsActive,AD_UI_ElementGroup_ID,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,AD_Tab_ID,SeqNo_SideList,AD_Org_ID,Name,AD_UI_ElementType,Created,SeqNo,SeqNoGrid,Updated) VALUES ('N',552477,565134,'N',100,0,100,'Y',540610,'Y','N','N',404,0,0,'Break Value Type','F',TO_TIMESTAMP('2018-07-26 20:31:00','YYYY-MM-DD HH24:MI:SS'),25,0,TO_TIMESTAMP('2018-07-26 20:31:00','YYYY-MM-DD HH24:MI:SS')) ; -- 2018-07-26T20:31:25.120 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (IsAllowFiltering,AD_UI_Element_ID,AD_Field_ID,IsAdvancedField,UpdatedBy,AD_Client_ID,CreatedBy,IsActive,AD_UI_ElementGroup_ID,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,AD_Tab_ID,SeqNo_SideList,AD_Org_ID,Name,AD_UI_ElementType,Created,SeqNo,SeqNoGrid,Updated) VALUES ('N',552478,565135,'N',100,0,100,'Y',540610,'Y','N','N',404,0,0,'Attribute','F',TO_TIMESTAMP('2018-07-26 20:31:24','YYYY-MM-DD HH24:MI:SS'),26,0,TO_TIMESTAMP('2018-07-26 20:31:24','YYYY-MM-DD HH24:MI:SS')) ; -- 2018-07-26T20:31:55.179 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2018-07-26 20:31:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552477 ; -- 2018-07-26T20:31:55.202 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2018-07-26 20:31:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552478 ; -- 2018-07-26T20:31:55.224 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2018-07-26 20:31:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545451 ; -- 2018-07-26T20:31:55.246 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2018-07-26 20:31:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545452 ; -- 2018-07-26T20:31:55.268 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2018-07-26 20:31:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545460 ; -- 2018-07-26T20:31:55.293 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2018-07-26 20:31:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545453 ; -- 2018-07-26T20:32:16.697 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=5240 ; -- 2018-07-26T20:32:16.780 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=5240 ; -- 2018-07-26T20:34:02.713 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM EXP_FormatLine WHERE EXP_FormatLine_ID=547732 ; -- 2018-07-26T20:35:52.310 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET MandatoryLogic='@DiscountType/X@=B & @BreakValueType/X@=T',Updated=TO_TIMESTAMP('2018-07-26 20:35:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560720 ; -- 2018-07-26T20:37:19.712 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Tab_ID,IsDisplayed,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,IsActive,CreatedBy,IsReadOnly,EntityType,AD_Field_ID,AD_Column_ID,AD_Org_ID,Name,UpdatedBy,DisplayLength,Created,Updated) VALUES (541088,'Y','N','N','N','N',0,'Y',100,'N','de.metas.vertical.pharma',565136,560719,0,'Break Value Type',100,1,TO_TIMESTAMP('2018-07-26 20:37:19','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-07-26 20:37:19','YYYY-MM-DD HH24:MI:SS')) ; -- 2018-07-26T20:37:19.716 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=565136 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2018-07-26T20:37:31.067 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Tab_ID,IsDisplayed,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,IsActive,CreatedBy,IsReadOnly,EntityType,Help,AD_Field_ID,AD_Column_ID,Description,AD_Org_ID,Name,UpdatedBy,DisplayLength,Created,Updated) VALUES (541088,'Y','N','N','N','N',0,'Y',100,'N','de.metas.vertical.pharma','',565137,560720,'',0,'Merkmal',100,10,TO_TIMESTAMP('2018-07-26 20:37:30','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-07-26 20:37:30','YYYY-MM-DD HH24:MI:SS')) ; -- 2018-07-26T20:37:31.078 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=565137 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2018-07-26T20:38:33.925 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@DiscountType/X@=B',Updated=TO_TIMESTAMP('2018-07-26 20:38:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565136 ; -- 2018-07-26T20:38:59.273 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@DiscountType/X@=B & @BreakValueType/X@=T',Updated=TO_TIMESTAMP('2018-07-26 20:38:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565137 ; -- 2018-07-26T20:39:20.982 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='N', SeqNo=0,Updated=TO_TIMESTAMP('2018-07-26 20:39:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563921 ; -- 2018-07-26T20:39:20.989 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='N', SeqNo=0,Updated=TO_TIMESTAMP('2018-07-26 20:39:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563927 ; -- 2018-07-26T20:39:20.995 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=10,Updated=TO_TIMESTAMP('2018-07-26 20:39:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563918 ; -- 2018-07-26T20:39:21.001 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=20,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563919 ; -- 2018-07-26T20:39:21.007 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=30,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563920 ; -- 2018-07-26T20:39:21.012 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563925 ; -- 2018-07-26T20:39:21.018 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=50,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565136 ; -- 2018-07-26T20:39:21.024 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=60,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565137 ; -- 2018-07-26T20:39:21.029 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563926 ; -- 2018-07-26T20:39:21.035 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563963 ; -- 2018-07-26T20:39:21.040 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563982 ; -- 2018-07-26T20:39:21.046 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563983 ; -- 2018-07-26T20:39:21.051 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110,Updated=TO_TIMESTAMP('2018-07-26 20:39:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563928 ; -- 2018-07-26T20:39:32.879 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563921 ; -- 2018-07-26T20:39:32.889 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563927 ; -- 2018-07-26T20:39:32.897 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563918 ; -- 2018-07-26T20:39:32.905 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563919 ; -- 2018-07-26T20:39:32.915 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563920 ; -- 2018-07-26T20:39:32.923 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563925 ; -- 2018-07-26T20:39:32.930 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565136 ; -- 2018-07-26T20:39:32.939 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565137 ; -- 2018-07-26T20:39:32.948 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563926 ; -- 2018-07-26T20:39:32.955 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563963 ; -- 2018-07-26T20:39:32.963 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563982 ; -- 2018-07-26T20:39:32.971 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563983 ; -- 2018-07-26T20:39:32.980 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2018-07-26 20:39:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=563928 ; -- 2018-07-26T20:39:57.288 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=551727 ; -- 2018-07-26T20:41:22.095 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (IsAllowFiltering,AD_UI_Element_ID,AD_Field_ID,IsAdvancedField,UpdatedBy,AD_Client_ID,CreatedBy,IsActive,AD_UI_ElementGroup_ID,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,AD_Tab_ID,SeqNo_SideList,AD_Org_ID,Name,AD_UI_ElementType,Created,SeqNo,SeqNoGrid,Updated) VALUES ('N',552479,565136,'N',100,0,100,'Y',541562,'Y','N','N',541088,0,0,'Break Value Type','F',TO_TIMESTAMP('2018-07-26 20:41:21','YYYY-MM-DD HH24:MI:SS'),15,0,TO_TIMESTAMP('2018-07-26 20:41:21','YYYY-MM-DD HH24:MI:SS')) ; -- 2018-07-26T20:41:51.547 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (IsAllowFiltering,AD_UI_Element_ID,AD_Field_ID,IsAdvancedField,UpdatedBy,AD_Client_ID,CreatedBy,IsActive,AD_UI_ElementGroup_ID,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,AD_Tab_ID,SeqNo_SideList,AD_Org_ID,Name,AD_UI_ElementType,Created,SeqNo,SeqNoGrid,Updated) VALUES ('N',552480,565137,'N',100,0,100,'Y',541562,'Y','N','N',541088,0,0,'Attribute','F',TO_TIMESTAMP('2018-07-26 20:41:51','YYYY-MM-DD HH24:MI:SS'),16,0,TO_TIMESTAMP('2018-07-26 20:41:51','YYYY-MM-DD HH24:MI:SS')) ; -- 2018-07-26T20:44:12.055 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=563925 ; -- 2018-07-26T20:44:12.061 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=563925 ; -- 2018-07-26T20:46:49.917 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field_Trl WHERE AD_Field_ID=10772 ; -- 2018-07-26T20:46:49.935 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Field WHERE AD_Field_ID=10772 ; -- 2018-07-26T20:46:59.730 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column_Trl WHERE AD_Column_ID=6595 ; -- 2018-07-26T20:46:59.737 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Column WHERE AD_Column_ID=6595 ;
the_stack
-- 2020-02-21T16:32:49.162Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='N',Updated=TO_TIMESTAMP('2020-02-21 17:32:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541069 ; -- 2020-02-21T16:33:04.409Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540058, SeqNo=30,Updated=TO_TIMESTAMP('2020-02-21 17:33:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541069 ; -- 2020-02-21T16:35:11.632Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='ErrorMsg',Updated=TO_TIMESTAMP('2020-02-21 17:35:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541075 ; -- 2020-02-21T16:35:37.827Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=5,Updated=TO_TIMESTAMP('2020-02-21 17:35:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541075 ; -- 2020-02-21T16:36:06.909Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsError/''N''@=''Y''',Updated=TO_TIMESTAMP('2020-02-21 17:36:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=549596 ; -- 2020-02-21T16:36:29.537Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsError/''N''@=''Y''',Updated=TO_TIMESTAMP('2020-02-21 17:36:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548751 ; -- 2020-02-21T16:36:39.755Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2020-02-21 17:36:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548749 ; -- 2020-02-21T16:37:30.236Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 17:37:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2395 AND AD_Language='de_CH' ; -- 2020-02-21T16:37:30.237Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2395,'de_CH') ; -- 2020-02-21T16:37:31.911Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 17:37:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2395 AND AD_Language='de_DE' ; -- 2020-02-21T16:37:31.913Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(2395,'de_DE') ; -- 2020-02-21T16:37:31.925Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(2395,'de_DE') ; -- 2020-02-21T16:37:58.630Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET AD_Name_ID=2395, Description='Ein Fehler ist bei der Durchführung aufgetreten', Help=NULL, Name='Fehler',Updated=TO_TIMESTAMP('2020-02-21 17:37:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548749 ; -- 2020-02-21T16:37:58.631Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(2395) ; -- 2020-02-21T16:37:58.639Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=548749 ; -- 2020-02-21T16:37:58.641Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(548749) ; -- 2020-02-21T16:38:02.878Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET AD_Name_ID=NULL, Description='Ein Fehler ist bei der Durchführung aufgetreten', Help=NULL, Name='Fehler',Updated=TO_TIMESTAMP('2020-02-21 17:38:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548749 ; -- 2020-02-21T16:38:02.879Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(2395) ; -- 2020-02-21T16:38:02.882Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=548749 ; -- 2020-02-21T16:38:02.883Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(548749) ; -- 2020-02-21T16:38:44.726Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 17:38:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1021 AND AD_Language='de_DE' ; -- 2020-02-21T16:38:44.727Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1021,'de_DE') ; -- 2020-02-21T16:38:44.739Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(1021,'de_DE') ; -- 2020-02-21T16:38:49.450Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 17:38:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1021 AND AD_Language='de_CH' ; -- 2020-02-21T16:38:49.451Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1021,'de_CH') ; -- 2020-02-21T16:39:12.218Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET AD_Name_ID=NULL, Description=NULL, Help=NULL, Name='Fehlermeldung',Updated=TO_TIMESTAMP('2020-02-21 17:39:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=549596 ; -- 2020-02-21T16:39:12.219Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(1021) ; -- 2020-02-21T16:39:12.223Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=549596 ; -- 2020-02-21T16:39:12.225Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(549596) ; -- 2020-02-21T16:39:41.734Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsToClear/''Y''@=''N''',Updated=TO_TIMESTAMP('2020-02-21 17:39:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548259 ; -- 2020-02-21T16:39:56.973Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsToClear/''N''@=''N''',Updated=TO_TIMESTAMP('2020-02-21 17:39:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548259 ; -- 2020-02-21T16:39:59.467Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsToClear/''N''@=''N''',Updated=TO_TIMESTAMP('2020-02-21 17:39:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=551671 ; -- 2020-02-21T16:40:02.929Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsToClear/''N''@=''N''',Updated=TO_TIMESTAMP('2020-02-21 17:40:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548260 ; -- 2020-02-21T16:40:12.125Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsToClear/''N''@=''N''',Updated=TO_TIMESTAMP('2020-02-21 17:40:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548261 ; -- 2020-02-21T16:41:03.022Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='@IsError/''N''@=''Y''',Updated=TO_TIMESTAMP('2020-02-21 17:41:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548749 ; -- 2020-02-21T16:41:19.443Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET DisplayLogic='',Updated=TO_TIMESTAMP('2020-02-21 17:41:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548749 ; -- 2020-02-21T16:41:50.736Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Description='', Name='IsError',Updated=TO_TIMESTAMP('2020-02-21 17:41:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541069 ; -- 2020-02-21T16:42:11.559Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='IsToRecompute',Updated=TO_TIMESTAMP('2020-02-21 17:42:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541086 ; -- 2020-02-21T16:42:31.397Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2020-02-21 17:42:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541085 ; -- 2020-02-21T16:42:34.191Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2020-02-21 17:42:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541084 ; -- 2020-02-21T16:42:37.331Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2020-02-21 17:42:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541086 ; -- 2020-02-21T16:42:43.408Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2020-02-21 17:42:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=560338 ; -- 2020-02-21T16:45:01.372Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577560,0,'IsInvoiceCandidateError',TO_TIMESTAMP('2020-02-21 17:45:01','YYYY-MM-DD HH24:MI:SS'),100,'Zeigt an, ob beim Aktualisieren oder Fakturieren des Rechnungskandidaten ein Fehler aufgetreten ist.','de.metas.invoicecandidate','Y','Fehler','Fehler',TO_TIMESTAMP('2020-02-21 17:45:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-21T16:45:01.374Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577560 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2020-02-21T16:45:05.873Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 17:45:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577560 AND AD_Language='de_CH' ; -- 2020-02-21T16:45:05.874Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577560,'de_CH') ; -- 2020-02-21T16:45:08.698Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 17:45:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577560 AND AD_Language='de_DE' ; -- 2020-02-21T16:45:08.699Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577560,'de_DE') ; -- 2020-02-21T16:45:08.705Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577560,'de_DE') ; -- 2020-02-21T16:45:18.253Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='', IsTranslated='Y', Name='Error', PrintName='Error',Updated=TO_TIMESTAMP('2020-02-21 17:45:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577560 AND AD_Language='en_US' ; -- 2020-02-21T16:45:18.254Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577560,'en_US') ;
the_stack
BEGIN; -- insert seed data for basic user/platform/project/reward \i /specs/sql-support/insert_platform_user_project.sql \i /specs/sql-support/clean_sets_helpers.sql \i /specs/sql-support/payment_json_build_helpers.sql select plan(20); select has_view('payment_service_api', 'subscriptions', 'check view'); -- generate a subscription for first_user_id insert into payment_service.subscriptions (status, created_at, platform_id, user_id, project_id, checkout_data, credit_card_id) values ('active', (now() - '1 month'::interval), __seed_platform_id(), __seed_first_user_id(), __seed_project_id(), __json_data_payment('{"payment_method": "credit_card", "anonymous": true}'::json)::jsonb, __seed_first_user_credit_card_id()), ('deleted', (now() - '1 month'::interval), __seed_platform_id(), __seed_first_user_id(), __seed_project_id(), __json_data_payment('{"payment_method": "credit_card", "anonymous": true}'::json)::jsonb, __seed_first_user_credit_card_id()); create or replace function test_access_with_anon() returns setof text language plpgsql as $$ declare _result_row payment_service_api.subscriptions; begin set local role anonymous; set local "request.header.platform-code" to 'a28be766-bb36-4821-82ec-768d2634d78b'; return next throws_like( 'select * from project_service_api.subscriptions', 'relation "project_service_api.subscriptions" does not exist', 'anon cant select on subscriptions view' ); perform clean_sets(); end; $$; select * from test_access_with_anon(); create or replace function test_access_with_scoped() returns setof text language plpgsql as $$ declare _subscription payment_service.subscriptions; _paid_payment payment_service.catalog_payments; _refused_payment payment_service.catalog_payments; _result_row payment_service_api.subscriptions; begin select * from payment_service.subscriptions limit 1 into _subscription; -- add paid payment to subscription insert into payment_service.catalog_payments (status, created_at, gateway, platform_id, user_id, project_id, data, subscription_id) values ('paid', (now() - '2 month'::interval), 'pagarme', __seed_platform_id(), __seed_first_user_id(), __seed_project_id(), json_build_object('payment_method', 'credit_card'), _subscription.id) returning * into _paid_payment; -- add refused payment insert into payment_service.catalog_payments (status, created_at, gateway, platform_id, user_id, project_id, data, subscription_id) values ('refused', (now() - '1 month'::interval), 'pagarme', __seed_platform_id(), __seed_first_user_id(), __seed_project_id(), json_build_object('payment_method', 'credit_card'), _subscription.id) returning * into _refused_payment; set local role scoped_user; EXECUTE 'set local "request.jwt.claim.user_id" to '''||__seed_first_user_id()||''''; EXECUTE 'set local "request.jwt.claim.platform_token" to '''||__seed_platform_token()||''''; -- when scoped is owner of subscription select * from payment_service_api.subscriptions into _result_row; return next is(_result_row.id, _subscription.id, 'subscription owner can see they subscription'); return next is(_result_row.credit_card_id, __seed_first_user_credit_card_id(), 'subscription owner can see the credit_card_id on subscription'); return next is((_result_row.last_payment_data->>'id')::uuid, _refused_payment.id, 'last payment id should be then same of refused payment'); return next is((_result_row.last_payment_data->>'status')::text, _refused_payment.status::text, 'last payment status should be the same of refused payment'); return next is((_result_row.last_payment_data->>'created_at')::timestamp without time zone, _refused_payment.created_at, 'last payment created_at should be the same of refused payment'); return next is((_result_row.last_payment_data->>'payment_method'), _refused_payment.data->>'payment_method', 'last payment payment method should be the same of refused payment'); return next is((_result_row.last_paid_payment_data->>'id')::uuid, _paid_payment.id, 'last paid payment id should be then same of paid payment'); return next is((_result_row.last_paid_payment_data->>'status')::text, _paid_payment.status::text, 'last paid payment status should be the same of paid payment'); return next is((_result_row.last_paid_payment_data->>'created_at')::timestamp without time zone, _paid_payment.created_at, 'last paid payment created_at should be the same of paid payment'); return next is((_result_row.last_paid_payment_data->>'payment_method'), _paid_payment.data->>'payment_method', 'last paid payment payment method should be the same of paid payment'); select * from payment_service_api.subscriptions where status = 'deleted' into _result_row; return next is(_result_row.id is null, true, 'should not show deleted subscriptions'); -- when scoped user is project owner EXECUTE 'set local "request.jwt.claim.user_id" to '''||__seed_second_user_id()||''''; select * from payment_service_api.subscriptions into _result_row; return next is(_result_row.id, _subscription.id, 'project owner can see all related subscriptions to they project'); return next is(_result_row.credit_card_id, null, 'projet owner cant see credit_card id from subscriptions from another users'); -- when scoped is another user that is not subscriber and not project owner EXECUTE 'set local "request.jwt.claim.user_id" to '''||__seed_third_user_id()||''''; select * from payment_service_api.subscriptions into _result_row; return next is(_result_row.id, null, 'cant see nothing when not is owner of subscription'); perform clean_sets(); end; $$; select * from test_access_with_scoped(); create or replace function test_access_with_platform() returns setof text language plpgsql as $$ declare _subscription payment_service.subscriptions; _result_row payment_service_api.subscriptions; begin select * from payment_service.subscriptions limit 1 into _subscription; set local role platform_user; EXECUTE 'set local "request.jwt.claim.platform_token" to '''||__seed_platform_token()||''''; select * from payment_service_api.subscriptions into _result_row; return next is(_result_row.id, _subscription.id, 'platform admin can see everything'); return next is(_result_row.credit_card_id, __seed_first_user_credit_card_id(), 'platform admin can see credit_card id'); perform clean_sets(); end; $$; select * from test_access_with_platform(); create or replace function test_search_index() returns setof text language plpgsql as $$ declare _subscription payment_service.subscriptions; _user community_service.users; _result_row payment_service_api.subscriptions; begin select * from payment_service.subscriptions limit 1 into _subscription; select * from community_service.users where id = __seed_first_user_id() into _user; set local role platform_user; EXECUTE 'set local "request.jwt.claim.platform_token" to '''||__seed_platform_token()||''''; -- searching by user email select * from payment_service_api.subscriptions where search_index @@ plainto_tsquery('portuguese', _user.email) into _result_row; return next is(_result_row.id, _subscription.id, 'should find subscription by searching on search_index'); end; $$; select * from test_search_index(); create or replace function test_access_with_scoped_with_subscription_version() returns setof text language plpgsql as $$ declare _subscription payment_service.subscriptions; _result_row payment_service_api.subscriptions; begin -- when scoped is owner of subscription select * from payment_service.subscriptions limit 1 into _subscription; set local role scoped_user; EXECUTE 'set local "request.jwt.claim.user_id" to '''||__seed_first_user_id()||''''; EXECUTE 'set local "request.jwt.claim.platform_token" to '''||__seed_platform_token()||''''; -- generate a subscription version for this subscription insert into payment_service.catalog_payments (gateway, platform_id, project_id, user_id, subscription_id, data, created_at, updated_at, status) values ('pagarme', __seed_platform_id(), __seed_project_id(), __seed_first_user_id(), _subscription.id, '{"amount": 1000, "customer": {"name": "Gasdasd", "email": "aslidasd@asdasd", "phone": {"ddd": "52", "ddi": "25", "number": "123123123"}, "address": {"city": "Casdas", "state": "WE", "street": "ASdasd asdasd", "country": "Brasil", "zipcode": "99999-999", "neighborhood": "ASasdasd", "complementary": "123", "street_number": "123"}, "document_number": "123456789"}, "anonymous": false, "current_ip": "127.0.0.1", "payment_method": "boleto", "is_international": false}'::json, now(), now(), 'paid'); select * from payment_service_api.subscriptions into _result_row; return next is(_result_row.current_paid_subscription->>'amount'::text, '1000', 'subscription version data loaded from subscriptions view'); perform clean_sets(); end; $$; select * from test_access_with_scoped_with_subscription_version(); select * from finish(); ROLLBACk;
the_stack
-- ---- test partition for (null) -- -- 1. test ordinary -- 1.1 range partitioned table -- 1.2 interval partitioned table -- 2. test data column of partition key value -- 2.1 text -- 2.2 timestamp -- 3. MAXVALUE -- 3.1 MAXVALUE is first column -- 3.2 MAXVALUE is second column CREATE schema FVT_COMPRESS_QWER; set search_path to FVT_COMPRESS_QWER; -- 1. test ordinary ---- 1.1 range partitioned table create table test_partition_for_null_range (a int, b int, c int, d int) partition by range (a, b) ( partition test_partition_for_null_range_p1 values less than (1, 1), partition test_partition_for_null_range_p2 values less than (4, 4), partition test_partition_for_null_range_p3 values less than (7, 7) ); insert into test_partition_for_null_range values (0, 0, 0, 0); insert into test_partition_for_null_range values (1, 1, 1, 1); insert into test_partition_for_null_range values (5, 5, 5, 5); -- failed: inserted partition key does not map to any table partition insert into test_partition_for_null_range values (null, null, null, null); -- failed: inserted partition key does not map to any table partition insert into test_partition_for_null_range values (null, 0, null, null); -- success insert into test_partition_for_null_range values (0, null, null, null); -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_range partition for (null, null) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_range partition for (null, 0) order by 1, 2, 3, 4; -- success select * from test_partition_for_null_range partition for (0, null) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range rename partition for (null, null) to test_partition_for_null_range_part1; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range rename partition for (null, 0) to test_partition_for_null_range_part1; -- success alter table test_partition_for_null_range rename partition for (0, null) to test_partition_for_null_range_part1; -- success select * from test_partition_for_null_range partition (test_partition_for_null_range_part1) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range drop partition for (null, null); -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range drop partition for (null, 0); -- success alter table test_partition_for_null_range drop partition for (0, null); -- failed select * from test_partition_for_null_range partition (test_partition_for_null_range_part1) order by 1, 2, 3, 4; ---- 1.2 interval partitioned table create table test_partition_for_null_interval (a int, b int) partition by range (a) ( partition test_partition_for_null_interval_p1 values less than (1), partition test_partition_for_null_interval_p2 values less than (4), partition test_partition_for_null_interval_p3 values less than (40) ); insert into test_partition_for_null_interval values (0, 0); insert into test_partition_for_null_interval values (1, 1); insert into test_partition_for_null_interval values (5, 5); insert into test_partition_for_null_interval values (7, 7); insert into test_partition_for_null_interval values (20, 20); insert into test_partition_for_null_interval values (30, 30); -- failed: inserted partition key does not map to any partition -- inserted partition key cannot be NULL for interval-partitioned table insert into test_partition_for_null_interval values (null, null); -- failed: inserted partition key does not map to any partition -- inserted partition key cannot be NULL for interval-partitioned table insert into test_partition_for_null_interval values (null, 0); -- success insert into test_partition_for_null_interval values (0, null); -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_interval partition for (null) order by 1, 2; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_interval rename partition for (null) to test_partition_for_null_interval_part1; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_interval drop partition for (null); -- 2. test data column of partition key value ---- 2.1 text create table test_partition_for_null_range_text (a text, b text, c text, d text) partition by range (a, b) ( partition test_partition_for_null_range_text_p1 values less than ('B', 'B'), partition test_partition_for_null_range_text_p2 values less than ('E', 'E'), partition test_partition_for_null_range_text_p3 values less than ('H', 'H') ); insert into test_partition_for_null_range_text values ('A', 'A', 'A', 'A'); insert into test_partition_for_null_range_text values ('B', 'B', 'B', 'B'); insert into test_partition_for_null_range_text values ('F', 'F', 'F', 'F'); -- failed: inserted partition key does not map to any table partition insert into test_partition_for_null_range_text values (null, null, null, null); -- failed: inserted partition key does not map to any table partition insert into test_partition_for_null_range_text values (null, 'A', null, null); -- success insert into test_partition_for_null_range_text values ('A', null, null, null); -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_range_text partition for (null, null) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_range_text partition for (null, 'A') order by 1, 2, 3, 4; -- success select * from test_partition_for_null_range_text partition for ('A', null) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_text rename partition for (null, null) to test_partition_for_null_range_text_part1; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_text rename partition for (null, 'A') to test_partition_for_null_range_text_part1; -- success alter table test_partition_for_null_range_text rename partition for ('A', null) to test_partition_for_null_range_text_part1; -- success select * from test_partition_for_null_range_text partition (test_partition_for_null_range_text_part1) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_text drop partition for (null, null); -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_text drop partition for (null, 'A'); -- success alter table test_partition_for_null_range_text drop partition for ('A', null); -- failed select * from test_partition_for_null_range_text partition (test_partition_for_null_range_text_part1) order by 1, 2, 3, 4; ---- 2.2 timestamp --a. range partitioned table create table test_partition_for_null_range_timestamp ( a timestamp without time zone, b timestamp with time zone, c int, d int) partition by range (a, b) ( partition test_partition_for_null_range_timestamp_p1 values less than ('2000-01-01 01:01:01', '2000-01-01 01:01:01+01'), partition test_partition_for_null_range_timestamp_p2 values less than ('2000-02-02 02:02:02', '2000-02-02 02:02:02+02'), partition test_partition_for_null_range_timestamp_p3 values less than ('2000-03-03 03:03:03', '2000-03-03 03:03:03+03') ); insert into test_partition_for_null_range_timestamp values ('2000-01-01 00:00:00', '2000-01-01 00:00:00+00', 1, 1); insert into test_partition_for_null_range_timestamp values ('2000-01-01 01:01:01', '2000-01-01 01:01:01+01', 2, 2); insert into test_partition_for_null_range_timestamp values ('2000-02-03 02:02:02', '2000-02-03 02:02:02+02', 3, 3); -- failed: inserted partition key does not map to any table partition insert into test_partition_for_null_range_timestamp values (null, null, null, null); -- failed: inserted partition key does not map to any table partition insert into test_partition_for_null_range_timestamp values (null, '2000-01-01 01:01:01+01', null, null); -- success insert into test_partition_for_null_range_timestamp values ('2000-01-01 01:01:01', null, null, null); -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_range_timestamp partition for (null, null) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_range_timestamp partition for (null, '2000-01-01 01:01:01+01') order by 1, 2, 3, 4; -- success select * from test_partition_for_null_range_timestamp partition for ('2000-01-01 01:01:01', null) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_timestamp rename partition for (null, null) to test_partition_for_null_range_timestamp_part1; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_timestamp rename partition for (null, '2000-01-01 01:01:01+01') to test_partition_for_null_range_timestamp_part1; -- success alter table test_partition_for_null_range_timestamp rename partition for ('2000-01-01 01:01:01', null) to test_partition_for_null_range_timestamp_part1; -- success select * from test_partition_for_null_range_timestamp partition (test_partition_for_null_range_timestamp_part1) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_timestamp drop partition for (null, null); -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_timestamp drop partition for (null, '2000-01-01 01:01:01+01'); -- success alter table test_partition_for_null_range_timestamp drop partition for ('2000-01-01 01:01:01', null); -- failed select * from test_partition_for_null_range_timestamp partition (test_partition_for_null_range_timestamp_part1) order by 1, 2, 3, 4; -- b. interval partitioned table create table test_partition_for_null_interval_timestamp (a timestamp without time zone, b int) partition by range (a) ( partition test_partition_for_null_interval_timestamp_p1 values less than ('2000-01-01'), partition test_partition_for_null_interval_timestamp_p2 values less than ('2000-04-01'), partition test_partition_for_null_interval_timestamp_p3 values less than ('2001-07-01') ); insert into test_partition_for_null_interval_timestamp values ('2000-01-01 00:00:00', 1); insert into test_partition_for_null_interval_timestamp values ('2000-04-01 00:00:00', 2); insert into test_partition_for_null_interval_timestamp values ('2000-05-01 00:00:00', 3); insert into test_partition_for_null_interval_timestamp values ('2000-10-01 00:00:00', 3); -- failed: inserted partition key does not map to any partition -- inserted partition key cannot be NULL for interval-partitioned table insert into test_partition_for_null_interval_timestamp values (null, null); -- failed: inserted partition key does not map to any partition -- inserted partition key cannot be NULL for interval-partitioned table insert into test_partition_for_null_interval_timestamp values (null, 0); -- success insert into test_partition_for_null_interval_timestamp values ('2000-01-01 00:00:00', null); -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_interval_timestamp partition for (null) order by 1, 2; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_interval_timestamp rename partition for (null) to test_partition_for_null_interval_timestamp_part1; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_interval_timestamp drop partition for (null); -- 3. MAXVALUE -- 3.1 MAXVALUE is first column create table test_partition_for_null_range_and_maxvalue_1 (a int, b int, c int, d int) partition by range (a, b) ( partition test_partition_for_null_range_and_maxvalue_1_p1 values less than (1, 1), partition test_partition_for_null_range_and_maxvalue_1_p2 values less than (4, 4), partition test_partition_for_null_range_and_maxvalue_1_p3 values less than (7, 7), partition test_partition_for_null_range_and_maxvalue_1_p4 values less than (maxvalue, 10) ); insert into test_partition_for_null_range_and_maxvalue_1 values (0, 0, 0, 0); insert into test_partition_for_null_range_and_maxvalue_1 values (1, 1, 1, 1); insert into test_partition_for_null_range_and_maxvalue_1 values (5, 5, 5, 5); insert into test_partition_for_null_range_and_maxvalue_1 values (8, 8, 8, 8); -- success: insert into partition p4 insert into test_partition_for_null_range_and_maxvalue_1 values (null, null, null, null); -- success: insert into partition p4 insert into test_partition_for_null_range_and_maxvalue_1 values (null, 0, null, null); -- success: insert into partition p1 insert into test_partition_for_null_range_and_maxvalue_1 values (0, null, null, null); -- success: select partition p4 select * from test_partition_for_null_range_and_maxvalue_1 partition for (null, null) order by 1, 2, 3, 4; -- success: select partition p4 select * from test_partition_for_null_range_and_maxvalue_1 partition for (null, 0) order by 1, 2, 3, 4; -- success: select partition p1 select * from test_partition_for_null_range_and_maxvalue_1 partition for (0, null) order by 1, 2, 3, 4; -- success: rename partition p4 alter table test_partition_for_null_range_and_maxvalue_1 rename partition for (null, null) to test_partition_for_null_range_and_maxvalue_1_part4; -- failed: partition "PART4" of relation "TEST_PARTITION_FOR_NULL_RANGE_AND_MAXVALUE_1" already exists alter table test_partition_for_null_range_and_maxvalue_1 rename partition for (null, 0) to test_partition_for_null_range_and_maxvalue_1_p4; -- success alter table test_partition_for_null_range_and_maxvalue_1 rename partition for (0, null) to test_partition_for_null_range_and_maxvalue_1_part1; -- success select * from test_partition_for_null_range_and_maxvalue_1 partition (test_partition_for_null_range_and_maxvalue_1_part1) order by 1, 2, 3, 4; select * from test_partition_for_null_range_and_maxvalue_1 partition (test_partition_for_null_range_and_maxvalue_1_p4) order by 1, 2, 3, 4; -- success: drop partition p4 alter table test_partition_for_null_range_and_maxvalue_1 drop partition for (null, null); -- failed: The partition number is invalid or out-of-range (partition p4 has dropped) alter table test_partition_for_null_range_and_maxvalue_1 drop partition for (null, 0); -- success: drop partition p1 alter table test_partition_for_null_range_and_maxvalue_1 drop partition for (0, null); -- failed select * from test_partition_for_null_range_and_maxvalue_1 partition (test_partition_for_null_range_and_maxvalue_1_part1) order by 1, 2, 3, 4; select * from test_partition_for_null_range_and_maxvalue_1 partition (test_partition_for_null_range_and_maxvalue_1_part4) order by 1, 2, 3, 4; -- 3.2 MAXVALUE is second column create table test_partition_for_null_range_and_maxvalue_2 (a int, b int, c int, d int) partition by range (a, b) ( partition test_partition_for_null_range_and_maxvalue_2_p1 values less than (1, 1), partition test_partition_for_null_range_and_maxvalue_2_p2 values less than (4, 4), partition test_partition_for_null_range_and_maxvalue_2_p3 values less than (7, 7), partition test_partition_for_null_range_and_maxvalue_2_p4 values less than (10, maxvalue) ); insert into test_partition_for_null_range_and_maxvalue_2 values (0, 0, 0, 0); insert into test_partition_for_null_range_and_maxvalue_2 values (1, 1, 1, 1); insert into test_partition_for_null_range_and_maxvalue_2 values (5, 5, 5, 5); insert into test_partition_for_null_range_and_maxvalue_2 values (8, 8, 8, 8); -- failed: inserted partition key does not map to any table partition insert into test_partition_for_null_range_and_maxvalue_2 values (null, null, null, null); -- failed: inserted partition key does not map to any table partition insert into test_partition_for_null_range_and_maxvalue_2 values (null, 0, null, null); -- success: insert into partition p1 insert into test_partition_for_null_range_and_maxvalue_2 values (0, null, null, null); -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_range_and_maxvalue_2 partition for (null, null) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range select * from test_partition_for_null_range_and_maxvalue_2 partition for (null, 0) order by 1, 2, 3, 4; -- success: select partition p1 select * from test_partition_for_null_range_and_maxvalue_2 partition for (0, null) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_and_maxvalue_2 rename partition for (null, null) to test_partition_for_null_range_and_maxvalue_2_part4; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_and_maxvalue_2 rename partition for (null, 0) to test_partition_for_null_range_and_maxvalue_2_part4; -- success alter table test_partition_for_null_range_and_maxvalue_2 rename partition for (0, null) to test_partition_for_null_range_and_maxvalue_2_part1; -- success select * from test_partition_for_null_range_and_maxvalue_2 partition (test_partition_for_null_range_and_maxvalue_2_part1) order by 1, 2, 3, 4; -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_and_maxvalue_2 drop partition for (null, null); -- failed: The partition number is invalid or out-of-range alter table test_partition_for_null_range_and_maxvalue_2 drop partition for (null, 0); -- success: drop partition p1 alter table test_partition_for_null_range_and_maxvalue_2 drop partition for (0, null); -- failed select * from test_partition_for_null_range_and_maxvalue_2 partition (test_partition_for_null_range_and_maxvalue_2_part1) order by 1, 2, 3, 4; CREATE TABLE select_partition_table_000_3( C_CHAR_1 CHAR(1), C_CHAR_2 CHAR(10), C_CHAR_3 CHAR(102400), C_VARCHAR_1 VARCHAR(1), C_VARCHAR_2 VARCHAR(10), C_VARCHAR_3 VARCHAR(1024), C_INT INTEGER, C_BIGINT BIGINT, C_SMALLINT SMALLINT, C_FLOAT FLOAT, C_NUMERIC numeric(10,5), C_DP double precision, C_DATE DATE, C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE, C_TS_WITH TIMESTAMP WITH TIME ZONE ) partition by range (C_INT) ( partition select_partition_000_3_1 values less than (500), partition select_partition_000_3_3 values less than (2000) ); create index select_partition_table_index_000_3 ON select_partition_table_000_3(C_CHAR_3,C_VARCHAR_3,C_INT,C_TS_WITHOUT) local(partition select_partition_000_3_1, partition select_partition_000_3_3); create view select_partition_table_view_000_3 as select * from select_partition_table_000_3; INSERT INTO select_partition_table_000_3 VALUES('A','ABC','ABCDEFG','a','abc','abcdefg',111,111111,11,1.1,1.11,1.111,'2000-01-01','2000-01-01 01:01:01','2000-01-01 01:01:01+01'); INSERT INTO select_partition_table_000_3 VALUES('B','BCD','BCDEFGH','b','bcd','bcdefgh',222,222222,22,2.2,2.22,2.222,'2000-02-02','2000-02-02 02:02:02','2000-02-02 02:02:02+02'); INSERT INTO select_partition_table_000_3 VALUES('C','CDE','CDEFGHI','c','cde','cdefghi',333,333333,33,3.3,3.33,3.333,'2000-03-03','2000-03-03 03:03:03','2000-03-03 03:03:03+03'); INSERT INTO select_partition_table_000_3 VALUES('D','DEF','DEFGHIJ','d','def','defghij',444,444444,44,4.4,4.44,4.444,'2000-04-04','2000-04-04 04:04:04','2000-04-04 04:04:04+04'); INSERT INTO select_partition_table_000_3 VALUES('E','EFG','EFGHIJK','e','efg','efghijk',555,555555,55,5.5,5.55,5.555,'2000-05-05','2000-05-05 05:05:05','2000-05-05 05:05:05+05'); INSERT INTO select_partition_table_000_3 VALUES('F','FGH','FGHIJKL','f','fgh','fghijkl',666,666666,66,6.6,6.66,6.666,'2000-06-06','2000-06-06 06:06:06','2000-06-06 06:06:06+06'); INSERT INTO select_partition_table_000_3 VALUES('G','GHI','GHIJKLM','g','ghi','ghijklm',777,777777,77,7.7,7.77,7.777,'2000-07-07','2000-07-07 07:07:07','2000-07-07 07:07:07+07'); INSERT INTO select_partition_table_000_3 VALUES('H','HIJ','HIJKLMN','h','hij','hijklmn',888,888888,88,8.8,8.88,8.888,'2000-08-08','2000-08-08 08:08:08','2000-08-08 08:08:08+08'); INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); INSERT INTO select_partition_table_000_3 VALUES('H','HIJ','HIJKLMN','h','hij','hijklmn',888,888888,88,8.8,8.88,8.888,'2000-08-08','2000-08-08 08:08:08','2000-08-08 08:08:08+08'); INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1100,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1600,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); select * from select_partition_table_000_3 partition for (NULL) order by C_INT; alter table select_partition_table_000_3 rename partition for (NULL) to select_partition_table_000_3_p1; alter table select_partition_table_000_3 drop partition for (NULL); CREATE TABLE select_partition_table_000_4( C_CHAR_1 CHAR(1), C_CHAR_2 CHAR(10), C_CHAR_3 CHAR(102400), C_VARCHAR_1 VARCHAR(1), C_VARCHAR_2 VARCHAR(10), C_VARCHAR_3 VARCHAR(1024), C_INT INTEGER, C_BIGINT BIGINT, C_SMALLINT SMALLINT, C_FLOAT FLOAT, C_NUMERIC numeric(10,5), C_DP double precision, C_DATE DATE, C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE, C_TS_WITH TIMESTAMP WITH TIME ZONE ) partition by range (C_TS_WITHOUT) ( partition select_partition_000_4_1 values less than ('2000-04-01'), partition select_partition_000_4_2 values less than ('2000-07-01'), partition select_partition_000_4_3 values less than ('2001-10-01') ); create index select_partition_table_index_000_4 ON select_partition_table_000_4(C_CHAR_3,C_VARCHAR_3,C_INT) local(PARTITION select_partition_000_4_1, PARTITION select_partition_000_4_2, PARTITION select_partition_000_4_3); create view select_partition_table_view_000_4 as select * from select_partition_table_000_4; INSERT INTO select_partition_table_000_4 VALUES('A','ABC','ABCDEFG','a','abc','abcdefg',111,111111,11,1.1,1.11,1.111,'2000-01-01','2000-01-01 01:01:01','2000-01-01 01:01:01+01'); INSERT INTO select_partition_table_000_4 VALUES('B','BCD','BCDEFGH','b','bcd','bcdefgh',222,222222,22,2.2,2.22,2.222,'2000-02-02','2000-02-02 02:02:02','2000-02-02 02:02:02+02'); INSERT INTO select_partition_table_000_4 VALUES('C','CDE','CDEFGHI','c','cde','cdefghi',333,333333,33,3.3,3.33,3.333,'2000-03-03','2000-03-03 03:03:03','2000-03-03 03:03:03+03'); INSERT INTO select_partition_table_000_4 VALUES('D','DEF','DEFGHIJ','d','def','defghij',444,444444,44,4.4,4.44,4.444,'2000-04-04','2000-04-04 04:04:04','2000-04-04 04:04:04+04'); INSERT INTO select_partition_table_000_4 VALUES('E','EFG','EFGHIJK','e','efg','efghijk',555,555555,55,5.5,5.55,5.555,'2000-05-05','2000-05-05 05:05:05','2000-05-05 05:05:05+05'); INSERT INTO select_partition_table_000_4 VALUES('F','FGH','FGHIJKL','f','fgh','fghijkl',666,666666,66,6.6,6.66,6.666,'2000-06-06','2000-06-06 06:06:06','2000-06-06 06:06:06+06'); INSERT INTO select_partition_table_000_4 VALUES('G','GHI','GHIJKLM','g','ghi','ghijklm',777,777777,77,7.7,7.77,7.777,'2000-07-07','2000-07-07 07:07:07','2000-07-07 07:07:07+07'); INSERT INTO select_partition_table_000_4 VALUES('H','HIJ','HIJKLMN','h','hij','hijklmn',888,888888,88,8.8,8.88,8.888,'2000-08-08','2000-08-08 08:08:08','2000-08-08 08:08:08+08'); INSERT INTO select_partition_table_000_4 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); INSERT INTO select_partition_table_000_4 VALUES('H','HIJ','HIJKLMN','h','hij','hijklmn',888,888888,88,8.8,8.88,8.888,'2000-08-08','2000-08-08 08:08:08','2000-08-08 08:08:08+08'); INSERT INTO select_partition_table_000_4 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); INSERT INTO select_partition_table_000_4 VALUES('J','IJK','IJKLMNO','j','jkl','jklmnop',1111,111111,111,11.1,11.11,11.111,'2000-09-09','2000-10-02 09:09:09','2000-10-02 09:09:09+09'); INSERT INTO select_partition_table_000_4 VALUES('K','JKl','IJKLMNO','j','jkl','jklmnop',1111,111111,111,11.1,11.11,11.111,'2000-09-09','2000-10-06 09:09:09','2000-10-06 09:09:09+09'); select C_INT,C_TS_WITHOUT from select_partition_table_000_4 partition for (null) order by 1, 2; alter table select_partition_table_000_4 rename partition for (null) to select_partition_table_000_4_p1; alter table select_partition_table_000_4 drop partition for (null); CREATE TABLE partition_wise_join_table_001_1 (ID INT NOT NULL,NAME VARCHAR(50) NOT NULL,SCORE NUMERIC(4,1),BIRTHDAY TIMESTAMP WITHOUT TIME ZONE,ADDRESS TEXT,SALARY double precision,RANK SMALLINT) partition by range(ID) ( partition partition_wise_join_table_001_1_1 values less than (100), partition partition_wise_join_table_001_1_2 values less than (1000) ) ; INSERT INTO partition_wise_join_table_001_1 VALUES (generate_series(1,10),'PARTITION WIASE JOIN 1-1-' || generate_series(1,10),90 + random() * 10,'1990-8-8',$$No.88# Science 6 Street of Xi'an of China $$,10000,13 ); INSERT INTO partition_wise_join_table_001_1 VALUES (generate_series(101,150),'PARTITION WIASE JOIN 1-2-' || generate_series(101,150),90 + random() * 10,'1989-8-8',$$No.99# Science 6 Street of Xi'an of China $$,12000 ,15); INSERT INTO partition_wise_join_table_001_1 VALUES (generate_series(40,60),'PARTITION WIASE JOIN 1-3-' || generate_series(40,60),90 + random() * 10,'1990-8-8',$$No.88# Science 6 Street of Xi'an of China $$,15000,15 ); INSERT INTO partition_wise_join_table_001_1 VALUES (generate_series(700,800),'PARTITION WIASE JOIN 1-4-' || generate_series(700,800),90 + random() * 10,'1990-8-8',$$No.88# Science 6 Street of Xi'an of China $$,18000,17 ); create index idx_partition_wise_join_table_001_1_1 on partition_wise_join_table_001_1(ID) LOCAL; create index idx_partition_wise_join_table_001_1_2 on partition_wise_join_table_001_1(ID,NAME) LOCAL; create index idx_partition_wise_join_table_001_1_3 on partition_wise_join_table_001_1(RANK) LOCAL; create index idx_partition_wise_join_table_001_1_4 on partition_wise_join_table_001_1(RANK,SALARY,NAME) LOCAL; CREATE TABLE partition_wise_join_table_001_2 (ID INT NOT NULL,NAME VARCHAR(50) NOT NULL,SCORE NUMERIC(4,1),BIRTHDAY TIMESTAMP WITHOUT TIME ZONE,ADDRESS TEXT,SALARY double precision ) partition by range(ID) ( partition partition_wise_join_table_001_1_1 values less than (100), partition partition_wise_join_table_001_1_2 values less than (300), partition partition_wise_join_table_001_1_3 values less than (1000) ); INSERT INTO partition_wise_join_table_001_2 VALUES (generate_series(1,10),'PARTITION WIASE JOIN 2-1-' || generate_series(1,10),90 + random() * 10,'1990-8-8',$$No 66# Science 4 Street of Xi'an of China $$,10000); INSERT INTO partition_wise_join_table_001_2 VALUES (generate_series(500,600),'PARTITION WIASE JOIN 2-2-' || generate_series(500,600),90 + random() * 10,'1990-8-8',$$No 77# Science 4 Street of Xi'an of China $$,12000); INSERT INTO partition_wise_join_table_001_2 VALUES (generate_series(70,80),'PARTITION WIASE JOIN 2-3-' || generate_series(70,80),90 + random() * 10,'1990-8-8',$$No 77# Science 4 Street of Xi'an of China $$,15000); CREATE INDEX IDX_PARTITION_WISE_JOIN_TABLE_001_2_1 ON PARTITION_WISE_JOIN_TABLE_001_2(ID) LOCAL; CREATE INDEX IDX_PARTITION_WISE_JOIN_TABLE_001_2_2 ON PARTITION_WISE_JOIN_TABLE_001_2(ID,NAME) LOCAL; CREATE INDEX IDX_PARTITION_WISE_JOIN_TABLE_001_2_3 ON PARTITION_WISE_JOIN_TABLE_001_2(SALARY,NAME) LOCAL; SELECT A.ID,B.ID,A.NAME,B.NAME,A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_WISE_JOIN_TABLE_001_1 A,PARTITION_WISE_JOIN_TABLE_001_2 B WHERE A.ID = B.ID AND A.ID < 100 OR A.ID >400 order by 1, 2; ANALYZE PARTITION_WISE_JOIN_TABLE_001_1; ANALYZE PARTITION_WISE_JOIN_TABLE_001_2; SELECT A.ID,B.ID,A.NAME,B.NAME,A.RANK,B.SALARY,A.SALARY,A.ADDRESS,B.BIRTHDAY FROM PARTITION_WISE_JOIN_TABLE_001_1 A,PARTITION_WISE_JOIN_TABLE_001_2 B WHERE A.ID = B.ID AND A.ID < 100 OR A.ID >400 order by 1, 2; CREATE TABLE HW_PARTITION_SELECT_RT (A INT, B INT) PARTITION BY RANGE (A) ( PARTITION HW_PARTITION_SELECT_RT_P1 VALUES LESS THAN (1), PARTITION HW_PARTITION_SELECT_RT_P2 VALUES LESS THAN (4), PARTITION HW_PARTITION_SELECT_RT_P3 VALUES LESS THAN (7) ); EXPLAIN (COSTS OFF, NODES OFF) SELECT B FROM (SELECT B FROM HW_PARTITION_SELECT_RT LIMIT 100) ORDER BY B; --CREATE TABLE HW_PARTITION_SELECT_PTEST(A INT, B INT) --PARTITION BY RANGE(A) --INTERVAL(1000) --( -- PARTITION HW_PARTITION_SELECT_PTEST_P0 VALUES LESS THAN(0) --); --CREATE INDEX INDEX_ON_PTEST ON HW_PARTITION_SELECT_PTEST(A) LOCAL; --INSERT INTO HW_PARTITION_SELECT_PTEST VALUES (GENERATE_SERIES(0,4999), GENERATE_SERIES(0,4999)); --ANALYZE HW_PARTITION_SELECT_PTEST; --EXPLAIN(COSTS OFF, NODES OFF) SELECT * FROM HW_PARTITION_SELECT_PTEST; --SEQSCAN --EXPLAIN(COSTS OFF, NODES OFF) SELECT * FROM HW_PARTITION_SELECT_PTEST WHERE A = 5000 AND B > 20; --INDEXSCAN --EXPLAIN(COSTS OFF, NODES OFF) SELECT * FROM HW_PARTITION_SELECT_PTEST WHERE A = 500 OR A = 3000; --BITMAPSCAN --EXPLAIN(COSTS OFF, NODES OFF) SELECT A FROM HW_PARTITION_SELECT_PTEST WHERE A > 5000; -- INDEXONLYSCAN CREATE TABLE DTS2013112504143_TEST1(A INT) PARTITION BY RANGE (A)(PARTITION DTS2013112504143_TEST1_P1 VALUES LESS THAN (10)); CREATE TABLE DTS2013112504143_TEST2(A INT); SELECT * FROM DTS2013112504143_TEST1 UNION ALL SELECT * FROM DTS2013112504143_TEST2 order by 1; create table hw_partition_select_rangetab( C_CHAR_3 CHAR(102400), C_INT INTEGER) partition by range (C_CHAR_3) ( partition RANGE_PARTITION_000_1 values less than ('DDDDD'), partition RANGE_PARTITION_000_2 values less than ('ZZZZZ') ); select * from hw_partition_select_rangetab where length(C_CHAR_3)>5 order by 1, 2; create table hw_partition_select_rangetab( C_CHAR_3 text, C_INT INTEGER) partition by range (C_CHAR_3) ( partition RANGE_PARTITION_000_1 values less than ('DDDDD'), partition RANGE_PARTITION_000_2 values less than ('ZZZZZ') ); select * from hw_partition_select_rangetab where length(C_CHAR_3)>5 order by 1, 2; --create range partition table CREATE TABLE select_partition_table_000_2( C_CHAR_1 CHAR(1), C_CHAR_2 CHAR(10), C_CHAR_3 CHAR(102400), C_VARCHAR_1 VARCHAR(1), C_VARCHAR_2 VARCHAR(10), C_VARCHAR_3 VARCHAR(1024), C_INT INTEGER, C_BIGINT BIGINT, C_SMALLINT SMALLINT, C_FLOAT FLOAT, C_NUMERIC numeric(10,5), C_DP double precision, C_DATE DATE, C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE, C_TS_WITH TIMESTAMP WITH TIME ZONE ) partition by range (C_TS_WITHOUT,C_NUMERIC) ( partition select_partition_000_2_1 values less than ('2000-05-01', 5), partition select_partition_000_2_3 values less than ('2000-10-01', 10) ); INSERT INTO select_partition_table_000_2 VALUES('A','ABC','ABCDEFG','a','abc','abcdefg',111,111111,11,1.1,1.11,1.111,'2000-01-01','2000-01-01 01:01:01','2000-01-01 01:01:01+01'); INSERT INTO select_partition_table_000_2 VALUES('B','BCD','BCDEFGH','b','bcd','bcdefgh',222,222222,22,2.2,2.22,2.222,'2000-02-02','2000-02-02 02:02:02','2000-02-02 02:02:02+02'); INSERT INTO select_partition_table_000_2 VALUES('C','CDE','CDEFGHI','c','cde','cdefghi',333,333333,33,3.3,3.33,3.333,'2000-03-03','2000-03-03 03:03:03','2000-03-03 03:03:03+03'); INSERT INTO select_partition_table_000_2 VALUES('D','DEF','DEFGHIJ','d','def','defghij',444,444444,44,4.4,4.44,4.444,'2000-04-04','2000-04-04 04:04:04','2000-04-04 04:04:04+04'); INSERT INTO select_partition_table_000_2 VALUES('E','EFG','EFGHIJK','e','efg','efghijk',555,555555,55,4.5,4.55,5.555,'2000-05-01','2000-05-01 ','2000-05-05 05:05:05+05'); INSERT INTO select_partition_table_000_2 VALUES('E','EFG','EFGHIJK','e','efg','efghijk',555,555555,55,5.5,5.55,5.555,'2000-05-01','2000-05-01 ','2000-05-05 05:05:05+05'); INSERT INTO select_partition_table_000_2 VALUES('F','FGH','FGHIJKL','f','fgh','fghijkl',666,666666,66,6.6,6.66,6.666,'2000-06-06','2000-06-06 06:06:06','2000-06-06 06:06:06+06'); INSERT INTO select_partition_table_000_2 VALUES('G','GHI','GHIJKLM','g','ghi','ghijklm',777,777777,77,7.7,7.77,7.777,'2000-07-07','2000-07-07 07:07:07','2000-07-07 07:07:07+07'); INSERT INTO select_partition_table_000_2 VALUES('H','HIJ','HIJKLMN','h','hij','hijklmn',888,888888,88,8.8,8.88,8.888,'2000-08-08','2000-08-08 08:08:08','2000-08-08 08:08:08+08'); INSERT INTO select_partition_table_000_2 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); INSERT INTO select_partition_table_000_2 VALUES('H','HIJ','HIJKLMN','h','hij','hijklmn',888,888888,88,8.8,8.88,8.888,'2000-08-08','2000-08-08 08:08:08','2000-08-08 08:08:08+08'); INSERT INTO select_partition_table_000_2 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); create index select_partition_table_index_000_2 ON select_partition_table_000_2(C_CHAR_3,C_VARCHAR_3,C_INT,C_TS_WITHOUT) local(PARTITION select_partition_000_2_1, PARTITION select_partition_000_2_3); create view select_partition_table_view_000_2 as select * from select_partition_table_000_2; explain (costs off, verbose on) select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3, rank() over w from select_partition_table_000_2 where C_INT > 600 or C_BIGINT < 444444 window w as (partition by C_TS_WITHOUT) order by 1,2,3,4,5; select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3, rank() over w from select_partition_table_000_2 where C_INT > 600 or C_BIGINT < 444444 window w as (partition by C_TS_WITHOUT) order by 1,2,3,4,5; --create interval partition table CREATE TABLE select_partition_table_000_3( C_CHAR_1 CHAR(1), C_CHAR_2 CHAR(10), C_CHAR_3 CHAR(102400), C_VARCHAR_1 VARCHAR(1), C_VARCHAR_2 VARCHAR(10), C_VARCHAR_3 VARCHAR(1024), C_INT INTEGER, C_BIGINT BIGINT, C_SMALLINT SMALLINT, C_FLOAT FLOAT, C_NUMERIC numeric(10,5), C_DP double precision, C_DATE DATE, C_TS_WITHOUT TIMESTAMP WITHOUT TIME ZONE, C_TS_WITH TIMESTAMP WITH TIME ZONE ) partition by range (C_INT) ( partition select_partition_000_3_1 values less than (500), partition select_partition_000_3_3 values less than (2000) ); create index select_partition_table_index_000_3 ON select_partition_table_000_3(C_CHAR_3,C_VARCHAR_3,C_INT,C_TS_WITHOUT) local(partition select_partition_000_3_1, partition select_partition_000_3_3); create view select_partition_table_view_000_3 as select * from select_partition_table_000_3; INSERT INTO select_partition_table_000_3 VALUES('A','ABC','ABCDEFG','a','abc','abcdefg',111,111111,11,1.1,1.11,1.111,'2000-01-01','2000-01-01 01:01:01','2000-01-01 01:01:01+01'); INSERT INTO select_partition_table_000_3 VALUES('B','BCD','BCDEFGH','b','bcd','bcdefgh',222,222222,22,2.2,2.22,2.222,'2000-02-02','2000-02-02 02:02:02','2000-02-02 02:02:02+02'); INSERT INTO select_partition_table_000_3 VALUES('C','CDE','CDEFGHI','c','cde','cdefghi',333,333333,33,3.3,3.33,3.333,'2000-03-03','2000-03-03 03:03:03','2000-03-03 03:03:03+03'); INSERT INTO select_partition_table_000_3 VALUES('D','DEF','DEFGHIJ','d','def','defghij',444,444444,44,4.4,4.44,4.444,'2000-04-04','2000-04-04 04:04:04','2000-04-04 04:04:04+04'); INSERT INTO select_partition_table_000_3 VALUES('E','EFG','EFGHIJK','e','efg','efghijk',555,555555,55,5.5,5.55,5.555,'2000-05-05','2000-05-05 05:05:05','2000-05-05 05:05:05+05'); INSERT INTO select_partition_table_000_3 VALUES('F','FGH','FGHIJKL','f','fgh','fghijkl',666,666666,66,6.6,6.66,6.666,'2000-06-06','2000-06-06 06:06:06','2000-06-06 06:06:06+06'); INSERT INTO select_partition_table_000_3 VALUES('G','GHI','GHIJKLM','g','ghi','ghijklm',777,777777,77,7.7,7.77,7.777,'2000-07-07','2000-07-07 07:07:07','2000-07-07 07:07:07+07'); INSERT INTO select_partition_table_000_3 VALUES('H','HIJ','HIJKLMN','h','hij','hijklmn',888,888888,88,8.8,8.88,8.888,'2000-08-08','2000-08-08 08:08:08','2000-08-08 08:08:08+08'); INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); INSERT INTO select_partition_table_000_3 VALUES('H','HIJ','HIJKLMN','h','hij','hijklmn',888,888888,88,8.8,8.88,8.888,'2000-08-08','2000-08-08 08:08:08','2000-08-08 08:08:08+08'); INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',999,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1100,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); INSERT INTO select_partition_table_000_3 VALUES('I','IJK','IJKLMNO','i','ijk','ijklmno',1600,999999,99,9.9,9.99,9.999,'2000-09-09','2000-09-09 09:09:09','2000-09-09 09:09:09+09'); explain (costs off, verbose on) select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3, rank() over w from select_partition_table_000_3 where C_INT > 600 or C_BIGINT < 444444 window w as (partition by C_TS_WITHOUT) order by 1,2,3,4,5; select lower(C_CHAR_3), initcap(C_VARCHAR_3), sqrt(C_INT), C_NUMERIC- 1 + 2*6/3, rank() over w from select_partition_table_000_3 where C_INT > 600 or C_BIGINT < 444444 window w as (partition by C_TS_WITHOUT) order by 1,2,3,4,5; create table hw_partition_select_rt1 (a int, b int, c int, d int) partition by range (a, b, c, d) ( partition pone values less than (2, 2, 2, 2), partition ptwo values less than (2, 3, 2, 2) ); select * from hw_partition_select_rt1 where a=2 and b>2 and c=2 and d=2; create table hw_partition_select_rt2 (a int, b int, c int, d int) partition by range (a, b, c, d) ( partition hw_partition_select_rt2_p1 values less than (2, 2, MAXVALUE, 2), partition hw_partition_select_rt2_p2 values less than (2, 3, 2, MAXVALUE) ); select * from hw_partition_select_rt2 where a=2 and b>2 and c=2 and d=2; create table hw_partition_select_rt3 (a int, b int, c int, d int) partition by range (a, b, c, d) ( partition hw_partition_select_rt3_p1 values less than (2, 2, 3, 2), partition hw_partition_select_rt3_p2 values less than (2, 3, 2, MAXVALUE) ); select * from hw_partition_select_rt3 where a=2 and b>2 and c=2 and d=2; create table hw_partition_select_rt4 (a int, b int, c int, d int) partition by range (a, b, c, d) ( partition hw_partition_select_rt4_p1 values less than (2, 2, 3, 2), partition hw_partition_select_rt4_p2 values less than (2, 4, 2, MAXVALUE) ); select * from hw_partition_select_rt4 where a=2 and b>2 and c=2 and d=2; create table hw_partition_select_rt5 (a int, b int, c int) partition by range(c) ( partition hw_partition_select_rt5_p1 values less than (1) ); alter table hw_partition_select_rt5 drop column b; update hw_partition_select_rt5 set c=0 where c=-1; drop schema FVT_COMPRESS_QWER cascade;
the_stack
DROP TABLE IF EXISTS `hisiphp_system_annex`; CREATE TABLE `hisiphp_system_annex` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `data_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '关联的数据ID', `type` varchar(20) NOT NULL DEFAULT '' COMMENT '类型', `group` varchar(100) NOT NULL DEFAULT 'sys' COMMENT '文件分组', `file` varchar(255) NOT NULL COMMENT '上传文件', `hash` varchar(64) NOT NULL COMMENT '文件hash值', `size` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '附件大小KB', `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '使用状态(0未使用,1已使用)', `ctime` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `hash` (`hash`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='[系统] 上传附件'; # Dump of table hisiphp_system_annex_group # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_annex_group`; CREATE TABLE `hisiphp_system_annex_group` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL COMMENT '附件分组', `count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '附件数量', `size` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '附件大小kb', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='[系统] 附件分组'; # Dump of table hisiphp_system_config # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_config`; CREATE TABLE `hisiphp_system_config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `system` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否为系统配置(1是,0否)', `group` varchar(20) NOT NULL DEFAULT 'base' COMMENT '分组', `title` varchar(20) NOT NULL COMMENT '配置标题', `name` varchar(50) NOT NULL COMMENT '配置名称,由英文字母和下划线组成', `value` text NOT NULL COMMENT '配置值', `type` varchar(20) NOT NULL DEFAULT 'input' COMMENT '配置类型()', `options` text NOT NULL COMMENT '配置项(选项名:选项值)', `url` varchar(255) NOT NULL DEFAULT '' COMMENT '文件上传接口', `tips` varchar(255) NOT NULL COMMENT '配置提示', `sort` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '排序', `status` tinyint(1) unsigned NOT NULL COMMENT '状态', `ctime` int(10) unsigned NOT NULL DEFAULT '0', `mtime` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8 COMMENT='[系统] 系统配置'; INSERT INTO `hisiphp_system_config` (`id`, `system`, `group`, `title`, `name`, `value`, `type`, `options`, `url`, `tips`, `sort`, `status`, `ctime`, `mtime`) VALUES (1,1,'sys','扩展配置分组','config_group','','array',' ','','请按如下格式填写:&lt;br&gt;键值:键名&lt;br&gt;键值:键名&lt;br&gt;&lt;span style=&quot;color:#f00&quot;&gt;键值只能为英文、数字、下划线&lt;/span&gt;',2,1,1492140215,1492140215), (13,1,'base','网站域名','site_domain','','input','','','',2,1,1492140215,1492140215), (14,1,'upload','图片上传大小限制','upload_image_size','0','input','','','单位:KB,0表示不限制大小',3,1,1490841797,1491040778), (15,1,'upload','允许上传图片格式','upload_image_ext','jpg,png,gif,jpeg,ico','input','','','多个格式请用英文逗号(,)隔开',4,1,1490842130,1491040778), (16,1,'upload','缩略图裁剪方式','thumb_type','2','select','1:等比例缩放\r\n2:缩放后填充\r\n3:居中裁剪\r\n4:左上角裁剪\r\n5:右下角裁剪\r\n6:固定尺寸缩放\r\n','','',5,1,1490842450,1491040778), (17,1,'upload','图片水印开关','image_watermark','1','switch','0:关闭\r\n1:开启','','',6,1,1490842583,1491040778), (18,1,'upload','图片水印图','image_watermark_pic','','image','','','',7,1,1490842679,1491040778), (19,1,'upload','图片水印透明度','image_watermark_opacity','50','input','','','可设置值为0~100,数字越小,透明度越高',8,1,1490857704,1491040778), (20,1,'upload','图片水印图位置','image_watermark_location','9','select','7:左下角\r\n1:左上角\r\n4:左居中\r\n9:右下角\r\n3:右上角\r\n6:右居中\r\n2:上居中\r\n8:下居中\r\n5:居中','','',9,1,1490858228,1491040778), (21,1,'upload','文件上传大小限制','upload_file_size','0','input','','','单位:KB,0表示不限制大小',1,1,1490859167,1491040778), (22,1,'upload','允许上传文件格式','upload_file_ext','doc,docx,xls,xlsx,ppt,pptx,pdf,wps,txt,rar,zip','input','','','多个格式请用英文逗号(,)隔开',2,1,1490859246,1491040778), (23,1,'upload','文字水印开关','text_watermark','0','switch','0:关闭\r\n1:开启','','',10,1,1490860872,1491040778), (24,1,'upload','文字水印内容','text_watermark_content','','input','','','',11,1,1490861005,1491040778), (25,1,'upload','文字水印字体','text_watermark_font','','file','','','不上传将使用系统默认字体',12,1,1490861117,1491040778), (26,1,'upload','文字水印字体大小','text_watermark_size','20','input','','','单位:px(像素)',13,1,1490861204,1491040778), (27,1,'upload','文字水印颜色','text_watermark_color','#000000','input','','','文字水印颜色,格式:#000000',14,1,1490861482,1491040778), (28,1,'upload','文字水印位置','text_watermark_location','7','select','7:左下角\r\n1:左上角\r\n4:左居中\r\n9:右下角\r\n3:右上角\r\n6:右居中\r\n2:上居中\r\n8:下居中\r\n5:居中','','',11,1,1490861718,1491040778), (29,1,'upload','缩略图尺寸','thumb_size','300x300;500x500','input','','','为空则不生成,生成 500x500 的缩略图,则填写 500x500,多个规格填写参考 300x300;500x500;800x800',4,1,1490947834,1491040778), (30,1,'sys','开发模式','app_debug','1','switch','0:关闭\r\n1:开启','','&lt;strong class=&quot;red&quot;&gt;生产环境下一定要关闭此配置&lt;/strong&gt;',3,1,1491005004,1492093874), (31,1,'sys','页面Trace','app_trace','0','switch','0:关闭\r\n1:开启','','&lt;strong class=&quot;red&quot;&gt;生产环境下一定要关闭此配置&lt;/strong&gt;',4,1,1491005081,1492093874), (33,1,'sys','富文本编辑器','editor','umeditor','select','ueditor:UEditor\r\numeditor:UMEditor\r\nkindeditor:KindEditor\r\nckeditor:CKEditor','','',0,1,1491142648,1492140215), (35,1,'databases','备份目录','backup_path','./backup/database/','input','','','数据库备份路径,路径必须以 / 结尾',0,1,1491881854,1491965974), (36,1,'databases','备份分卷大小','part_size','20971520','input','','','用于限制压缩后的分卷最大长度。单位:B;建议设置20M',0,1,1491881975,1491965974), (37,1,'databases','备份压缩开关','compress','1','switch','0:关闭\r\n1:开启','','压缩备份文件需要PHP环境支持gzopen,gzwrite函数',0,1,1491882038,1491965974), (38,1,'databases','备份压缩级别','compress_level','4','radio','1:最低\r\n4:一般\r\n9:最高','','数据库备份文件的压缩级别,该配置在开启压缩时生效',0,1,1491882154,1491965974), (39,1,'base','网站状态','site_status','1','switch','0:关闭\r\n1:开启','','站点关闭后将不能访问,后台可正常登录',1,1,1492049460,1494690024), (40,1,'sys','后台管理路径','admin_path','admin.php','input','','','必须以.php为后缀',1,1,1492139196,1492140215), (41,1,'base','网站标题','site_title','HisiPHP 开源后台管理框架','input','','','网站标题是体现一个网站的主旨,要做到主题突出、标题简洁、连贯等特点,建议不超过28个字',6,1,1492502354,1494695131), (42,1,'base','网站关键词','site_keywords','hisiphp,hisiphp框架,php开源框架','input','','','网页内容所包含的核心搜索关键词,多个关键字请用英文逗号&quot;,&quot;分隔',7,1,1494690508,1494690780), (43,1,'base','网站描述','site_description','','textarea','','','网页的描述信息,搜索引擎采纳后,作为搜索结果中的页面摘要显示,建议不超过80个字',8,1,1494690669,1494691075), (44,1,'base','ICP备案信息','site_icp','','input','','','请填写ICP备案号,用于展示在网站底部,ICP备案官网:&lt;a href=&quot;http://www.miibeian.gov.cn&quot; target=&quot;_blank&quot;&gt;http://www.miibeian.gov.cn&lt;/a&gt;',9,1,1494691721,1494692046), (45,1,'base','站点统计代码','site_statis','','textarea','','','第三方流量统计代码,前台调用时请先用 htmlspecialchars_decode函数转义输出',10,1,1494691959,1494694797), (46,1,'base','网站名称','site_name','HisiPHP','input','','','将显示在浏览器窗口标题等位置',3,1,1494692103,1494694680), (47,1,'base','网站LOGO','site_logo','','image','','','网站LOGO图片',4,1,1494692345,1494693235), (48,1,'base','网站图标','site_favicon','','image','','/system/annex/favicon','又叫网站收藏夹图标,它显示位于浏览器的地址栏或者标题前面,&lt;strong class=&quot;red&quot;&gt;.ico格式&lt;/strong&gt;,&lt;a href=&quot;https://www.baidu.com/s?ie=UTF-8&amp;wd=favicon&quot; target=&quot;_blank&quot;&gt;点此了解网站图标&lt;/a&gt;',5,1,1494692781,1494693966), (49,1,'base','手机网站','wap_site_status','1','switch','0:关闭\r\n1:开启','','如果有手机网站,请设置为开启状态,否则只显示PC网站',2,1,1498405436,1498405436), (50,1,'sys','云端推送','cloud_push','0','switch','0:关闭\r\n1:开启','','关闭之后,无法通过云端推送安装扩展',5,1,1504250320,1504250320), (51,1,'base','手机网站域名','wap_domain','','input','','','手机访问将自动跳转至此域名,示例:http://m.domain.com',2,1,1504304776,1504304837), (52,1,'sys','多语言支持','multi_language','0','switch','0:关闭\r\n1:开启','','开启后你可以自由上传多种语言包',6,1,1506532211,1506532211), (53,1,'sys','后台白名单验证','admin_whitelist_verify','0','switch','0:禁用\r\n1:启用','','禁用后不存在的菜单节点将不在提示',7,1,1542012232,1542012321), (54,1,'sys','系统日志保留','system_log_retention','30','input','','','单位天,系统将自动清除 ? 天前的系统日志',8,1,1542013958,1542014158), (55,1, 'upload', '上传驱动', 'upload_driver', 'local', 'select', 'local:本地上传', '', '资源上传驱动设置', 0, 1, 1558599270, 1558618703); # Dump of table hisiphp_system_hook # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_hook`; CREATE TABLE `hisiphp_system_hook` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `system` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '系统插件', `name` varchar(50) NOT NULL DEFAULT '' COMMENT '钩子名称', `source` varchar(50) NOT NULL DEFAULT '' COMMENT '钩子来源[plugins.插件名,module.模块名]', `intro` varchar(200) NOT NULL DEFAULT '' COMMENT '钩子简介', `status` tinyint(1) unsigned NOT NULL DEFAULT '1', `ctime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `mtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='[系统] 钩子表'; INSERT INTO `hisiphp_system_hook` (`id`, `system`, `name`, `source`, `intro`, `status`, `ctime`, `mtime`) VALUES (1,1,'system_admin_index','','后台首页',1,1490885108,1490885108), (2,1,'system_admin_tips','','后台所有页面提示',1,1490713165,1490885137), (3,1,'system_annex_upload','','附件上传钩子,可扩展上传到第三方存储',1,1490884242,1490885121), (4,1,'system_member_login','','会员登陆成功之后的动作',1,1490885108,1490885108), (5,1,'system_member_register','','会员注册成功后的动作',1,1512610518,1512610518); # Dump of table hisiphp_system_hook_plugins # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_hook_plugins`; CREATE TABLE `hisiphp_system_hook_plugins` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `hook` varchar(32) NOT NULL COMMENT '钩子id', `plugins` varchar(32) NOT NULL COMMENT '插件标识', `ctime` int(11) unsigned NOT NULL DEFAULT '0', `mtime` int(11) unsigned NOT NULL DEFAULT '0', `sort` int(11) unsigned NOT NULL DEFAULT '0', `status` tinyint(2) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='[系统] 钩子-插件对应表'; INSERT INTO `hisiphp_system_hook_plugins` (`id`, `hook`, `plugins`, `ctime`, `mtime`, `sort`, `status`) VALUES (1,'system_admin_index','hisiphp',1509380301,1509380301,0,1); # Dump of table hisiphp_system_language # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_language`; CREATE TABLE `hisiphp_system_language` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL DEFAULT '' COMMENT '语言包名称', `code` varchar(20) NOT NULL DEFAULT '' COMMENT '编码', `locale` varchar(255) NOT NULL DEFAULT '' COMMENT '本地浏览器语言编码', `icon` varchar(30) NOT NULL DEFAULT '' COMMENT '图标', `pack` varchar(100) NOT NULL DEFAULT '' COMMENT '上传的语言包', `sort` tinyint(2) unsigned NOT NULL DEFAULT '1', `status` tinyint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='[系统] 语言包'; INSERT INTO `hisiphp_system_language` (`id`, `name`, `code`, `locale`, `icon`, `pack`, `sort`, `status`) VALUES (1,'简体中文','zh-cn','zh-CN,zh-CN.UTF-8,zh-cn','','1',1,1); # Dump of table hisiphp_system_log # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_log`; CREATE TABLE `hisiphp_system_log` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `uid` int(10) unsigned NOT NULL DEFAULT '0', `title` varchar(100) DEFAULT '', `url` varchar(200) DEFAULT '', `param` text, `remark` varchar(255) DEFAULT '', `count` int(10) unsigned NOT NULL DEFAULT '1', `ip` varchar(128) DEFAULT '', `ctime` int(10) unsigned NOT NULL DEFAULT '0', `mtime` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='[系统] 操作日志'; # Dump of table hisiphp_system_menu # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_menu`; CREATE TABLE `hisiphp_system_menu` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `uid` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '管理员ID(快捷菜单专用)', `pid` int(10) unsigned NOT NULL DEFAULT '0', `module` varchar(20) NOT NULL COMMENT '模块名或插件名,插件名格式:plugins.插件名', `title` varchar(20) NOT NULL COMMENT '菜单标题', `icon` varchar(80) NOT NULL DEFAULT 'aicon ai-shezhi' COMMENT '菜单图标', `url` varchar(200) NOT NULL COMMENT '链接地址(模块/控制器/方法)', `param` varchar(200) NOT NULL DEFAULT '' COMMENT '扩展参数', `target` varchar(20) NOT NULL DEFAULT '_self' COMMENT '打开方式(_blank,_self)', `sort` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '排序', `debug` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开发模式可见', `system` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否为系统菜单,系统菜单不可删除', `nav` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否为菜单显示,1显示0不显示', `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态1显示,0隐藏', `ctime` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=141 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='[系统] 管理菜单'; INSERT INTO `hisiphp_system_menu` (`id`, `uid`, `pid`, `module`, `title`, `icon`, `url`, `param`, `target`, `sort`, `debug`, `system`, `nav`, `status`, `ctime`) VALUES (1, 0, 0, 'system', '首页', '', 'system/index', '', '_self', 0, 0, 1, 1, 1, 1490315067), (2, 0, 0, 'system', '系统', '', 'system/system', '', '_self', 1, 0, 1, 1, 1, 1490315067), (3, 0, 0, 'system', '插件', 'aicon ai-shezhi', 'system/plugins', '', '_self', 2, 0, 1, 1, 1, 1490315067), (4, 0, 1, 'system', '快捷菜单', 'aicon ai-caidan', 'system/quick', '', '_self', 0, 0, 1, 1, 1, 1490315067), (5, 0, 3, 'system', '插件列表', 'aicon ai-mokuaiguanli', 'system/plugins', '', '_self', 0, 0, 1, 1, 1, 1490315067), (6, 0, 2, 'system', '系统基础', 'aicon ai-gongneng', 'system/system', '', '_self', 1, 0, 1, 1, 1, 1490315067), (7,0,17,'system','导入主题SQL','','system/module/exeSql','','_self',10,0,1,0,1,1490315067), (8, 0, 2, 'system', '系统扩展', 'aicon ai-shezhi', 'system/extend', '', '_self', 3, 0, 1, 1, 1, 1490315067), (9, 0, 4, 'system', '预留占位', '', '', '', '_self', 4, 0, 1, 1, 0, 1490315067), (10, 0, 6, 'system', '系统设置', 'aicon ai-icon01', 'system/system/index', '', '_self', 1, 0, 1, 1, 1, 1490315067), (11, 0, 6, 'system', '配置管理', 'aicon ai-peizhiguanli', 'system/config/index', '', '_self', 2, 1, 1, 1, 1, 1490315067), (12, 0, 6, 'system', '系统菜单', 'aicon ai-systemmenu', 'system/menu/index', '', '_self', 3, 1, 1, 1, 1, 1490315067), (13, 0, 6, 'system', '管理员角色', '', 'system/user/role', '', '_self', 4, 0, 1, 0, 1, 1490315067), (14, 0, 6, 'system', '系统管理员', 'aicon ai-tubiao05', 'system/user/index', '', '_self', 5, 0, 1, 1, 1, 1490315067), (15, 0, 6, 'system', '系统日志', 'aicon ai-xitongrizhi-tiaoshi', 'system/log/index', '', '_self', 7, 0, 1, 1, 1, 1490315067), (16, 0, 6, 'system', '附件管理', '', 'system/annex/index', '', '_self', 8, 0, 1, 0, 1, 1490315067), (17, 0, 8, 'system', '本地模块', 'aicon ai-mokuaiguanli1', 'system/module/index', '', '_self', 1, 0, 1, 1, 1, 1490315067), (18, 0, 8, 'system', '本地插件', 'aicon ai-chajianguanli', 'system/plugins/index', '', '_self', 2, 0, 1, 1, 1, 1490315067), (19, 0, 8, 'system', '插件钩子', 'aicon ai-icon-test', 'system/hook/index', '', '_self', 3, 0, 1, 1, 1, 1490315067), (20, 0, 4, 'system', '预留占位', '', '', '', '_self', 1, 0, 1, 1, 0, 1490315067), (21, 0, 4, 'system', '预留占位', '', '', '', '_self', 2, 0, 1, 1, 0, 1490315067), (22, 0, 4, 'system', '预留占位', '', '', '', '_self', 1, 0, 1, 1, 0, 1490315067), (23, 0, 4, 'system', '预留占位', '', '', '', '_self', 2, 0, 1, 1, 0, 1490315067), (24, 0, 4, 'system', '后台首页', '', 'system/index/index', '', '_self', 100, 0, 1, 0, 1, 1490315067), (25, 0, 4, 'system', '清空缓存', '', 'system/index/clear', '', '_self', 2, 0, 1, 0, 1, 1490315067), (26, 0, 12, 'system', '添加菜单', '', 'system/menu/add', '', '_self', 1, 0, 1, 1, 1, 1490315067), (27, 0, 12, 'system', '修改菜单', '', 'system/menu/edit', '', '_self', 2, 0, 1, 1, 1, 1490315067), (28, 0, 12, 'system', '删除菜单', '', 'system/menu/del', '', '_self', 3, 0, 1, 1, 1, 1490315067), (29, 0, 12, 'system', '状态设置', '', 'system/menu/status', '', '_self', 4, 0, 1, 1, 1, 1490315067), (30, 0, 12, 'system', '排序设置', '', 'system/menu/sort', '', '_self', 5, 0, 1, 1, 1, 1490315067), (31, 0, 12, 'system', '添加快捷菜单', '', 'system/menu/quick', '', '_self', 6, 0, 1, 1, 1, 1490315067), (32, 0, 12, 'system', '导出菜单', '', 'system/menu/export', '', '_self', 7, 0, 1, 1, 1, 1490315067), (33, 0, 13, 'system', '添加角色', '', 'system/user/addrole', '', '_self', 1, 0, 1, 1, 1, 1490315067), (34, 0, 13, 'system', '修改角色', '', 'system/user/editrole', '', '_self', 2, 0, 1, 1, 1, 1490315067), (35, 0, 13, 'system', '删除角色', '', 'system/user/delrole', '', '_self', 3, 0, 1, 1, 1, 1490315067), (36, 0, 13, 'system', '状态设置', '', 'system/user/statusRole', '', '_self', 4, 0, 1, 1, 1, 1490315067), (37, 0, 14, 'system', '添加管理员', '', 'system/user/adduser', '', '_self', 1, 0, 1, 1, 1, 1490315067), (38, 0, 14, 'system', '修改管理员', '', 'system/user/edituser', '', '_self', 2, 0, 1, 1, 1, 1490315067), (39, 0, 14, 'system', '删除管理员', '', 'system/user/deluser', '', '_self', 3, 0, 1, 1, 1, 1490315067), (40, 0, 14, 'system', '状态设置', '', 'system/user/status', '', '_self', 4, 0, 1, 0, 1, 1490315067), (41, 0, 4, 'system', '个人信息设置', '', 'system/user/info', '', '_self', 5, 0, 1, 0, 1, 1490315067), (42, 0, 18, 'system', '安装插件', '', 'system/plugins/install', '', '_self', 1, 0, 1, 1, 1, 1490315067), (43, 0, 18, 'system', '卸载插件', '', 'system/plugins/uninstall', '', '_self', 2, 0, 1, 1, 1, 1490315067), (44, 0, 18, 'system', '删除插件', '', 'system/plugins/del', '', '_self', 3, 0, 1, 1, 1, 1490315067), (45, 0, 18, 'system', '状态设置', '', 'system/plugins/status', '', '_self', 4, 0, 1, 1, 1, 1490315067), (46, 0, 18, 'system', '生成插件', '', 'system/plugins/design', '', '_self', 5, 0, 1, 1, 1, 1490315067), (47, 0, 18, 'system', '运行插件', '', 'system/plugins/run', '', '_self', 6, 0, 1, 1, 1, 1490315067), (48, 0, 18, 'system', '更新插件', '', 'system/plugins/update', '', '_self', 7, 0, 1, 1, 1, 1490315067), (49, 0, 18, 'system', '插件配置', '', 'system/plugins/setting', '', '_self', 8, 0, 1, 1, 1, 1490315067), (50, 0, 19, 'system', '添加钩子', '', 'system/hook/add', '', '_self', 1, 0, 1, 1, 1, 1490315067), (51, 0, 19, 'system', '修改钩子', '', 'system/hook/edit', '', '_self', 2, 0, 1, 1, 1, 1490315067), (52, 0, 19, 'system', '删除钩子', '', 'system/hook/del', '', '_self', 3, 0, 1, 1, 1, 1490315067), (53, 0, 19, 'system', '状态设置', '', 'system/hook/status', '', '_self', 4, 0, 1, 1, 1, 1490315067), (54, 0, 19, 'system', '插件排序', '', 'system/hook/sort', '', '_self', 5, 0, 1, 1, 1, 1490315067), (55, 0, 11, 'system', '添加配置', '', 'system/config/add', '', '_self', 1, 0, 1, 1, 1, 1490315067), (56, 0, 11, 'system', '修改配置', '', 'system/config/edit', '', '_self', 2, 0, 1, 1, 1, 1490315067), (57, 0, 11, 'system', '删除配置', '', 'system/config/del', '', '_self', 3, 0, 1, 1, 1, 1490315067), (58, 0, 11, 'system', '状态设置', '', 'system/config/status', '', '_self', 4, 0, 1, 1, 1, 1490315067), (59, 0, 11, 'system', '排序设置', '', 'system/config/sort', '', '_self', 5, 0, 1, 1, 1, 1490315067), (60, 0, 10, 'system', '基础配置', '', 'system/system/index', 'group=base', '_self', 1, 0, 1, 1, 1, 1490315067), (61, 0, 10, 'system', '系统配置', '', 'system/system/index', 'group=sys', '_self', 2, 0, 1, 1, 1, 1490315067), (62, 0, 10, 'system', '上传配置', '', 'system/system/index', 'group=upload', '_self', 3, 0, 1, 1, 1, 1490315067), (63, 0, 10, 'system', '开发配置', '', 'system/system/index', 'group=develop', '_self', 4, 0, 1, 1, 1, 1490315067), (64, 0, 17, 'system', '生成模块', '', 'system/module/design', '', '_self', 6, 1, 1, 1, 1, 1490315067), (65, 0, 17, 'system', '安装模块', '', 'system/module/install', '', '_self', 1, 0, 1, 1, 1, 1490315067), (66, 0, 17, 'system', '卸载模块', '', 'system/module/uninstall', '', '_self', 2, 0, 1, 1, 1, 1490315067), (67, 0, 17, 'system', '状态设置', '', 'system/module/status', '', '_self', 3, 0, 1, 1, 1, 1490315067), (68, 0, 17, 'system', '设置默认模块', '', 'system/module/setdefault', '', '_self', 4, 0, 1, 1, 1, 1490315067), (69, 0, 17, 'system', '删除模块', '', 'system/module/del', '', '_self', 5, 0, 1, 1, 1, 1490315067), (70, 0, 4, 'system', '预留占位', '', '', '', '_self', 1, 0, 1, 1, 0, 1490315067), (71, 0, 4, 'system', '预留占位', '', '', '', '_self', 2, 0, 1, 1, 0, 1490315067), (72, 0, 4, 'system', '预留占位', '', '', '', '_self', 3, 0, 1, 1, 0, 1490315067), (73, 0, 4, 'system', '预留占位', '', '', '', '_self', 4, 0, 1, 1, 0, 1490315067), (74, 0, 4, 'system', '预留占位', '', '', '', '_self', 5, 0, 1, 1, 0, 1490315067), (75, 0, 4, 'system', '预留占位', '', '', '', '_self', 0, 0, 1, 1, 0, 1490315067), (76, 0, 4, 'system', '预留占位', '', '', '', '_self', 0, 0, 1, 1, 0, 1490315067), (77, 0, 4, 'system', '预留占位', '', '', '', '_self', 0, 0, 1, 1, 0, 1490315067), (78, 0, 16, 'system', '附件上传', '', 'system/annex/upload', '', '_self', 1, 0, 1, 1, 1, 1490315067), (79, 0, 16, 'system', '删除附件', '', 'system/annex/del', '', '_self', 2, 0, 1, 1, 1, 1490315067), (80, 0, 8, 'system', '框架升级', 'aicon ai-iconfontshengji', 'system/upgrade/index', '', '_self', 4, 0, 1, 1, 1, 1491352728), (81, 0, 80, 'system', '获取升级列表', '', 'system/upgrade/lists', '', '_self', 0, 0, 1, 1, 1, 1491353504), (82, 0, 80, 'system', '安装升级包', '', 'system/upgrade/install', '', '_self', 0, 0, 1, 1, 1, 1491353568), (83, 0, 80, 'system', '下载升级包', '', 'system/upgrade/download', '', '_self', 0, 0, 1, 1, 1, 1491395830), (84, 0, 6, 'system', '数据库管理', 'aicon ai-shujukuguanli', 'system/database/index', '', '_self', 6, 0, 1, 1, 1, 1491461136), (85, 0, 84, 'system', '备份数据库', '', 'system/database/export', '', '_self', 0, 0, 1, 1, 1, 1491461250), (86, 0, 84, 'system', '恢复数据库', '', 'system/database/import', '', '_self', 0, 0, 1, 1, 1, 1491461315), (87, 0, 84, 'system', '优化数据库', '', 'system/database/optimize', '', '_self', 0, 0, 1, 1, 1, 1491467000), (88, 0, 84, 'system', '删除备份', '', 'system/database/del', '', '_self', 0, 0, 1, 1, 1, 1491467058), (89, 0, 84, 'system', '修复数据库', '', 'system/database/repair', '', '_self', 0, 0, 1, 1, 1, 1491880879), (90, 0, 21, 'system', '设置默认等级', '', 'system/member/setdefault', '', '_self', 0, 0, 1, 1, 1, 1491966585), (91, 0, 10, 'system', '数据库配置', '', 'system/system/index', 'group=databases', '_self', 5, 0, 1, 0, 1, 1492072213), (92, 0, 17, 'system', '模块打包', '', 'system/module/package', '', '_self', 7, 0, 1, 1, 1, 1492134693), (93, 0, 18, 'system', '插件打包', '', 'system/plugins/package', '', '_self', 0, 0, 1, 1, 1, 1492134743), (94, 0, 17, 'system', '主题管理', '', 'system/module/theme', '', '_self', 8, 0, 1, 1, 1, 1492433470), (95, 0, 17, 'system', '设置默认主题', '', 'system/module/setdefaulttheme', '', '_self', 9, 0, 1, 1, 1, 1492433618), (96, 0, 17, 'system', '删除主题', '', 'system/module/deltheme', '', '_self', 10, 0, 1, 1, 1, 1490315067), (97, 0, 6, 'system', '语言包管理', '', 'system/language/index', '', '_self', 9, 0, 1, 0, 1, 1490315067), (98, 0, 97, 'system', '添加语言包', '', 'system/language/add', '', '_self', 100, 0, 1, 0, 1, 1490315067), (99, 0, 97, 'system', '修改语言包', '', 'system/language/edit', '', '_self', 100, 0, 1, 0, 1, 1490315067), (100, 0, 97, 'system', '删除语言包', '', 'system/language/del', '', '_self', 100, 0, 1, 0, 1, 1490315067), (101, 0, 97, 'system', '排序设置', '', 'system/language/sort', '', '_self', 100, 0, 1, 0, 1, 1490315067), (102, 0, 97, 'system', '状态设置', '', 'system/language/status', '', '_self', 100, 0, 1, 0, 1, 1490315067), (103, 0, 16, 'system', '收藏夹图标上传', '', 'system/annex/favicon', '', '_self', 3, 0, 1, 0, 1, 1490315067), (104, 0, 17, 'system', '导入模块', '', 'system/module/import', '', '_self', 11, 0, 1, 0, 1, 1490315067), (105, 0, 4, 'system', '后台首页', '', 'system/index/welcome', '', '_self', 100, 0, 1, 0, 1, 1490315067), (106, 0, 4, 'system', '布局切换', '', 'system/user/iframe', '', '_self', 100, 0, 1, 0, 1, 1490315067), (107, 0, 15, 'system', '删除日志', '', 'system/log/del', 'table=admin_log', '_self', 100, 0, 1, 0, 1, 1490315067), (108, 0, 15, 'system', '清空日志', '', 'system/log/clear', '', '_self', 100, 0, 1, 0, 1, 1490315067), (109, 0, 17, 'system', '编辑模块', '', 'system/module/edit', '', '_self', 100, 0, 1, 0, 1, 1490315067), (110, 0, 17, 'system', '模块图标上传', '', 'system/module/icon', '', '_self', 100, 0, 1, 0, 1, 1490315067), (111, 0, 18, 'system', '导入插件', '', 'system/plugins/import', '', '_self', 100, 0, 1, 0, 1, 1490315067), (112, 0, 4, 'system', '钩子插件状态', '', 'system/hook/hookPluginsStatus', '', '_self', 100, 0, 1, 0, 1, 1490315067), (113, 0, 4, 'system', '设置主题', '', 'system/user/setTheme', '', '_self', 100, 0, 1, 0, 1, 1490315067), (114, 0, 8, 'system', '应用市场', 'aicon ai-app-store', 'system/store/index', '', '_self', 0, 0, 1, 1, 1, 1490315067), (115, 0, 114, 'system', '安装应用', '', 'system/store/install', '', '_self', 0, 0, 1, 1, 1, 1490315067), (116, 0, 21, 'system', '重置密码', '', 'system/member/resetPwd', '', '_self', 6, 0, 1, 1, 1, 1490315067), (117, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (118, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (119, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (120, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (121, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (122, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (123, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (124, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (125, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (126, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (127, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (128, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (129, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (130, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (131, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (132, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (133, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (134, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (135, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (136, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (137, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (138, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (139, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067), (140, 0, 4, 'system', '预留占位', '', '', '', '_self', 100, 0, 1, 1, 0, 1490315067); # Dump of table hisiphp_system_menu_lang # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_menu_lang`; CREATE TABLE `hisiphp_system_menu_lang` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `menu_id` int(11) unsigned NOT NULL DEFAULT '0', `title` varchar(120) NOT NULL DEFAULT '' COMMENT '标题', `lang` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '语言包', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=271 DEFAULT CHARSET=utf8 COMMENT='[系统] 管理菜单语言包'; INSERT INTO `hisiphp_system_menu_lang` (`id`, `menu_id`, `title`, `lang`) VALUES (131, 1, '首页', 1), (132, 2, '系统', 1), (133, 3, '插件', 1), (134, 4, '快捷菜单', 1), (135, 5, '插件列表', 1), (136, 6, '系统基础', 1), (137, 7, '预留占位', 1), (138, 8, '系统扩展', 1), (139, 9, '开发专用', 1), (140, 10, '系统设置', 1), (141, 11, '配置管理', 1), (142, 12, '系统菜单', 1), (143, 13, '管理员角色', 1), (144, 14, '系统管理员', 1), (145, 15, '系统日志', 1), (146, 16, '附件管理', 1), (147, 17, '本地模块', 1), (148, 18, '本地插件', 1), (149, 19, '插件钩子', 1), (150, 20, '预留占位', 1), (151, 21, '预留占位', 1), (152, 22, '预留占位', 1), (153, 23, '预留占位', 1), (154, 24, '后台首页', 1), (155, 25, '清空缓存', 1), (156, 26, '添加菜单', 1), (157, 27, '修改菜单', 1), (158, 28, '删除菜单', 1), (159, 29, '状态设置', 1), (160, 30, '排序设置', 1), (161, 31, '添加快捷菜单', 1), (162, 32, '导出菜单', 1), (163, 33, '添加角色', 1), (164, 34, '修改角色', 1), (165, 35, '删除角色', 1), (166, 36, '状态设置', 1), (167, 37, '添加管理员', 1), (168, 38, '修改管理员', 1), (169, 39, '删除管理员', 1), (170, 40, '状态设置', 1), (171, 41, '个人信息设置', 1), (172, 42, '安装插件', 1), (173, 43, '卸载插件', 1), (174, 44, '删除插件', 1), (175, 45, '状态设置', 1), (176, 46, '生成插件', 1), (177, 47, '运行插件', 1), (178, 48, '更新插件', 1), (179, 49, '插件配置', 1), (180, 50, '添加钩子', 1), (181, 51, '修改钩子', 1), (182, 52, '删除钩子', 1), (183, 53, '状态设置', 1), (184, 54, '插件排序', 1), (185, 55, '添加配置', 1), (186, 56, '修改配置', 1), (187, 57, '删除配置', 1), (188, 58, '状态设置', 1), (189, 59, '排序设置', 1), (190, 60, '基础配置', 1), (191, 61, '系统配置', 1), (192, 62, '上传配置', 1), (193, 63, '开发配置', 1), (194, 64, '生成模块', 1), (195, 65, '安装模块', 1), (196, 66, '卸载模块', 1), (197, 67, '状态设置', 1), (198, 68, '设置默认模块', 1), (199, 69, '删除模块', 1), (200, 70, '预留占位', 1), (201, 71, '预留占位', 1), (202, 72, '预留占位', 1), (203, 73, '预留占位', 1), (204, 74, '预留占位', 1), (205, 75, '预留占位', 1), (206, 76, '预留占位', 1), (207, 77, '预留占位', 1), (208, 78, '附件上传', 1), (209, 79, '删除附件', 1), (210, 80, '框架升级', 1), (211, 81, '获取升级列表', 1), (212, 82, '安装升级包', 1), (213, 83, '下载升级包', 1), (214, 84, '数据库管理', 1), (215, 85, '备份数据库', 1), (216, 86, '恢复数据库', 1), (217, 87, '优化数据库', 1), (218, 88, '删除备份', 1), (219, 89, '修复数据库', 1), (220, 90, '设置默认等级', 1), (221, 91, '数据库配置', 1), (222, 92, '模块打包', 1), (223, 93, '插件打包', 1), (224, 94, '主题管理', 1), (225, 95, '设置默认主题', 1), (226, 96, '删除主题', 1), (227, 97, '语言包管理', 1), (228, 98, '添加语言包', 1), (229, 99, '修改语言包', 1), (230, 100, '删除语言包', 1), (231, 101, '排序设置', 1), (232, 102, '状态设置', 1), (233, 103, '收藏夹图标上传', 1), (234, 104, '导入模块', 1), (235, 105, '后台首页', 1), (236, 106, '布局切换', 1), (237, 107, '删除日志', 1), (238, 108, '清空日志', 1), (239, 109, '编辑模块', 1), (240, 110, '模块图标上传', 1), (241, 111, '导入插件', 1), (242, 112, '钩子插件状态', 1), (243, 113, '设置主题', 1), (244, 114, '应用市场', 1), (245, 115, '安装应用', 1), (246, 116, '重置密码', 1), (247,117,'预留占位',1), (248,118,'预留占位',1), (249,119,'预留占位',1), (250,120,'预留占位',1), (251,121,'预留占位',1), (252,122,'预留占位',1), (253,123,'预留占位',1), (254,124,'预留占位',1), (255,125,'预留占位',1), (256,126,'预留占位',1), (257,127,'预留占位',1), (258,128,'预留占位',1), (259,129,'预留占位',1), (260,130,'预留占位',1), (261,131,'预留占位',1), (262,132,'预留占位',1), (263,133,'预留占位',1), (264,134,'预留占位',1), (265,135,'预留占位',1), (266,136,'预留占位',1), (267,137,'预留占位',1), (268,138,'预留占位',1), (269,139,'预留占位',1), (270,140,'预留占位',1); # Dump of table hisiphp_system_module # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_module`; CREATE TABLE `hisiphp_system_module` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `system` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '系统模块', `name` varchar(50) NOT NULL COMMENT '模块名(英文)', `identifier` varchar(100) NOT NULL COMMENT '模块标识(模块名(字母).开发者标识.module)', `title` varchar(50) NOT NULL COMMENT '模块标题', `intro` varchar(255) NOT NULL COMMENT '模块简介', `author` varchar(100) NOT NULL COMMENT '作者', `icon` varchar(80) NOT NULL DEFAULT 'aicon ai-mokuaiguanli' COMMENT '图标', `version` varchar(20) NOT NULL COMMENT '版本号', `url` varchar(255) NOT NULL COMMENT '链接', `sort` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '排序', `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0未安装,1未启用,2已启用', `default` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '默认模块(只能有一个)', `config` text NOT NULL COMMENT '配置', `app_id` varchar(30) NOT NULL DEFAULT '0' COMMENT '应用市场ID(0本地)', `app_keys` varchar(200) DEFAULT '' COMMENT '应用秘钥', `theme` varchar(50) NOT NULL DEFAULT 'default' COMMENT '主题模板', `ctime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `mtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), UNIQUE KEY `identifier` (`identifier`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='[系统] 模块'; INSERT INTO `hisiphp_system_module` (`id`, `system`, `name`, `identifier`, `title`, `intro`, `author`, `icon`, `version`, `url`, `sort`, `status`, `default`, `config`, `app_id`, `app_keys`, `theme`, `ctime`, `mtime`) VALUES (1, 1, 'system', 'system.hisiphp.module', '系统管理模块', '系统核心模块,用于后台各项管理功能模块及功能拓展', 'HisiPHP官方出品', '', '1.0.0', 'http://www.hisiphp.com', 0, 2, 0, '', '0', '', 'default', 1489998096, 1489998096), (2, 1, 'index', 'index.hisiphp.module', '默认模块', '推荐使用扩展模块作为默认首页。', 'HisiPHP官方出品', '', '1.0.0', 'http://www.hisiphp.com', 0, 2, 0, '', '0', '', 'default', 1489998096, 1489998096), (3, 1, 'install', 'install.hisiphp.module', '系统安装模块', '系统安装模块,勿动。', 'HisiPHP官方出品', '', '1.0.0', 'http://www.hisiphp.com', 0, 2, 0, '', '0', '', 'default', 1489998096, 1489998096); # Dump of table hisiphp_system_plugins # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_plugins`; CREATE TABLE `hisiphp_system_plugins` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `system` tinyint(1) unsigned NOT NULL DEFAULT '0', `name` varchar(32) NOT NULL COMMENT '插件名称(英文)', `title` varchar(32) NOT NULL COMMENT '插件标题', `icon` varchar(64) NOT NULL COMMENT '图标', `intro` text NOT NULL COMMENT '插件简介', `author` varchar(32) NOT NULL COMMENT '作者', `url` varchar(255) NOT NULL COMMENT '作者主页', `version` varchar(16) NOT NULL DEFAULT '' COMMENT '版本号', `identifier` varchar(64) NOT NULL DEFAULT '' COMMENT '插件唯一标识符', `config` text NOT NULL COMMENT '插件配置', `app_id` varchar(30) NOT NULL DEFAULT '0' COMMENT '来源(0本地)', `app_keys` varchar(200) DEFAULT '' COMMENT '应用秘钥', `ctime` int(10) unsigned NOT NULL DEFAULT '0', `mtime` int(10) unsigned NOT NULL DEFAULT '0', `sort` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '排序', `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='[系统] 插件表'; INSERT INTO `hisiphp_system_plugins` (`id`, `system`, `name`, `title`, `icon`, `intro`, `author`, `url`, `version`, `identifier`, `config`, `app_id`, `app_keys`, `ctime`, `mtime`, `sort`, `status`) VALUES (1, 1, 'hisiphp', '系统基础信息', '/static/plugins/hisiphp/hisiphp.png', '后台首页展示系统基础信息和开发团队信息', 'HisiPHP', 'http://www.hisiphp.com', '1.0.0', 'hisiphp.hisiphp.plugins', '', '0', '', 1509379331, 1509379331, 0, 2); # Dump of table hisiphp_system_role # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_role`; CREATE TABLE `hisiphp_system_role` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL COMMENT '角色名称', `intro` varchar(200) NOT NULL COMMENT '角色简介', `auth` text NOT NULL COMMENT '角色权限', `ctime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `mtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='[系统] 管理角色'; INSERT INTO `hisiphp_system_role` (`id`, `name`, `intro`, `auth`, `ctime`, `mtime`, `status`) VALUES (1,'超级管理员','拥有系统最高权限','0',1489411760,0,1), (2,'系统管理员','拥有系统管理员权限','[\"1\",\"4\",\"25\",\"24\",\"2\",\"6\",\"10\",\"60\",\"61\",\"62\",\"63\",\"91\",\"11\",\"55\",\"56\",\"57\",\"58\",\"59\",\"12\",\"26\",\"27\",\"28\",\"29\",\"30\",\"31\",\"32\",\"13\",\"33\",\"34\",\"35\",\"36\",\"14\",\"37\",\"38\",\"39\",\"40\",\"41\",\"16\",\"78\",\"79\",\"84\",\"85\",\"86\",\"87\",\"88\",\"89\",\"7\",\"20\",\"75\",\"76\",\"77\",\"21\",\"90\",\"70\",\"71\",\"72\",\"73\",\"74\",\"8\",\"17\",\"65\",\"66\",\"67\",\"68\",\"94\",\"95\",\"18\",\"42\",\"43\",\"45\",\"47\",\"48\",\"49\",\"19\",\"80\",\"81\",\"82\",\"83\",\"9\",\"22\",\"23\",\"3\",\"5\"]',1489411760,1507731116,1), (3,'普通管理员','普通管理员','{\"0\":\"1\",\"1\":\"4\",\"2\":\"25\",\"4\":\"24\",\"6\":\"106\",\"8\":\"113\"}',1507737902,1542075415,1); # Dump of table hisiphp_system_user # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_user`; CREATE TABLE `hisiphp_system_user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL COMMENT '用户名', `password` varchar(64) NOT NULL, `nick` varchar(50) NOT NULL COMMENT '昵称', `mobile` varchar(11) NOT NULL, `email` varchar(50) NOT NULL COMMENT '邮箱', `auth` text NOT NULL COMMENT '权限', `iframe` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0默认,1框架', `theme` varchar(50) NOT NULL DEFAULT 'default' COMMENT '主题', `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态', `last_login_ip` varchar(128) NOT NULL COMMENT '最后登陆IP', `last_login_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后登陆时间', `ctime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `mtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='[系统] 管理用户'; # Dump of table hisiphp_system_user_role # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_system_user_role`; CREATE TABLE `hisiphp_system_user_role` ( `user_id` int(11) unsigned NOT NULL, `role_id` int(10) unsigned DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='管理员角色索引'; # Dump of table hisiphp_jobs # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_jobs`; CREATE TABLE `hisiphp_jobs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `queue` varchar(255) NOT NULL, `payload` longtext NOT NULL, `attempts` tinyint(3) unsigned NOT NULL, `reserved` tinyint(3) unsigned NOT NULL, `reserved_at` int(10) unsigned DEFAULT NULL, `available_at` int(10) unsigned NOT NULL, `created_at` int(10) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # Dump of table hisiphp_token # ------------------------------------------------------------ DROP TABLE IF EXISTS `hisiphp_token`; CREATE TABLE IF NOT EXISTS `hisiphp_token` ( `token` varchar(128) NOT NULL DEFAULT '' COMMENT 'Token', `tag` varchar(50) DEFAULT '' COMMENT '标签', `value` varchar(30) NOT NULL DEFAULT '' COMMENT '映射的值', `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `expire_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '过期时间', PRIMARY KEY (`token`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='token表';
the_stack
\set ECHO none -- This file defines pgTAP Core, a portable collection of assertion -- functions for TAP-based unit testing on PostgreSQL 8.3 or higher. It is -- distributed under the revised FreeBSD license. The home page for the pgTAP -- project is: -- -- https://pgtap.org/ -- \pset format unaligned \pset tuples_only true \pset pager -- Revert all changes on failure. \set ON_ERROR_ROLLBACK 1 \set ON_ERROR_STOP true CREATE OR REPLACE FUNCTION pg_version() RETURNS text AS 'SELECT current_setting(''server_version'')' LANGUAGE SQL IMMUTABLE; CREATE OR REPLACE FUNCTION pg_version_num() RETURNS integer AS $$ SELECT s.a[1]::int * 10000 + COALESCE(substring(s.a[2] FROM '[[:digit:]]+')::int, 0) * 100 + COALESCE(substring(s.a[3] FROM '[[:digit:]]+')::int, 0) FROM ( SELECT string_to_array(current_setting('server_version'), '.') AS a ) AS s; $$ LANGUAGE SQL IMMUTABLE; CREATE OR REPLACE FUNCTION pgtap_version() RETURNS NUMERIC AS 'SELECT 0.25;' LANGUAGE SQL IMMUTABLE; CREATE OR REPLACE FUNCTION plan( integer ) RETURNS TEXT AS $$ DECLARE rcount INTEGER; BEGIN BEGIN EXECUTE ' CREATE TEMP SEQUENCE __tcache___id_seq; CREATE TEMP TABLE __tcache__ ( id INTEGER NOT NULL DEFAULT nextval(''__tcache___id_seq''), label TEXT NOT NULL, value INTEGER NOT NULL, note TEXT NOT NULL DEFAULT '''' ); CREATE UNIQUE INDEX __tcache___key ON __tcache__(id); GRANT ALL ON TABLE __tcache__ TO PUBLIC; GRANT ALL ON TABLE __tcache___id_seq TO PUBLIC; CREATE TEMP SEQUENCE __tresults___numb_seq; CREATE TEMP TABLE __tresults__ ( numb INTEGER NOT NULL DEFAULT nextval(''__tresults___numb_seq''), ok BOOLEAN NOT NULL DEFAULT TRUE, aok BOOLEAN NOT NULL DEFAULT TRUE, descr TEXT NOT NULL DEFAULT '''', type TEXT NOT NULL DEFAULT '''', reason TEXT NOT NULL DEFAULT '''' ); CREATE UNIQUE INDEX __tresults___key ON __tresults__(numb); GRANT ALL ON TABLE __tresults__ TO PUBLIC; GRANT ALL ON TABLE __tresults___numb_seq TO PUBLIC; '; EXCEPTION WHEN duplicate_table THEN -- Raise an exception if there's already a plan. EXECUTE 'SELECT TRUE FROM __tcache__ WHERE label = ''plan'''; GET DIAGNOSTICS rcount = ROW_COUNT; IF rcount > 0 THEN RAISE EXCEPTION 'You tried to plan twice!'; END IF; END; -- Save the plan and return. PERFORM _set('plan', $1 ); RETURN '1..' || $1; END; $$ LANGUAGE plpgsql strict; CREATE OR REPLACE FUNCTION no_plan() RETURNS SETOF boolean AS $$ BEGIN PERFORM plan(0); RETURN; END; $$ LANGUAGE plpgsql strict; CREATE OR REPLACE FUNCTION _get ( text ) RETURNS integer AS $$ DECLARE ret integer; BEGIN EXECUTE 'SELECT value FROM __tcache__ WHERE label = ' || quote_literal($1) || ' LIMIT 1' INTO ret; RETURN ret; END; $$ LANGUAGE plpgsql strict; CREATE OR REPLACE FUNCTION _get_latest ( text ) RETURNS integer[] AS $$ DECLARE ret integer[]; BEGIN EXECUTE 'SELECT ARRAY[ id, value] FROM __tcache__ WHERE label = ' || quote_literal($1) || ' AND id = (SELECT MAX(id) FROM __tcache__ WHERE label = ' || quote_literal($1) || ') LIMIT 1' INTO ret; RETURN ret; END; $$ LANGUAGE plpgsql strict; CREATE OR REPLACE FUNCTION _get_latest ( text, integer ) RETURNS integer AS $$ DECLARE ret integer; BEGIN EXECUTE 'SELECT MAX(id) FROM __tcache__ WHERE label = ' || quote_literal($1) || ' AND value = ' || $2 INTO ret; RETURN ret; END; $$ LANGUAGE plpgsql strict; CREATE OR REPLACE FUNCTION _get_note ( text ) RETURNS text AS $$ DECLARE ret text; BEGIN EXECUTE 'SELECT note FROM __tcache__ WHERE label = ' || quote_literal($1) || ' LIMIT 1' INTO ret; RETURN ret; END; $$ LANGUAGE plpgsql strict; CREATE OR REPLACE FUNCTION _get_note ( integer ) RETURNS text AS $$ DECLARE ret text; BEGIN EXECUTE 'SELECT note FROM __tcache__ WHERE id = ' || $1 || ' LIMIT 1' INTO ret; RETURN ret; END; $$ LANGUAGE plpgsql strict; CREATE OR REPLACE FUNCTION _set ( text, integer, text ) RETURNS integer AS $$ DECLARE rcount integer; BEGIN EXECUTE 'UPDATE __tcache__ SET value = ' || $2 || CASE WHEN $3 IS NULL THEN '' ELSE ', note = ' || quote_literal($3) END || ' WHERE label = ' || quote_literal($1); GET DIAGNOSTICS rcount = ROW_COUNT; IF rcount = 0 THEN RETURN _add( $1, $2, $3 ); END IF; RETURN $2; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _set ( text, integer ) RETURNS integer AS $$ SELECT _set($1, $2, '') $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _set ( integer, integer ) RETURNS integer AS $$ BEGIN EXECUTE 'UPDATE __tcache__ SET value = ' || $2 || ' WHERE id = ' || $1; RETURN $2; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _add ( text, integer, text ) RETURNS integer AS $$ BEGIN EXECUTE 'INSERT INTO __tcache__ (label, value, note) values (' || quote_literal($1) || ', ' || $2 || ', ' || quote_literal(COALESCE($3, '')) || ')'; RETURN $2; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _add ( text, integer ) RETURNS integer AS $$ SELECT _add($1, $2, '') $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION add_result ( bool, bool, text, text, text ) RETURNS integer AS $$ BEGIN EXECUTE 'INSERT INTO __tresults__ ( ok, aok, descr, type, reason ) VALUES( ' || $1 || ', ' || $2 || ', ' || quote_literal(COALESCE($3, '')) || ', ' || quote_literal($4) || ', ' || quote_literal($5) || ' )'; RETURN currval('__tresults___numb_seq'); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION num_failed () RETURNS INTEGER AS $$ DECLARE ret integer; BEGIN EXECUTE 'SELECT COUNT(*)::INTEGER FROM __tresults__ WHERE ok = FALSE' INTO ret; RETURN ret; END; $$ LANGUAGE plpgsql strict; CREATE OR REPLACE FUNCTION _finish ( INTEGER, INTEGER, INTEGER) RETURNS SETOF TEXT AS $$ DECLARE curr_test ALIAS FOR $1; exp_tests INTEGER := $2; num_faild ALIAS FOR $3; plural CHAR; BEGIN plural := CASE exp_tests WHEN 1 THEN '' ELSE 's' END; IF curr_test IS NULL THEN RAISE EXCEPTION '# No tests run!'; END IF; IF exp_tests = 0 OR exp_tests IS NULL THEN -- No plan. Output one now. exp_tests = curr_test; RETURN NEXT '1..' || exp_tests; END IF; IF curr_test <> exp_tests THEN RETURN NEXT diag( 'Looks like you planned ' || exp_tests || ' test' || plural || ' but ran ' || curr_test ); ELSIF num_faild > 0 THEN RETURN NEXT diag( 'Looks like you failed ' || num_faild || ' test' || CASE num_faild WHEN 1 THEN '' ELSE 's' END || ' of ' || exp_tests ); ELSE END IF; RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION finish () RETURNS SETOF TEXT AS $$ SELECT * FROM _finish( _get('curr_test'), _get('plan'), num_failed() ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION diag ( msg text ) RETURNS TEXT AS $$ SELECT '# ' || replace( replace( replace( $1, E'\r\n', E'\n# ' ), E'\n', E'\n# ' ), E'\r', E'\n# ' ); $$ LANGUAGE sql strict; CREATE OR REPLACE FUNCTION diag ( msg anyelement ) RETURNS TEXT AS $$ SELECT diag($1::text); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION diag( VARIADIC text[] ) RETURNS TEXT AS $$ SELECT diag(array_to_string($1, '')); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION diag( VARIADIC anyarray ) RETURNS TEXT AS $$ SELECT diag(array_to_string($1, '')); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION ok ( boolean, text ) RETURNS TEXT AS $$ DECLARE aok ALIAS FOR $1; descr text := $2; test_num INTEGER; todo_why TEXT; ok BOOL; BEGIN todo_why := _todo(); ok := CASE WHEN aok = TRUE THEN aok WHEN todo_why IS NULL THEN COALESCE(aok, false) ELSE TRUE END; IF _get('plan') IS NULL THEN RAISE EXCEPTION 'You tried to run a test without a plan! Gotta have a plan'; END IF; test_num := add_result( ok, COALESCE(aok, false), descr, CASE WHEN todo_why IS NULL THEN '' ELSE 'todo' END, COALESCE(todo_why, '') ); RETURN (CASE aok WHEN TRUE THEN '' ELSE 'not ' END) || 'ok ' || _set( 'curr_test', test_num ) || CASE descr WHEN '' THEN '' ELSE COALESCE( ' - ' || substr(diag( descr ), 3), '' ) END || COALESCE( ' ' || diag( 'TODO ' || todo_why ), '') || CASE aok WHEN TRUE THEN '' ELSE E'\n' || diag('Failed ' || CASE WHEN todo_why IS NULL THEN '' ELSE '(TODO) ' END || 'test ' || test_num || CASE descr WHEN '' THEN '' ELSE COALESCE(': "' || descr || '"', '') END ) || CASE WHEN aok IS NULL THEN E'\n' || diag(' (test result was NULL)') ELSE '' END END; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION ok ( boolean ) RETURNS TEXT AS $$ SELECT ok( $1, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION is (anyelement, anyelement, text) RETURNS TEXT AS $$ DECLARE result BOOLEAN; output TEXT; BEGIN -- Would prefer $1 IS NOT DISTINCT FROM, but that's not supported by 8.1. result := NOT $1 IS DISTINCT FROM $2; output := ok( result, $3 ); RETURN output || CASE result WHEN TRUE THEN '' ELSE E'\n' || diag( ' have: ' || CASE WHEN $1 IS NULL THEN 'NULL' ELSE $1::text END || E'\n want: ' || CASE WHEN $2 IS NULL THEN 'NULL' ELSE $2::text END ) END; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION is (anyelement, anyelement) RETURNS TEXT AS $$ SELECT is( $1, $2, NULL); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION isnt (anyelement, anyelement, text) RETURNS TEXT AS $$ DECLARE result BOOLEAN; output TEXT; BEGIN result := $1 IS DISTINCT FROM $2; output := ok( result, $3 ); RETURN output || CASE result WHEN TRUE THEN '' ELSE E'\n' || diag( ' have: ' || COALESCE( $1::text, 'NULL' ) || E'\n want: anything else' ) END; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION isnt (anyelement, anyelement) RETURNS TEXT AS $$ SELECT isnt( $1, $2, NULL); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _alike ( BOOLEAN, ANYELEMENT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE result ALIAS FOR $1; got ALIAS FOR $2; rx ALIAS FOR $3; descr ALIAS FOR $4; output TEXT; BEGIN output := ok( result, descr ); RETURN output || CASE result WHEN TRUE THEN '' ELSE E'\n' || diag( ' ' || COALESCE( quote_literal(got), 'NULL' ) || E'\n doesn''t match: ' || COALESCE( quote_literal(rx), 'NULL' ) ) END; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION matches ( anyelement, text, text ) RETURNS TEXT AS $$ SELECT _alike( $1 ~ $2, $1, $2, $3 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION matches ( anyelement, text ) RETURNS TEXT AS $$ SELECT _alike( $1 ~ $2, $1, $2, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION imatches ( anyelement, text, text ) RETURNS TEXT AS $$ SELECT _alike( $1 ~* $2, $1, $2, $3 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION imatches ( anyelement, text ) RETURNS TEXT AS $$ SELECT _alike( $1 ~* $2, $1, $2, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION alike ( anyelement, text, text ) RETURNS TEXT AS $$ SELECT _alike( $1 ~~ $2, $1, $2, $3 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION alike ( anyelement, text ) RETURNS TEXT AS $$ SELECT _alike( $1 ~~ $2, $1, $2, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION ialike ( anyelement, text, text ) RETURNS TEXT AS $$ SELECT _alike( $1 ~~* $2, $1, $2, $3 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION ialike ( anyelement, text ) RETURNS TEXT AS $$ SELECT _alike( $1 ~~* $2, $1, $2, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _unalike ( BOOLEAN, ANYELEMENT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE result ALIAS FOR $1; got ALIAS FOR $2; rx ALIAS FOR $3; descr ALIAS FOR $4; output TEXT; BEGIN output := ok( result, descr ); RETURN output || CASE result WHEN TRUE THEN '' ELSE E'\n' || diag( ' ' || COALESCE( quote_literal(got), 'NULL' ) || E'\n matches: ' || COALESCE( quote_literal(rx), 'NULL' ) ) END; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION doesnt_match ( anyelement, text, text ) RETURNS TEXT AS $$ SELECT _unalike( $1 !~ $2, $1, $2, $3 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION doesnt_match ( anyelement, text ) RETURNS TEXT AS $$ SELECT _unalike( $1 !~ $2, $1, $2, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION doesnt_imatch ( anyelement, text, text ) RETURNS TEXT AS $$ SELECT _unalike( $1 !~* $2, $1, $2, $3 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION doesnt_imatch ( anyelement, text ) RETURNS TEXT AS $$ SELECT _unalike( $1 !~* $2, $1, $2, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION unalike ( anyelement, text, text ) RETURNS TEXT AS $$ SELECT _unalike( $1 !~~ $2, $1, $2, $3 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION unalike ( anyelement, text ) RETURNS TEXT AS $$ SELECT _unalike( $1 !~~ $2, $1, $2, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION unialike ( anyelement, text, text ) RETURNS TEXT AS $$ SELECT _unalike( $1 !~~* $2, $1, $2, $3 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION unialike ( anyelement, text ) RETURNS TEXT AS $$ SELECT _unalike( $1 !~~* $2, $1, $2, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION cmp_ok (anyelement, text, anyelement, text) RETURNS TEXT AS $$ DECLARE have ALIAS FOR $1; op ALIAS FOR $2; want ALIAS FOR $3; descr ALIAS FOR $4; result BOOLEAN; output TEXT; BEGIN EXECUTE 'SELECT ' || COALESCE(quote_literal( have ), 'NULL') || '::' || pg_typeof(have) || ' ' || op || ' ' || COALESCE(quote_literal( want ), 'NULL') || '::' || pg_typeof(want) INTO result; output := ok( COALESCE(result, FALSE), descr ); RETURN output || CASE result WHEN TRUE THEN '' ELSE E'\n' || diag( ' ' || COALESCE( quote_literal(have), 'NULL' ) || E'\n ' || op || E'\n ' || COALESCE( quote_literal(want), 'NULL' ) ) END; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION cmp_ok (anyelement, text, anyelement) RETURNS TEXT AS $$ SELECT cmp_ok( $1, $2, $3, NULL ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION pass ( text ) RETURNS TEXT AS $$ SELECT ok( TRUE, $1 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION pass () RETURNS TEXT AS $$ SELECT ok( TRUE, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION fail ( text ) RETURNS TEXT AS $$ SELECT ok( FALSE, $1 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION fail () RETURNS TEXT AS $$ SELECT ok( FALSE, NULL ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION todo ( why text, how_many int ) RETURNS SETOF BOOLEAN AS $$ BEGIN PERFORM _add('todo', COALESCE(how_many, 1), COALESCE(why, '')); RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION todo ( how_many int, why text ) RETURNS SETOF BOOLEAN AS $$ BEGIN PERFORM _add('todo', COALESCE(how_many, 1), COALESCE(why, '')); RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION todo ( why text ) RETURNS SETOF BOOLEAN AS $$ BEGIN PERFORM _add('todo', 1, COALESCE(why, '')); RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION todo ( how_many int ) RETURNS SETOF BOOLEAN AS $$ BEGIN PERFORM _add('todo', COALESCE(how_many, 1), ''); RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION todo_start (text) RETURNS SETOF BOOLEAN AS $$ BEGIN PERFORM _add('todo', -1, COALESCE($1, '')); RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION todo_start () RETURNS SETOF BOOLEAN AS $$ BEGIN PERFORM _add('todo', -1, ''); RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION in_todo () RETURNS BOOLEAN AS $$ DECLARE todos integer; BEGIN todos := _get('todo'); RETURN CASE WHEN todos IS NULL THEN FALSE ELSE TRUE END; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION todo_end () RETURNS SETOF BOOLEAN AS $$ DECLARE id integer; BEGIN id := _get_latest( 'todo', -1 ); IF id IS NULL THEN RAISE EXCEPTION 'todo_end() called without todo_start()'; END IF; EXECUTE 'DELETE FROM __tcache__ WHERE id = ' || id; RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _todo() RETURNS TEXT AS $$ DECLARE todos INT[]; note text; BEGIN -- Get the latest id and value, because todo() might have been called -- again before the todos ran out for the first call to todo(). This -- allows them to nest. todos := _get_latest('todo'); IF todos IS NULL THEN -- No todos. RETURN NULL; END IF; IF todos[2] = 0 THEN -- Todos depleted. Clean up. EXECUTE 'DELETE FROM __tcache__ WHERE id = ' || todos[1]; RETURN NULL; END IF; -- Decrement the count of counted todos and return the reason. IF todos[2] <> -1 THEN PERFORM _set(todos[1], todos[2] - 1); END IF; note := _get_note(todos[1]); IF todos[2] = 1 THEN -- This was the last todo, so delete the record. EXECUTE 'DELETE FROM __tcache__ WHERE id = ' || todos[1]; END IF; RETURN note; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION skip ( why text, how_many int ) RETURNS TEXT AS $$ DECLARE output TEXT[]; BEGIN output := '{}'; FOR i IN 1..how_many LOOP output = array_append(output, ok( TRUE, 'SKIP: ' || COALESCE( why, '') ) ); END LOOP; RETURN array_to_string(output, E'\n'); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION skip ( text ) RETURNS TEXT AS $$ SELECT ok( TRUE, 'SKIP: ' || $1 ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION skip( int, text ) RETURNS TEXT AS 'SELECT skip($2, $1)' LANGUAGE sql; CREATE OR REPLACE FUNCTION skip( int ) RETURNS TEXT AS 'SELECT skip(NULL, $1)' LANGUAGE sql; CREATE OR REPLACE FUNCTION _query( TEXT ) RETURNS TEXT AS $$ SELECT CASE WHEN $1 LIKE '"%' OR $1 !~ '[[:space:]]' THEN 'EXECUTE ' || $1 ELSE $1 END; $$ LANGUAGE SQL; -- throws_ok ( sql, errcode, errmsg, description ) CREATE OR REPLACE FUNCTION throws_ok ( TEXT, CHAR(5), TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE query TEXT := _query($1); errcode ALIAS FOR $2; errmsg ALIAS FOR $3; desctext ALIAS FOR $4; descr TEXT; BEGIN descr := COALESCE( desctext, 'threw ' || errcode || ': ' || errmsg, 'threw ' || errcode, 'threw ' || errmsg, 'threw an exception' ); EXECUTE query; RETURN ok( FALSE, descr ) || E'\n' || diag( ' caught: no exception' || E'\n wanted: ' || COALESCE( errcode, 'an exception' ) ); EXCEPTION WHEN OTHERS THEN IF (errcode IS NULL OR SQLSTATE = errcode) AND ( errmsg IS NULL OR SQLERRM = errmsg) THEN -- The expected errcode and/or message was thrown. RETURN ok( TRUE, descr ); ELSE -- This was not the expected errcode or errmsg. RETURN ok( FALSE, descr ) || E'\n' || diag( ' caught: ' || SQLSTATE || ': ' || SQLERRM || E'\n wanted: ' || COALESCE( errcode, 'an exception' ) || COALESCE( ': ' || errmsg, '') ); END IF; END; $$ LANGUAGE plpgsql; -- throws_ok ( sql, errcode, errmsg ) -- throws_ok ( sql, errmsg, description ) CREATE OR REPLACE FUNCTION throws_ok ( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ BEGIN IF octet_length($2) = 5 THEN RETURN throws_ok( $1, $2::char(5), $3, NULL ); ELSE RETURN throws_ok( $1, NULL, $2, $3 ); END IF; END; $$ LANGUAGE plpgsql; -- throws_ok ( query, errcode ) -- throws_ok ( query, errmsg ) CREATE OR REPLACE FUNCTION throws_ok ( TEXT, TEXT ) RETURNS TEXT AS $$ BEGIN IF octet_length($2) = 5 THEN RETURN throws_ok( $1, $2::char(5), NULL, NULL ); ELSE RETURN throws_ok( $1, NULL, $2, NULL ); END IF; END; $$ LANGUAGE plpgsql; -- throws_ok ( sql ) CREATE OR REPLACE FUNCTION throws_ok ( TEXT ) RETURNS TEXT AS $$ SELECT throws_ok( $1, NULL, NULL, NULL ); $$ LANGUAGE SQL; -- Magically cast integer error codes. -- throws_ok ( sql, errcode, errmsg, description ) CREATE OR REPLACE FUNCTION throws_ok ( TEXT, int4, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT throws_ok( $1, $2::char(5), $3, $4 ); $$ LANGUAGE SQL; -- throws_ok ( sql, errcode, errmsg ) CREATE OR REPLACE FUNCTION throws_ok ( TEXT, int4, TEXT ) RETURNS TEXT AS $$ SELECT throws_ok( $1, $2::char(5), $3, NULL ); $$ LANGUAGE SQL; -- throws_ok ( sql, errcode ) CREATE OR REPLACE FUNCTION throws_ok ( TEXT, int4 ) RETURNS TEXT AS $$ SELECT throws_ok( $1, $2::char(5), NULL, NULL ); $$ LANGUAGE SQL; -- lives_ok( sql, description ) CREATE OR REPLACE FUNCTION lives_ok ( TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE code TEXT := _query($1); descr ALIAS FOR $2; BEGIN EXECUTE code; RETURN ok( TRUE, descr ); EXCEPTION WHEN OTHERS THEN -- There should have been no exception. RETURN ok( FALSE, descr ) || E'\n' || diag( ' died: ' || SQLSTATE || ': ' || SQLERRM ); END; $$ LANGUAGE plpgsql; -- lives_ok( sql ) CREATE OR REPLACE FUNCTION lives_ok ( TEXT ) RETURNS TEXT AS $$ SELECT lives_ok( $1, NULL ); $$ LANGUAGE SQL; -- performs_ok ( sql, milliseconds, description ) CREATE OR REPLACE FUNCTION performs_ok ( TEXT, NUMERIC, TEXT ) RETURNS TEXT AS $$ DECLARE query TEXT := _query($1); max_time ALIAS FOR $2; descr ALIAS FOR $3; starts_at TEXT; act_time NUMERIC; BEGIN starts_at := timeofday(); EXECUTE query; act_time := extract( millisecond from timeofday()::timestamptz - starts_at::timestamptz); IF act_time < max_time THEN RETURN ok(TRUE, descr); END IF; RETURN ok( FALSE, descr ) || E'\n' || diag( ' runtime: ' || act_time || ' ms' || E'\n exceeds: ' || max_time || ' ms' ); END; $$ LANGUAGE plpgsql; -- performs_ok ( sql, milliseconds ) CREATE OR REPLACE FUNCTION performs_ok ( TEXT, NUMERIC ) RETURNS TEXT AS $$ SELECT performs_ok( $1, $2, 'Should run in less than ' || $2 || ' ms' ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION display_type ( OID, INTEGER ) RETURNS TEXT AS $$ SELECT COALESCE(substring( pg_catalog.format_type($1, $2), '(("(?!")([^"]|"")+"|[^.]+)([(][^)]+[)])?)$' ), '') $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION display_type ( NAME, OID, INTEGER ) RETURNS TEXT AS $$ SELECT CASE WHEN $1 IS NULL THEN '' ELSE quote_ident($1) || '.' END || display_type($2, $3) $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _ident_array_to_string( name[], text ) RETURNS text AS $$ SELECT array_to_string(ARRAY( SELECT quote_ident($1[i]) FROM generate_series(1, array_upper($1, 1)) s(i) ORDER BY i ), $2); $$ LANGUAGE SQL immutable; -- Borrowed from newsysviews. CREATE OR REPLACE VIEW tap_funky AS SELECT p.oid AS oid, n.nspname AS schema, p.proname AS name, array_to_string(p.proargtypes::regtype[], ',') AS args, CASE p.proretset WHEN TRUE THEN 'setof ' ELSE '' END || p.prorettype::regtype AS returns, p.prolang AS langoid, p.proisstrict AS is_strict, -- p.proisagg AS is_agg, p.prosecdef AS is_definer, p.proretset AS returns_set, p.provolatile::char AS volatility, pg_catalog.pg_function_is_visible(p.oid) AS is_visible FROM pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON p.pronamespace = n.oid ; CREATE OR REPLACE FUNCTION _got_func ( NAME, NAME, NAME[] ) RETURNS BOOLEAN AS $$ SELECT EXISTS( SELECT TRUE FROM tap_funky WHERE schema = $1 AND name = $2 AND args = array_to_string($3, ',') ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _got_func ( NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS( SELECT TRUE FROM tap_funky WHERE schema = $1 AND name = $2 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _got_func ( NAME, NAME[] ) RETURNS BOOLEAN AS $$ SELECT EXISTS( SELECT TRUE FROM tap_funky WHERE name = $1 AND args = array_to_string($2, ',') AND is_visible ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _got_func ( NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS( SELECT TRUE FROM tap_funky WHERE name = $1 AND is_visible); $$ LANGUAGE SQL; -- has_function( schema, function, args[], description ) CREATE OR REPLACE FUNCTION has_function ( NAME, NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT ok( _got_func($1, $2, $3), $4 ); $$ LANGUAGE SQL; -- has_function( schema, function, args[] ) CREATE OR REPLACE FUNCTION has_function( NAME, NAME, NAME[] ) RETURNS TEXT AS $$ SELECT ok( _got_func($1, $2, $3), 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '(' || array_to_string($3, ', ') || ') should exist' ); $$ LANGUAGE sql; -- has_function( schema, function, description ) CREATE OR REPLACE FUNCTION has_function ( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _got_func($1, $2), $3 ); $$ LANGUAGE SQL; -- has_function( schema, function ) CREATE OR REPLACE FUNCTION has_function( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _got_func($1, $2), 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '() should exist' ); $$ LANGUAGE sql; -- has_function( function, args[], description ) CREATE OR REPLACE FUNCTION has_function ( NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT ok( _got_func($1, $2), $3 ); $$ LANGUAGE SQL; -- has_function( function, args[] ) CREATE OR REPLACE FUNCTION has_function( NAME, NAME[] ) RETURNS TEXT AS $$ SELECT ok( _got_func($1, $2), 'Function ' || quote_ident($1) || '(' || array_to_string($2, ', ') || ') should exist' ); $$ LANGUAGE sql; -- has_function( function, description ) CREATE OR REPLACE FUNCTION has_function( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _got_func($1), $2 ); $$ LANGUAGE sql; -- has_function( function ) CREATE OR REPLACE FUNCTION has_function( NAME ) RETURNS TEXT AS $$ SELECT ok( _got_func($1), 'Function ' || quote_ident($1) || '() should exist' ); $$ LANGUAGE sql; -- hasnt_function( schema, function, args[], description ) CREATE OR REPLACE FUNCTION hasnt_function ( NAME, NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _got_func($1, $2, $3), $4 ); $$ LANGUAGE SQL; -- hasnt_function( schema, function, args[] ) CREATE OR REPLACE FUNCTION hasnt_function( NAME, NAME, NAME[] ) RETURNS TEXT AS $$ SELECT ok( NOT _got_func($1, $2, $3), 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '(' || array_to_string($3, ', ') || ') should not exist' ); $$ LANGUAGE sql; -- hasnt_function( schema, function, description ) CREATE OR REPLACE FUNCTION hasnt_function ( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _got_func($1, $2), $3 ); $$ LANGUAGE SQL; -- hasnt_function( schema, function ) CREATE OR REPLACE FUNCTION hasnt_function( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _got_func($1, $2), 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '() should not exist' ); $$ LANGUAGE sql; -- hasnt_function( function, args[], description ) CREATE OR REPLACE FUNCTION hasnt_function ( NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _got_func($1, $2), $3 ); $$ LANGUAGE SQL; -- hasnt_function( function, args[] ) CREATE OR REPLACE FUNCTION hasnt_function( NAME, NAME[] ) RETURNS TEXT AS $$ SELECT ok( NOT _got_func($1, $2), 'Function ' || quote_ident($1) || '(' || array_to_string($2, ', ') || ') should not exist' ); $$ LANGUAGE sql; -- hasnt_function( function, description ) CREATE OR REPLACE FUNCTION hasnt_function( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _got_func($1), $2 ); $$ LANGUAGE sql; -- hasnt_function( function ) CREATE OR REPLACE FUNCTION hasnt_function( NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _got_func($1), 'Function ' || quote_ident($1) || '() should not exist' ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _pg_sv_type_array( OID[] ) RETURNS NAME[] AS $$ SELECT ARRAY( SELECT t.typname FROM pg_catalog.pg_type t JOIN generate_series(1, array_upper($1, 1)) s(i) ON t.oid = $1[i] ORDER BY i ) $$ LANGUAGE SQL stable; -- can( schema, functions[], description ) CREATE OR REPLACE FUNCTION can ( NAME, NAME[], TEXT ) RETURNS TEXT AS $$ DECLARE missing text[]; BEGIN SELECT ARRAY( SELECT quote_ident($2[i]) FROM generate_series(1, array_upper($2, 1)) s(i) LEFT JOIN tap_funky ON name = $2[i] AND schema = $1 WHERE oid IS NULL GROUP BY $2[i], s.i ORDER BY MIN(s.i) ) INTO missing; IF missing[1] IS NULL THEN RETURN ok( true, $3 ); END IF; RETURN ok( false, $3 ) || E'\n' || diag( ' ' || quote_ident($1) || '.' || array_to_string( missing, E'() missing\n ' || quote_ident($1) || '.') || '() missing' ); END; $$ LANGUAGE plpgsql; -- can( schema, functions[] ) CREATE OR REPLACE FUNCTION can ( NAME, NAME[] ) RETURNS TEXT AS $$ SELECT can( $1, $2, 'Schema ' || quote_ident($1) || ' can' ); $$ LANGUAGE sql; -- can( functions[], description ) CREATE OR REPLACE FUNCTION can ( NAME[], TEXT ) RETURNS TEXT AS $$ DECLARE missing text[]; BEGIN SELECT ARRAY( SELECT quote_ident($1[i]) FROM generate_series(1, array_upper($1, 1)) s(i) LEFT JOIN pg_catalog.pg_proc p ON $1[i] = p.proname AND pg_catalog.pg_function_is_visible(p.oid) WHERE p.oid IS NULL ORDER BY s.i ) INTO missing; IF missing[1] IS NULL THEN RETURN ok( true, $2 ); END IF; RETURN ok( false, $2 ) || E'\n' || diag( ' ' || array_to_string( missing, E'() missing\n ') || '() missing' ); END; $$ LANGUAGE plpgsql; -- can( functions[] ) CREATE OR REPLACE FUNCTION can ( NAME[] ) RETURNS TEXT AS $$ SELECT can( $1, 'Schema ' || _ident_array_to_string(current_schemas(true), ' or ') || ' can' ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _has_type( NAME, NAME, CHAR[] ) RETURNS BOOLEAN AS $$ SELECT EXISTS( SELECT true FROM pg_catalog.pg_type t JOIN pg_catalog.pg_namespace n ON t.typnamespace = n.oid WHERE t.typisdefined AND n.nspname = $1 AND t.typname = $2 AND t.typtype = ANY( COALESCE($3, ARRAY['b', 'c', 'd', 'p', 'e']) ) ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _has_type( NAME, CHAR[] ) RETURNS BOOLEAN AS $$ SELECT EXISTS( SELECT true FROM pg_catalog.pg_type t WHERE t.typisdefined AND pg_catalog.pg_type_is_visible(t.oid) AND t.typname = $1 AND t.typtype = ANY( COALESCE($2, ARRAY['b', 'c', 'd', 'p', 'e']) ) ); $$ LANGUAGE sql; -- has_type( schema, type, description ) CREATE OR REPLACE FUNCTION has_type( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _has_type( $1, $2, NULL ), $3 ); $$ LANGUAGE sql; -- has_type( schema, type ) CREATE OR REPLACE FUNCTION has_type( NAME, NAME ) RETURNS TEXT AS $$ SELECT has_type( $1, $2, 'Type ' || quote_ident($1) || '.' || quote_ident($2) || ' should exist' ); $$ LANGUAGE sql; -- has_type( type, description ) CREATE OR REPLACE FUNCTION has_type( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _has_type( $1, NULL ), $2 ); $$ LANGUAGE sql; -- has_type( type ) CREATE OR REPLACE FUNCTION has_type( NAME ) RETURNS TEXT AS $$ SELECT ok( _has_type( $1, NULL ), ('Type ' || quote_ident($1) || ' should exist')::text ); $$ LANGUAGE sql; -- hasnt_type( schema, type, description ) CREATE OR REPLACE FUNCTION hasnt_type( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _has_type( $1, $2, NULL ), $3 ); $$ LANGUAGE sql; -- hasnt_type( schema, type ) CREATE OR REPLACE FUNCTION hasnt_type( NAME, NAME ) RETURNS TEXT AS $$ SELECT hasnt_type( $1, $2, 'Type ' || quote_ident($1) || '.' || quote_ident($2) || ' should not exist' ); $$ LANGUAGE sql; -- hasnt_type( type, description ) CREATE OR REPLACE FUNCTION hasnt_type( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _has_type( $1, NULL ), $2 ); $$ LANGUAGE sql; -- hasnt_type( type ) CREATE OR REPLACE FUNCTION hasnt_type( NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _has_type( $1, NULL ), ('Type ' || quote_ident($1) || ' should not exist')::text ); $$ LANGUAGE sql; -- has_domain( schema, domain, description ) CREATE OR REPLACE FUNCTION has_domain( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _has_type( $1, $2, ARRAY['d'] ), $3 ); $$ LANGUAGE sql; -- has_domain( schema, domain ) CREATE OR REPLACE FUNCTION has_domain( NAME, NAME ) RETURNS TEXT AS $$ SELECT has_domain( $1, $2, 'Domain ' || quote_ident($1) || '.' || quote_ident($2) || ' should exist' ); $$ LANGUAGE sql; -- has_domain( domain, description ) CREATE OR REPLACE FUNCTION has_domain( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _has_type( $1, ARRAY['d'] ), $2 ); $$ LANGUAGE sql; -- has_domain( domain ) CREATE OR REPLACE FUNCTION has_domain( NAME ) RETURNS TEXT AS $$ SELECT ok( _has_type( $1, ARRAY['d'] ), ('Domain ' || quote_ident($1) || ' should exist')::text ); $$ LANGUAGE sql; -- hasnt_domain( schema, domain, description ) CREATE OR REPLACE FUNCTION hasnt_domain( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _has_type( $1, $2, ARRAY['d'] ), $3 ); $$ LANGUAGE sql; -- hasnt_domain( schema, domain ) CREATE OR REPLACE FUNCTION hasnt_domain( NAME, NAME ) RETURNS TEXT AS $$ SELECT hasnt_domain( $1, $2, 'Domain ' || quote_ident($1) || '.' || quote_ident($2) || ' should not exist' ); $$ LANGUAGE sql; -- hasnt_domain( domain, description ) CREATE OR REPLACE FUNCTION hasnt_domain( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _has_type( $1, ARRAY['d'] ), $2 ); $$ LANGUAGE sql; -- hasnt_domain( domain ) CREATE OR REPLACE FUNCTION hasnt_domain( NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _has_type( $1, ARRAY['d'] ), ('Domain ' || quote_ident($1) || ' should not exist')::text ); $$ LANGUAGE sql; -- has_enum( schema, enum, description ) CREATE OR REPLACE FUNCTION has_enum( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _has_type( $1, $2, ARRAY['e'] ), $3 ); $$ LANGUAGE sql; -- has_enum( schema, enum ) CREATE OR REPLACE FUNCTION has_enum( NAME, NAME ) RETURNS TEXT AS $$ SELECT has_enum( $1, $2, 'Enum ' || quote_ident($1) || '.' || quote_ident($2) || ' should exist' ); $$ LANGUAGE sql; -- has_enum( enum, description ) CREATE OR REPLACE FUNCTION has_enum( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _has_type( $1, ARRAY['e'] ), $2 ); $$ LANGUAGE sql; -- has_enum( enum ) CREATE OR REPLACE FUNCTION has_enum( NAME ) RETURNS TEXT AS $$ SELECT ok( _has_type( $1, ARRAY['e'] ), ('Enum ' || quote_ident($1) || ' should exist')::text ); $$ LANGUAGE sql; -- hasnt_enum( schema, enum, description ) CREATE OR REPLACE FUNCTION hasnt_enum( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _has_type( $1, $2, ARRAY['e'] ), $3 ); $$ LANGUAGE sql; -- hasnt_enum( schema, enum ) CREATE OR REPLACE FUNCTION hasnt_enum( NAME, NAME ) RETURNS TEXT AS $$ SELECT hasnt_enum( $1, $2, 'Enum ' || quote_ident($1) || '.' || quote_ident($2) || ' should not exist' ); $$ LANGUAGE sql; -- hasnt_enum( enum, description ) CREATE OR REPLACE FUNCTION hasnt_enum( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _has_type( $1, ARRAY['e'] ), $2 ); $$ LANGUAGE sql; -- hasnt_enum( enum ) CREATE OR REPLACE FUNCTION hasnt_enum( NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _has_type( $1, ARRAY['e'] ), ('Enum ' || quote_ident($1) || ' should not exist')::text ); $$ LANGUAGE sql; -- enum_has_labels( schema, enum, labels, description ) CREATE OR REPLACE FUNCTION enum_has_labels( NAME, NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT is( ARRAY( SELECT e.enumlabel FROM pg_catalog.pg_type t JOIN pg_catalog.pg_enum e ON t.oid = e.enumtypid JOIN pg_catalog.pg_namespace n ON t.typnamespace = n.oid WHERE t.typisdefined AND n.nspname = $1 AND t.typname = $2 AND t.typtype = 'e' ORDER BY e.oid ), $3, $4 ); $$ LANGUAGE sql; -- enum_has_labels( schema, enum, labels ) CREATE OR REPLACE FUNCTION enum_has_labels( NAME, NAME, NAME[] ) RETURNS TEXT AS $$ SELECT enum_has_labels( $1, $2, $3, 'Enum ' || quote_ident($1) || '.' || quote_ident($2) || ' should have labels (' || array_to_string( $3, ', ' ) || ')' ); $$ LANGUAGE sql; -- enum_has_labels( enum, labels, description ) CREATE OR REPLACE FUNCTION enum_has_labels( NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT is( ARRAY( SELECT e.enumlabel FROM pg_catalog.pg_type t JOIN pg_catalog.pg_enum e ON t.oid = e.enumtypid WHERE t.typisdefined AND pg_catalog.pg_type_is_visible(t.oid) AND t.typname = $1 AND t.typtype = 'e' ORDER BY e.oid ), $2, $3 ); $$ LANGUAGE sql; -- enum_has_labels( enum, labels ) CREATE OR REPLACE FUNCTION enum_has_labels( NAME, NAME[] ) RETURNS TEXT AS $$ SELECT enum_has_labels( $1, $2, 'Enum ' || quote_ident($1) || ' should have labels (' || array_to_string( $2, ', ' ) || ')' ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _cmp_types(oid, name) RETURNS BOOLEAN AS $$ DECLARE dtype TEXT := display_type($1, NULL); BEGIN RETURN dtype = _quote_ident_like($2, dtype); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _cast_exists ( NAME, NAME, NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS ( SELECT TRUE FROM pg_catalog.pg_cast c JOIN pg_catalog.pg_proc p ON c.castfunc = p.oid JOIN pg_catalog.pg_namespace n ON p.pronamespace = n.oid WHERE _cmp_types(castsource, $1) AND _cmp_types(casttarget, $2) AND n.nspname = $3 AND p.proname = $4 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _cast_exists ( NAME, NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS ( SELECT TRUE FROM pg_catalog.pg_cast c JOIN pg_catalog.pg_proc p ON c.castfunc = p.oid WHERE _cmp_types(castsource, $1) AND _cmp_types(casttarget, $2) AND p.proname = $3 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _cast_exists ( NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS ( SELECT TRUE FROM pg_catalog.pg_cast c WHERE _cmp_types(castsource, $1) AND _cmp_types(casttarget, $2) ); $$ LANGUAGE SQL; -- has_cast( source_type, target_type, schema, function, description ) CREATE OR REPLACE FUNCTION has_cast ( NAME, NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _cast_exists( $1, $2, $3, $4 ), $5 ); $$ LANGUAGE SQL; -- has_cast( source_type, target_type, schema, function ) CREATE OR REPLACE FUNCTION has_cast ( NAME, NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _cast_exists( $1, $2, $3, $4 ), 'Cast (' || quote_ident($1) || ' AS ' || quote_ident($2) || ') WITH FUNCTION ' || quote_ident($3) || '.' || quote_ident($4) || '() should exist' ); $$ LANGUAGE SQL; -- has_cast( source_type, target_type, function, description ) CREATE OR REPLACE FUNCTION has_cast ( NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _cast_exists( $1, $2, $3 ), $4 ); $$ LANGUAGE SQL; -- has_cast( source_type, target_type, function ) CREATE OR REPLACE FUNCTION has_cast ( NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _cast_exists( $1, $2, $3 ), 'Cast (' || quote_ident($1) || ' AS ' || quote_ident($2) || ') WITH FUNCTION ' || quote_ident($3) || '() should exist' ); $$ LANGUAGE SQL; -- has_cast( source_type, target_type, description ) CREATE OR REPLACE FUNCTION has_cast ( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _cast_exists( $1, $2 ), $3 ); $$ LANGUAGE SQL; -- has_cast( source_type, target_type ) CREATE OR REPLACE FUNCTION has_cast ( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _cast_exists( $1, $2 ), 'Cast (' || quote_ident($1) || ' AS ' || quote_ident($2) || ') should exist' ); $$ LANGUAGE SQL; -- hasnt_cast( source_type, target_type, schema, function, description ) CREATE OR REPLACE FUNCTION hasnt_cast ( NAME, NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _cast_exists( $1, $2, $3, $4 ), $5 ); $$ LANGUAGE SQL; -- hasnt_cast( source_type, target_type, schema, function ) CREATE OR REPLACE FUNCTION hasnt_cast ( NAME, NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _cast_exists( $1, $2, $3, $4 ), 'Cast (' || quote_ident($1) || ' AS ' || quote_ident($2) || ') WITH FUNCTION ' || quote_ident($3) || '.' || quote_ident($4) || '() should not exist' ); $$ LANGUAGE SQL; -- hasnt_cast( source_type, target_type, function, description ) CREATE OR REPLACE FUNCTION hasnt_cast ( NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _cast_exists( $1, $2, $3 ), $4 ); $$ LANGUAGE SQL; -- hasnt_cast( source_type, target_type, function ) CREATE OR REPLACE FUNCTION hasnt_cast ( NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _cast_exists( $1, $2, $3 ), 'Cast (' || quote_ident($1) || ' AS ' || quote_ident($2) || ') WITH FUNCTION ' || quote_ident($3) || '() should not exist' ); $$ LANGUAGE SQL; -- hasnt_cast( source_type, target_type, description ) CREATE OR REPLACE FUNCTION hasnt_cast ( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _cast_exists( $1, $2 ), $3 ); $$ LANGUAGE SQL; -- hasnt_cast( source_type, target_type ) CREATE OR REPLACE FUNCTION hasnt_cast ( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _cast_exists( $1, $2 ), 'Cast (' || quote_ident($1) || ' AS ' || quote_ident($2) || ') should not exist' ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _expand_context( char ) RETURNS text AS $$ SELECT CASE $1 WHEN 'i' THEN 'implicit' WHEN 'a' THEN 'assignment' WHEN 'e' THEN 'explicit' ELSE 'unknown' END $$ LANGUAGE SQL IMMUTABLE; CREATE OR REPLACE FUNCTION _get_context( NAME, NAME ) RETURNS "char" AS $$ SELECT c.castcontext FROM pg_catalog.pg_cast c WHERE _cmp_types(castsource, $1) AND _cmp_types(casttarget, $2) $$ LANGUAGE SQL; -- cast_context_is( source_type, target_type, context, description ) CREATE OR REPLACE FUNCTION cast_context_is( NAME, NAME, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE want char = substring(LOWER($3) FROM 1 FOR 1); have char := _get_context($1, $2); BEGIN IF have IS NOT NULL THEN RETURN is( _expand_context(have), _expand_context(want), $4 ); END IF; RETURN ok( false, $4 ) || E'\n' || diag( ' Cast (' || quote_ident($1) || ' AS ' || quote_ident($2) || ') does not exist' ); END; $$ LANGUAGE plpgsql; -- cast_context_is( source_type, target_type, context ) CREATE OR REPLACE FUNCTION cast_context_is( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT cast_context_is( $1, $2, $3, 'Cast (' || quote_ident($1) || ' AS ' || quote_ident($2) || ') context should be ' || _expand_context(substring(LOWER($3) FROM 1 FOR 1)) ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _op_exists ( NAME, NAME, NAME, NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS ( SELECT TRUE FROM pg_catalog.pg_operator o JOIN pg_catalog.pg_namespace n ON o.oprnamespace = n.oid WHERE n.nspname = $2 AND o.oprname = $3 AND CASE o.oprkind WHEN 'l' THEN $1 IS NULL ELSE _cmp_types(o.oprleft, $1) END AND CASE o.oprkind WHEN 'r' THEN $4 IS NULL ELSE _cmp_types(o.oprright, $4) END AND _cmp_types(o.oprresult, $5) ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _op_exists ( NAME, NAME, NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS ( SELECT TRUE FROM pg_catalog.pg_operator o WHERE pg_catalog.pg_operator_is_visible(o.oid) AND o.oprname = $2 AND CASE o.oprkind WHEN 'l' THEN $1 IS NULL ELSE _cmp_types(o.oprleft, $1) END AND CASE o.oprkind WHEN 'r' THEN $3 IS NULL ELSE _cmp_types(o.oprright, $3) END AND _cmp_types(o.oprresult, $4) ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _op_exists ( NAME, NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS ( SELECT TRUE FROM pg_catalog.pg_operator o WHERE pg_catalog.pg_operator_is_visible(o.oid) AND o.oprname = $2 AND CASE o.oprkind WHEN 'l' THEN $1 IS NULL ELSE _cmp_types(o.oprleft, $1) END AND CASE o.oprkind WHEN 'r' THEN $3 IS NULL ELSE _cmp_types(o.oprright, $3) END ); $$ LANGUAGE SQL; -- has_operator( left_type, schema, name, right_type, return_type, description ) CREATE OR REPLACE FUNCTION has_operator ( NAME, NAME, NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _op_exists($1, $2, $3, $4, $5 ), $6 ); $$ LANGUAGE SQL; -- has_operator( left_type, schema, name, right_type, return_type ) CREATE OR REPLACE FUNCTION has_operator ( NAME, NAME, NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _op_exists($1, $2, $3, $4, $5 ), 'Operator ' || quote_ident($2) || '.' || $3 || '(' || $1 || ',' || $4 || ') RETURNS ' || $5 || ' should exist' ); $$ LANGUAGE SQL; -- has_operator( left_type, name, right_type, return_type, description ) CREATE OR REPLACE FUNCTION has_operator ( NAME, NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _op_exists($1, $2, $3, $4 ), $5 ); $$ LANGUAGE SQL; -- has_operator( left_type, name, right_type, return_type ) CREATE OR REPLACE FUNCTION has_operator ( NAME, NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _op_exists($1, $2, $3, $4 ), 'Operator ' || $2 || '(' || $1 || ',' || $3 || ') RETURNS ' || $4 || ' should exist' ); $$ LANGUAGE SQL; -- has_operator( left_type, name, right_type, description ) CREATE OR REPLACE FUNCTION has_operator ( NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _op_exists($1, $2, $3 ), $4 ); $$ LANGUAGE SQL; -- has_operator( left_type, name, right_type ) CREATE OR REPLACE FUNCTION has_operator ( NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _op_exists($1, $2, $3 ), 'Operator ' || $2 || '(' || $1 || ',' || $3 || ') should exist' ); $$ LANGUAGE SQL; -- has_leftop( schema, name, right_type, return_type, description ) CREATE OR REPLACE FUNCTION has_leftop ( NAME, NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _op_exists(NULL, $1, $2, $3, $4), $5 ); $$ LANGUAGE SQL; -- has_leftop( schema, name, right_type, return_type ) CREATE OR REPLACE FUNCTION has_leftop ( NAME, NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _op_exists(NULL, $1, $2, $3, $4 ), 'Left operator ' || quote_ident($1) || '.' || $2 || '(NONE,' || $3 || ') RETURNS ' || $4 || ' should exist' ); $$ LANGUAGE SQL; -- has_leftop( name, right_type, return_type, description ) CREATE OR REPLACE FUNCTION has_leftop ( NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _op_exists(NULL, $1, $2, $3), $4 ); $$ LANGUAGE SQL; -- has_leftop( name, right_type, return_type ) CREATE OR REPLACE FUNCTION has_leftop ( NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _op_exists(NULL, $1, $2, $3 ), 'Left operator ' || $1 || '(NONE,' || $2 || ') RETURNS ' || $3 || ' should exist' ); $$ LANGUAGE SQL; -- has_leftop( name, right_type, description ) CREATE OR REPLACE FUNCTION has_leftop ( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _op_exists(NULL, $1, $2), $3 ); $$ LANGUAGE SQL; -- has_leftop( name, right_type ) CREATE OR REPLACE FUNCTION has_leftop ( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _op_exists(NULL, $1, $2 ), 'Left operator ' || $1 || '(NONE,' || $2 || ') should exist' ); $$ LANGUAGE SQL; -- has_rightop( left_type, schema, name, return_type, description ) CREATE OR REPLACE FUNCTION has_rightop ( NAME, NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _op_exists( $1, $2, $3, NULL, $4), $5 ); $$ LANGUAGE SQL; -- has_rightop( left_type, schema, name, return_type ) CREATE OR REPLACE FUNCTION has_rightop ( NAME, NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _op_exists($1, $2, $3, NULL, $4 ), 'Right operator ' || quote_ident($2) || '.' || $3 || '(' || $1 || ',NONE) RETURNS ' || $4 || ' should exist' ); $$ LANGUAGE SQL; -- has_rightop( left_type, name, return_type, description ) CREATE OR REPLACE FUNCTION has_rightop ( NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _op_exists( $1, $2, NULL, $3), $4 ); $$ LANGUAGE SQL; -- has_rightop( left_type, name, return_type ) CREATE OR REPLACE FUNCTION has_rightop ( NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _op_exists($1, $2, NULL, $3 ), 'Right operator ' || $2 || '(' || $1 || ',NONE) RETURNS ' || $3 || ' should exist' ); $$ LANGUAGE SQL; -- has_rightop( left_type, name, description ) CREATE OR REPLACE FUNCTION has_rightop ( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _op_exists( $1, $2, NULL), $3 ); $$ LANGUAGE SQL; -- has_rightop( left_type, name ) CREATE OR REPLACE FUNCTION has_rightop ( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _op_exists($1, $2, NULL ), 'Right operator ' || $2 || '(' || $1 || ',NONE) should exist' ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _is_trusted( NAME ) RETURNS BOOLEAN AS $$ SELECT lanpltrusted FROM pg_catalog.pg_language WHERE lanname = $1; $$ LANGUAGE SQL; -- has_language( language, description) CREATE OR REPLACE FUNCTION has_language( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _is_trusted($1) IS NOT NULL, $2 ); $$ LANGUAGE SQL; -- has_language( language ) CREATE OR REPLACE FUNCTION has_language( NAME ) RETURNS TEXT AS $$ SELECT ok( _is_trusted($1) IS NOT NULL, 'Procedural language ' || quote_ident($1) || ' should exist' ); $$ LANGUAGE SQL; -- hasnt_language( language, description) CREATE OR REPLACE FUNCTION hasnt_language( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _is_trusted($1) IS NULL, $2 ); $$ LANGUAGE SQL; -- hasnt_language( language ) CREATE OR REPLACE FUNCTION hasnt_language( NAME ) RETURNS TEXT AS $$ SELECT ok( _is_trusted($1) IS NULL, 'Procedural language ' || quote_ident($1) || ' should not exist' ); $$ LANGUAGE SQL; -- language_is_trusted( language, description ) CREATE OR REPLACE FUNCTION language_is_trusted( NAME, TEXT ) RETURNS TEXT AS $$ DECLARE is_trusted boolean := _is_trusted($1); BEGIN IF is_trusted IS NULL THEN RETURN fail( $2 ) || E'\n' || diag( ' Procedural language ' || quote_ident($1) || ' does not exist') ; END IF; RETURN ok( is_trusted, $2 ); END; $$ LANGUAGE plpgsql; -- language_is_trusted( language ) CREATE OR REPLACE FUNCTION language_is_trusted( NAME ) RETURNS TEXT AS $$ SELECT language_is_trusted($1, 'Procedural language ' || quote_ident($1) || ' should be trusted' ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _opc_exists( NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS ( SELECT TRUE FROM pg_catalog.pg_opclass oc JOIN pg_catalog.pg_namespace n ON oc.opcnamespace = n.oid WHERE n.nspname = COALESCE($1, n.nspname) AND oc.opcname = $2 ); $$ LANGUAGE SQL; -- has_opclass( schema, name, description ) CREATE OR REPLACE FUNCTION has_opclass( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _opc_exists( $1, $2 ), $3 ); $$ LANGUAGE SQL; -- has_opclass( schema, name ) CREATE OR REPLACE FUNCTION has_opclass( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _opc_exists( $1, $2 ), 'Operator class ' || quote_ident($1) || '.' || quote_ident($2) || ' should exist' ); $$ LANGUAGE SQL; -- has_opclass( name, description ) CREATE OR REPLACE FUNCTION has_opclass( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( _opc_exists( NULL, $1 ), $2) $$ LANGUAGE SQL; -- has_opclass( name ) CREATE OR REPLACE FUNCTION has_opclass( NAME ) RETURNS TEXT AS $$ SELECT ok( _opc_exists( NULL, $1 ), 'Operator class ' || quote_ident($1) || ' should exist' ); $$ LANGUAGE SQL; -- hasnt_opclass( schema, name, description ) CREATE OR REPLACE FUNCTION hasnt_opclass( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _opc_exists( $1, $2 ), $3 ); $$ LANGUAGE SQL; -- hasnt_opclass( schema, name ) CREATE OR REPLACE FUNCTION hasnt_opclass( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _opc_exists( $1, $2 ), 'Operator class ' || quote_ident($1) || '.' || quote_ident($2) || ' should exist' ); $$ LANGUAGE SQL; -- hasnt_opclass( name, description ) CREATE OR REPLACE FUNCTION hasnt_opclass( NAME, TEXT ) RETURNS TEXT AS $$ SELECT ok( NOT _opc_exists( NULL, $1 ), $2) $$ LANGUAGE SQL; -- hasnt_opclass( name ) CREATE OR REPLACE FUNCTION hasnt_opclass( NAME ) RETURNS TEXT AS $$ SELECT ok( NOT _opc_exists( NULL, $1 ), 'Operator class ' || quote_ident($1) || ' should exist' ); $$ LANGUAGE SQL; -- opclasses_are( schema, opclasses[], description ) CREATE OR REPLACE FUNCTION _nosuch( NAME, NAME, NAME[]) RETURNS TEXT AS $$ SELECT E'\n' || diag( ' Function ' || CASE WHEN $1 IS NOT NULL THEN quote_ident($1) || '.' ELSE '' END || quote_ident($2) || '(' || array_to_string($3, ', ') || ') does not exist' ); $$ LANGUAGE SQL IMMUTABLE; CREATE OR REPLACE FUNCTION _func_compare( NAME, NAME, NAME[], anyelement, anyelement, TEXT) RETURNS TEXT AS $$ SELECT CASE WHEN $4 IS NULL THEN ok( FALSE, $6 ) || _nosuch($1, $2, $3) ELSE is( $4, $5, $6 ) END; $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _func_compare( NAME, NAME, NAME[], boolean, TEXT) RETURNS TEXT AS $$ SELECT CASE WHEN $4 IS NULL THEN ok( FALSE, $5 ) || _nosuch($1, $2, $3) ELSE ok( $4, $5 ) END; $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _func_compare( NAME, NAME, anyelement, anyelement, TEXT) RETURNS TEXT AS $$ SELECT CASE WHEN $3 IS NULL THEN ok( FALSE, $5 ) || _nosuch($1, $2, '{}') ELSE is( $3, $4, $5 ) END; $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _func_compare( NAME, NAME, boolean, TEXT) RETURNS TEXT AS $$ SELECT CASE WHEN $3 IS NULL THEN ok( FALSE, $4 ) || _nosuch($1, $2, '{}') ELSE ok( $3, $4 ) END; $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _lang ( NAME, NAME, NAME[] ) RETURNS NAME AS $$ SELECT l.lanname FROM tap_funky f JOIN pg_catalog.pg_language l ON f.langoid = l.oid WHERE f.schema = $1 and f.name = $2 AND f.args = array_to_string($3, ',') $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _lang ( NAME, NAME ) RETURNS NAME AS $$ SELECT l.lanname FROM tap_funky f JOIN pg_catalog.pg_language l ON f.langoid = l.oid WHERE f.schema = $1 and f.name = $2 $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _lang ( NAME, NAME[] ) RETURNS NAME AS $$ SELECT l.lanname FROM tap_funky f JOIN pg_catalog.pg_language l ON f.langoid = l.oid WHERE f.name = $1 AND f.args = array_to_string($2, ',') AND f.is_visible; $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _lang ( NAME ) RETURNS NAME AS $$ SELECT l.lanname FROM tap_funky f JOIN pg_catalog.pg_language l ON f.langoid = l.oid WHERE f.name = $1 AND f.is_visible; $$ LANGUAGE SQL; -- function_lang_is( schema, function, args[], language, description ) CREATE OR REPLACE FUNCTION function_lang_is( NAME, NAME, NAME[], NAME, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, $3, _lang($1, $2, $3), $4, $5 ); $$ LANGUAGE SQL; -- function_lang_is( schema, function, args[], language ) CREATE OR REPLACE FUNCTION function_lang_is( NAME, NAME, NAME[], NAME ) RETURNS TEXT AS $$ SELECT function_lang_is( $1, $2, $3, $4, 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '(' || array_to_string($3, ', ') || ') should be written in ' || quote_ident($4) ); $$ LANGUAGE SQL; -- function_lang_is( schema, function, language, description ) CREATE OR REPLACE FUNCTION function_lang_is( NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, _lang($1, $2), $3, $4 ); $$ LANGUAGE SQL; -- function_lang_is( schema, function, language ) CREATE OR REPLACE FUNCTION function_lang_is( NAME, NAME, NAME ) RETURNS TEXT AS $$ SELECT function_lang_is( $1, $2, $3, 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '() should be written in ' || quote_ident($3) ); $$ LANGUAGE SQL; -- function_lang_is( function, args[], language, description ) CREATE OR REPLACE FUNCTION function_lang_is( NAME, NAME[], NAME, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, $2, _lang($1, $2), $3, $4 ); $$ LANGUAGE SQL; -- function_lang_is( function, args[], language ) CREATE OR REPLACE FUNCTION function_lang_is( NAME, NAME[], NAME ) RETURNS TEXT AS $$ SELECT function_lang_is( $1, $2, $3, 'Function ' || quote_ident($1) || '(' || array_to_string($2, ', ') || ') should be written in ' || quote_ident($3) ); $$ LANGUAGE SQL; -- function_lang_is( function, language, description ) CREATE OR REPLACE FUNCTION function_lang_is( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, _lang($1), $2, $3 ); $$ LANGUAGE SQL; -- function_lang_is( function, language ) CREATE OR REPLACE FUNCTION function_lang_is( NAME, NAME ) RETURNS TEXT AS $$ SELECT function_lang_is( $1, $2, 'Function ' || quote_ident($1) || '() should be written in ' || quote_ident($2) ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _returns ( NAME, NAME, NAME[] ) RETURNS TEXT AS $$ SELECT returns FROM tap_funky WHERE schema = $1 AND name = $2 AND args = array_to_string($3, ',') $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _returns ( NAME, NAME ) RETURNS TEXT AS $$ SELECT returns FROM tap_funky WHERE schema = $1 AND name = $2 $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _returns ( NAME, NAME[] ) RETURNS TEXT AS $$ SELECT returns FROM tap_funky WHERE name = $1 AND args = array_to_string($2, ',') AND is_visible; $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _returns ( NAME ) RETURNS TEXT AS $$ SELECT returns FROM tap_funky WHERE name = $1 AND is_visible; $$ LANGUAGE SQL; -- function_returns( schema, function, args[], type, description ) CREATE OR REPLACE FUNCTION function_returns( NAME, NAME, NAME[], TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, $3, _returns($1, $2, $3), $4, $5 ); $$ LANGUAGE SQL; -- function_returns( schema, function, args[], type ) CREATE OR REPLACE FUNCTION function_returns( NAME, NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT function_returns( $1, $2, $3, $4, 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '(' || array_to_string($3, ', ') || ') should return ' || $4 ); $$ LANGUAGE SQL; -- function_returns( schema, function, type, description ) CREATE OR REPLACE FUNCTION function_returns( NAME, NAME, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, _returns($1, $2), $3, $4 ); $$ LANGUAGE SQL; -- function_returns( schema, function, type ) CREATE OR REPLACE FUNCTION function_returns( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT function_returns( $1, $2, $3, 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '() should return ' || $3 ); $$ LANGUAGE SQL; -- function_returns( function, args[], type, description ) CREATE OR REPLACE FUNCTION function_returns( NAME, NAME[], TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, $2, _returns($1, $2), $3, $4 ); $$ LANGUAGE SQL; -- function_returns( function, args[], type ) CREATE OR REPLACE FUNCTION function_returns( NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT function_returns( $1, $2, $3, 'Function ' || quote_ident($1) || '(' || array_to_string($2, ', ') || ') should return ' || $3 ); $$ LANGUAGE SQL; -- function_returns( function, type, description ) CREATE OR REPLACE FUNCTION function_returns( NAME, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, _returns($1), $2, $3 ); $$ LANGUAGE SQL; -- function_returns( function, type ) CREATE OR REPLACE FUNCTION function_returns( NAME, TEXT ) RETURNS TEXT AS $$ SELECT function_returns( $1, $2, 'Function ' || quote_ident($1) || '() should return ' || $2 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _definer ( NAME, NAME, NAME[] ) RETURNS BOOLEAN AS $$ SELECT is_definer FROM tap_funky WHERE schema = $1 AND name = $2 AND args = array_to_string($3, ',') $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _definer ( NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT is_definer FROM tap_funky WHERE schema = $1 AND name = $2 $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _definer ( NAME, NAME[] ) RETURNS BOOLEAN AS $$ SELECT is_definer FROM tap_funky WHERE name = $1 AND args = array_to_string($2, ',') AND is_visible; $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _definer ( NAME ) RETURNS BOOLEAN AS $$ SELECT is_definer FROM tap_funky WHERE name = $1 AND is_visible; $$ LANGUAGE SQL; -- is_definer( schema, function, args[], description ) CREATE OR REPLACE FUNCTION is_definer ( NAME, NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, $3, _definer($1, $2, $3), $4 ); $$ LANGUAGE SQL; -- is_definer( schema, function, args[] ) CREATE OR REPLACE FUNCTION is_definer( NAME, NAME, NAME[] ) RETURNS TEXT AS $$ SELECT ok( _definer($1, $2, $3), 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '(' || array_to_string($3, ', ') || ') should be security definer' ); $$ LANGUAGE sql; -- is_definer( schema, function, description ) CREATE OR REPLACE FUNCTION is_definer ( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, _definer($1, $2), $3 ); $$ LANGUAGE SQL; -- is_definer( schema, function ) CREATE OR REPLACE FUNCTION is_definer( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _definer($1, $2), 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '() should be security definer' ); $$ LANGUAGE sql; -- is_definer( function, args[], description ) CREATE OR REPLACE FUNCTION is_definer ( NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, $2, _definer($1, $2), $3 ); $$ LANGUAGE SQL; -- is_definer( function, args[] ) CREATE OR REPLACE FUNCTION is_definer( NAME, NAME[] ) RETURNS TEXT AS $$ SELECT ok( _definer($1, $2), 'Function ' || quote_ident($1) || '(' || array_to_string($2, ', ') || ') should be security definer' ); $$ LANGUAGE sql; -- is_definer( function, description ) CREATE OR REPLACE FUNCTION is_definer( NAME, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, _definer($1), $2 ); $$ LANGUAGE sql; -- is_definer( function ) CREATE OR REPLACE FUNCTION is_definer( NAME ) RETURNS TEXT AS $$ SELECT ok( _definer($1), 'Function ' || quote_ident($1) || '() should be security definer' ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _strict ( NAME, NAME, NAME[] ) RETURNS BOOLEAN AS $$ SELECT is_strict FROM tap_funky WHERE schema = $1 AND name = $2 AND args = array_to_string($3, ',') $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _strict ( NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT is_strict FROM tap_funky WHERE schema = $1 AND name = $2 $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _strict ( NAME, NAME[] ) RETURNS BOOLEAN AS $$ SELECT is_strict FROM tap_funky WHERE name = $1 AND args = array_to_string($2, ',') AND is_visible; $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _strict ( NAME ) RETURNS BOOLEAN AS $$ SELECT is_strict FROM tap_funky WHERE name = $1 AND is_visible; $$ LANGUAGE SQL; -- is_strict( schema, function, args[], description ) CREATE OR REPLACE FUNCTION is_strict ( NAME, NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, $3, _strict($1, $2, $3), $4 ); $$ LANGUAGE SQL; -- is_strict( schema, function, args[] ) CREATE OR REPLACE FUNCTION is_strict( NAME, NAME, NAME[] ) RETURNS TEXT AS $$ SELECT ok( _strict($1, $2, $3), 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '(' || array_to_string($3, ', ') || ') should be strict' ); $$ LANGUAGE sql; -- is_strict( schema, function, description ) CREATE OR REPLACE FUNCTION is_strict ( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, _strict($1, $2), $3 ); $$ LANGUAGE SQL; -- is_strict( schema, function ) CREATE OR REPLACE FUNCTION is_strict( NAME, NAME ) RETURNS TEXT AS $$ SELECT ok( _strict($1, $2), 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '() should be strict' ); $$ LANGUAGE sql; -- is_strict( function, args[], description ) CREATE OR REPLACE FUNCTION is_strict ( NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, $2, _strict($1, $2), $3 ); $$ LANGUAGE SQL; -- is_strict( function, args[] ) CREATE OR REPLACE FUNCTION is_strict( NAME, NAME[] ) RETURNS TEXT AS $$ SELECT ok( _strict($1, $2), 'Function ' || quote_ident($1) || '(' || array_to_string($2, ', ') || ') should be strict' ); $$ LANGUAGE sql; -- is_strict( function, description ) CREATE OR REPLACE FUNCTION is_strict( NAME, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, _strict($1), $2 ); $$ LANGUAGE sql; -- is_strict( function ) CREATE OR REPLACE FUNCTION is_strict( NAME ) RETURNS TEXT AS $$ SELECT ok( _strict($1), 'Function ' || quote_ident($1) || '() should be strict' ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _expand_vol( char ) RETURNS TEXT AS $$ SELECT CASE $1 WHEN 'i' THEN 'IMMUTABLE' WHEN 's' THEN 'STABLE' WHEN 'v' THEN 'VOLATILE' ELSE 'UNKNOWN' END $$ LANGUAGE SQL IMMUTABLE; CREATE OR REPLACE FUNCTION _refine_vol( text ) RETURNS text AS $$ SELECT _expand_vol(substring(LOWER($1) FROM 1 FOR 1)::char); $$ LANGUAGE SQL IMMUTABLE; CREATE OR REPLACE FUNCTION _vol ( NAME, NAME, NAME[] ) RETURNS TEXT AS $$ SELECT _expand_vol(volatility) FROM tap_funky f WHERE f.schema = $1 and f.name = $2 AND f.args = array_to_string($3, ',') $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _vol ( NAME, NAME ) RETURNS TEXT AS $$ SELECT _expand_vol(volatility) FROM tap_funky f WHERE f.schema = $1 and f.name = $2 $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _vol ( NAME, NAME[] ) RETURNS TEXT AS $$ SELECT _expand_vol(volatility) FROM tap_funky f WHERE f.name = $1 AND f.args = array_to_string($2, ',') AND f.is_visible; $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _vol ( NAME ) RETURNS TEXT AS $$ SELECT _expand_vol(volatility) FROM tap_funky f WHERE f.name = $1 AND f.is_visible; $$ LANGUAGE SQL; -- volatility_is( schema, function, args[], volatility, description ) CREATE OR REPLACE FUNCTION volatility_is( NAME, NAME, NAME[], TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, $3, _vol($1, $2, $3), _refine_vol($4), $5 ); $$ LANGUAGE SQL; -- volatility_is( schema, function, args[], volatility ) CREATE OR REPLACE FUNCTION volatility_is( NAME, NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT volatility_is( $1, $2, $3, $4, 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '(' || array_to_string($3, ', ') || ') should be ' || _refine_vol($4) ); $$ LANGUAGE SQL; -- volatility_is( schema, function, volatility, description ) CREATE OR REPLACE FUNCTION volatility_is( NAME, NAME, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare($1, $2, _vol($1, $2), _refine_vol($3), $4 ); $$ LANGUAGE SQL; -- volatility_is( schema, function, volatility ) CREATE OR REPLACE FUNCTION volatility_is( NAME, NAME, TEXT ) RETURNS TEXT AS $$ SELECT volatility_is( $1, $2, $3, 'Function ' || quote_ident($1) || '.' || quote_ident($2) || '() should be ' || _refine_vol($3) ); $$ LANGUAGE SQL; -- volatility_is( function, args[], volatility, description ) CREATE OR REPLACE FUNCTION volatility_is( NAME, NAME[], TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, $2, _vol($1, $2), _refine_vol($3), $4 ); $$ LANGUAGE SQL; -- volatility_is( function, args[], volatility ) CREATE OR REPLACE FUNCTION volatility_is( NAME, NAME[], TEXT ) RETURNS TEXT AS $$ SELECT volatility_is( $1, $2, $3, 'Function ' || quote_ident($1) || '(' || array_to_string($2, ', ') || ') should be ' || _refine_vol($3) ); $$ LANGUAGE SQL; -- volatility_is( function, volatility, description ) CREATE OR REPLACE FUNCTION volatility_is( NAME, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _func_compare(NULL, $1, _vol($1), _refine_vol($2), $3 ); $$ LANGUAGE SQL; -- volatility_is( function, volatility ) CREATE OR REPLACE FUNCTION volatility_is( NAME, TEXT ) RETURNS TEXT AS $$ SELECT volatility_is( $1, $2, 'Function ' || quote_ident($1) || '() should be ' || _refine_vol($2) ); $$ LANGUAGE SQL; -- check_test( test_output, pass, name, description, diag, match_diag ) CREATE OR REPLACE FUNCTION findfuncs( NAME, TEXT ) RETURNS TEXT[] AS $$ SELECT ARRAY( SELECT DISTINCT quote_ident(n.nspname) || '.' || quote_ident(p.proname) AS pname FROM pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON p.pronamespace = n.oid WHERE n.nspname = $1 AND p.proname ~ $2 ORDER BY pname ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION findfuncs( TEXT ) RETURNS TEXT[] AS $$ SELECT ARRAY( SELECT DISTINCT quote_ident(n.nspname) || '.' || quote_ident(p.proname) AS pname FROM pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON p.pronamespace = n.oid WHERE pg_catalog.pg_function_is_visible(p.oid) AND p.proname ~ $1 ORDER BY pname ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _runem( text[], boolean ) RETURNS SETOF TEXT AS $$ DECLARE tap text; lbound int := array_lower($1, 1); BEGIN IF lbound IS NULL THEN RETURN; END IF; FOR i IN lbound..array_upper($1, 1) LOOP -- Send the name of the function to diag if warranted. IF $2 THEN RETURN NEXT diag( $1[i] || '()' ); END IF; -- Execute the tap function and return its results. FOR tap IN EXECUTE 'SELECT * FROM ' || $1[i] || '()' LOOP RETURN NEXT tap; END LOOP; END LOOP; RETURN; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _is_verbose() RETURNS BOOLEAN AS $$ SELECT current_setting('client_min_messages') NOT IN ( 'warning', 'error', 'fatal', 'panic' ); $$ LANGUAGE sql STABLE; -- do_tap( schema, pattern ) CREATE OR REPLACE FUNCTION do_tap( name, text ) RETURNS SETOF TEXT AS $$ SELECT * FROM _runem( findfuncs($1, $2), _is_verbose() ); $$ LANGUAGE sql; -- do_tap( schema ) CREATE OR REPLACE FUNCTION do_tap( name ) RETURNS SETOF TEXT AS $$ SELECT * FROM _runem( findfuncs($1, '^test'), _is_verbose() ); $$ LANGUAGE sql; -- do_tap( pattern ) CREATE OR REPLACE FUNCTION do_tap( text ) RETURNS SETOF TEXT AS $$ SELECT * FROM _runem( findfuncs($1), _is_verbose() ); $$ LANGUAGE sql; -- do_tap() CREATE OR REPLACE FUNCTION do_tap( ) RETURNS SETOF TEXT AS $$ SELECT * FROM _runem( findfuncs('^test'), _is_verbose()); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _currtest() RETURNS INTEGER AS $$ BEGIN RETURN currval('__tresults___numb_seq'); EXCEPTION WHEN object_not_in_prerequisite_state THEN RETURN 0; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _cleanup() RETURNS boolean AS $$ DROP TABLE __tresults__; DROP SEQUENCE __tresults___numb_seq; DROP TABLE __tcache__; DROP SEQUENCE __tcache___id_seq; SELECT TRUE; $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _runner( text[], text[], text[], text[], text[] ) RETURNS SETOF TEXT AS $$ DECLARE startup ALIAS FOR $1; shutdown ALIAS FOR $2; setup ALIAS FOR $3; teardown ALIAS FOR $4; tests ALIAS FOR $5; tap text; verbos boolean := _is_verbose(); -- verbose is a reserved word in 8.5. num_faild INTEGER := 0; BEGIN BEGIN -- No plan support. PERFORM * FROM no_plan(); FOR tap IN SELECT * FROM _runem(startup, false) LOOP RETURN NEXT tap; END LOOP; EXCEPTION -- Catch all exceptions and simply rethrow custom exceptions. This -- will roll back everything in the above block. WHEN raise_exception THEN RAISE EXCEPTION '%', SQLERRM; END; BEGIN FOR i IN 1..array_upper(tests, 1) LOOP BEGIN -- What test are we running? IF verbos THEN RETURN NEXT diag(tests[i] || '()'); END IF; -- Run the setup functions. FOR tap IN SELECT * FROM _runem(setup, false) LOOP RETURN NEXT tap; END LOOP; -- Run the actual test function. FOR tap IN EXECUTE 'SELECT * FROM ' || tests[i] || '()' LOOP RETURN NEXT tap; END LOOP; -- Run the teardown functions. FOR tap IN SELECT * FROM _runem(teardown, false) LOOP RETURN NEXT tap; END LOOP; -- Remember how many failed and then roll back. num_faild := num_faild + num_failed(); RAISE EXCEPTION '__TAP_ROLLBACK__'; EXCEPTION WHEN raise_exception THEN IF SQLERRM <> '__TAP_ROLLBACK__' THEN -- We didn't raise it, so propagate it. RAISE EXCEPTION '%', SQLERRM; END IF; END; END LOOP; -- Run the shutdown functions. FOR tap IN SELECT * FROM _runem(shutdown, false) LOOP RETURN NEXT tap; END LOOP; -- Raise an exception to rollback any changes. RAISE EXCEPTION '__TAP_ROLLBACK__'; EXCEPTION WHEN raise_exception THEN IF SQLERRM <> '__TAP_ROLLBACK__' THEN -- We didn't raise it, so propagate it. RAISE EXCEPTION '%', SQLERRM; END IF; END; -- Finish up. FOR tap IN SELECT * FROM _finish( currval('__tresults___numb_seq')::integer, 0, num_faild ) LOOP RETURN NEXT tap; END LOOP; -- Clean up and return. PERFORM _cleanup(); RETURN; END; $$ LANGUAGE plpgsql; -- runtests( schema, match ) CREATE OR REPLACE FUNCTION runtests( NAME, TEXT ) RETURNS SETOF TEXT AS $$ SELECT * FROM _runner( findfuncs( $1, '^startup' ), findfuncs( $1, '^shutdown' ), findfuncs( $1, '^setup' ), findfuncs( $1, '^teardown' ), findfuncs( $1, $2 ) ); $$ LANGUAGE sql; -- runtests( schema ) CREATE OR REPLACE FUNCTION runtests( NAME ) RETURNS SETOF TEXT AS $$ SELECT * FROM runtests( $1, '^test' ); $$ LANGUAGE sql; -- runtests( match ) CREATE OR REPLACE FUNCTION runtests( TEXT ) RETURNS SETOF TEXT AS $$ SELECT * FROM _runner( findfuncs( '^startup' ), findfuncs( '^shutdown' ), findfuncs( '^setup' ), findfuncs( '^teardown' ), findfuncs( $1 ) ); $$ LANGUAGE sql; -- runtests( ) CREATE OR REPLACE FUNCTION runtests( ) RETURNS SETOF TEXT AS $$ SELECT * FROM runtests( '^test' ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _temptable ( TEXT, TEXT ) RETURNS TEXT AS $$ BEGIN EXECUTE 'CREATE TEMP TABLE ' || $2 || ' AS ' || _query($1); return $2; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _temptable ( anyarray, TEXT ) RETURNS TEXT AS $$ BEGIN CREATE TEMP TABLE _____coltmp___ AS SELECT $1[i] FROM generate_series(array_lower($1, 1), array_upper($1, 1)) s(i); EXECUTE 'ALTER TABLE _____coltmp___ RENAME TO ' || $2; return $2; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _temptypes( TEXT ) RETURNS TEXT AS $$ SELECT array_to_string(ARRAY( SELECT pg_catalog.format_type(a.atttypid, a.atttypmod) FROM pg_catalog.pg_attribute a JOIN pg_catalog.pg_class c ON a.attrelid = c.oid JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid WHERE c.relname = $1 AND n.nspname LIKE 'pg_temp%' AND attnum > 0 AND NOT attisdropped ORDER BY attnum ), ','); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _docomp( TEXT, TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE have ALIAS FOR $1; want ALIAS FOR $2; extras TEXT[] := '{}'; missing TEXT[] := '{}'; res BOOLEAN := TRUE; msg TEXT := ''; rec RECORD; BEGIN BEGIN -- Find extra records. FOR rec in EXECUTE 'SELECT * FROM ' || have || ' EXCEPT ' || $4 || 'SELECT * FROM ' || want LOOP extras := extras || rec::text; END LOOP; -- Find missing records. FOR rec in EXECUTE 'SELECT * FROM ' || want || ' EXCEPT ' || $4 || 'SELECT * FROM ' || have LOOP missing := missing || rec::text; END LOOP; -- Drop the temporary tables. EXECUTE 'DROP TABLE ' || have; EXECUTE 'DROP TABLE ' || want; EXCEPTION WHEN syntax_error OR datatype_mismatch THEN msg := E'\n' || diag( E' Columns differ between queries:\n' || ' have: (' || _temptypes(have) || E')\n' || ' want: (' || _temptypes(want) || ')' ); EXECUTE 'DROP TABLE ' || have; EXECUTE 'DROP TABLE ' || want; RETURN ok(FALSE, $3) || msg; END; -- What extra records do we have? IF extras[1] IS NOT NULL THEN res := FALSE; msg := E'\n' || diag( E' Extra records:\n ' || array_to_string( extras, E'\n ' ) ); END IF; -- What missing records do we have? IF missing[1] IS NOT NULL THEN res := FALSE; msg := msg || E'\n' || diag( E' Missing records:\n ' || array_to_string( missing, E'\n ' ) ); END IF; RETURN ok(res, $3) || msg; END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _relcomp( TEXT, TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _docomp( _temptable( $1, '__taphave__' ), _temptable( $2, '__tapwant__' ), $3, $4 ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _relcomp( TEXT, anyarray, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _docomp( _temptable( $1, '__taphave__' ), _temptable( $2, '__tapwant__' ), $3, $4 ); $$ LANGUAGE sql; -- set_eq( sql, sql, description ) CREATE OR REPLACE FUNCTION set_eq( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, $3, '' ); $$ LANGUAGE sql; -- set_eq( sql, sql ) CREATE OR REPLACE FUNCTION set_eq( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, NULL::text, '' ); $$ LANGUAGE sql; -- set_eq( sql, array, description ) CREATE OR REPLACE FUNCTION set_eq( TEXT, anyarray, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, $3, '' ); $$ LANGUAGE sql; -- set_eq( sql, array ) CREATE OR REPLACE FUNCTION set_eq( TEXT, anyarray ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, NULL::text, '' ); $$ LANGUAGE sql; -- bag_eq( sql, sql, description ) CREATE OR REPLACE FUNCTION bag_eq( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, $3, 'ALL ' ); $$ LANGUAGE sql; -- bag_eq( sql, sql ) CREATE OR REPLACE FUNCTION bag_eq( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, NULL::text, 'ALL ' ); $$ LANGUAGE sql; -- bag_eq( sql, array, description ) CREATE OR REPLACE FUNCTION bag_eq( TEXT, anyarray, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, $3, 'ALL ' ); $$ LANGUAGE sql; -- bag_eq( sql, array ) CREATE OR REPLACE FUNCTION bag_eq( TEXT, anyarray ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, NULL::text, 'ALL ' ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _do_ne( TEXT, TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE have ALIAS FOR $1; want ALIAS FOR $2; extras TEXT[] := '{}'; missing TEXT[] := '{}'; res BOOLEAN := TRUE; msg TEXT := ''; BEGIN BEGIN -- Find extra records. EXECUTE 'SELECT EXISTS ( ' || '( SELECT * FROM ' || have || ' EXCEPT ' || $4 || ' SELECT * FROM ' || want || ' ) UNION ( ' || ' SELECT * FROM ' || want || ' EXCEPT ' || $4 || ' SELECT * FROM ' || have || ' ) LIMIT 1 )' INTO res; -- Drop the temporary tables. EXECUTE 'DROP TABLE ' || have; EXECUTE 'DROP TABLE ' || want; EXCEPTION WHEN syntax_error OR datatype_mismatch THEN msg := E'\n' || diag( E' Columns differ between queries:\n' || ' have: (' || _temptypes(have) || E')\n' || ' want: (' || _temptypes(want) || ')' ); EXECUTE 'DROP TABLE ' || have; EXECUTE 'DROP TABLE ' || want; RETURN ok(FALSE, $3) || msg; END; -- Return the value from the query. RETURN ok(res, $3); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _relne( TEXT, TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _do_ne( _temptable( $1, '__taphave__' ), _temptable( $2, '__tapwant__' ), $3, $4 ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _relne( TEXT, anyarray, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _do_ne( _temptable( $1, '__taphave__' ), _temptable( $2, '__tapwant__' ), $3, $4 ); $$ LANGUAGE sql; -- set_ne( sql, sql, description ) CREATE OR REPLACE FUNCTION set_ne( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relne( $1, $2, $3, '' ); $$ LANGUAGE sql; -- set_ne( sql, sql ) CREATE OR REPLACE FUNCTION set_ne( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relne( $1, $2, NULL::text, '' ); $$ LANGUAGE sql; -- set_ne( sql, array, description ) CREATE OR REPLACE FUNCTION set_ne( TEXT, anyarray, TEXT ) RETURNS TEXT AS $$ SELECT _relne( $1, $2, $3, '' ); $$ LANGUAGE sql; -- set_ne( sql, array ) CREATE OR REPLACE FUNCTION set_ne( TEXT, anyarray ) RETURNS TEXT AS $$ SELECT _relne( $1, $2, NULL::text, '' ); $$ LANGUAGE sql; -- bag_ne( sql, sql, description ) CREATE OR REPLACE FUNCTION bag_ne( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relne( $1, $2, $3, 'ALL ' ); $$ LANGUAGE sql; -- bag_ne( sql, sql ) CREATE OR REPLACE FUNCTION bag_ne( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relne( $1, $2, NULL::text, 'ALL ' ); $$ LANGUAGE sql; -- bag_ne( sql, array, description ) CREATE OR REPLACE FUNCTION bag_ne( TEXT, anyarray, TEXT ) RETURNS TEXT AS $$ SELECT _relne( $1, $2, $3, 'ALL ' ); $$ LANGUAGE sql; -- bag_ne( sql, array ) CREATE OR REPLACE FUNCTION bag_ne( TEXT, anyarray ) RETURNS TEXT AS $$ SELECT _relne( $1, $2, NULL::text, 'ALL ' ); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _relcomp( TEXT, TEXT, TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE have TEXT := _temptable( $1, '__taphave__' ); want TEXT := _temptable( $2, '__tapwant__' ); results TEXT[] := '{}'; res BOOLEAN := TRUE; msg TEXT := ''; rec RECORD; BEGIN BEGIN -- Find relevant records. FOR rec in EXECUTE 'SELECT * FROM ' || want || ' ' || $4 || ' SELECT * FROM ' || have LOOP results := results || rec::text; END LOOP; -- Drop the temporary tables. EXECUTE 'DROP TABLE ' || have; EXECUTE 'DROP TABLE ' || want; EXCEPTION WHEN syntax_error OR datatype_mismatch THEN msg := E'\n' || diag( E' Columns differ between queries:\n' || ' have: (' || _temptypes(have) || E')\n' || ' want: (' || _temptypes(want) || ')' ); EXECUTE 'DROP TABLE ' || have; EXECUTE 'DROP TABLE ' || want; RETURN ok(FALSE, $3) || msg; END; -- What records do we have? IF results[1] IS NOT NULL THEN res := FALSE; msg := msg || E'\n' || diag( ' ' || $5 || E' records:\n ' || array_to_string( results, E'\n ' ) ); END IF; RETURN ok(res, $3) || msg; END; $$ LANGUAGE plpgsql; -- set_has( sql, sql, description ) CREATE OR REPLACE FUNCTION set_has( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, $3, 'EXCEPT', 'Missing' ); $$ LANGUAGE sql; -- set_has( sql, sql ) CREATE OR REPLACE FUNCTION set_has( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, NULL::TEXT, 'EXCEPT', 'Missing' ); $$ LANGUAGE sql; -- bag_has( sql, sql, description ) CREATE OR REPLACE FUNCTION bag_has( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, $3, 'EXCEPT ALL', 'Missing' ); $$ LANGUAGE sql; -- bag_has( sql, sql ) CREATE OR REPLACE FUNCTION bag_has( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, NULL::TEXT, 'EXCEPT ALL', 'Missing' ); $$ LANGUAGE sql; -- set_hasnt( sql, sql, description ) CREATE OR REPLACE FUNCTION set_hasnt( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, $3, 'INTERSECT', 'Extra' ); $$ LANGUAGE sql; -- set_hasnt( sql, sql ) CREATE OR REPLACE FUNCTION set_hasnt( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, NULL::TEXT, 'INTERSECT', 'Extra' ); $$ LANGUAGE sql; -- bag_hasnt( sql, sql, description ) CREATE OR REPLACE FUNCTION bag_hasnt( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, $3, 'INTERSECT ALL', 'Extra' ); $$ LANGUAGE sql; -- bag_hasnt( sql, sql ) CREATE OR REPLACE FUNCTION bag_hasnt( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT _relcomp( $1, $2, NULL::TEXT, 'INTERSECT ALL', 'Extra' ); $$ LANGUAGE sql; -- results_eq( cursor, cursor, description ) CREATE OR REPLACE FUNCTION results_eq( refcursor, refcursor, text ) RETURNS TEXT AS $$ DECLARE have ALIAS FOR $1; want ALIAS FOR $2; have_rec RECORD; want_rec RECORD; have_found BOOLEAN; want_found BOOLEAN; rownum INTEGER := 1; BEGIN FETCH have INTO have_rec; have_found := FOUND; FETCH want INTO want_rec; want_found := FOUND; WHILE have_found OR want_found LOOP IF have_rec::text IS DISTINCT FROM want_rec::text OR have_found <> want_found THEN RETURN ok( false, $3 ) || E'\n' || diag( ' Results differ beginning at row ' || rownum || E':\n' || ' have: ' || CASE WHEN have_found THEN have_rec::text ELSE 'NULL' END || E'\n' || ' want: ' || CASE WHEN want_found THEN want_rec::text ELSE 'NULL' END ); END IF; rownum = rownum + 1; FETCH have INTO have_rec; have_found := FOUND; FETCH want INTO want_rec; want_found := FOUND; END LOOP; RETURN ok( true, $3 ); EXCEPTION WHEN datatype_mismatch THEN RETURN ok( false, $3 ) || E'\n' || diag( E' Columns differ between queries:\n' || ' have: ' || CASE WHEN have_found THEN have_rec::text ELSE 'NULL' END || E'\n' || ' want: ' || CASE WHEN want_found THEN want_rec::text ELSE 'NULL' END ); END; $$ LANGUAGE plpgsql; -- results_eq( cursor, cursor ) CREATE OR REPLACE FUNCTION results_eq( refcursor, refcursor ) RETURNS TEXT AS $$ SELECT results_eq( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_eq( sql, sql, description ) CREATE OR REPLACE FUNCTION results_eq( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE have REFCURSOR; want REFCURSOR; res TEXT; BEGIN OPEN have FOR EXECUTE _query($1); OPEN want FOR EXECUTE _query($2); res := results_eq(have, want, $3); CLOSE have; CLOSE want; RETURN res; END; $$ LANGUAGE plpgsql; -- results_eq( sql, sql ) CREATE OR REPLACE FUNCTION results_eq( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT results_eq( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_eq( sql, array, description ) CREATE OR REPLACE FUNCTION results_eq( TEXT, anyarray, TEXT ) RETURNS TEXT AS $$ DECLARE have REFCURSOR; want REFCURSOR; res TEXT; BEGIN OPEN have FOR EXECUTE _query($1); OPEN want FOR SELECT $2[i] FROM generate_series(array_lower($2, 1), array_upper($2, 1)) s(i); res := results_eq(have, want, $3); CLOSE have; CLOSE want; RETURN res; END; $$ LANGUAGE plpgsql; -- results_eq( sql, array ) CREATE OR REPLACE FUNCTION results_eq( TEXT, anyarray ) RETURNS TEXT AS $$ SELECT results_eq( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_eq( sql, cursor, description ) CREATE OR REPLACE FUNCTION results_eq( TEXT, refcursor, TEXT ) RETURNS TEXT AS $$ DECLARE have REFCURSOR; res TEXT; BEGIN OPEN have FOR EXECUTE _query($1); res := results_eq(have, $2, $3); CLOSE have; RETURN res; END; $$ LANGUAGE plpgsql; -- results_eq( sql, cursor ) CREATE OR REPLACE FUNCTION results_eq( TEXT, refcursor ) RETURNS TEXT AS $$ SELECT results_eq( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_eq( cursor, sql, description ) CREATE OR REPLACE FUNCTION results_eq( refcursor, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE want REFCURSOR; res TEXT; BEGIN OPEN want FOR EXECUTE _query($2); res := results_eq($1, want, $3); CLOSE want; RETURN res; END; $$ LANGUAGE plpgsql; -- results_eq( cursor, sql ) CREATE OR REPLACE FUNCTION results_eq( refcursor, TEXT ) RETURNS TEXT AS $$ SELECT results_eq( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_eq( cursor, array, description ) CREATE OR REPLACE FUNCTION results_eq( refcursor, anyarray, TEXT ) RETURNS TEXT AS $$ DECLARE want REFCURSOR; res TEXT; BEGIN OPEN want FOR SELECT $2[i] FROM generate_series(array_lower($2, 1), array_upper($2, 1)) s(i); res := results_eq($1, want, $3); CLOSE want; RETURN res; END; $$ LANGUAGE plpgsql; -- results_eq( cursor, array ) CREATE OR REPLACE FUNCTION results_eq( refcursor, anyarray ) RETURNS TEXT AS $$ SELECT results_eq( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_ne( cursor, cursor, description ) CREATE OR REPLACE FUNCTION results_ne( refcursor, refcursor, text ) RETURNS TEXT AS $$ DECLARE have ALIAS FOR $1; want ALIAS FOR $2; have_rec RECORD; want_rec RECORD; have_found BOOLEAN; want_found BOOLEAN; BEGIN FETCH have INTO have_rec; have_found := FOUND; FETCH want INTO want_rec; want_found := FOUND; WHILE have_found OR want_found LOOP IF have_rec::text IS DISTINCT FROM want_rec::text OR have_found <> want_found THEN RETURN ok( true, $3 ); ELSE FETCH have INTO have_rec; have_found := FOUND; FETCH want INTO want_rec; want_found := FOUND; END IF; END LOOP; RETURN ok( false, $3 ); EXCEPTION WHEN datatype_mismatch THEN RETURN ok( false, $3 ) || E'\n' || diag( E' Columns differ between queries:\n' || ' have: ' || CASE WHEN have_found THEN have_rec::text ELSE 'NULL' END || E'\n' || ' want: ' || CASE WHEN want_found THEN want_rec::text ELSE 'NULL' END ); END; $$ LANGUAGE plpgsql; -- results_ne( cursor, cursor ) CREATE OR REPLACE FUNCTION results_ne( refcursor, refcursor ) RETURNS TEXT AS $$ SELECT results_ne( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_ne( sql, sql, description ) CREATE OR REPLACE FUNCTION results_ne( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE have REFCURSOR; want REFCURSOR; res TEXT; BEGIN OPEN have FOR EXECUTE _query($1); OPEN want FOR EXECUTE _query($2); res := results_ne(have, want, $3); CLOSE have; CLOSE want; RETURN res; END; $$ LANGUAGE plpgsql; -- results_ne( sql, sql ) CREATE OR REPLACE FUNCTION results_ne( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT results_ne( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_ne( sql, array, description ) CREATE OR REPLACE FUNCTION results_ne( TEXT, anyarray, TEXT ) RETURNS TEXT AS $$ DECLARE have REFCURSOR; want REFCURSOR; res TEXT; BEGIN OPEN have FOR EXECUTE _query($1); OPEN want FOR SELECT $2[i] FROM generate_series(array_lower($2, 1), array_upper($2, 1)) s(i); res := results_ne(have, want, $3); CLOSE have; CLOSE want; RETURN res; END; $$ LANGUAGE plpgsql; -- results_ne( sql, array ) CREATE OR REPLACE FUNCTION results_ne( TEXT, anyarray ) RETURNS TEXT AS $$ SELECT results_ne( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_ne( sql, cursor, description ) CREATE OR REPLACE FUNCTION results_ne( TEXT, refcursor, TEXT ) RETURNS TEXT AS $$ DECLARE have REFCURSOR; res TEXT; BEGIN OPEN have FOR EXECUTE _query($1); res := results_ne(have, $2, $3); CLOSE have; RETURN res; END; $$ LANGUAGE plpgsql; -- results_ne( sql, cursor ) CREATE OR REPLACE FUNCTION results_ne( TEXT, refcursor ) RETURNS TEXT AS $$ SELECT results_ne( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_ne( cursor, sql, description ) CREATE OR REPLACE FUNCTION results_ne( refcursor, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE want REFCURSOR; res TEXT; BEGIN OPEN want FOR EXECUTE _query($2); res := results_ne($1, want, $3); CLOSE want; RETURN res; END; $$ LANGUAGE plpgsql; -- results_ne( cursor, sql ) CREATE OR REPLACE FUNCTION results_ne( refcursor, TEXT ) RETURNS TEXT AS $$ SELECT results_ne( $1, $2, NULL::text ); $$ LANGUAGE sql; -- results_ne( cursor, array, description ) CREATE OR REPLACE FUNCTION results_ne( refcursor, anyarray, TEXT ) RETURNS TEXT AS $$ DECLARE want REFCURSOR; res TEXT; BEGIN OPEN want FOR SELECT $2[i] FROM generate_series(array_lower($2, 1), array_upper($2, 1)) s(i); res := results_ne($1, want, $3); CLOSE want; RETURN res; END; $$ LANGUAGE plpgsql; -- results_ne( cursor, array ) CREATE OR REPLACE FUNCTION results_ne( refcursor, anyarray ) RETURNS TEXT AS $$ SELECT results_ne( $1, $2, NULL::text ); $$ LANGUAGE sql; -- isa_ok( value, regtype, description ) CREATE OR REPLACE FUNCTION isa_ok( anyelement, regtype, TEXT ) RETURNS TEXT AS $$ DECLARE typeof regtype := pg_typeof($1); BEGIN IF typeof = $2 THEN RETURN ok(true, $3 || ' isa ' || $2 ); END IF; RETURN ok(false, $3 || ' isa ' || $2 ) || E'\n' || diag(' ' || $3 || ' isn''t a "' || $2 || '" it''s a "' || typeof || '"'); END; $$ LANGUAGE plpgsql; -- isa_ok( value, regtype ) CREATE OR REPLACE FUNCTION isa_ok( anyelement, regtype ) RETURNS TEXT AS $$ SELECT isa_ok($1, $2, 'the value'); $$ LANGUAGE sql; -- is_empty( sql, description ) CREATE OR REPLACE FUNCTION is_empty( TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE extras TEXT[] := '{}'; res BOOLEAN := TRUE; msg TEXT := ''; rec RECORD; BEGIN -- Find extra records. FOR rec in EXECUTE _query($1) LOOP extras := extras || rec::text; END LOOP; -- What extra records do we have? IF extras[1] IS NOT NULL THEN res := FALSE; msg := E'\n' || diag( E' Unexpected records:\n ' || array_to_string( extras, E'\n ' ) ); END IF; RETURN ok(res, $2) || msg; END; $$ LANGUAGE plpgsql; -- is_empty( sql ) CREATE OR REPLACE FUNCTION is_empty( TEXT ) RETURNS TEXT AS $$ SELECT is_empty( $1, NULL ); $$ LANGUAGE sql; -- collect_tap( tap, tap, tap ) CREATE OR REPLACE FUNCTION collect_tap( text[] ) RETURNS TEXT AS $$ SELECT array_to_string($1, E'\n'); $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _tlike ( BOOLEAN, TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT ok( $1, $4 ) || CASE WHEN $1 THEN '' ELSE E'\n' || diag( ' error message: ' || COALESCE( quote_literal($2), 'NULL' ) || E'\n doesn''t match: ' || COALESCE( quote_literal($3), 'NULL' ) ) END; $$ LANGUAGE sql; -- throws_like ( sql, pattern, description ) CREATE OR REPLACE FUNCTION throws_like ( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ BEGIN EXECUTE _query($1); RETURN ok( FALSE, $3 ) || E'\n' || diag( ' no exception thrown' ); EXCEPTION WHEN OTHERS THEN return _tlike( SQLERRM ~~ $2, SQLERRM, $2, $3 ); END; $$ LANGUAGE plpgsql; -- throws_like ( sql, pattern ) CREATE OR REPLACE FUNCTION throws_like ( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT throws_like($1, $2, 'Should throw exception like ' || quote_literal($2) ); $$ LANGUAGE sql; -- throws_ilike ( sql, pattern, description ) CREATE OR REPLACE FUNCTION throws_ilike ( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ BEGIN EXECUTE _query($1); RETURN ok( FALSE, $3 ) || E'\n' || diag( ' no exception thrown' ); EXCEPTION WHEN OTHERS THEN return _tlike( SQLERRM ~~* $2, SQLERRM, $2, $3 ); END; $$ LANGUAGE plpgsql; -- throws_ilike ( sql, pattern ) CREATE OR REPLACE FUNCTION throws_ilike ( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT throws_ilike($1, $2, 'Should throw exception like ' || quote_literal($2) ); $$ LANGUAGE sql; -- throws_matching ( sql, pattern, description ) CREATE OR REPLACE FUNCTION throws_matching ( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ BEGIN EXECUTE _query($1); RETURN ok( FALSE, $3 ) || E'\n' || diag( ' no exception thrown' ); EXCEPTION WHEN OTHERS THEN return _tlike( SQLERRM ~ $2, SQLERRM, $2, $3 ); END; $$ LANGUAGE plpgsql; -- throws_matching ( sql, pattern ) CREATE OR REPLACE FUNCTION throws_matching ( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT throws_matching($1, $2, 'Should throw exception matching ' || quote_literal($2) ); $$ LANGUAGE sql; -- throws_imatching ( sql, pattern, description ) CREATE OR REPLACE FUNCTION throws_imatching ( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ BEGIN EXECUTE _query($1); RETURN ok( FALSE, $3 ) || E'\n' || diag( ' no exception thrown' ); EXCEPTION WHEN OTHERS THEN return _tlike( SQLERRM ~* $2, SQLERRM, $2, $3 ); END; $$ LANGUAGE plpgsql; -- throws_imatching ( sql, pattern ) CREATE OR REPLACE FUNCTION throws_imatching ( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT throws_imatching($1, $2, 'Should throw exception matching ' || quote_literal($2) ); $$ LANGUAGE sql; -- roles_are( roles[], description ) CREATE OR REPLACE FUNCTION _dexists ( NAME, NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS( SELECT true FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_type t on n.oid = t.typnamespace WHERE n.nspname = $1 AND t.typname = $2 ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _dexists ( NAME ) RETURNS BOOLEAN AS $$ SELECT EXISTS( SELECT true FROM pg_catalog.pg_type t WHERE t.typname = $1 AND pg_catalog.pg_type_is_visible(t.oid) ); $$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION _get_dtype( NAME, TEXT, BOOLEAN ) RETURNS TEXT AS $$ SELECT display_type(CASE WHEN $3 THEN tn.nspname ELSE NULL END, t.oid, t.typtypmod) FROM pg_catalog.pg_type d JOIN pg_catalog.pg_namespace dn ON d.typnamespace = dn.oid JOIN pg_catalog.pg_type t ON d.typbasetype = t.oid JOIN pg_catalog.pg_namespace tn ON d.typnamespace = tn.oid WHERE d.typisdefined AND dn.nspname = $1 AND d.typname = LOWER($2) AND d.typtype = 'd' $$ LANGUAGE sql; CREATE OR REPLACE FUNCTION _get_dtype( NAME ) RETURNS TEXT AS $$ SELECT display_type(t.oid, t.typtypmod) FROM pg_catalog.pg_type d JOIN pg_catalog.pg_type t ON d.typbasetype = t.oid WHERE d.typisdefined AND d.typname = LOWER($1) AND d.typtype = 'd' $$ LANGUAGE sql; -- domain_type_is( schema, domain, schema, type, description ) CREATE OR REPLACE FUNCTION domain_type_is( NAME, TEXT, NAME, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE actual_type TEXT := _get_dtype($1, $2, true); BEGIN IF actual_type IS NULL THEN RETURN fail( $5 ) || E'\n' || diag ( ' Domain ' || quote_ident($1) || '.' || $2 || ' does not exist' ); END IF; RETURN is( actual_type, quote_ident($3) || '.' || _quote_ident_like($4, actual_type), $5 ); END; $$ LANGUAGE plpgsql; -- domain_type_is( schema, domain, schema, type ) CREATE OR REPLACE FUNCTION domain_type_is( NAME, TEXT, NAME, TEXT ) RETURNS TEXT AS $$ SELECT domain_type_is( $1, $2, $3, $4, 'Domain ' || quote_ident($1) || '.' || $2 || ' should extend type ' || quote_ident($3) || '.' || $4 ); $$ LANGUAGE SQL; -- domain_type_is( schema, domain, type, description ) CREATE OR REPLACE FUNCTION domain_type_is( NAME, TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE actual_type TEXT := _get_dtype($1, $2, false); BEGIN IF actual_type IS NULL THEN RETURN fail( $4 ) || E'\n' || diag ( ' Domain ' || quote_ident($1) || '.' || $2 || ' does not exist' ); END IF; RETURN is( actual_type, _quote_ident_like($3, actual_type), $4 ); END; $$ LANGUAGE plpgsql; -- domain_type_is( schema, domain, type ) CREATE OR REPLACE FUNCTION domain_type_is( NAME, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT domain_type_is( $1, $2, $3, 'Domain ' || quote_ident($1) || '.' || $2 || ' should extend type ' || $3 ); $$ LANGUAGE SQL; -- domain_type_is( domain, type, description ) CREATE OR REPLACE FUNCTION domain_type_is( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE actual_type TEXT := _get_dtype($1); BEGIN IF actual_type IS NULL THEN RETURN fail( $3 ) || E'\n' || diag ( ' Domain ' || $1 || ' does not exist' ); END IF; RETURN is( actual_type, _quote_ident_like($2, actual_type), $3 ); END; $$ LANGUAGE plpgsql; -- domain_type_is( domain, type ) CREATE OR REPLACE FUNCTION domain_type_is( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT domain_type_is( $1, $2, 'Domain ' || $1 || ' should extend type ' || $2 ); $$ LANGUAGE SQL; -- domain_type_isnt( schema, domain, schema, type, description ) CREATE OR REPLACE FUNCTION domain_type_isnt( NAME, TEXT, NAME, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE actual_type TEXT := _get_dtype($1, $2, true); BEGIN IF actual_type IS NULL THEN RETURN fail( $5 ) || E'\n' || diag ( ' Domain ' || quote_ident($1) || '.' || $2 || ' does not exist' ); END IF; RETURN isnt( actual_type, quote_ident($3) || '.' || _quote_ident_like($4, actual_type), $5 ); END; $$ LANGUAGE plpgsql; -- domain_type_isnt( schema, domain, schema, type ) CREATE OR REPLACE FUNCTION domain_type_isnt( NAME, TEXT, NAME, TEXT ) RETURNS TEXT AS $$ SELECT domain_type_isnt( $1, $2, $3, $4, 'Domain ' || quote_ident($1) || '.' || $2 || ' should not extend type ' || quote_ident($3) || '.' || $4 ); $$ LANGUAGE SQL; -- domain_type_isnt( schema, domain, type, description ) CREATE OR REPLACE FUNCTION domain_type_isnt( NAME, TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE actual_type TEXT := _get_dtype($1, $2, false); BEGIN IF actual_type IS NULL THEN RETURN fail( $4 ) || E'\n' || diag ( ' Domain ' || quote_ident($1) || '.' || $2 || ' does not exist' ); END IF; RETURN isnt( actual_type, _quote_ident_like($3, actual_type), $4 ); END; $$ LANGUAGE plpgsql; -- domain_type_isnt( schema, domain, type ) CREATE OR REPLACE FUNCTION domain_type_isnt( NAME, TEXT, TEXT ) RETURNS TEXT AS $$ SELECT domain_type_isnt( $1, $2, $3, 'Domain ' || quote_ident($1) || '.' || $2 || ' should not extend type ' || $3 ); $$ LANGUAGE SQL; -- domain_type_isnt( domain, type, description ) CREATE OR REPLACE FUNCTION domain_type_isnt( TEXT, TEXT, TEXT ) RETURNS TEXT AS $$ DECLARE actual_type TEXT := _get_dtype($1); BEGIN IF actual_type IS NULL THEN RETURN fail( $3 ) || E'\n' || diag ( ' Domain ' || $1 || ' does not exist' ); END IF; RETURN isnt( actual_type, _quote_ident_like($2, actual_type), $3 ); END; $$ LANGUAGE plpgsql; -- domain_type_isnt( domain, type ) CREATE OR REPLACE FUNCTION domain_type_isnt( TEXT, TEXT ) RETURNS TEXT AS $$ SELECT domain_type_isnt( $1, $2, 'Domain ' || $1 || ' should not extend type ' || $2 ); $$ LANGUAGE SQL; -- row_eq( sql, record, description ) CREATE OR REPLACE FUNCTION row_eq( TEXT, anyelement, TEXT ) RETURNS TEXT AS $$ DECLARE rec RECORD; BEGIN EXECUTE _query($1) INTO rec; IF NOT rec::text IS DISTINCT FROM $2::text THEN RETURN ok(true, $3); END IF; RETURN ok(false, $3 ) || E'\n' || diag( ' have: ' || CASE WHEN rec IS NULL THEN 'NULL' ELSE rec::text END || E'\n want: ' || CASE WHEN $2 IS NULL THEN 'NULL' ELSE $2::text END ); END; $$ LANGUAGE plpgsql; -- row_eq( sql, record ) CREATE OR REPLACE FUNCTION row_eq( TEXT, anyelement ) RETURNS TEXT AS $$ SELECT row_eq($1, $2, NULL ); $$ LANGUAGE sql; -- triggers_are( schema, table, triggers[], description )
the_stack
CREATE PROCEDURE [Application].[Configuration_DisableInMemory] AS BEGIN SET NOCOUNT ON; SET XACT_ABORT ON; DECLARE @SQL nvarchar(max) = N''; BEGIN TRY /*-------------------------------------------------------------------------------------*/ /* Drop the procedures that are used by the table types */ /*-------------------------------------------------------------------------------------*/ SET @SQL = N'DROP PROCEDURE IF EXISTS Website.InvoiceCustomerOrders;'; EXECUTE (@SQL); SET @SQL = N'DROP PROCEDURE IF EXISTS Website.InsertCustomerOrders;'; EXECUTE (@SQL); SET @SQL = N'DROP PROCEDURE IF EXISTS Website.RecordColdRoomTemperatures;'; EXECUTE (@SQL); -- Drop the table types SET @SQL = N'DROP TYPE IF EXISTS Website.OrderIDList;'; EXECUTE (@SQL); SET @SQL = N'DROP TYPE IF EXISTS Website.OrderLineList;'; EXECUTE (@SQL); SET @SQL = N'DROP TYPE IF EXISTS Website.OrderList;'; EXECUTE (@SQL); SET @SQL = N'DROP TYPE IF EXISTS Website.SensorDataList;'; EXECUTE (@SQL); /*-------------------------------------------------------------------------------------*/ /* Cold Room Temperatures - Recreate as non temporal and not memory optimized */ /*-------------------------------------------------------------------------------------*/ IF NOT EXISTS (SELECT 1 FROM sys.tables WHERE name = N'ColdRoomTemperatures' AND is_memory_optimized = 0) BEGIN SET @SQL = N' ALTER TABLE Warehouse.ColdRoomTemperatures SET (SYSTEM_VERSIONING = OFF); ALTER TABLE Warehouse.ColdRoomTemperatures DROP PERIOD FOR SYSTEM_TIME;'; EXECUTE (@SQL); SET @SQL = N' CREATE TABLE Warehouse.ColdRoomTemperatures_Staging ( ColdRoomTemperatureID bigint IDENTITY(1,1) NOT NULL, ColdRoomSensorNumber int NOT NULL, RecordedWhen datetime2(7) NOT NULL, Temperature decimal(10, 2) NOT NULL, ValidFrom datetime2(7) NOT NULL, ValidTo datetime2(7) NOT NULL, ) ;'; EXECUTE (@SQL); SET @SQL = N' SET IDENTITY_INSERT Warehouse.ColdRoomTemperatures_Staging ON; INSERT Warehouse.ColdRoomTemperatures_Staging (ColdRoomTemperatureID, ColdRoomSensorNumber, RecordedWhen, Temperature, ValidFrom, ValidTo) SELECT ColdRoomTemperatureID, ColdRoomSensorNumber, RecordedWhen, Temperature, ValidFrom, ValidTo FROM Warehouse.ColdRoomTemperatures; SET IDENTITY_INSERT Warehouse.ColdRoomTemperatures_Staging OFF;'; EXECUTE (@SQL); SET @SQL = N'DROP TABLE Warehouse.ColdRoomTemperatures;'; EXECUTE (@SQL); SET @SQL = N' EXEC dbo.sp_rename @objname = N''Warehouse.ColdRoomTemperatures_Staging'', @newname = N''ColdRoomTemperatures'', @objtype = N''OBJECT'';'; EXECUTE (@SQL); SET @SQL = ' CREATE NONCLUSTERED INDEX [IX_Warehouse_ColdRoomTemperatures_ColdRoomSensorNumber] ON Warehouse.ColdRoomTemperatures (ColdRoomSensorNumber) '; EXECUTE (@SQL); SET @SQL = ' ALTER TABLE Warehouse.ColdRoomTemperatures ADD CONSTRAINT PK_Warehouse_ColdRoomTemperatures PRIMARY KEY CLUSTERED (ColdRoomTemperatureID) '; EXECUTE (@SQL); SET @SQL = N' ALTER TABLE Warehouse.ColdRoomTemperatures ADD PERIOD FOR SYSTEM_TIME(ValidFrom, ValidTo);'; EXECUTE (@SQL); SET @SQL = N' ALTER TABLE Warehouse.ColdRoomTemperatures SET (SYSTEM_VERSIONING = ON (HISTORY_TABLE = Warehouse.ColdRoomTemperatures_Archive, DATA_CONSISTENCY_CHECK = ON));'; EXECUTE (@SQL); END /*-------------------------------------------------------------------------------------*/ /* Vehicle Temperatures - Recreate as non temporal and not memory optimized */ /*-------------------------------------------------------------------------------------*/ SET @SQL = N' CREATE TABLE Warehouse.VehicleTemperatures_Staging ( VehicleTemperatureID bigint IDENTITY(1,1) NOT NULL, VehicleRegistration nvarchar(20) COLLATE Latin1_General_CI_AS NOT NULL, ChillerSensorNumber int NOT NULL, RecordedWhen datetime2(7) NOT NULL, Temperature decimal(10, 2) NOT NULL, FullSensorData nvarchar(1000) COLLATE Latin1_General_CI_AS NULL, IsCompressed bit NOT NULL, CompressedSensorData varbinary(max) NULL ) ;'; EXECUTE (@SQL); SET @SQL = N' SET IDENTITY_INSERT Warehouse.VehicleTemperatures_Staging ON; INSERT Warehouse.VehicleTemperatures_Staging (VehicleTemperatureID, VehicleRegistration, ChillerSensorNumber, RecordedWhen, Temperature, FullSensorData, IsCompressed, CompressedSensorData) SELECT VehicleTemperatureID, VehicleRegistration, ChillerSensorNumber, RecordedWhen, Temperature, FullSensorData, IsCompressed, CompressedSensorData FROM Warehouse.VehicleTemperatures; SET IDENTITY_INSERT Warehouse.VehicleTemperatures_Staging OFF;'; EXECUTE (@SQL); SET @SQL = N'DROP TABLE Warehouse.VehicleTemperatures;'; EXECUTE (@SQL); SET @SQL = N' EXEC dbo.sp_rename @objname = N''Warehouse.VehicleTemperatures_Staging'', @newname = N''VehicleTemperatures'', @objtype = N''OBJECT'';'; EXECUTE (@SQL); SET @SQL = ' ALTER TABLE Warehouse.VehicleTemperatures ADD CONSTRAINT PK_Warehouse_VehicleTemperatures PRIMARY KEY NONCLUSTERED (VehicleTemperatureID) '; EXECUTE (@SQL); /*-------------------------------------------------------------------------------------*/ /* Create the new table types */ /*-------------------------------------------------------------------------------------*/ SET @SQL = N' CREATE TYPE Website.OrderIDList AS TABLE ( OrderID int PRIMARY KEY NONCLUSTERED );'; EXECUTE (@SQL); SET @SQL = N' CREATE TYPE Website.OrderList AS TABLE ( OrderReference int PRIMARY KEY NONCLUSTERED, CustomerID int, ContactPersonID int, ExpectedDeliveryDate date, CustomerPurchaseOrderNumber nvarchar(20), IsUndersupplyBackordered bit, Comments nvarchar(max), DeliveryInstructions nvarchar(max) );'; EXECUTE (@SQL); SET @SQL = N' CREATE TYPE Website.OrderLineList AS TABLE ( OrderReference int, StockItemID int, [Description] nvarchar(100), Quantity int, INDEX IX_Website_OrderLineList NONCLUSTERED (OrderReference) );'; EXECUTE (@SQL); SET @SQL = N' CREATE TYPE Website.SensorDataList AS TABLE ( SensorDataListID int IDENTITY(1,1) PRIMARY KEY NONCLUSTERED, ColdRoomSensorNumber int, RecordedWhen datetime2(7), Temperature decimal(18,2) );'; EXECUTE (@SQL); SET @SQL = N' CREATE PROCEDURE Website.InvoiceCustomerOrders @OrdersToInvoice Website.OrderIDList READONLY, @PackedByPersonID int, @InvoicedByPersonID int WITH EXECUTE AS OWNER AS BEGIN SET NOCOUNT ON; SET XACT_ABORT ON; DECLARE @InvoicesToGenerate TABLE ( OrderID int PRIMARY KEY, InvoiceID int NOT NULL, TotalDryItems int NOT NULL, TotalChillerItems int NOT NULL ); BEGIN TRY; -- Check that all orders exist, have been fully picked, and not already invoiced. Also allocate new invoice numbers. INSERT @InvoicesToGenerate (OrderID, InvoiceID, TotalDryItems, TotalChillerItems) SELECT oti.OrderID, NEXT VALUE FOR Sequences.InvoiceID, COALESCE((SELECT SUM(CASE WHEN si.IsChillerStock <> 0 THEN 0 ELSE 1 END) FROM Sales.OrderLines AS ol INNER JOIN Warehouse.StockItems AS si ON ol.StockItemID = si.StockItemID WHERE ol.OrderID = oti.OrderID), 0), COALESCE((SELECT SUM(CASE WHEN si.IsChillerStock <> 0 THEN 1 ELSE 0 END) FROM Sales.OrderLines AS ol INNER JOIN Warehouse.StockItems AS si ON ol.StockItemID = si.StockItemID WHERE ol.OrderID = oti.OrderID), 0) FROM @OrdersToInvoice AS oti INNER JOIN Sales.Orders AS o ON oti.OrderID = o.OrderID WHERE NOT EXISTS (SELECT 1 FROM Sales.Invoices AS i WHERE i.OrderID = oti.OrderID) AND o.PickingCompletedWhen IS NOT NULL; IF EXISTS (SELECT 1 FROM @OrdersToInvoice AS oti WHERE NOT EXISTS (SELECT 1 FROM @InvoicesToGenerate AS itg WHERE itg.OrderID = oti.OrderID)) BEGIN PRINT N''At least one order ID either does not exist, is not picked, or is already invoiced''; THROW 51000, N''At least one orderID either does not exist, is not picked, or is already invoiced'', 1; END; BEGIN TRAN; INSERT Sales.Invoices (InvoiceID, CustomerID, BillToCustomerID, OrderID, DeliveryMethodID, ContactPersonID, AccountsPersonID, SalespersonPersonID, PackedByPersonID, InvoiceDate, CustomerPurchaseOrderNumber, IsCreditNote, CreditNoteReason, Comments, DeliveryInstructions, InternalComments, TotalDryItems, TotalChillerItems, DeliveryRun, RunPosition, ReturnedDeliveryData, LastEditedBy, LastEditedWhen) SELECT itg.InvoiceID, c.CustomerID, c.BillToCustomerID, itg.OrderID, c.DeliveryMethodID, o.ContactPersonID, btc.PrimaryContactPersonID, o.SalespersonPersonID, @PackedByPersonID, SYSDATETIME(), o.CustomerPurchaseOrderNumber, 0, NULL, NULL, c.DeliveryAddressLine1 + N'', '' + c.DeliveryAddressLine2, NULL, itg.TotalDryItems, itg.TotalChillerItems, c.DeliveryRun, c.RunPosition, JSON_MODIFY(N''{"Events": []}'', N''append $.Events'', JSON_MODIFY(JSON_MODIFY(JSON_MODIFY(N''{ }'', N''$.Event'', N''Ready for collection''), N''$.EventTime'', CONVERT(nvarchar(20), SYSDATETIME(), 126)), N''$.ConNote'', N''EAN-125-'' + CAST(itg.InvoiceID + 1050 AS nvarchar(20)))), @InvoicedByPersonID, SYSDATETIME() FROM @InvoicesToGenerate AS itg INNER JOIN Sales.Orders AS o ON itg.OrderID = o.OrderID INNER JOIN Sales.Customers AS c ON o.CustomerID = c.CustomerID INNER JOIN Sales.Customers AS btc ON btc.CustomerID = c.BillToCustomerID; INSERT Sales.InvoiceLines (InvoiceID, StockItemID, [Description], PackageTypeID, Quantity, UnitPrice, TaxRate, TaxAmount, LineProfit, ExtendedPrice, LastEditedBy, LastEditedWhen) SELECT itg.InvoiceID, ol.StockItemID, ol.[Description], ol.PackageTypeID, ol.PickedQuantity, ol.UnitPrice, ol.TaxRate, ROUND(ol.PickedQuantity * ol.UnitPrice * ol.TaxRate / 100.0, 2), ROUND(ol.PickedQuantity * (ol.UnitPrice - sih.LastCostPrice), 2), ROUND(ol.PickedQuantity * ol.UnitPrice, 2) + ROUND(ol.PickedQuantity * ol.UnitPrice * ol.TaxRate / 100.0, 2), @InvoicedByPersonID, SYSDATETIME() FROM @InvoicesToGenerate AS itg INNER JOIN Sales.OrderLines AS ol ON itg.OrderID = ol.OrderID INNER JOIN Warehouse.StockItems AS si ON ol.StockItemID = si.StockItemID INNER JOIN Warehouse.StockItemHoldings AS sih ON si.StockItemID = sih.StockItemID ORDER BY ol.OrderID, ol.OrderLineID; INSERT Warehouse.StockItemTransactions (StockItemID, TransactionTypeID, CustomerID, InvoiceID, SupplierID, PurchaseOrderID, TransactionOccurredWhen, Quantity, LastEditedBy, LastEditedWhen) SELECT il.StockItemID, (SELECT TransactionTypeID FROM [Application].TransactionTypes WHERE TransactionTypeName = N''Stock Issue''), i.CustomerID, i.InvoiceID, NULL, NULL, SYSDATETIME(), 0 - il.Quantity, @InvoicedByPersonID, SYSDATETIME() FROM @InvoicesToGenerate AS itg INNER JOIN Sales.InvoiceLines AS il ON itg.InvoiceID = il.InvoiceID INNER JOIN Sales.Invoices AS i ON il.InvoiceID = i.InvoiceID ORDER BY il.InvoiceID, il.InvoiceLineID; WITH StockItemTotals AS ( SELECT il.StockItemID, SUM(il.Quantity) AS TotalQuantity FROM Sales.InvoiceLines aS il WHERE il.InvoiceID IN (SELECT InvoiceID FROM @InvoicesToGenerate) GROUP BY il.StockItemID ) UPDATE sih SET sih.QuantityOnHand -= sit.TotalQuantity, sih.LastEditedBy = @InvoicedByPersonID, sih.LastEditedWhen = SYSDATETIME() FROM Warehouse.StockItemHoldings AS sih INNER JOIN StockItemTotals AS sit ON sih.StockItemID = sit.StockItemID; INSERT Sales.CustomerTransactions (CustomerID, TransactionTypeID, InvoiceID, PaymentMethodID, TransactionDate, AmountExcludingTax, TaxAmount, TransactionAmount, OutstandingBalance, FinalizationDate, LastEditedBy, LastEditedWhen) SELECT i.BillToCustomerID, (SELECT TransactionTypeID FROM [Application].TransactionTypes WHERE TransactionTypeName = N''Customer Invoice''), itg.InvoiceID, NULL, SYSDATETIME(), (SELECT SUM(il.ExtendedPrice - il.TaxAmount) FROM Sales.InvoiceLines AS il WHERE il.InvoiceID = itg.InvoiceID), (SELECT SUM(il.TaxAmount) FROM Sales.InvoiceLines AS il WHERE il.InvoiceID = itg.InvoiceID), (SELECT SUM(il.ExtendedPrice) FROM Sales.InvoiceLines AS il WHERE il.InvoiceID = itg.InvoiceID), (SELECT SUM(il.ExtendedPrice) FROM Sales.InvoiceLines AS il WHERE il.InvoiceID = itg.InvoiceID), NULL, @InvoicedByPersonID, SYSDATETIME() FROM @InvoicesToGenerate AS itg INNER JOIN Sales.Invoices AS i ON itg.InvoiceID = i.InvoiceID; COMMIT; END TRY BEGIN CATCH IF XACT_STATE() <> 0 ROLLBACK; PRINT N''Unable to invoice these orders''; THROW; RETURN -1; END CATCH; RETURN 0; END;'; EXECUTE (@SQL); SET @SQL = N' CREATE PROCEDURE Website.RecordColdRoomTemperatures @SensorReadings Website.SensorDataList READONLY WITH EXECUTE AS OWNER AS BEGIN BEGIN TRY DECLARE @NumberOfReadings int = (SELECT MAX(SensorDataListID) FROM @SensorReadings); DECLARE @Counter int = (SELECT MIN(SensorDataListID) FROM @SensorReadings); DECLARE @ColdRoomSensorNumber int; DECLARE @RecordedWhen datetime2(7); DECLARE @Temperature decimal(18,2); -- note that we cannot use a merge here because multiple readings might exist for each sensor WHILE @Counter <= @NumberOfReadings BEGIN SELECT @ColdRoomSensorNumber = ColdRoomSensorNumber, @RecordedWhen = RecordedWhen, @Temperature = Temperature FROM @SensorReadings WHERE SensorDataListID = @Counter; UPDATE Warehouse.ColdRoomTemperatures SET RecordedWhen = @RecordedWhen, Temperature = @Temperature WHERE ColdRoomSensorNumber = @ColdRoomSensorNumber; IF @@ROWCOUNT = 0 BEGIN INSERT Warehouse.ColdRoomTemperatures (ColdRoomSensorNumber, RecordedWhen, Temperature) VALUES (@ColdRoomSensorNumber, @RecordedWhen, @Temperature); END; SET @Counter += 1; END; END TRY BEGIN CATCH THROW 51000, N''Unable to apply the sensor data'', 2; RETURN 1; END CATCH; END;'; EXECUTE (@SQL); SET @SQL = N' CREATE PROCEDURE Website.InsertCustomerOrders @Orders Website.OrderList READONLY, @OrderLines Website.OrderLineList READONLY, @OrdersCreatedByPersonID int, @SalespersonPersonID int WITH EXECUTE AS OWNER AS BEGIN SET NOCOUNT ON; SET XACT_ABORT ON; DECLARE @OrdersToGenerate AS TABLE ( OrderReference int PRIMARY KEY, -- reference from the application OrderID int ); -- allocate the new order numbers INSERT @OrdersToGenerate (OrderReference, OrderID) SELECT OrderReference, NEXT VALUE FOR Sequences.OrderID FROM @Orders; BEGIN TRY BEGIN TRAN; INSERT Sales.Orders (OrderID, CustomerID, SalespersonPersonID, PickedByPersonID, ContactPersonID, BackorderOrderID, OrderDate, ExpectedDeliveryDate, CustomerPurchaseOrderNumber, IsUndersupplyBackordered, Comments, DeliveryInstructions, InternalComments, PickingCompletedWhen, LastEditedBy, LastEditedWhen) SELECT otg.OrderID, o.CustomerID, @SalespersonPersonID, NULL, o.ContactPersonID, NULL, SYSDATETIME(), o.ExpectedDeliveryDate, o.CustomerPurchaseOrderNumber, o.IsUndersupplyBackordered, o.Comments, o.DeliveryInstructions, NULL, NULL, @OrdersCreatedByPersonID, SYSDATETIME() FROM @OrdersToGenerate AS otg INNER JOIN @Orders AS o ON otg.OrderReference = o.OrderReference; INSERT Sales.OrderLines (OrderID, StockItemID, [Description], PackageTypeID, Quantity, UnitPrice, TaxRate, PickedQuantity, PickingCompletedWhen, LastEditedBy, LastEditedWhen) SELECT otg.OrderID, ol.StockItemID, ol.[Description], si.UnitPackageID, ol.Quantity, Website.CalculateCustomerPrice(o.CustomerID, ol.StockItemID, SYSDATETIME()), si.TaxRate, 0, NULL, @OrdersCreatedByPersonID, SYSDATETIME() FROM @OrdersToGenerate AS otg INNER JOIN @OrderLines AS ol ON otg.OrderReference = ol.OrderReference INNER JOIN @Orders AS o ON ol.OrderReference = o.OrderReference INNER JOIN Warehouse.StockItems AS si ON ol.StockItemID = si.StockItemID; COMMIT; END TRY BEGIN CATCH IF XACT_STATE() <> 0 ROLLBACK; PRINT N''Unable to create the customer orders.''; THROW; RETURN -1; END CATCH; RETURN 0; END;'; EXECUTE (@SQL); SET @SQL = N' ALTER DATABASE CURRENT SET MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT = OFF;'; EXECUTE (@SQL); END TRY BEGIN CATCH PRINT N'Unable to remove memory-optimized tables'; THROW; END CATCH; END;
the_stack
-- 2017-07-27T16:33:20.858 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-27 16:33:20','YYYY-MM-DD HH24:MI:SS'),Name='No.' WHERE AD_Field_ID=57714 AND AD_Language='en_US' ; -- 2017-07-27T16:37:41.792 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-27 16:37:41','YYYY-MM-DD HH24:MI:SS'),Name='Date' WHERE AD_Field_ID=57718 AND AD_Language='en_US' ; -- 2017-07-27T16:37:52.825 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-27 16:37:52','YYYY-MM-DD HH24:MI:SS'),Name='Reference' WHERE AD_Field_ID=57715 AND AD_Language='en_US' ; -- 2017-07-27T16:39:15.684 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='',Updated=TO_TIMESTAMP('2017-07-27 16:39:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540512 ; -- 2017-07-27T16:43:43.179 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540507, SeqNo=20,Updated=TO_TIMESTAMP('2017-07-27 16:43:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544846 ; -- 2017-07-27T16:44:18.757 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET AD_UI_Column_ID=540080, SeqNo=30,Updated=TO_TIMESTAMP('2017-07-27 16:44:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540512 ; -- 2017-07-27T16:44:59.796 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Column WHERE AD_UI_Column_ID=540304 ; -- 2017-07-27T16:45:17.836 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Section_Trl WHERE AD_UI_Section_ID=540220 ; -- 2017-07-27T16:45:17.848 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Section WHERE AD_UI_Section_ID=540220 ; -- 2017-07-27T16:46:27.040 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540512, SeqNo=140,Updated=TO_TIMESTAMP('2017-07-27 16:46:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544836 ; -- 2017-07-27T16:47:10.019 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540507, SeqNo=30,Updated=TO_TIMESTAMP('2017-07-27 16:47:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546047 ; -- 2017-07-27T16:47:49.278 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='N',Updated=TO_TIMESTAMP('2017-07-27 16:47:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546047 ; -- 2017-07-27T16:50:56.189 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=546047 ; -- 2017-07-27T16:51:42.337 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-07-27 16:51:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544836 ; -- 2017-07-27T16:53:11.830 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540512, SeqNo=150,Updated=TO_TIMESTAMP('2017-07-27 16:53:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544837 ; -- 2017-07-27T16:53:23.682 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540512, SeqNo=160,Updated=TO_TIMESTAMP('2017-07-27 16:53:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544838 ; -- 2017-07-27T16:53:29.116 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540512, SeqNo=170,Updated=TO_TIMESTAMP('2017-07-27 16:53:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544839 ; -- 2017-07-27T16:54:09.651 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540512, SeqNo=180,Updated=TO_TIMESTAMP('2017-07-27 16:54:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544844 ; -- 2017-07-27T16:54:16.274 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=540512, SeqNo=190,Updated=TO_TIMESTAMP('2017-07-27 16:54:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544845 ; -- 2017-07-27T16:54:21.310 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=540510 ; -- 2017-07-27T16:54:54.595 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-07-27 16:54:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544837 ; -- 2017-07-27T16:54:55.138 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-07-27 16:54:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544838 ; -- 2017-07-27T16:54:55.532 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-07-27 16:54:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544839 ; -- 2017-07-27T16:54:56.340 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-07-27 16:54:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544844 ; -- 2017-07-27T16:55:57.729 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:55:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544850 ; -- 2017-07-27T16:55:58.975 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:55:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544851 ; -- 2017-07-27T16:56:03.726 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544852 ; -- 2017-07-27T16:56:05.308 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544853 ; -- 2017-07-27T16:56:06.471 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546042 ; -- 2017-07-27T16:56:11.235 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546043 ; -- 2017-07-27T16:56:13.269 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546044 ; -- 2017-07-27T16:56:14.671 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546045 ; -- 2017-07-27T16:56:15.982 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546046 ; -- 2017-07-27T16:56:17.301 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546048 ; -- 2017-07-27T16:56:18.428 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546049 ; -- 2017-07-27T16:56:19.724 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546050 ; -- 2017-07-27T16:56:21.155 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544836 ; -- 2017-07-27T16:56:22.516 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544837 ; -- 2017-07-27T16:56:23.884 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544838 ; -- 2017-07-27T16:56:25.003 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544839 ; -- 2017-07-27T16:56:26.147 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544844 ; -- 2017-07-27T16:56:28.780 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=0,Updated=TO_TIMESTAMP('2017-07-27 16:56:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544845 ; -- 2017-07-27T16:56:37.819 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-27 16:56:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544844 ; -- 2017-07-27T16:56:41.412 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-27 16:56:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544845 ; -- 2017-07-27T16:56:45.295 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-27 16:56:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544838 ; -- 2017-07-27T16:56:50.251 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-27 16:56:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544853 ; -- 2017-07-27T16:56:55.764 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-27 16:56:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546043 ; -- 2017-07-27T16:56:58.676 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-27 16:56:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546042 ; -- 2017-07-27T16:57:01.038 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-27 16:57:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544850 ; -- 2017-07-27T16:57:04.249 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-27 16:57:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544851 ; -- 2017-07-27T16:57:08.833 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-07-27 16:57:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546045 ; -- 2017-07-27T16:57:15.407 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-27 16:57:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546044 ; -- 2017-07-27T16:57:17.365 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-27 16:57:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546046 ; -- 2017-07-27T16:57:19.908 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-07-27 16:57:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546044 ; -- 2017-07-27T16:57:29.943 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-07-27 16:57:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546048 ; -- 2017-07-27T16:57:33.054 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-07-27 16:57:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544853 ; -- 2017-07-27T16:57:35.732 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-27 16:57:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544844 ; -- 2017-07-27T16:57:38.403 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-27 16:57:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544845 ; -- 2017-07-27T16:57:45.563 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-27 16:57:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544838 ; -- 2017-07-27T16:57:51.099 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-27 16:57:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546043 ; -- 2017-07-27T16:57:54.095 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-27 16:57:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546042 ; -- 2017-07-27T16:57:57.535 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-27 16:57:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544850 ; -- 2017-07-27T16:58:00.301 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-07-27 16:58:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544851 ; -- 2017-07-27T16:58:03.747 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-27 16:58:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546045 ; -- 2017-07-27T16:58:05.585 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-07-27 16:58:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546046 ; -- 2017-07-27T16:58:08.134 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-07-27 16:58:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546044 ; -- 2017-07-27T16:58:13.092 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-07-27 16:58:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546049 ; -- 2017-07-27T16:58:19.072 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-27 16:58:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546050 ; -- 2017-07-27T16:58:22.135 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-27 16:58:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544838 ; -- 2017-07-27T16:58:41.595 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-07-27 16:58:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546043 ; -- 2017-07-27T16:58:43.363 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-07-27 16:58:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546042 ; -- 2017-07-27T16:58:45.003 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-07-27 16:58:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544850 ; -- 2017-07-27T16:58:46.744 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-07-27 16:58:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544851 ; -- 2017-07-27T16:58:48.499 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-07-27 16:58:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546045 ; -- 2017-07-27T16:58:50.093 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-07-27 16:58:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546046 ; -- 2017-07-27T16:58:51.842 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-07-27 16:58:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546044 ; -- 2017-07-27T16:58:54.566 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=140,Updated=TO_TIMESTAMP('2017-07-27 16:58:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=546049 ; -- 2017-07-27T16:58:58.700 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=150,Updated=TO_TIMESTAMP('2017-07-27 16:58:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544837 ; -- 2017-07-27T16:59:01.067 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=160,Updated=TO_TIMESTAMP('2017-07-27 16:59:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544839 ; -- 2017-07-27T16:59:04.746 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=170,Updated=TO_TIMESTAMP('2017-07-27 16:59:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544852 ; -- 2017-07-27T16:59:07.299 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=180,Updated=TO_TIMESTAMP('2017-07-27 16:59:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544836 ; -- 2017-07-27T16:59:33.852 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-07-27 16:59:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544845 ; -- 2017-07-27T17:03:52.879 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-27 17:03:52','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Trading Unit Quantity' WHERE AD_Field_ID=558494 AND AD_Language='en_US' ; -- 2017-07-27T17:04:25.241 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-27 17:04:25','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Trading Unit' WHERE AD_Field_ID=558493 AND AD_Language='en_US' ; -- 2017-07-27T17:06:15.260 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='N',Updated=TO_TIMESTAMP('2017-07-27 17:06:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3523 ; -- 2017-07-27T17:06:17.778 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='N',Updated=TO_TIMESTAMP('2017-07-27 17:06:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3809 ; -- 2017-07-27T17:06:34.093 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='N',Updated=TO_TIMESTAMP('2017-07-27 17:06:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3799 ; -- 2017-07-27T17:06:39.539 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2017-07-27 17:06:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3795 ; -- 2017-07-27T17:07:55.746 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2017-07-27 17:07:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3517 ; -- 2017-07-27T17:09:56.289 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-07-27 17:09:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544843 ; -- 2017-07-27T17:09:56.291 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-07-27 17:09:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544835 ; -- 2017-07-27T17:09:56.292 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-07-27 17:09:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544852 ; -- 2017-07-27T17:09:56.294 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-07-27 17:09:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544846 ; -- 2017-07-27T17:09:56.296 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-07-27 17:09:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544838 ; -- 2017-07-27T17:10:47.040 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,57749,0,53271,540509,547184,TO_TIMESTAMP('2017-07-27 17:10:46','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Belegstatus',40,0,0,TO_TIMESTAMP('2017-07-27 17:10:46','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-07-27T17:10:52.555 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2017-07-27 17:10:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547184 ; -- 2017-07-27T17:10:52.559 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-07-27 17:10:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544847 ; -- 2017-07-27T17:11:34.886 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=-1.000000000000,Updated=TO_TIMESTAMP('2017-07-27 17:11:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57718 ; -- 2017-07-27T17:12:55.496 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=0,Updated=TO_TIMESTAMP('2017-07-27 17:12:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57714 ; -- 2017-07-27T17:30:06.628 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-27 17:30:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540107 ; -- 2017-07-27T17:31:31.724 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-27 17:31:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545270 ; -- 2017-07-27T17:31:34.324 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-27 17:31:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545269 ; -- 2017-07-27T17:32:02.054 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-07-27 17:32:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541584 ; -- 2017-07-27T17:32:05.772 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-07-27 17:32:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=541586 ; -- 2017-07-27T17:32:09.611 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-07-27 17:32:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545270 ; -- 2017-07-27T17:32:12.427 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-07-27 17:32:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=545269 ; -- 2017-07-27T17:34:12.129 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-27 17:34:12','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Products' WHERE AD_Field_ID=558008 AND AD_Language='en_US' ; -- 2017-07-27T17:34:24.866 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-07-27 17:34:24','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Quantity',Description='',Help='' WHERE AD_Field_ID=558006 AND AD_Language='en_US' ; -- 2017-07-27T17:37:21.011 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='',Updated=TO_TIMESTAMP('2017-07-27 17:37:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540577 ; -- 2017-07-27T17:37:26.659 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-27 17:37:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540577 ; -- 2017-07-27T17:41:55.842 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='',Updated=TO_TIMESTAMP('2017-07-27 17:41:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540577 ; -- 2017-07-27T17:42:22.946 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-07-27 17:42:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540577 ;
the_stack
-- 2017-11-17T17:59:49.725 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,Description,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsSelectionColumn,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,557868,2115,0,10,533,'N','OrgValue',TO_TIMESTAMP('2017-11-17 17:59:49','YYYY-MM-DD HH24:MI:SS'),100,'N','Suchschlüssel der Organisation','D',40,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Organisations-Schlüssel',0,1,TO_TIMESTAMP('2017-11-17 17:59:49','YYYY-MM-DD HH24:MI:SS'),100,1) ; -- 2017-11-17T17:59:49.748 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=557868 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2017-11-17T18:00:00.966 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('I_BPartner','ALTER TABLE public.I_BPartner ADD COLUMN OrgValue VARCHAR(40)') ; -- 2017-11-17T18:00:22.215 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,Description,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsCentrallyMaintained,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,557868,560543,0,441,0,TO_TIMESTAMP('2017-11-17 18:00:22','YYYY-MM-DD HH24:MI:SS'),100,'Suchschlüssel der Organisation',0,'D',0,'Y','Y','Y','Y','N','N','N','N','N','Organisations-Schlüssel',500,500,0,1,1,TO_TIMESTAMP('2017-11-17 18:00:22','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-17T18:00:22.223 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=560543 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2017-11-17T18:01:00.776 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=60,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560543 ; -- 2017-11-17T18:01:00.781 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5942 ; -- 2017-11-17T18:01:00.783 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5936 ; -- 2017-11-17T18:01:00.786 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=556301 ; -- 2017-11-17T18:01:00.789 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5950 ; -- 2017-11-17T18:01:00.791 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=110,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5935 ; -- 2017-11-17T18:01:00.793 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=120,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5953 ; -- 2017-11-17T18:01:00.794 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6050 ; -- 2017-11-17T18:01:00.796 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6051 ; -- 2017-11-17T18:01:00.798 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5943 ; -- 2017-11-17T18:01:00.799 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5948 ; -- 2017-11-17T18:01:00.800 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5947 ; -- 2017-11-17T18:01:00.802 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560399 ; -- 2017-11-17T18:01:00.803 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=560400 ; -- 2017-11-17T18:01:00.805 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=200,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5927 ; -- 2017-11-17T18:01:00.806 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5933 ; -- 2017-11-17T18:01:00.807 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=220,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5945 ; -- 2017-11-17T18:01:00.808 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5951 ; -- 2017-11-17T18:01:00.809 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=240,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5954 ; -- 2017-11-17T18:01:00.811 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=250,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5918 ; -- 2017-11-17T18:01:00.812 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5949 ; -- 2017-11-17T18:01:00.813 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5922 ; -- 2017-11-17T18:01:00.814 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=280,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5929 ; -- 2017-11-17T18:01:00.815 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=556302 ; -- 2017-11-17T18:01:00.817 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=300,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=556303 ; -- 2017-11-17T18:01:00.818 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=310,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5946 ; -- 2017-11-17T18:01:00.820 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=320,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559884 ; -- 2017-11-17T18:01:00.822 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=330,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5920 ; -- 2017-11-17T18:01:00.823 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=340,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5921 ; -- 2017-11-17T18:01:00.824 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=350,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5923 ; -- 2017-11-17T18:01:00.825 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=360,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5952 ; -- 2017-11-17T18:01:00.827 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=370,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5930 ; -- 2017-11-17T18:01:00.828 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=380,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5944 ; -- 2017-11-17T18:01:00.829 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=390,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5919 ; -- 2017-11-17T18:01:00.830 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5934 ; -- 2017-11-17T18:01:00.831 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=410,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58038 ; -- 2017-11-17T18:01:00.833 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=420,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58039 ; -- 2017-11-17T18:01:00.834 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=430,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58040 ; -- 2017-11-17T18:01:00.836 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=440,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=557474 ; -- 2017-11-17T18:01:00.837 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=450,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559883 ; -- 2017-11-17T18:01:00.838 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=460,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=557475 ; -- 2017-11-17T18:01:00.838 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=470,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559882 ; -- 2017-11-17T18:01:00.839 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=480,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559903 ; -- 2017-11-17T18:01:00.840 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=490,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559904 ; -- 2017-11-17T18:01:00.841 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=500,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=559947 ; -- 2017-11-17T18:01:00.842 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=510,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5941 ; -- 2017-11-17T18:01:00.843 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='Y', SeqNo=520,Updated=TO_TIMESTAMP('2017-11-17 18:01:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5924 ; -- 2017-11-17T18:01:28.653 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_ImpFormat_Row (AD_Client_ID,AD_Column_ID,AD_ImpFormat_ID,AD_ImpFormat_Row_ID,AD_Org_ID,Created,CreatedBy,DataType,DecimalPoint,DivideBy100,EndNo,IsActive,Name,SeqNo,StartNo,Updated,UpdatedBy) VALUES (0,557868,531096,540194,0,TO_TIMESTAMP('2017-11-17 18:01:28','YYYY-MM-DD HH24:MI:SS'),100,'S','.','N',0,'Y','Sprache',180,18,TO_TIMESTAMP('2017-11-17 18:01:28','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-17T18:01:44.701 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_ImpFormat_Row SET Name='OrgValue',Updated=TO_TIMESTAMP('2017-11-17 18:01:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ImpFormat_Row_ID=540194 ; -- 2017-11-20T13:35:48.898 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_ImpFormat_Row SET SeqNo=190, StartNo=19,Updated=TO_TIMESTAMP('2017-11-20 13:35:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ImpFormat_Row_ID=540194 ;
the_stack
------------------------------------------------------------------------------- -- jsonb_path_exists ------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION ps_tag.tag_op_jsonb_path_exists(_tag_key text, _value jsonpath) RETURNS ps_tag.tag_op_jsonb_path_exists AS $func$ SELECT ROW(_tag_key, _value)::ps_tag.tag_op_jsonb_path_exists $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_jsonb_path_exists(text, jsonpath) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_jsonb_path_exists IS $$This function supports the @? operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.@? ( LEFTARG = text, RIGHTARG = jsonpath, FUNCTION = ps_tag.tag_op_jsonb_path_exists ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; ------------------------------------------------------------------------------- -- regexp_matches ------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION ps_tag.tag_op_regexp_matches(_tag_key text, _value text) RETURNS ps_tag.tag_op_regexp_matches AS $func$ SELECT ROW(_tag_key, _value)::ps_tag.tag_op_regexp_matches $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_regexp_matches(text, text) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_regexp_matches IS $$This function supports the ==~ operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.==~ ( LEFTARG = text, RIGHTARG = text, FUNCTION = ps_tag.tag_op_regexp_matches ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; ------------------------------------------------------------------------------- -- regexp_not_matches ------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION ps_tag.tag_op_regexp_not_matches(_tag_key text, _value text) RETURNS ps_tag.tag_op_regexp_not_matches AS $func$ SELECT ROW(_tag_key, _value)::ps_tag.tag_op_regexp_not_matches $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_regexp_not_matches(text, text) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_regexp_not_matches IS $$This function supports the !=~ operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.!=~ ( LEFTARG = text, RIGHTARG = text, FUNCTION = ps_tag.tag_op_regexp_not_matches ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; ------------------------------------------------------------------------------- -- equals ------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION ps_tag.tag_op_equals_text(_tag_key text, _value text) RETURNS ps_tag.tag_op_equals AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_equals $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_equals_text(text, text) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_equals_text(text, text) IS $$This function supports the == operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.== ( LEFTARG = text, RIGHTARG = text, FUNCTION = ps_tag.tag_op_equals_text ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; CREATE OR REPLACE FUNCTION ps_tag.tag_op_equals(_tag_key text, _value anyelement) RETURNS ps_tag.tag_op_equals AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_equals $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_equals(text, anyelement) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_equals(text, anyelement) IS $$This function supports the == operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.== ( LEFTARG = text, RIGHTARG = anyelement, FUNCTION = ps_tag.tag_op_equals ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; ------------------------------------------------------------------------------- -- not_equals ------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION ps_tag.tag_op_not_equals_text(_tag_key text, _value text) RETURNS ps_tag.tag_op_not_equals AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_not_equals $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_not_equals_text(text, text) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_not_equals_text(text, text) IS $$This function supports the !== operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.!== ( LEFTARG = text, RIGHTARG = text, FUNCTION = ps_tag.tag_op_not_equals_text ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; CREATE OR REPLACE FUNCTION ps_tag.tag_op_not_equals(_tag_key text, _value anyelement) RETURNS ps_tag.tag_op_not_equals AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_not_equals $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_not_equals(text, anyelement) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_not_equals(text, anyelement) IS $$This function supports the !== operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.!== ( LEFTARG = text, RIGHTARG = anyelement, FUNCTION = ps_tag.tag_op_not_equals ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; ------------------------------------------------------------------------------- -- less_than ------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION ps_tag.tag_op_less_than_text(_tag_key text, _value text) RETURNS ps_tag.tag_op_less_than AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_less_than $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_less_than_text(text, text) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_less_than_text(text, text) IS $$This function supports the #< operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.#< ( LEFTARG = text, RIGHTARG = text, FUNCTION = ps_tag.tag_op_less_than_text ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; CREATE OR REPLACE FUNCTION ps_tag.tag_op_less_than(_tag_key text, _value anyelement) RETURNS ps_tag.tag_op_less_than AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_less_than $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_less_than(text, anyelement) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_less_than(text, anyelement) IS $$This function supports the #< operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.#< ( LEFTARG = text, RIGHTARG = anyelement, FUNCTION = ps_tag.tag_op_less_than ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; ------------------------------------------------------------------------------- -- less_than_or_equal ------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION ps_tag.tag_op_less_than_or_equal_text(_tag_key text, _value text) RETURNS ps_tag.tag_op_less_than_or_equal AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_less_than_or_equal $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_less_than_or_equal_text(text, text) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_less_than_or_equal_text(text, text) IS $$This function supports the #<= operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.#<= ( LEFTARG = text, RIGHTARG = text, FUNCTION = ps_tag.tag_op_less_than_or_equal_text ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; CREATE OR REPLACE FUNCTION ps_tag.tag_op_less_than_or_equal(_tag_key text, _value anyelement) RETURNS ps_tag.tag_op_less_than_or_equal AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_less_than_or_equal $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_less_than_or_equal(text, anyelement) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_less_than_or_equal IS $$This function supports the #<= operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.#<= ( LEFTARG = text, RIGHTARG = anyelement, FUNCTION = ps_tag.tag_op_less_than_or_equal ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; ------------------------------------------------------------------------------- -- greater_than ------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION ps_tag.tag_op_greater_than_text(_tag_key text, _value text) RETURNS ps_tag.tag_op_greater_than AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_greater_than $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_greater_than_text(text, text) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_greater_than_text(text, text) IS $$This function supports the #> operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.#> ( LEFTARG = text, RIGHTARG = text, FUNCTION = ps_tag.tag_op_greater_than_text ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; CREATE OR REPLACE FUNCTION ps_tag.tag_op_greater_than(_tag_key text, _value anyelement) RETURNS ps_tag.tag_op_greater_than AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_greater_than $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_greater_than(text, anyelement) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_greater_than(text, anyelement) IS $$This function supports the #> operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.#> ( LEFTARG = text, RIGHTARG = anyelement, FUNCTION = ps_tag.tag_op_greater_than ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; ------------------------------------------------------------------------------- -- greater_than_or_equal ------------------------------------------------------------------------------- CREATE OR REPLACE FUNCTION ps_tag.tag_op_greater_than_or_equal_text(_tag_key text, _value text) RETURNS ps_tag.tag_op_greater_than_or_equal AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_greater_than_or_equal $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_greater_than_or_equal_text(text, text) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_greater_than_or_equal_text(text, text) IS $$This function supports the #>= operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.#>= ( LEFTARG = text, RIGHTARG = text, FUNCTION = ps_tag.tag_op_greater_than_or_equal_text ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$; CREATE OR REPLACE FUNCTION ps_tag.tag_op_greater_than_or_equal(_tag_key text, _value anyelement) RETURNS ps_tag.tag_op_greater_than_or_equal AS $func$ SELECT ROW(_tag_key, to_jsonb(_value))::ps_tag.tag_op_greater_than_or_equal $func$ LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE; GRANT EXECUTE ON FUNCTION ps_tag.tag_op_greater_than_or_equal(text, anyelement) TO prom_reader; COMMENT ON FUNCTION ps_tag.tag_op_greater_than_or_equal IS $$This function supports the #>= operator.$$; DO $do$ BEGIN CREATE OPERATOR ps_tag.#>= ( LEFTARG = text, RIGHTARG = anyelement, FUNCTION = ps_tag.tag_op_greater_than_or_equal ); EXCEPTION WHEN SQLSTATE '42723' THEN -- operator already exists null; END; $do$;
the_stack
-- 2019-11-22T22:02:35.275Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='HU-Mindesthaltbarkeitsdatum', PrintName='HU-Mindesthaltbarkeitsdatum',Updated=TO_TIMESTAMP('2019-11-22 23:02:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543895 AND AD_Language='de_CH' ; -- 2019-11-22T22:02:35.276Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543895,'de_CH') ; -- 2019-11-22T22:02:46.594Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='HU best before date', PrintName='HU best before date',Updated=TO_TIMESTAMP('2019-11-22 23:02:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543895 AND AD_Language='en_US' ; -- 2019-11-22T22:02:46.595Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543895,'en_US') ; -- 2019-11-22T22:02:51.509Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='HU best before date',Updated=TO_TIMESTAMP('2019-11-22 23:02:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543895 AND AD_Language='de_DE' ; -- 2019-11-22T22:02:51.510Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543895,'de_DE') ; -- 2019-11-22T22:02:51.516Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(543895,'de_DE') ; -- 2019-11-22T22:02:51.517Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='HU_BestBeforeDate', Name='HU best before date', Description=NULL, Help=NULL WHERE AD_Element_ID=543895 ; -- 2019-11-22T22:02:51.519Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='HU_BestBeforeDate', Name='HU best before date', Description=NULL, Help=NULL, AD_Element_ID=543895 WHERE UPPER(ColumnName)='HU_BESTBEFOREDATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2019-11-22T22:02:51.520Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='HU_BestBeforeDate', Name='HU best before date', Description=NULL, Help=NULL WHERE AD_Element_ID=543895 AND IsCentrallyMaintained='Y' ; -- 2019-11-22T22:02:51.521Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='HU best before date', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=543895) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 543895) ; -- 2019-11-22T22:02:51.532Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Best Before Date', Name='HU best before date' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=543895) ; -- 2019-11-22T22:02:51.533Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='HU best before date', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 543895 ; -- 2019-11-22T22:02:51.535Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='HU best before date', Description=NULL, Help=NULL WHERE AD_Element_ID = 543895 ; -- 2019-11-22T22:02:51.536Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'HU best before date', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 543895 ; -- 2019-11-22T22:03:01.217Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='HU-Mindesthaltbarkeitsdatum', PrintName='HU-Mindesthaltbarkeitsdatum',Updated=TO_TIMESTAMP('2019-11-22 23:03:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543895 AND AD_Language='de_DE' ; -- 2019-11-22T22:03:01.218Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543895,'de_DE') ; -- 2019-11-22T22:03:01.227Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(543895,'de_DE') ; -- 2019-11-22T22:03:01.229Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='HU_BestBeforeDate', Name='HU-Mindesthaltbarkeitsdatum', Description=NULL, Help=NULL WHERE AD_Element_ID=543895 ; -- 2019-11-22T22:03:01.230Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='HU_BestBeforeDate', Name='HU-Mindesthaltbarkeitsdatum', Description=NULL, Help=NULL, AD_Element_ID=543895 WHERE UPPER(ColumnName)='HU_BESTBEFOREDATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2019-11-22T22:03:01.230Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='HU_BestBeforeDate', Name='HU-Mindesthaltbarkeitsdatum', Description=NULL, Help=NULL WHERE AD_Element_ID=543895 AND IsCentrallyMaintained='Y' ; -- 2019-11-22T22:03:01.231Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='HU-Mindesthaltbarkeitsdatum', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=543895) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 543895) ; -- 2019-11-22T22:03:01.241Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='HU-Mindesthaltbarkeitsdatum', Name='HU-Mindesthaltbarkeitsdatum' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=543895) ; -- 2019-11-22T22:03:01.243Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='HU-Mindesthaltbarkeitsdatum', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 543895 ; -- 2019-11-22T22:03:01.244Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='HU-Mindesthaltbarkeitsdatum', Description=NULL, Help=NULL WHERE AD_Element_ID = 543895 ; -- 2019-11-22T22:03:01.245Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'HU-Mindesthaltbarkeitsdatum', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 543895 ; -- 2019-11-22T22:03:18.868Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577375,0,'BestBeforeDate',TO_TIMESTAMP('2019-11-22 23:03:18','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Mindesthaltbarkeitsdatum','Mindesthaltbarkeitsdatum',TO_TIMESTAMP('2019-11-22 23:03:18','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-11-22T22:03:18.869Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577375 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2019-11-22T22:03:41.541Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Best before date', PrintName='Best before date',Updated=TO_TIMESTAMP('2019-11-22 23:03:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577375 AND AD_Language='en_US' ; -- 2019-11-22T22:03:41.542Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577375,'en_US') ; -- 2019-11-22T22:03:47.288Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-11-22 23:03:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577375 AND AD_Language='de_DE' ; -- 2019-11-22T22:03:47.289Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577375,'de_DE') ; -- 2019-11-22T22:03:47.296Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577375,'de_DE') ; -- 2019-11-22T22:03:49.406Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-11-22 23:03:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577375 AND AD_Language='de_CH' ; -- 2019-11-22T22:03:49.407Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577375,'de_CH') ; -- 2019-11-22T22:04:04.023Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutoApplyValidationRule,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,569642,577375,0,15,540645,'BestBeforeDate',TO_TIMESTAMP('2019-11-22 23:04:03','YYYY-MM-DD HH24:MI:SS'),100,'N','de.metas.esb.edi',7,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Mindesthaltbarkeitsdatum',0,0,TO_TIMESTAMP('2019-11-22 23:04:03','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2019-11-22T22:04:04.024Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Column_ID=569642 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2019-11-22T22:04:04.025Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_Column_Translation_From_AD_Element(577375) ; -- 2019-11-22T22:04:05.808Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('EDI_DesadvLine','ALTER TABLE public.EDI_DesadvLine ADD COLUMN BestBeforeDate TIMESTAMP WITHOUT TIME ZONE') ; -- 2019-11-22T22:04:26.360Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,569642,591932,0,540663,TO_TIMESTAMP('2019-11-22 23:04:26','YYYY-MM-DD HH24:MI:SS'),100,7,'de.metas.esb.edi','Y','Y','N','N','N','N','N','Mindesthaltbarkeitsdatum',TO_TIMESTAMP('2019-11-22 23:04:26','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-11-22T22:04:26.364Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=591932 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2019-11-22T22:04:26.370Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(577375) ; -- 2019-11-22T22:04:26.378Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=591932 ; -- 2019-11-22T22:04:26.380Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(591932) ; -- 2019-11-22T22:05:16.961Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,591932,0,540663,541228,564071,'F',TO_TIMESTAMP('2019-11-22 23:05:16','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',0,'BestBeforeDate',87,0,0,TO_TIMESTAMP('2019-11-22 23:05:16','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-11-22T22:05:52.354Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=564071 ; -- 2019-11-22T22:05:52.359Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563260 ; -- 2019-11-22T22:05:52.362Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549241 ; -- 2019-11-22T22:05:52.366Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549242 ; -- 2019-11-22T22:05:52.370Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549243 ; -- 2019-11-22T22:05:52.374Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549244 ; -- 2019-11-22T22:05:52.377Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549245 ; -- 2019-11-22T22:05:52.381Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=180,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563224 ; -- 2019-11-22T22:05:52.384Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=190,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=563223 ; -- 2019-11-22T22:05:52.388Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=200,Updated=TO_TIMESTAMP('2019-11-22 23:05:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549232 ; -- 2019-11-22T22:06:39.357Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO EXP_FormatLine (AD_Client_ID,AD_Column_ID,AD_Org_ID,Created,CreatedBy,EntityType,EXP_Format_ID,EXP_FormatLine_ID,IsActive,IsMandatory,Name,Position,Type,Updated,UpdatedBy,Value) VALUES (0,569642,0,TO_TIMESTAMP('2019-11-22 23:06:39','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.esb.edi',540406,550257,'N','N','Mindesthaltbarkeitsdatum',340,'E',TO_TIMESTAMP('2019-11-22 23:06:39','YYYY-MM-DD HH24:MI:SS'),100,'BestBeforeDate') ; -- 2019-11-22T22:06:51.863Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE EXP_FormatLine SET IsActive='Y',Updated=TO_TIMESTAMP('2019-11-22 23:06:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE EXP_FormatLine_ID=550257 ;
the_stack
-- 2019-12-19T05:14:04.453Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577440,0,'C_Tax_Acct_ID',TO_TIMESTAMP('2019-12-19 07:14:04','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','C_Tax_Acct','C_Tax_Acct',TO_TIMESTAMP('2019-12-19 07:14:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-12-19T05:14:04.461Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577440 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2019-12-19T05:14:04.668Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,569784,577440,0,13,399,'C_Tax_Acct_ID',TO_TIMESTAMP('2019-12-19 07:14:04','YYYY-MM-DD HH24:MI:SS'),100,'D',10,'Y','Y','N','N','N','Y','Y','N','N','N','N','C_Tax_Acct',TO_TIMESTAMP('2019-12-19 07:14:04','YYYY-MM-DD HH24:MI:SS'),100,1) ; -- 2019-12-19T05:14:04.670Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Column_ID=569784 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2019-12-19T05:14:04.723Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_Column_Translation_From_AD_Element(577440) ; -- 2019-12-19T05:14:04.767Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER SEQUENCE C_TAX_ACCT_SEQ INCREMENT 1 MINVALUE 1 MAXVALUE 2147483647 RESTART 1000000 ; -- 2019-12-19T05:14:04.776Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE C_Tax_Acct ADD COLUMN C_Tax_Acct_ID numeric(10,0) ; -- 2019-12-19T05:14:04.878Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540002 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=540003.000000 ; -- 2019-12-19T05:14:04.960Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540003 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=540006.000000 ; -- 2019-12-19T05:14:05.047Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540004 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=540007.000000 ; -- 2019-12-19T05:14:05.129Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540005 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000000.000000 ; -- 2019-12-19T05:14:05.213Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540006 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000003.000000 ; -- 2019-12-19T05:14:05.294Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540007 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000004.000000 ; -- 2019-12-19T05:14:05.381Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540008 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000005.000000 ; -- 2019-12-19T05:14:05.466Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540009 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000006.000000 ; -- 2019-12-19T05:14:05.549Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540010 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000009.000000 ; -- 2019-12-19T05:14:05.646Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540011 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000010.000000 ; -- 2019-12-19T05:14:05.716Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540012 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000011.000000 ; -- 2019-12-19T05:14:05.800Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540013 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000012.000000 ; -- 2019-12-19T05:14:05.881Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540014 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000013.000000 ; -- 2019-12-19T05:14:05.967Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540015 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000014.000000 ; -- 2019-12-19T05:14:06.047Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540016 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000016.000000 ; -- 2019-12-19T05:14:06.133Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540017 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000017.000000 ; -- 2019-12-19T05:14:06.214Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540018 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000018.000000 ; -- 2019-12-19T05:14:06.284Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540019 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000019.000000 ; -- 2019-12-19T05:14:06.393Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540020 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000020.000000 ; -- 2019-12-19T05:14:06.476Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540021 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000021.000000 ; -- 2019-12-19T05:14:06.560Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540022 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000022.000000 ; -- 2019-12-19T05:14:06.645Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540023 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000023.000000 ; -- 2019-12-19T05:14:06.733Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540024 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000024.000000 ; -- 2019-12-19T05:14:06.812Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540025 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000025.000000 ; -- 2019-12-19T05:14:06.899Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540026 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000026.000000 ; -- 2019-12-19T05:14:06.980Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540027 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000027.000000 ; -- 2019-12-19T05:14:07.073Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540028 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000028.000000 ; -- 2019-12-19T05:14:07.164Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540029 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000029.000000 ; -- 2019-12-19T05:14:07.248Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540030 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000030.000000 ; -- 2019-12-19T05:14:07.331Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540031 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000031.000000 ; -- 2019-12-19T05:14:07.419Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_Tax_Acct SET C_Tax_Acct_ID=540032 WHERE 1=1 AND C_AcctSchema_ID=1000000.000000 AND C_Tax_ID=1000032.000000 ; -- 2019-12-19T05:14:07.427Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE C_Tax_Acct ALTER COLUMN C_Tax_Acct_ID SET DEFAULT nextval('c_tax_acct_seq') ; UPDATE C_Tax_Acct SET C_Tax_Acct_ID=nextval('c_tax_acct_seq') WHERE C_Tax_Acct_ID IS NULL; -- 2019-12-19T05:14:07.439Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE C_Tax_Acct ALTER COLUMN C_Tax_Acct_ID SET NOT NULL ; -- 2019-12-19T05:14:07.448Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE C_Tax_Acct DROP CONSTRAINT IF EXISTS c_tax_acct_pkey ; -- 2019-12-19T05:14:07.462Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE C_Tax_Acct DROP CONSTRAINT IF EXISTS c_tax_acct_key ; -- 2019-12-19T05:14:07.469Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator ALTER TABLE C_Tax_Acct ADD CONSTRAINT c_tax_acct_pkey PRIMARY KEY (C_Tax_Acct_ID) ; -- 2019-12-19T05:14:07.658Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,569784,593806,0,333,TO_TIMESTAMP('2019-12-19 07:14:07','YYYY-MM-DD HH24:MI:SS'),100,10,'D','Y','N','N','N','N','N','N','N','C_Tax_Acct',TO_TIMESTAMP('2019-12-19 07:14:07','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-12-19T05:14:07.660Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=593806 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2019-12-19T05:14:07.663Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(577440) ; -- 2019-12-19T05:14:07.683Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=593806 ; -- 2019-12-19T05:14:07.690Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(593806) ; -- 2019-12-19T05:14:07.809Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,569784,593807,0,53077,TO_TIMESTAMP('2019-12-19 07:14:07','YYYY-MM-DD HH24:MI:SS'),100,10,'EE04','Y','N','N','N','N','N','N','N','C_Tax_Acct',TO_TIMESTAMP('2019-12-19 07:14:07','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-12-19T05:14:07.813Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=593807 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2019-12-19T05:14:07.820Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_FieldTranslation_From_AD_Name_Element(577440) ; -- 2019-12-19T05:14:07.828Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Element_Link WHERE AD_Field_ID=593807 ; -- 2019-12-19T05:14:07.834Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select AD_Element_Link_Create_Missing_Field(593807) ; -- 2019-12-19T05:27:20.149Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table SET IsChangeLog='Y',Updated=TO_TIMESTAMP('2019-12-19 07:27:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=399 ;
the_stack
----------------------------------------------------------------------- -- SELECT https://msdn.microsoft.com/en-us/library/ms187731.aspx --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using SELECT to retrieve rows and columns USE AdventureWorks2012; GO SELECT * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT p.* FROM Production.Product AS p ORDER BY Name ASC; GO USE AdventureWorks2012; GO SELECT Name, ProductNumber, ListPrice AS Price FROM Production.Product ORDER BY Name ASC; GO USE AdventureWorks2012; GO SELECT Name, ProductNumber, ListPrice AS Price FROM Production.Product WHERE ProductLine = 'R' AND DaysToManufacture < 4 ORDER BY Name ASC; GO -- Select with Multiple Batch Separators USE AdventureWorks2012; GO SELECT * FROM Production.Product ORDER BY Name ASC; GO GO USE AdventureWorks2012; GO SELECT [Production].[Product].[ProductID], [Production].[Product].[Name] FROM [Production].[Product] GO USE AdventureWorks2012; GO SELECT *, *, * -- yes, syntax is valid FROM [Production].[Product] GO USE AdventureWorks2012; GO SELECT some_type::static_method (@arg1, @arg2, @arg3), another_type::method ('some value'), still_one_type.non_static_method (@but, @with, @params) FROM [Production].[Product] GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using SELECT with column headings and calculations USE AdventureWorks2012; GO SELECT p.Name AS ProductName, NonDiscountSales = (OrderQty * UnitPrice), Discounts = ((OrderQty * UnitPrice) * UnitPriceDiscount) FROM Production.Product AS p INNER JOIN Sales.SalesOrderDetail AS sod ON p.ProductID = sod.ProductID ORDER BY ProductName DESC; GO USE AdventureWorks2012; GO SELECT 'Total income is', ((OrderQty * UnitPrice) * (1.0 - UnitPriceDiscount)), ' for ', p.Name AS ProductName FROM Production.Product AS p INNER JOIN Sales.SalesOrderDetail AS sod ON p.ProductID = sod.ProductID ORDER BY ProductName ASC; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using DISTINCT with SELECT USE AdventureWorks2012; GO SELECT DISTINCT JobTitle FROM HumanResources.Employee ORDER BY JobTitle; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Creating tables with SELECT INTO USE tempdb; GO IF OBJECT_ID (N'#Bicycles',N'U') IS NOT NULL DROP TABLE #Bicycles; GO SELECT * INTO #Bicycles FROM AdventureWorks2012.Production.Product WHERE ProductNumber LIKE 'BK%'; GO USE AdventureWorks2012; GO IF OBJECT_ID('dbo.NewProducts', 'U') IS NOT NULL DROP TABLE dbo.NewProducts; GO ALTER DATABASE AdventureWorks2012 SET RECOVERY BULK_LOGGED; GO SELECT * INTO dbo.NewProducts FROM Production.Product WHERE ListPrice > $25 AND ListPrice < $100; GO ALTER DATABASE AdventureWorks2012 SET RECOVERY FULL; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using correlated subqueries USE AdventureWorks2012; GO SELECT DISTINCT Name FROM Production.Product AS p WHERE EXISTS (SELECT * FROM Production.ProductModel AS pm WHERE p.ProductModelID = pm.ProductModelID AND pm.Name LIKE 'Long-Sleeve Logo Jersey%'); GO -- OR USE AdventureWorks2012; GO SELECT DISTINCT Name FROM Production.Product WHERE ProductModelID IN (SELECT ProductModelID FROM Production.ProductModel WHERE Name LIKE 'Long-Sleeve Logo Jersey%'); GO USE AdventureWorks2012; GO SELECT DISTINCT p.LastName, p.FirstName FROM Person.Person AS p JOIN HumanResources.Employee AS e ON e.BusinessEntityID = p.BusinessEntityID WHERE 5000.00 IN (SELECT Bonus FROM Sales.SalesPerson AS sp WHERE e.BusinessEntityID = sp.BusinessEntityID); GO USE AdventureWorks2012; GO SELECT p1.ProductModelID FROM Production.Product AS p1 GROUP BY p1.ProductModelID HAVING MAX(p1.ListPrice) >= ALL (SELECT AVG(p2.ListPrice) FROM Production.Product AS p2 WHERE p1.ProductModelID = p2.ProductModelID); GO USE AdventureWorks2012; GO SELECT DISTINCT pp.LastName, pp.FirstName FROM Person.Person pp JOIN HumanResources.Employee e ON e.BusinessEntityID = pp.BusinessEntityID WHERE pp.BusinessEntityID IN (SELECT SalesPersonID FROM Sales.SalesOrderHeader WHERE SalesOrderID IN (SELECT SalesOrderID FROM Sales.SalesOrderDetail WHERE ProductID IN (SELECT ProductID FROM Production.Product p WHERE ProductNumber = 'BK-M68B-42'))); GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using GROUP BY USE AdventureWorks2012; GO SELECT SalesOrderID, SUM(LineTotal) AS SubTotal FROM Sales.SalesOrderDetail GROUP BY SalesOrderID ORDER BY SalesOrderID; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using GROUP BY with multiple groups USE AdventureWorks2012; GO SELECT ProductID, SpecialOfferID, AVG(UnitPrice) AS [Average Price], SUM(LineTotal) AS SubTotal FROM Sales.SalesOrderDetail GROUP BY ProductID, SpecialOfferID ORDER BY ProductID; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using GROUP BY and WHERE USE AdventureWorks2012; GO SELECT ProductModelID, AVG(ListPrice) AS [Average List Price] FROM Production.Product WHERE ListPrice > $1000 GROUP BY ProductModelID ORDER BY ProductModelID; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using GROUP BY with an expression USE AdventureWorks2012; GO SELECT AVG(OrderQty) AS [Average Quantity], NonDiscountSales = (OrderQty * UnitPrice) FROM Sales.SalesOrderDetail GROUP BY (OrderQty * UnitPrice) ORDER BY (OrderQty * UnitPrice) DESC; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using GROUP BY with ORDER BY USE AdventureWorks2012; GO SELECT ProductID, AVG(UnitPrice) AS [Average Price] FROM Sales.SalesOrderDetail WHERE OrderQty > 10 GROUP BY ProductID ORDER BY AVG(UnitPrice); GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using the HAVING clause USE AdventureWorks2012; GO SELECT ProductID FROM Sales.SalesOrderDetail GROUP BY ProductID HAVING AVG(OrderQty) > 5 ORDER BY ProductID; GO USE AdventureWorks2012 ; GO SELECT SalesOrderID, CarrierTrackingNumber FROM Sales.SalesOrderDetail GROUP BY SalesOrderID, CarrierTrackingNumber HAVING CarrierTrackingNumber LIKE '4BD%' ORDER BY SalesOrderID ; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using HAVING and GROUP BY USE AdventureWorks2012; GO SELECT ProductID FROM Sales.SalesOrderDetail WHERE UnitPrice < 25.00 GROUP BY ProductID HAVING AVG(OrderQty) > 5 ORDER BY ProductID; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using HAVING with SUM and AVG USE AdventureWorks2012; GO SELECT ProductID, AVG(OrderQty) AS AverageQuantity, SUM(LineTotal) AS Total FROM Sales.SalesOrderDetail GROUP BY ProductID HAVING SUM(LineTotal) > $1000000.00 AND AVG(OrderQty) < 3; GO USE AdventureWorks2012; GO SELECT ProductID, Total = SUM(LineTotal) FROM Sales.SalesOrderDetail GROUP BY ProductID HAVING SUM(LineTotal) > $2000000.00; GO USE AdventureWorks2012; GO SELECT ProductID, SUM(LineTotal) AS Total FROM Sales.SalesOrderDetail GROUP BY ProductID HAVING COUNT(*) > 1500; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using the INDEX optimizer hint USE AdventureWorks2012; GO SELECT pp.FirstName, pp.LastName, e.NationalIDNumber FROM HumanResources.Employee AS e WITH (INDEX(AK_Employee_NationalIDNumber)) JOIN Person.Person AS pp on e.BusinessEntityID = pp.BusinessEntityID WHERE LastName = 'Johnson'; GO -- Force a table scan by using INDEX = 0. USE AdventureWorks2012; GO SELECT pp.LastName, pp.FirstName, e.JobTitle FROM HumanResources.Employee AS e WITH (INDEX = 0) JOIN Person.Person AS pp ON e.BusinessEntityID = pp.BusinessEntityID WHERE LastName = 'Johnson'; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using OPTION and the GROUP hints USE AdventureWorks2012; GO SELECT ProductID, OrderQty, SUM(LineTotal) AS Total FROM Sales.SalesOrderDetail WHERE UnitPrice < $5.00 GROUP BY ProductID, OrderQty ORDER BY ProductID, OrderQty OPTION (HASH GROUP, FAST 10); GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using the UNION query hint USE AdventureWorks2012; GO SELECT BusinessEntityID, JobTitle, HireDate, VacationHours, SickLeaveHours FROM HumanResources.Employee AS e1 UNION SELECT BusinessEntityID, JobTitle, HireDate, VacationHours, SickLeaveHours FROM HumanResources.Employee AS e2 OPTION (MERGE UNION); GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using a simple UNION USE AdventureWorks2012; GO IF OBJECT_ID ('dbo.Gloves', 'U') IS NOT NULL DROP TABLE dbo.Gloves; GO -- Create Gloves table. SELECT ProductModelID, Name INTO dbo.Gloves FROM Production.ProductModel WHERE ProductModelID IN (3, 4); GO -- Here is the simple union. USE AdventureWorks2012; GO SELECT ProductModelID, Name FROM Production.ProductModel WHERE ProductModelID NOT IN (3, 4) UNION SELECT ProductModelID, Name FROM dbo.Gloves ORDER BY Name; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using SELECT INTO with UNION USE AdventureWorks2012; GO IF OBJECT_ID ('dbo.ProductResults', 'U') IS NOT NULL DROP TABLE dbo.ProductResults; GO IF OBJECT_ID ('dbo.Gloves', 'U') IS NOT NULL DROP TABLE dbo.Gloves; GO -- Create Gloves table. SELECT ProductModelID, Name INTO dbo.Gloves FROM Production.ProductModel WHERE ProductModelID IN (3, 4); GO USE AdventureWorks2012; GO SELECT ProductModelID, Name INTO dbo.ProductResults FROM Production.ProductModel WHERE ProductModelID NOT IN (3, 4) UNION SELECT ProductModelID, Name FROM dbo.Gloves; GO SELECT ProductModelID, Name FROM dbo.ProductResults; --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using UNION of two SELECT statements with ORDER BY USE AdventureWorks2012; GO IF OBJECT_ID ('dbo.Gloves', 'U') IS NOT NULL DROP TABLE dbo.Gloves; GO -- Create Gloves table. SELECT ProductModelID, Name INTO dbo.Gloves FROM Production.ProductModel WHERE ProductModelID IN (3, 4); GO /* CORRECT */ USE AdventureWorks2012; GO SELECT ProductModelID, Name FROM Production.ProductModel WHERE ProductModelID NOT IN (3, 4) UNION SELECT ProductModelID, Name FROM dbo.Gloves ORDER BY Name; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using UNION of three SELECT statements to show the effects of ALL and parentheses USE AdventureWorks2012; GO IF OBJECT_ID ('dbo.EmployeeOne', 'U') IS NOT NULL DROP TABLE dbo.EmployeeOne; GO IF OBJECT_ID ('dbo.EmployeeTwo', 'U') IS NOT NULL DROP TABLE dbo.EmployeeTwo; GO IF OBJECT_ID ('dbo.EmployeeThree', 'U') IS NOT NULL DROP TABLE dbo.EmployeeThree; GO SELECT pp.LastName, pp.FirstName, e.JobTitle INTO dbo.EmployeeOne FROM Person.Person AS pp JOIN HumanResources.Employee AS e ON e.BusinessEntityID = pp.BusinessEntityID WHERE LastName = 'Johnson'; GO SELECT pp.LastName, pp.FirstName, e.JobTitle INTO dbo.EmployeeTwo FROM Person.Person AS pp JOIN HumanResources.Employee AS e ON e.BusinessEntityID = pp.BusinessEntityID WHERE LastName = 'Johnson'; GO SELECT pp.LastName, pp.FirstName, e.JobTitle INTO dbo.EmployeeThree FROM Person.Person AS pp JOIN HumanResources.Employee AS e ON e.BusinessEntityID = pp.BusinessEntityID WHERE LastName = 'Johnson'; GO -- Union ALL SELECT LastName, FirstName, JobTitle FROM dbo.EmployeeOne UNION ALL SELECT LastName, FirstName ,JobTitle FROM dbo.EmployeeTwo UNION ALL SELECT LastName, FirstName,JobTitle FROM dbo.EmployeeThree; GO SELECT LastName, FirstName,JobTitle FROM dbo.EmployeeOne UNION SELECT LastName, FirstName, JobTitle FROM dbo.EmployeeTwo UNION SELECT LastName, FirstName, JobTitle FROM dbo.EmployeeThree; GO SELECT LastName, FirstName,JobTitle FROM dbo.EmployeeOne UNION ALL ( SELECT LastName, FirstName, JobTitle FROM dbo.EmployeeTwo UNION SELECT LastName, FirstName, JobTitle FROM dbo.EmployeeThree ); GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using SELECT with TOP clause USE AdventureWorks2012; GO SELECT TOP 10 * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (10) * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (@localvar) * FROM Production.Product ORDER BY Name ASC; -- TOP with percentage. USE AdventureWorks2012; GO SELECT TOP 10.5 PERCENT * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (10.5) PERCENT * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (@localvar) PERCENT * FROM Production.Product ORDER BY Name ASC; -- TOP with ties. USE AdventureWorks2012; GO SELECT TOP 10 WITH TIES * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP 10.5 PERCENT WITH TIES * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (@localvar) WITH TIES * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (@localvar) PERCENT WITH TIES * FROM Production.Product ORDER BY Name ASC; -- Can apply any expression WITH parentheses. -- If without parentheses, expression trails may be misunderstanding select_list. -- ex: "SELECT TOP 1 + 2 * FROM HOGE" --> "+ 2" are matching in select_list. USE AdventureWorks2012; GO SELECT TOP (NULL) * -- (But cause runtime error by SQL Server) FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (1+2) * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (1+@localvar) * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (NULL) PERCENT * -- (But cause runtime error by SQL Server) FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (1+2) PERCENT * FROM Production.Product ORDER BY Name ASC; -- Alternate way. USE AdventureWorks2012; GO SELECT TOP (1+@localvar) PERCENT * FROM Production.Product ORDER BY Name ASC; -- TRY_CAST & TRY_CONVERT use AdventureWorks2012; GO SELECT TRY_CAST(SalesOrderID AS INT), TRY_CONVERT(INT, SalesOrderID) FROM Sales.SalesOrderDetail WHERE SalesOrderDetailID = 1; GO -- SET statement SET ANSI_WARNINGS OFF; SELECT id FROM tbl; GO -- Select with full table name SELECT * FROM ServerName.DBName.do.TestTable TestTable --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using SELECT from build in function SELECT * FROM ::fn_helpcollations() --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using PIVOT and UNPIVOT statements -- Pivot table with one row and five columns SELECT 'AverageCost' AS Cost_Sorted_By_Production_Days, [0], [1], [2], [3], [4] FROM (SELECT DaysToManufacture, StandardCost FROM Production.Product) AS SourceTable PIVOT ( AVG(StandardCost) FOR DaysToManufacture IN ([0], [1], [2], [3], [4]) ) AS PivotTable; --Create the table and insert values as portrayed in the previous example. CREATE TABLE pvt (VendorID int, Emp1 int, Emp2 int, Emp3 int, Emp4 int, Emp5 int); GO INSERT INTO pvt VALUES (1,4,3,5,4,4); INSERT INTO pvt VALUES (2,4,1,5,5,5); INSERT INTO pvt VALUES (3,4,3,5,4,4); INSERT INTO pvt VALUES (4,4,2,5,5,4); INSERT INTO pvt VALUES (5,5,1,5,5,5); GO --Unpivot the table. SELECT VendorID, Employee, Orders FROM (SELECT VendorID, Emp1, Emp2, Emp3, Emp4, Emp5 FROM pvt) p UNPIVOT (Orders FOR Employee IN (Emp1, Emp2, Emp3, Emp4, Emp5) )AS unpvt; GO --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Using table value constructor SELECT a, b FROM (VALUES (1, 2), (3, 4), (5, 6), (7, 8), (9, 10) ) AS MyTable(a, b); GO -- Used in an inner join to specify values to return. SELECT ProductID, a.Name, Color FROM Production.Product AS a INNER JOIN (VALUES ('Blade'), ('Crown Race'), ('AWC Logo Cap')) AS b(Name) ON a.Name = b.Name; --+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -- Open XML Statement DECLARE @idoc int, @doc varchar(1000); SET @doc =' <ROOT> <Customer CustomerID="VINET" ContactName="Paul Henriot"> <Order CustomerID="VINET" EmployeeID="5" OrderDate="1996-07-04T00:00:00"> <OrderDetail OrderID="10248" ProductID="11" Quantity="12"/> <OrderDetail OrderID="10248" ProductID="42" Quantity="10"/> </Order> </Customer> <Customer CustomerID="LILAS" ContactName="Carlos Gonzlez"> <Order CustomerID="LILAS" EmployeeID="3" OrderDate="1996-08-16T00:00:00"> <OrderDetail OrderID="10283" ProductID="72" Quantity="3"/> </Order> </Customer> </ROOT>'; --Create an internal representation of the XML document. EXEC sp_xml_preparedocument @idoc OUTPUT, @doc; -- Execute a SELECT statement that uses the OPENXML rowset provider. SELECT * FROM OPENXML (@idoc, '/ROOT/Customer',1) WITH (CustomerID varchar(10), ContactName varchar(20)); DECLARE @idoc int, @doc varchar(1000); SET @doc =' <ROOT> <Customer CustomerID="VINET" ContactName="Paul Henriot"> <Order OrderID="10248" CustomerID="VINET" EmployeeID="5" OrderDate="1996-07-04T00:00:00"> <OrderDetail ProductID="11" Quantity="12"/> <OrderDetail ProductID="42" Quantity="10"/> </Order> </Customer> <Customer CustomerID="LILAS" ContactName="Carlos Gonzlez">v <Order OrderID="10283" CustomerID="LILAS" EmployeeID="3" OrderDate="1996-08-16T00:00:00"> <OrderDetail ProductID="72" Quantity="3"/> </Order> </Customer> </ROOT>'; --Create an internal representation of the XML document. EXEC sp_xml_preparedocument @idoc OUTPUT, @doc; -- SELECT stmt using OPENXML rowset provider SELECT * FROM OPENXML (@idoc, '/ROOT/Customer/Order/OrderDetail',2) WITH (OrderID int '../@OrderID', CustomerID varchar(10) '../@CustomerID', OrderDate datetime '../@OrderDate', ProdID int '@ProductID', Qty int '@Quantity');
the_stack
CREATE PROCEDURE [dbo].[usp_sqlwatch_logger_index_histogram] as /* ------------------------------------------------------------------------------------------------------------------- Procedure: [usp_sqlwatch_logger_index_histogram] Description: Collect index histogram. Parameters Author: Marcin Gminski Change Log: 1.0 2018-08 - Marcin Gminski, Initial version 1.1 2020-03-18 - Marcin Gminski, move explicit transaction after header to fix https://github.com/marcingminski/sqlwatch/issues/155 ------------------------------------------------------------------------------------------------------------------- */ set xact_abort on set nocount on declare @snapshot_type_id tinyint = 14, @snapshot_time datetime, @database_name sysname, @sql varchar(max), @object_id int, @index_name sysname, @index_id int, @object_name nvarchar(256), @sqlwatch_database_id smallint, @sqlwatch_table_id int, @sqlwatch_index_id int declare @indextype as table ( is_index_hierarchical bit, is_index_timestamp bit ) create table #stats_hierarchical ( [database_name] sysname default 'fe92qw0fa_dummy', [object_name] sysname default 'fe92qw0fa_dummy', index_name sysname default 'fe92qw0fa_dummy', index_id int, RANGE_HI_KEY hierarchyid, RANGE_ROWS real, EQ_ROWS real, DISTINCT_RANGE_ROWS real, AVG_RANGE_ROWS real, [collection_time] datetime, [sqlwatch_database_id] smallint, [sqlwatch_table_id] int, [sqlwatch_index_id] int ) /* new temp table because of https://github.com/marcingminski/sqlwatch/issues/119 */ create table #stats_timestamp ( [database_name] sysname default 'fe92qw0fa_dummy', [object_name] sysname default 'fe92qw0fa_dummy', index_name sysname default 'fe92qw0fa_dummy', index_id int, /* timestamp is a rowversion column - a binary "counter" to identify that the row has been modified. it is unlikely to have index or/and stats on the rowversion column but we have seen it happen. (yay vendor apps!) so we have to be able to handle it. Anyway, timestamp (aka rowversion) will implicitly convert to varchar and datetime. when converted to varchar the value will be empty string, and when converted to datetime it will simply add the counter value to 1900-01-01 and will show relatively random date. I don't either will be of any use and I'd be actually tempted to just not collect any stats from indexes on these columns but happy to wait for community advice and expertise. */ RANGE_HI_KEY datetime, RANGE_ROWS real, EQ_ROWS real, DISTINCT_RANGE_ROWS real, AVG_RANGE_ROWS real, [collection_time] datetime, [sqlwatch_database_id] smallint, [sqlwatch_table_id] int, [sqlwatch_index_id] int ) create table #stats ( [database_name] sysname default 'fe92qw0fa_dummy', [object_name] sysname default 'fe92qw0fa_dummy', index_name sysname default 'fe92qw0fa_dummy', index_id int, RANGE_HI_KEY sql_variant, RANGE_ROWS real, EQ_ROWS real, DISTINCT_RANGE_ROWS real, AVG_RANGE_ROWS real, [collection_time] datetime, [sqlwatch_database_id] smallint, [sqlwatch_table_id] int, [sqlwatch_index_id] int ) declare @is_index_hierarchical bit declare @is_index_timestamp bit set @snapshot_type_id = 15 declare c_index cursor for select md.[database_name], table_name=mt.table_name , index_name = mi.index_name, mi.index_id, mi.sqlwatch_database_id, mi.sqlwatch_table_id, mi.sqlwatch_index_id from [dbo].[sqlwatch_meta_index] mi inner join [dbo].[sqlwatch_meta_table] mt on mt.sqlwatch_database_id = mi.sqlwatch_database_id and mt.sql_instance = mi.sql_instance and mt.sqlwatch_table_id = mi.sqlwatch_table_id inner join [dbo].[sqlwatch_meta_database] md on md.sql_instance = mi.sql_instance and md.sqlwatch_database_id = mi.sqlwatch_database_id inner join [dbo].[vw_sqlwatch_sys_databases] sdb on sdb.name = md.database_name collate database_default and sdb.create_date = md.database_create_date /* Index histograms can be very large and since its only required for a very specific performance tuning, we are only going to collect those exclusively included for collection */ inner join [dbo].[sqlwatch_config_include_index_histogram] ih on md.[database_name] like parsename(ih.object_name_pattern,3) and mt.table_name like parsename(ih.object_name_pattern,2) + '.' + parsename(ih.object_name_pattern,1) and mi.index_name like ih.index_name_pattern left join [dbo].[sqlwatch_config_exclude_database] ed on md.[database_name] like ed.database_name_pattern and ed.snapshot_type_id = @snapshot_type_id where ed.snapshot_type_id is null open c_index fetch next from c_index into @database_name, @object_name, @index_name, @index_id, @sqlwatch_database_id, @sqlwatch_table_id, @sqlwatch_index_id while @@FETCH_STATUS = 0 begin delete from @indextype select @is_index_hierarchical = 0, @is_index_timestamp = 0 set @sql = 'use [' + @database_name + ']; select is_index_hierarchical = case when tp.name = ''hierarchyid'' then 1 else 0 end, is_index_timestamp = case when tp.name = ''timestamp'' then 1 else 0 end from sys.schemas s inner join sys.tables t on s.schema_id = t.schema_id inner join sys.indexes i on i.object_id = t.object_id inner join sys.index_columns ic on ic.index_id = i.index_id and ic.object_id = i.object_id /* only the leading column is used to build histogram https://dba.stackexchange.com/a/182250 */ and ic.index_column_id = 1 inner join sys.columns c on c.column_id = ic.column_id and c.object_id = ic.object_id inner join sys.types tp on tp.system_type_id = c.system_type_id and tp.user_type_id = c.user_type_id where i.name = ''' + @index_name + ''' and s.name + ''.'' + t.name = ''' + @object_name + '''' insert into @indextype(is_index_hierarchical, is_index_timestamp) exec (@sql) select @is_index_hierarchical = is_index_hierarchical, @is_index_timestamp = is_index_timestamp from @indextype --set @object_name = object_schema_name(@object_id) + '.' + object_name(@object_id) set @sql = 'use [' + @database_name + ']; --extra check if the table and index still exist. since we are collecting histogram for indexes already collected in sqlwatch, --there could be a situation where index was deleted from Sql Server before SQLWATCH was upated and the below would have thrown an error. if exists ( select * from sys.indexes where object_id = object_id(''' + @object_name + ''') and name=''' + @index_name + ''') begin dbcc show_statistics (''' + @object_name + ''',''' + @index_name + ''') with HISTOGRAM Print ''['' + convert(varchar(23),getdate(),121) + ''] Collecting index histogram for index: ' + @index_name + ''' end' if @is_index_hierarchical = 1 begin insert into #stats_hierarchical (RANGE_HI_KEY,RANGE_ROWS,EQ_ROWS,DISTINCT_RANGE_ROWS,AVG_RANGE_ROWS) exec (@sql) update #stats_hierarchical set [database_name] = @database_name , [object_name] = @object_name , index_name = @index_name , index_id = @index_id , [collection_time] = getutcdate() , [sqlwatch_database_id] = @sqlwatch_database_id , [sqlwatch_table_id] = @sqlwatch_table_id , [sqlwatch_index_id] = @sqlwatch_index_id where index_name = 'fe92qw0fa_dummy' end else if @is_index_timestamp = 1 begin insert into #stats_timestamp (RANGE_HI_KEY,RANGE_ROWS,EQ_ROWS,DISTINCT_RANGE_ROWS,AVG_RANGE_ROWS) exec (@sql) update #stats_timestamp set [database_name] = @database_name , [object_name] = @object_name , index_name = @index_name , index_id = @index_id , [collection_time] = getutcdate() , [sqlwatch_database_id] = @sqlwatch_database_id , [sqlwatch_table_id] = @sqlwatch_table_id , [sqlwatch_index_id] = @sqlwatch_index_id where index_name = 'fe92qw0fa_dummy' end else begin insert into #stats (RANGE_HI_KEY,RANGE_ROWS,EQ_ROWS,DISTINCT_RANGE_ROWS,AVG_RANGE_ROWS) exec (@sql) update #stats set [database_name] = @database_name , [object_name] = @object_name , index_name = @index_name , index_id = @index_id , [collection_time] = getutcdate() , [sqlwatch_database_id] = @sqlwatch_database_id , [sqlwatch_table_id] = @sqlwatch_table_id , [sqlwatch_index_id] = @sqlwatch_index_id where index_name = 'fe92qw0fa_dummy' end fetch next from c_index into @database_name, @object_name, @index_name, @index_id, @sqlwatch_database_id, @sqlwatch_table_id, @sqlwatch_index_id end close c_index deallocate c_index exec [dbo].[usp_sqlwatch_internal_insert_header] @snapshot_time_new = @snapshot_time OUTPUT, @snapshot_type_id = @snapshot_type_id begin tran insert into [dbo].[sqlwatch_logger_index_histogram]( [sqlwatch_database_id], [sqlwatch_table_id], [sqlwatch_index_id], RANGE_HI_KEY, RANGE_ROWS, EQ_ROWS, DISTINCT_RANGE_ROWS, AVG_RANGE_ROWS, [snapshot_time], [snapshot_type_id], [collection_time]) select st.[sqlwatch_database_id], st.[sqlwatch_table_id], st.[sqlwatch_index_id], convert(nvarchar(max),st.RANGE_HI_KEY), RANGE_ROWS = convert(real,st.RANGE_ROWS), EQ_ROWS = convert(real,st.EQ_ROWS), DISTINCT_RANGE_ROWS = convert(real,st.DISTINCT_RANGE_ROWS), AVG_RANGE_ROWS = convert(real,st.AVG_RANGE_ROWS), [snapshot_time] = @snapshot_time, [snapshot_type_id] = @snapshot_type_id, [collection_time] from #stats st insert into [dbo].[sqlwatch_logger_index_histogram]( [sqlwatch_database_id], [sqlwatch_table_id], [sqlwatch_index_id], RANGE_HI_KEY, RANGE_ROWS, EQ_ROWS, DISTINCT_RANGE_ROWS, AVG_RANGE_ROWS, [snapshot_time], [snapshot_type_id], [collection_time]) select st.[sqlwatch_database_id], st.[sqlwatch_table_id], st.[sqlwatch_index_id], convert(nvarchar(max),st.RANGE_HI_KEY), RANGE_ROWS = convert(real,st.RANGE_ROWS), EQ_ROWS = convert(real,st.EQ_ROWS), DISTINCT_RANGE_ROWS = convert(real,st.DISTINCT_RANGE_ROWS), AVG_RANGE_ROWS = convert(real,st.AVG_RANGE_ROWS), [snapshot_time] = @snapshot_time, [snapshot_type_id] = @snapshot_type_id, [collection_time] from #stats_hierarchical st insert into [dbo].[sqlwatch_logger_index_histogram]( [sqlwatch_database_id], [sqlwatch_table_id], [sqlwatch_index_id], RANGE_HI_KEY, RANGE_ROWS, EQ_ROWS, DISTINCT_RANGE_ROWS, AVG_RANGE_ROWS, [snapshot_time], [snapshot_type_id], [collection_time]) select st.[sqlwatch_database_id], st.[sqlwatch_table_id], st.[sqlwatch_index_id], convert(nvarchar(max),st.RANGE_HI_KEY), RANGE_ROWS = convert(real,st.RANGE_ROWS), EQ_ROWS = convert(real,st.EQ_ROWS), DISTINCT_RANGE_ROWS = convert(real,st.DISTINCT_RANGE_ROWS), AVG_RANGE_ROWS = convert(real,st.AVG_RANGE_ROWS), [snapshot_time] = @snapshot_time, [snapshot_type_id] = @snapshot_type_id, [collection_time] from #stats_timestamp st commit tran
the_stack
SET NUMERIC_ROUNDABORT OFF GO SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON GO SET XACT_ABORT ON GO SET TRANSACTION ISOLATION LEVEL Serializable GO BEGIN TRANSACTION GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Altering [dbo].[FillEmptyQuestionsForAnalysis]' GO -- ============================================= -- Author: hansbk -- Create date: 7/9/2018 -- Description: CopyData -- ============================================= ALTER PROCEDURE [dbo].[FillEmptyQuestionsForAnalysis] -- Add the parameters for the stored procedure here @Assessment_Id int AS BEGIN --SET NOCOUNT ON; --get the list of selected standards --get the mode --for the given mode --select the new_questions_sets or requirement_sets table with left join answers (possibly on the view) -- and do the insert declare @ApplicationMode varchar(100) declare @SALevel varchar(10) declare @NumRowsChanged int select @SALevel = ul.Universal_Sal_Level from STANDARD_SELECTION ss join UNIVERSAL_SAL_LEVEL ul on ss.Selected_Sal_Level = ul.Full_Name_Sal where @Assessment_Id = @Assessment_Id DECLARE @result int; exec GetApplicationModeDefault @assessment_id,@applicationmode output if(@ApplicationMode = 'Questions Based') begin BEGIN TRANSACTION; EXEC @result = sp_getapplock @DbPrincipal = 'dbo', @Resource = '[Answer]', @LockMode = 'Exclusive'; INSERT INTO [dbo].[ANSWER] ([Is_Requirement],[Question_Or_Requirement_Id],[Component_Id] ,[Answer_Text],[Is_Component],[Is_Framework],[Assessment_Id]) select Is_Requirement=0,s.Question_id,Component_Id =0, Answer_Text = 'U', Is_Component='0',Is_Framework=0, Assessment_Id =@Assessment_Id from (select distinct s.Question_Id from NEW_QUESTION_SETS s join AVAILABLE_STANDARDS v on s.Set_Name = v.Set_Name join NEW_QUESTION_LEVELS l on s.New_Question_Set_Id = l.new_question_set_id where v.Selected = 1 and v.Assessment_Id = @assessment_id and l.Universal_Sal_Level = @SALevel) s left join (select * from ANSWER where Assessment_Id = @Assessment_Id and Is_Requirement = 0) a on s.Question_Id = a.Question_Or_Requirement_Id where a.Question_Or_Requirement_Id is null IF @result = -3 BEGIN ROLLBACK TRANSACTION; END ELSE BEGIN EXEC sp_releaseapplock @DbPrincipal = 'dbo', @Resource = '[Answer]'; COMMIT TRANSACTION; END; if(@@ROWCOUNT>0) begin exec usp_BuildCatNumbers @assessment_id end end else begin BEGIN TRANSACTION; EXEC @result = sp_getapplock @DbPrincipal = 'dbo', @Resource = '[Answer]', @LockMode = 'Exclusive'; INSERT INTO [dbo].[ANSWER] ([Is_Requirement],[Question_Or_Requirement_Id],[Component_Id] ,[Answer_Text],[Is_Component],[Is_Framework],[Assessment_Id]) select distinct Is_Requirement=1,s.Requirement_Id,Component_Id =0, Answer_Text = 'U', Is_Component='0',Is_Framework=0,av.Assessment_Id from requirement_sets s join AVAILABLE_STANDARDS av on s.Set_Name=av.Set_Name join REQUIREMENT_LEVELS rl on s.Requirement_Id = rl.Requirement_Id left join (select * from ANSWER where Assessment_Id = @Assessment_Id and Is_Requirement = 1) a on s.Requirement_Id = a.Question_Or_Requirement_Id where av.Selected = 1 and av.Assessment_Id = @Assessment_Id and a.Question_Or_Requirement_Id is null and rl.Standard_Level = @SALevel and rl.Level_Type = 'NST' IF @result = -3 BEGIN ROLLBACK TRANSACTION; END ELSE BEGIN EXEC sp_releaseapplock @DbPrincipal = 'dbo', @Resource = '[Answer]'; COMMIT TRANSACTION; END; if(@@ROWCOUNT>0) exec usp_BuildCatNumbers @assessment_id end END GO IF @@ERROR <> 0 SET NOEXEC ON GO COMMIT TRANSACTION GO IF @@ERROR <> 0 SET NOEXEC ON GO -- This statement writes to the SQL Server Log so SQL Monitor can show this deployment. IF HAS_PERMS_BY_NAME(N'sys.xp_logevent', N'OBJECT', N'EXECUTE') = 1 BEGIN DECLARE @databaseName AS nvarchar(2048), @eventMessage AS nvarchar(2048) SET @databaseName = REPLACE(REPLACE(DB_NAME(), N'\', N'\\'), N'"', N'\"') SET @eventMessage = N'Redgate SQL Compare: { "deployment": { "description": "Redgate SQL Compare deployed to ' + @databaseName + N'", "database": "' + @databaseName + N'" }}' EXECUTE sys.xp_logevent 55000, @eventMessage END GO DECLARE @Success AS BIT SET @Success = 1 SET NOEXEC OFF IF (@Success = 1) PRINT 'The database update succeeded' ELSE BEGIN IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION PRINT 'The database update failed' END GO SET NUMERIC_ROUNDABORT OFF GO SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON GO SET XACT_ABORT ON GO SET TRANSACTION ISOLATION LEVEL Serializable GO BEGIN TRANSACTION GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Dropping foreign keys from [dbo].[ASSESSMENT_CONTACTS]' GO ALTER TABLE [dbo].[ASSESSMENT_CONTACTS] DROP CONSTRAINT [FK_ASSESSMENT_CONTACTS_USERS] GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Dropping foreign keys from [dbo].[ASSESSMENTS]' GO ALTER TABLE [dbo].[ASSESSMENTS] DROP CONSTRAINT [FK_ASSESSMENTS_USERS] GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Dropping foreign keys from [dbo].[USER_SECURITY_QUESTIONS]' GO ALTER TABLE [dbo].[USER_SECURITY_QUESTIONS] DROP CONSTRAINT [FK_USER_SECURITY_QUESTIONS_USERS] GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Dropping constraints from [dbo].[USERS]' GO ALTER TABLE [dbo].[USERS] DROP CONSTRAINT [IX_USERS] GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Creating [dbo].[FiltersNormalized]' GO CREATE TABLE [dbo].[FiltersNormalized] ( [Assessment_Id] [int] NOT NULL, [DomainId] [int] NOT NULL, [MaturityId] [int] NOT NULL ) GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Creating primary key [PK_FiltersNormalized] on [dbo].[FiltersNormalized]' GO ALTER TABLE [dbo].[FiltersNormalized] ADD CONSTRAINT [PK_FiltersNormalized] PRIMARY KEY CLUSTERED ([Assessment_Id], [DomainId], [MaturityId]) GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Creating trigger [dbo].[Move_Domain_Filters_To_Normal_Form] on [dbo].[FINANCIAL_DOMAIN_FILTERS]' GO CREATE trigger [dbo].[Move_Domain_Filters_To_Normal_Form] on [dbo].[FINANCIAL_DOMAIN_FILTERS] after UPDATE, INSERT, DELETE as --delete first delete filtersnormalized from deleted where filtersnormalized.Assessment_Id = deleted.assessment_id and filtersnormalized.DomainId = deleted.DomainId and maturityid = 1 delete filtersnormalized from deleted where filtersnormalized.Assessment_Id = deleted.assessment_id and filtersnormalized.DomainId = deleted.DomainId and maturityid = 2 delete filtersnormalized from deleted where filtersnormalized.Assessment_Id = deleted.assessment_id and filtersnormalized.DomainId = deleted.DomainId and maturityid = 3 delete filtersnormalized from deleted where filtersnormalized.Assessment_Id = deleted.assessment_id and filtersnormalized.DomainId = deleted.DomainId and maturityid = 4 delete filtersnormalized from deleted where filtersnormalized.Assessment_Id = deleted.assessment_id and filtersnormalized.DomainId = deleted.DomainId and maturityid = 5 --then insert INSERT INTO [dbo].[FiltersNormalized] ([Assessment_Id],[DomainId],[MaturityId]) select assessment_id, domainid, 1 from inserted where B = 1; INSERT INTO [dbo].[FiltersNormalized] ([Assessment_Id],[DomainId],[MaturityId]) select assessment_id, domainid, 2 from inserted where E = 1; INSERT INTO [dbo].[FiltersNormalized] ([Assessment_Id],[DomainId],[MaturityId]) select assessment_id, domainid, 3 from inserted where [int] = 1; INSERT INTO [dbo].[FiltersNormalized] ([Assessment_Id],[DomainId],[MaturityId]) select assessment_id, domainid, 4 from inserted where [A] = 1; INSERT INTO [dbo].[FiltersNormalized] ([Assessment_Id],[DomainId],[MaturityId]) select assessment_id, domainid, 5 from inserted where [inn] = 1; GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Creating [dbo].[usp_getFinancialQuestions]' GO -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= CREATE PROCEDURE [dbo].[usp_getFinancialQuestions] @assessment_id int AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here select r.Requirement_title, r.Requirement_text, a.Answer_text, m.MaturityLevel from filtersNormalized f join FINANCIAL_GROUPS g on f.domainid = g.domainid and f.MaturityId = g.MaturityId join FINANCIAL_MATURITY m on g.MaturityId = m.MaturityId join FINANCIAL_DETAILS fd on g.FinancialGroupId = fd.FinancialGroupId join FINANCIAL_REQUIREMENTS fr on fd.StmtNumber = fr.StmtNumber join NEW_REQUIREMENT r on fr.Requirement_Id=r.Requirement_Id join Answer_Requirements a on r.requirement_id = a.Question_Or_Requirement_Id where a.assessment_id = @assessment_id and f.assessment_id = @assessment_id END GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Adding constraints to [dbo].[USERS]' GO ALTER TABLE [dbo].[USERS] ADD CONSTRAINT [IX_USERS] UNIQUE NONCLUSTERED ([PrimaryEmail]) GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Adding foreign keys to [dbo].[ASSESSMENT_CONTACTS]' GO ALTER TABLE [dbo].[ASSESSMENT_CONTACTS] ADD CONSTRAINT [FK_ASSESSMENT_CONTACTS_USERS] FOREIGN KEY ([UserId]) REFERENCES [dbo].[USERS] ([UserId]) ON DELETE CASCADE ON UPDATE CASCADE GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Adding foreign keys to [dbo].[ASSESSMENTS]' GO ALTER TABLE [dbo].[ASSESSMENTS] ADD CONSTRAINT [FK_ASSESSMENTS_USERS] FOREIGN KEY ([AssessmentCreatorId]) REFERENCES [dbo].[USERS] ([UserId]) ON DELETE SET NULL GO IF @@ERROR <> 0 SET NOEXEC ON GO PRINT N'Adding foreign keys to [dbo].[USER_SECURITY_QUESTIONS]' GO ALTER TABLE [dbo].[USER_SECURITY_QUESTIONS] ADD CONSTRAINT [FK_USER_SECURITY_QUESTIONS_USERS] FOREIGN KEY ([UserId]) REFERENCES [dbo].[USERS] ([UserId]) ON DELETE CASCADE ON UPDATE CASCADE GO IF @@ERROR <> 0 SET NOEXEC ON GO COMMIT TRANSACTION GO IF @@ERROR <> 0 SET NOEXEC ON GO -- This statement writes to the SQL Server Log so SQL Monitor can show this deployment. IF HAS_PERMS_BY_NAME(N'sys.xp_logevent', N'OBJECT', N'EXECUTE') = 1 BEGIN DECLARE @databaseName AS nvarchar(2048), @eventMessage AS nvarchar(2048) SET @databaseName = REPLACE(REPLACE(DB_NAME(), N'\', N'\\'), N'"', N'\"') SET @eventMessage = N'Redgate SQL Compare: { "deployment": { "description": "Redgate SQL Compare deployed to ' + @databaseName + N'", "database": "' + @databaseName + N'" }}' EXECUTE sys.xp_logevent 55000, @eventMessage END GO DECLARE @Success AS BIT SET @Success = 1 SET NOEXEC OFF IF (@Success = 1) PRINT 'The database update succeeded' ELSE BEGIN IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION PRINT 'The database update failed' END GO update [FINANCIAL_DOMAIN_FILTERS] set B = B GO
the_stack
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for #none#_admin -- ---------------------------- DROP TABLE IF EXISTS `#none#_admin`; CREATE TABLE `#none#_admin` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(20) NOT NULL DEFAULT '' COMMENT '登录名', `password` varchar(32) NOT NULL DEFAULT '' COMMENT '密码', `encrypt` varchar(6) NOT NULL DEFAULT '', `realname` varchar(20) NOT NULL DEFAULT '', `email` varchar(100) NOT NULL DEFAULT '', `usertype` tinyint(4) NOT NULL DEFAULT '0', `logintime` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '登录时间', `loginip` varchar(30) NOT NULL DEFAULT '' COMMENT '登录IP', `islock` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '锁定状态', `createtime` int(10) NOT NULL DEFAULT '0' COMMENT '管理员创建时间', `role_id` int(10) DEFAULT '0' COMMENT '角色id', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for #none#_admin_power -- ---------------------------- DROP TABLE IF EXISTS `#none#_admin_power`; CREATE TABLE `#none#_admin_power` ( `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '权限id', `name` varchar(255) NOT NULL COMMENT '操作名称', `route` varchar(255) NOT NULL COMMENT '路由 =》MVC', `parent` int(10) DEFAULT '0' COMMENT '父级', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_admin_power -- ---------------------------- INSERT INTO `#none#_admin_power` VALUES ('1', '后台管理', 'main/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('2', '系统设置', 'index/system', '1'); INSERT INTO `#none#_admin_power` VALUES ('3', '清除缓存', 'index/clear', '1'); INSERT INTO `#none#_admin_power` VALUES ('4', '查看操作记录', 'log/index', '1'); INSERT INTO `#none#_admin_power` VALUES ('5', '文章管理', 'article/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('6', '添加文章', 'article/add', '5'); INSERT INTO `#none#_admin_power` VALUES ('7', '编辑文章', 'article/edit', '5'); INSERT INTO `#none#_admin_power` VALUES ('8', '删除文章', 'article/dele', '5'); INSERT INTO `#none#_admin_power` VALUES ('9', '移动文章分类', 'article/move', '5'); INSERT INTO `#none#_admin_power` VALUES ('10', '产品管理', 'product/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('11', '添加产品', 'product/add', '10'); INSERT INTO `#none#_admin_power` VALUES ('12', '编辑产品', 'product/edit', '10'); INSERT INTO `#none#_admin_power` VALUES ('13', '删除产品', 'product/dele', '10'); INSERT INTO `#none#_admin_power` VALUES ('14', '移动产品分类', 'product/move', '10'); INSERT INTO `#none#_admin_power` VALUES ('15', '单页管理', 'page/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('16', '添加单页', 'page/add', '15'); INSERT INTO `#none#_admin_power` VALUES ('17', '修改单页', 'page/edit', '15'); INSERT INTO `#none#_admin_power` VALUES ('18', '删除单页', 'page/dele', '15'); INSERT INTO `#none#_admin_power` VALUES ('19', '导航管理', 'nav/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('20', '添加导航', 'nav/add', '19'); INSERT INTO `#none#_admin_power` VALUES ('21', '修改导航', 'nav/edit', '19'); INSERT INTO `#none#_admin_power` VALUES ('22', '删除导航', 'nav/dele', '19'); INSERT INTO `#none#_admin_power` VALUES ('23', '管理员管理', 'admin/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('24', '添加管理员', 'admin/add', '23'); INSERT INTO `#none#_admin_power` VALUES ('25', '修改管理员', 'admin/edit', '23'); INSERT INTO `#none#_admin_power` VALUES ('26', '删除管理员', 'admin/dele', '23'); INSERT INTO `#none#_admin_power` VALUES ('27', '幻灯广告管理', 'banner/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('28', '添加幻灯广告', 'banner/add', '27'); INSERT INTO `#none#_admin_power` VALUES ('29', '修改幻灯广告', 'banner/edit', '27'); INSERT INTO `#none#_admin_power` VALUES ('30', '删除幻灯广告', 'banner/dele', '27'); INSERT INTO `#none#_admin_power` VALUES ('31', '添加幻灯图片集', 'banner/adddetail', '27'); INSERT INTO `#none#_admin_power` VALUES ('32', '修改幻灯图片集', 'banner/editdetail', '27'); INSERT INTO `#none#_admin_power` VALUES ('33', '删除幻灯图片集', 'banner/deledetail', '27'); INSERT INTO `#none#_admin_power` VALUES ('34', '友情链接管理', 'flink/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('35', '添加友链', 'flink/add', '34'); INSERT INTO `#none#_admin_power` VALUES ('36', '修改友链', 'flink/edit', '34'); INSERT INTO `#none#_admin_power` VALUES ('37', '删除友链', 'flink/dele', '34'); INSERT INTO `#none#_admin_power` VALUES ('38', '转载文章', 'article/copy', '5'); INSERT INTO `#none#_admin_power` VALUES ('39', '角色管理', 'role/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('40', '添加角色', 'role/add', '39'); INSERT INTO `#none#_admin_power` VALUES ('41', '修改角色', 'role/edit', '39'); INSERT INTO `#none#_admin_power` VALUES ('42', '删除角色', 'role/dele', '39'); INSERT INTO `#none#_admin_power` VALUES ('43', '幻灯图片集管理', 'banner/banlist', '27'); INSERT INTO `#none#_admin_power` VALUES ('44', '留言管理', 'comment/index', '0'); INSERT INTO `#none#_admin_power` VALUES ('45', '回复留言', 'comment/add', '44'); INSERT INTO `#none#_admin_power` VALUES ('46', '删除留言', 'comment/dele', '44'); -- ---------------------------- -- Table structure for #none#_admin_role -- ---------------------------- DROP TABLE IF EXISTS `#none#_admin_role`; CREATE TABLE `#none#_admin_role` ( `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '角色id', `name` varchar(255) NOT NULL COMMENT '角色名', `power` varchar(255) DEFAULT '' COMMENT '拥有的权限', `createtime` int(10) DEFAULT NULL COMMENT '创建时间', `remark` varchar(255) DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_admin_role -- ---------------------------- -- ---------------------------- -- Table structure for #none#_article -- ---------------------------- DROP TABLE IF EXISTS `#none#_article`; CREATE TABLE `#none#_article` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(60) NOT NULL DEFAULT '' COMMENT '标题', `shorttitle` varchar(30) NOT NULL DEFAULT '' COMMENT '副标题', `color` char(10) NOT NULL DEFAULT '' COMMENT '标题颜色', `copyfrom` varchar(150) NOT NULL DEFAULT '', `author` varchar(30) NOT NULL DEFAULT '', `keywords` varchar(50) DEFAULT '' COMMENT '关键字', `litpic` varchar(150) NOT NULL DEFAULT '' COMMENT '缩略图', `content` text COMMENT '内容', `description` varchar(255) NOT NULL DEFAULT '' COMMENT '摘要描述', `publishtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '发布时间', `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `click` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '点击数', `cid` int(10) unsigned NOT NULL COMMENT '分类ID', `commentflag` tinyint(1) NOT NULL DEFAULT '1' COMMENT '允许评论', `flag` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '属性', `jumpurl` varchar(200) NOT NULL DEFAULT '', `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '1回收站', `userid` int(10) unsigned NOT NULL DEFAULT '0', `aid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'admin', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_article -- ---------------------------- -- ---------------------------- -- Table structure for #none#_banner -- ---------------------------- DROP TABLE IF EXISTS `#none#_banner`; CREATE TABLE `#none#_banner` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'banner 标题', `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'banner 类型 1:banner大图;2:广告', `start_time` int DEFAULT NULL COMMENT '广告开始时间', `end_time` int DEFAULT NULL COMMENT '广告结束时间', `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除 0:否;1:是', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_banner -- ---------------------------- INSERT INTO `#none#_banner` VALUES ('1', '首页大图', '1', 1484512321, 1645710511, '0'); -- ---------------------------- -- Table structure for #none#_banner_detail -- ---------------------------- DROP TABLE IF EXISTS `#none#_banner_detail`; CREATE TABLE `#none#_banner_detail` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `pid` int(10) NOT NULL DEFAULT '0' COMMENT '所属banner id', `title` varchar(255) NOT NULL DEFAULT '' COMMENT '图片标题', `img` varchar(255) DEFAULT '' COMMENT '图片地址', `url` varchar(255) DEFAULT '' COMMENT '图片链接', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_banner_detail -- ---------------------------- INSERT INTO `#none#_banner_detail` VALUES ('1', '1', '2222', '/uploads/20161219\\d57ee6aa088a79866cfa7f8d64c3546a.jpg', 'http://blog.csdn.net/free_ant/article/details/52701212'); INSERT INTO `#none#_banner_detail` VALUES ('2', '1', '2', '/uploads/20161219\\47aacf820659b5e3bcf08e74174e7946.jpg', 'http://blog.csdn.net/free_ant/article/details/52936756'); INSERT INTO `#none#_banner_detail` VALUES ('3', '1', '3', '/uploads/20161219\\d764a6c9cb36617eefd1340d2b3fb69e.jpg', 'http://blog.csdn.net/free_ant/article/details/52936722'); -- ---------------------------- -- Table structure for #none#_category -- ---------------------------- DROP TABLE IF EXISTS `#none#_category`; CREATE TABLE `#none#_category` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL DEFAULT '' COMMENT '栏目分类名称', `ename` varchar(200) NOT NULL DEFAULT '' COMMENT '别名', `catpic` varchar(150) NOT NULL DEFAULT '', `pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类', `modelid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属模型', `type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类别', `seotitle` varchar(50) NOT NULL DEFAULT '', `keywords` varchar(50) DEFAULT '' COMMENT '关键字', `description` varchar(255) DEFAULT '' COMMENT '关键字', `template_category` varchar(60) NOT NULL DEFAULT '', `template_list` varchar(60) NOT NULL DEFAULT '', `template_show` varchar(60) NOT NULL DEFAULT '', `content` text COMMENT '内容', `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0 ,显示;1, 不显示', `sort` smallint(6) NOT NULL DEFAULT '100' COMMENT '排序', `position` varchar(6) NOT NULL DEFAULT '1' COMMENT '导航出现的位置,默认1:主导航;2:底部;3:侧边', `outurl` varchar(255) NOT NULL DEFAULT '' COMMENT '外链url', `flag` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '属性:8 百度富文本框编辑;9 Markdown编辑', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_category -- ---------------------------- -- ---------------------------- -- Table structure for #none#_comment -- ---------------------------- DROP TABLE IF EXISTS `#none#_comment`; CREATE TABLE `#none#_comment` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL DEFAULT '' COMMENT '留言标题', `username` varchar(10) NOT NULL DEFAULT '' COMMENT '留言者姓名', `tel` varchar(12) DEFAULT '' COMMENT '电话', `email` varchar(255) DEFAULT '' COMMENT 'email', `qq` varchar(15) DEFAULT '' COMMENT 'qq', `content` varchar(255) NOT NULL COMMENT '留言内容', `create_time` int NOT NULL COMMENT '创建时间', `rid` int(10) DEFAULT '0' COMMENT '回复id', `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '评论状态 1:已删除', `uid` int(10) DEFAULT '0' COMMENT '用户id', `aid` int(10) DEFAULT '0' COMMENT '管理员id', `from` varchar(10) DEFAULT '' COMMENT '评论来源:本站 or 第三方站(多说)', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_comment -- ---------------------------- -- ---------------------------- -- Table structure for #none#_flink -- ---------------------------- DROP TABLE IF EXISTS `#none#_flink`; CREATE TABLE `#none#_flink` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL DEFAULT '' COMMENT '友情链接名称', `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '记录类型:1:友情链接;2:公告', `logo` varchar(255) DEFAULT '' COMMENT 'logo', `url` varchar(255) DEFAULT NULL COMMENT 'url', `description` varchar(255) DEFAULT '' COMMENT '描述', `status` tinyint(1) DEFAULT '0' COMMENT '状态', `create_time` int(11) DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_flink -- ---------------------------- INSERT INTO `#none#_flink` VALUES ('1', 'nonecms', '1', '', 'http://www.5none.com', '简单建站!', '1', null); -- ---------------------------- -- Table structure for #none#_log -- ---------------------------- DROP TABLE IF EXISTS `#none#_log`; CREATE TABLE `#none#_log` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '日志类型 1,登入;2,操作', `datetime` int(10) unsigned NOT NULL COMMENT '操作时间', `ip` varchar(15) DEFAULT '0' COMMENT '登入ip', `content` varchar(255) DEFAULT '' COMMENT '操作内容', `username` varchar(255) DEFAULT NULL, `userid` int(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for #none#_modeln -- ---------------------------- DROP TABLE IF EXISTS `#none#_modeln`; CREATE TABLE `#none#_modeln` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL DEFAULT '', `description` varchar(255) NOT NULL DEFAULT '', `tablename` varchar(30) NOT NULL DEFAULT '', `status` tinyint(1) unsigned NOT NULL DEFAULT '0', `template_category` varchar(60) NOT NULL DEFAULT '', `template_list` varchar(60) NOT NULL DEFAULT '', `template_show` varchar(60) NOT NULL DEFAULT '', `sort` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_model -- ---------------------------- INSERT INTO `#none#_modeln` VALUES ('1', '文章模型', '', 'article', '1', '', 'List_article.html', 'Show_article.html', '1'); INSERT INTO `#none#_modeln` VALUES ('2', '单页模型', '', 'category', '1', '', 'List_page.html', 'Show_page.html', '2'); INSERT INTO `#none#_modeln` VALUES ('3', '产品模型', '', 'product', '1', '', 'List_product.html', 'Show_product.html', '3'); INSERT INTO `#none#_modeln` VALUES ('6', '留言本模型', '', 'comment', '1', '', 'Guestbook_index.html', 'Guestbook_detail.html', '6'); -- ---------------------------- -- Table structure for #none#_product -- ---------------------------- DROP TABLE IF EXISTS `#none#_product`; CREATE TABLE `#none#_product` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(30) NOT NULL DEFAULT '' COMMENT '标题', `color` char(10) NOT NULL DEFAULT '' COMMENT '标题颜色', `keywords` varchar(50) DEFAULT '' COMMENT '关键字', `litpic` varchar(150) NOT NULL DEFAULT '' COMMENT '缩略图', `pictureurls` text COMMENT '图片地址', `content` text COMMENT '内容', `description` varchar(255) NOT NULL DEFAULT '' COMMENT '摘要描述', `price` decimal(8,2) NOT NULL DEFAULT '0.00', `marketprice` decimal(8,2) NOT NULL DEFAULT '0.00', `brand` varchar(50) NOT NULL DEFAULT '' COMMENT '品牌', `units` varchar(50) NOT NULL DEFAULT '' COMMENT '单位', `specification` varchar(50) NOT NULL DEFAULT '' COMMENT '规格', `publishtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '发布时间', `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `click` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '点击数', `cid` int(10) unsigned NOT NULL COMMENT '分类ID', `commentflag` tinyint(1) NOT NULL DEFAULT '1' COMMENT '允许评论', `flag` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '属性', `jumpurl` varchar(200) NOT NULL DEFAULT '', `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '1回收站', `userid` int(10) unsigned NOT NULL DEFAULT '0', `aid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'admin', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for #none#_system -- ---------------------------- DROP TABLE IF EXISTS `#none#_system`; CREATE TABLE `#none#_system` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL DEFAULT '' COMMENT '标识', `title` varchar(50) NOT NULL DEFAULT '' COMMENT '名称', `remark` varchar(100) NOT NULL DEFAULT '' COMMENT '说明', `tvalue` varchar(150) NOT NULL DEFAULT '' COMMENT '参数类型', `typeid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '类型', `groupid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '分组', `value` text, `sort` smallint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of #none#_system -- ---------------------------- INSERT INTO `#none#_system` VALUES ('1', 'site_name', '站点名称', '', '', '0', '0', '#site_name#', '0'); INSERT INTO `#none#_system` VALUES ('2', 'site_title', '站点标题', '', '', '0', '0', '#site_name#', '0'); INSERT INTO `#none#_system` VALUES ('3', 'site_keywords', '站点关键字', '', '', '0', '0', '#site_name#', '0'); INSERT INTO `#none#_system` VALUES ('4', 'site_description', '站点描述', '', '', '0', '0', '#site_name#', '0'); INSERT INTO `#none#_system` VALUES ('5', 'site_address', '公司地址', '', '', '0', '0', '浙江省杭州市', '0'); INSERT INTO `#none#_system` VALUES ('6', 'site_closed', '关闭网站', '', 'radio', '0', '0', '0', '0'); INSERT INTO `#none#_system` VALUES ('7', 'site_icp', 'ICP备案证书号', '', '', '0', '0', '', '0'); INSERT INTO `#none#_system` VALUES ('8', 'site_tel', '客服电话', '', '', '0', '0', '0571-11223311', '0'); INSERT INTO `#none#_system` VALUES ('9', 'site_fax', '传真', '', '', '0', '0', '0571-112231111', '0'); INSERT INTO `#none#_system` VALUES ('10', 'site_qq', '客服QQ号码', '多个客服的QQ号码请以半角逗号(,)分隔,如果需要设定昵称则在号码后跟 /昵称。', '', '0', '0', '553212320', '0'); INSERT INTO `#none#_system` VALUES ('11', 'site_email', '邮件地址', '', '', '0', '0', '553212320@qq.com', '0'); INSERT INTO `#none#_system` VALUES ('12', 'display_thumbw', '缩略图宽度', '', '', '0', '0', '300', '0'); INSERT INTO `#none#_system` VALUES ('13', 'display_thumbh', '缩略图高度', '', '', '0', '0', '300', '0'); INSERT INTO `#none#_system` VALUES ('14', 'site_editor', '编辑器选择', '如果选择Markdown编辑器,则前台展示页面需引入editor.md相关js;具体操作流程看文章:blog.5none.com', 'radio', '0', '0', 'markdown', '0'); INSERT INTO `#none#_system` VALUES ('15', 'site_theme', '网站主题', '', 'select', '0', '0', '#site_theme#', '0'); INSERT INTO `#none#_system` VALUES ('16', 'site_mobile_theme', '移动端主题', '', 'select', '0', '0', 'default', '0');
the_stack
-- 2021-02-18T01:49:17.123Z -- URL zum Konzept UPDATE AD_Column SET TechnicalNote='!!! Note that this column is only relevant when doing quickentry *in the swing client* !!!',Updated=TO_TIMESTAMP('2021-02-18 02:49:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=505000 ; -- 2021-02-18T09:07:41.649Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540610 AND AD_Tree_ID=10 ; -- 2021-02-18T09:07:41.691Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=541054 AND AD_Tree_ID=10 ; -- 2021-02-18T09:07:41.722Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=541096 AND AD_Tree_ID=10 ; -- 2021-02-18T09:07:41.756Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=541068 AND AD_Tree_ID=10 ; -- 2021-02-18T09:07:41.782Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540794 AND AD_Tree_ID=10 ; -- 2021-02-18T09:07:41.804Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=541101 AND AD_Tree_ID=10 ; -- 2021-02-18T09:07:41.827Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=541040 AND AD_Tree_ID=10 ; -- 2021-02-18T09:07:41.851Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000096 AND AD_Tree_ID=10 ; -- 2021-02-18T09:07:41.879Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=541130 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:39.562Z -- URL zum Konzept INSERT INTO AD_Menu (AD_Client_ID,AD_Element_ID,AD_Menu_ID,AD_Org_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsCreateNew,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES (0,167,541598,0,TO_TIMESTAMP('2021-02-18 10:08:39','YYYY-MM-DD HH24:MI:SS'),100,'D','M_Attribute_Folder','Y','N','N','N','Y','Merkmal',TO_TIMESTAMP('2021-02-18 10:08:39','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-02-18T09:08:39.869Z -- URL zum Konzept INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Menu_ID, t.Description,t.Name,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Menu_ID=541598 AND NOT EXISTS (SELECT 1 FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID) ; -- 2021-02-18T09:08:39.893Z -- URL zum Konzept INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 541598, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=541598) ; -- 2021-02-18T09:08:39.968Z -- URL zum Konzept /* DDL */ select update_menu_translation_from_ad_element(167) ; -- 2021-02-18T09:08:49.883Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=541293 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:49.908Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000034 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:49.930Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=541391 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:49.952Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=541468 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:49.973Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000089 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:49.993Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=541408 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.018Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540840 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.057Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540990 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.086Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000092 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.111Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=541376 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.136Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000093 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.160Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=541230 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.194Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=541062 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.215Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=541115 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.239Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=541116 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.262Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=541126 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.290Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=541127 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.314Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=17, Updated=now(), UpdatedBy=100 WHERE Node_ID=541194 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.340Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=18, Updated=now(), UpdatedBy=100 WHERE Node_ID=541411 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.362Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=19, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000044 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.387Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=20, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000035 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.411Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=21, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000037 AND AD_Tree_ID=10 ; -- 2021-02-18T09:08:50.433Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000009, SeqNo=22, Updated=now(), UpdatedBy=100 WHERE Node_ID=541598 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.176Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540610 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.198Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=541598 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.220Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=541054 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.245Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=541096 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.265Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=541068 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.287Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540794 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.325Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=541101 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.349Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=541040 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.391Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000096 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:00.412Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=541130 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:10.815Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540990 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:18.910Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540840 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:18.937Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540990 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:21.871Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=541408 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:21.893Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540840 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:21.914Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540990 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:25.182Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000089 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:25.209Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=541408 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:25.237Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540840 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:25.257Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=541598, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540990 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.682Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=541598 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.703Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=541054 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.741Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540610 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.763Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=541096 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.785Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=541068 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.809Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540794 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.837Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=541101 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.861Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=541040 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.894Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000096 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:34.918Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=541130 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:36.934Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=541598 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:36.959Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540610 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:36.991Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=541054 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:37.015Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=541096 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:37.041Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=541068 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:37.068Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540794 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:37.097Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=541101 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:37.132Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=541040 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:37.167Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000096 AND AD_Tree_ID=10 ; -- 2021-02-18T09:09:37.192Z -- URL zum Konzept UPDATE AD_TreeNodeMM SET Parent_ID=1000037, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=541130 AND AD_Tree_ID=10 ;
the_stack
-- 2018-06-23T08:41:12.820 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,544136,0,'ShowSubBOMIngredients',TO_TIMESTAMP('2018-06-23 08:41:12','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Show Sub BOM Ingredients','Show Sub BOM Ingredients',TO_TIMESTAMP('2018-06-23 08:41:12','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T08:41:12.827 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=544136 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2018-06-23T08:41:39.040 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,DefaultValue,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,Updated,UpdatedBy,Version) VALUES (0,560495,544136,0,20,53019,'N','ShowSubBOMIngredients',TO_TIMESTAMP('2018-06-23 08:41:38','YYYY-MM-DD HH24:MI:SS'),100,'N','N','EE01',1,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Y','N','Show Sub BOM Ingredients',0,TO_TIMESTAMP('2018-06-23 08:41:38','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-06-23T08:41:39.045 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560495 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-06-23T08:41:42.430 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('PP_Product_BOMLine','ALTER TABLE public.PP_Product_BOMLine ADD COLUMN ShowSubBOMIngredients CHAR(1) DEFAULT ''N'' CHECK (ShowSubBOMIngredients IN (''Y'',''N''))') ; -- 2018-06-23T08:42:40.425 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,544137,0,'CULabelQuanitity',TO_TIMESTAMP('2018-06-23 08:42:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','CU Label Qty','CU Label Qty',TO_TIMESTAMP('2018-06-23 08:42:40','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T08:42:40.430 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=544137 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2018-06-23T08:43:07.161 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,560496,544137,0,10,53019,'N','CULabelQuanitity',TO_TIMESTAMP('2018-06-23 08:43:07','YYYY-MM-DD HH24:MI:SS'),100,'N','EE01',60,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','CU Label Qty',0,0,TO_TIMESTAMP('2018-06-23 08:43:07','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-06-23T08:43:07.165 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560496 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-06-23T08:43:11.473 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('PP_Product_BOMLine','ALTER TABLE public.PP_Product_BOMLine ADD COLUMN CULabelQuanitity VARCHAR(60)') ; -- 2018-06-23T08:47:20.203 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,560495,564975,0,53029,0,TO_TIMESTAMP('2018-06-23 08:47:20','YYYY-MM-DD HH24:MI:SS'),100,0,'U',0,'Y','Y','Y','N','N','N','N','N','Show Sub BOM Ingredients',190,190,0,1,1,TO_TIMESTAMP('2018-06-23 08:47:20','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T08:47:20.208 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=564975 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2018-06-23T08:47:27.112 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET EntityType='D',Updated=TO_TIMESTAMP('2018-06-23 08:47:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=564975 ; -- 2018-06-23T08:47:41.882 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,560496,564976,0,53029,0,TO_TIMESTAMP('2018-06-23 08:47:41','YYYY-MM-DD HH24:MI:SS'),100,0,'D',0,'Y','Y','Y','N','N','N','N','N','CU Label Qty',200,200,0,1,1,TO_TIMESTAMP('2018-06-23 08:47:41','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T08:47:41.884 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=564976 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2018-06-23T08:48:04.952 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Menge Konsumentenlabel',Updated=TO_TIMESTAMP('2018-06-23 08:48:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=564976 ; -- 2018-06-23T08:48:53.214 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Inhaltsstoffe Unterstückliste anzeigen',Updated=TO_TIMESTAMP('2018-06-23 08:48:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=564975 ; -- 2018-06-23T09:30:42.815 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,564976,0,53029,540444,552311,'F',TO_TIMESTAMP('2018-06-23 09:30:42','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Menge Konsumentenlabel',230,0,0,TO_TIMESTAMP('2018-06-23 09:30:42','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T09:31:09.800 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,564975,0,53029,540444,552312,'F',TO_TIMESTAMP('2018-06-23 09:31:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Inhaltsstoffe Unterstückliste anzeigen',240,0,0,TO_TIMESTAMP('2018-06-23 09:31:09','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T09:31:27.654 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2018-06-23 09:31:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552311 ; -- 2018-06-23T09:31:27.660 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2018-06-23 09:31:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552312 ; -- 2018-06-23T09:31:27.665 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2018-06-23 09:31:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544416 ; -- 2018-06-23T09:31:27.673 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2018-06-23 09:31:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544405 ; -- 2018-06-23T09:31:27.678 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2018-06-23 09:31:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547353 ; -- 2018-06-23T09:38:26.908 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=105,Updated=TO_TIMESTAMP('2018-06-23 09:38:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552311 ; -- 2018-06-23T09:38:32.463 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=106,Updated=TO_TIMESTAMP('2018-06-23 09:38:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552312 ; -- 2018-06-23T09:45:19.184 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,560497,544137,0,10,53025,'N','CULabelQuanitity',TO_TIMESTAMP('2018-06-23 09:45:19','YYYY-MM-DD HH24:MI:SS'),100,'N','EE01',60,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','CU Label Qty',0,0,TO_TIMESTAMP('2018-06-23 09:45:19','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-06-23T09:45:19.185 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560497 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-06-23T09:45:22.467 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('PP_Order_BOMLine','ALTER TABLE public.PP_Order_BOMLine ADD COLUMN CULabelQuanitity VARCHAR(60)') ; -- 2018-06-23T09:46:00.598 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AllowZoomTo,ColumnName,Created,CreatedBy,DDL_NoForeignKey,DefaultValue,EntityType,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,560498,544136,0,20,53025,'N','ShowSubBOMIngredients',TO_TIMESTAMP('2018-06-23 09:46:00','YYYY-MM-DD HH24:MI:SS'),100,'N','N ','EE01',1,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','Show Sub BOM Ingredients',0,0,TO_TIMESTAMP('2018-06-23 09:46:00','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-06-23T09:46:00.602 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560498 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-06-23T09:46:25.418 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET DefaultValue='N',Updated=TO_TIMESTAMP('2018-06-23 09:46:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560498 ; -- 2018-06-23T09:46:27.912 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ SELECT public.db_alter_table('PP_Order_BOMLine','ALTER TABLE public.PP_Order_BOMLine ADD COLUMN ShowSubBOMIngredients CHAR(1) DEFAULT ''N'' CHECK (ShowSubBOMIngredients IN (''Y'',''N''))') ; -- 2018-06-23T09:47:18.821 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,560498,564977,0,53039,0,TO_TIMESTAMP('2018-06-23 09:47:18','YYYY-MM-DD HH24:MI:SS'),100,0,'D',0,'Y','Y','Y','N','N','N','N','N','Show Sub BOM Ingredients',380,380,0,1,1,TO_TIMESTAMP('2018-06-23 09:47:18','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T09:47:18.825 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=564977 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2018-06-23T09:47:42.127 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,560497,564978,0,53039,0,TO_TIMESTAMP('2018-06-23 09:47:42','YYYY-MM-DD HH24:MI:SS'),100,0,'D',0,'Y','Y','Y','N','N','N','N','N','CU Label Qty',390,390,0,1,1,TO_TIMESTAMP('2018-06-23 09:47:42','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T09:47:42.128 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=564978 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) ; -- 2018-06-23T09:50:31.216 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,564978,0,53039,540244,552313,'F',TO_TIMESTAMP('2018-06-23 09:50:31','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Menge Konsumentenlabel',400,0,0,TO_TIMESTAMP('2018-06-23 09:50:31','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T09:50:53.188 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,564977,0,53039,540244,552314,'F',TO_TIMESTAMP('2018-06-23 09:50:53','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','Inhaltsstoffe Unterstückliste anzeigen',410,0,0,TO_TIMESTAMP('2018-06-23 09:50:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-06-23T09:51:23.137 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2018-06-23 09:51:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552313 ; -- 2018-06-23T09:51:23.142 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2018-06-23 09:51:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552314 ; -- 2018-06-23T09:51:23.148 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2018-06-23 09:51:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=542875 ; -- 2018-06-23T09:54:37.379 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Menge Konsumentenlabel',Updated=TO_TIMESTAMP('2018-06-23 09:54:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=564978 ; -- 2018-06-23T09:54:57.744 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Inhaltsstoffe Unterstückliste anzeigen',Updated=TO_TIMESTAMP('2018-06-23 09:54:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=564977 ; -- 2018-06-23T09:55:28.197 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET WidgetSize='S',Updated=TO_TIMESTAMP('2018-06-23 09:55:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552313 ; -- 2018-06-23T09:56:19.536 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=375,Updated=TO_TIMESTAMP('2018-06-23 09:56:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552313 ; -- 2018-06-23T09:56:23.550 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=376,Updated=TO_TIMESTAMP('2018-06-23 09:56:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=552314 ;
the_stack
ALTER PROCEDURE [dbo].[usp_GetPackageDetails] @Path VARCHAR(8000) = 'C:\Packages1' AS /* exec [usp_GetPackageDetails] 'C:\Packages1' exec sp_configure 'show advanced options',1 reconfigure with override go exec sp_configure 'xp_cmdshell',1 reconfigure with override */ BEGIN SET NOCOUNT ON; --------------------drop all temp tables------------------------------------ IF OBJECT_id('pkgStats') IS NOT NULL DROP TABLE pkgStats; IF OBJECT_id('ConnectionDetails') IS NOT NULL DROP TABLE ConnectionDetails; IF OBJECT_id('PackageAnalysis') IS NOT NULL DROP TABLE PackageAnalysis; IF OBJECT_id('TblPrecedenceConstraint') IS NOT NULL DROP TABLE TblPrecedenceConstraint; IF OBJECT_id('TblControlFlowDetails') IS NOT NULL DROP TABLE TblControlFlowDetails; IF OBJECT_id('TblScriptTaskdetails') IS NOT NULL DROP TABLE TblScriptTaskdetails; IF OBJECT_id('TblExecutePackageTaskDetails') IS NOT NULL DROP TABLE TblExecutePackageTaskDetails; IF OBJECT_id('TblSQLTaskDetails') IS NOT NULL DROP TABLE TblSQLTaskDetails; IF OBJECT_id('TblDFTTaskDetails') IS NOT NULL DROP TABLE TblDFTTaskDetails; IF OBJECT_id('TblSrcDestDetails') IS NOT NULL DROP TABLE TblSrcDestDetails; IF OBJECT_id('TblDerivedTaskDetails') IS NOT NULL DROP TABLE TblDerivedTaskDetails; IF OBJECT_id('TblLookupTaskDetails') IS NOT NULL DROP TABLE TblLookupTaskDetails; IF OBJECT_id('TblVariableDetails') IS NOT NULL DROP TABLE TblVariableDetails; IF OBJECT_id('TblParameterDetails') IS NOT NULL DROP TABLE TblParameterDetails; IF OBJECT_id('tempdb.dbo.#tempprecedence1') IS NOT NULL DROP TABLE #tempprecedence1; IF OBJECT_id('tempdb.dbo.#tempprecedence2') IS NOT NULL DROP TABLE #tempprecedence2; IF OBJECT_id('tempdb.dbo.#tempprecedence3') IS NOT NULL DROP TABLE #tempprecedence3; IF OBJECT_id('tempdb.dbo.#tempprecedence5') IS NOT NULL DROP TABLE #tempprecedence5; IF OBJECT_id('tempdb.dbo.#tempprecedence5_Hierarchy') IS NOT NULL DROP TABLE #tempprecedence5_Hierarchy; IF OBJECT_id('tempdb.dbo.#tempprecedence4') IS NOT NULL DROP TABLE #tempprecedence4; IF OBJECT_id('tempdb.dbo.#tempprecedence6') IS NOT NULL DROP TABLE #tempprecedence6; -------------------drop all temp tables------------------------------------ ------------------create all tables------------------------------------------- CREATE TABLE pkgStats ( RowID INT identity(1, 1) NOT NULL PRIMARY KEY ,PackagePath VARCHAR(8000) NOT NULL ,PackageXML XML NOT NULL ,PackageCreatorName VARCHAR(1000) NULL ,PackageProtectionLevel varchar(100) null ); CREATE TABLE ConnectionDetails ( ConnectionManager VARCHAR(5000) ,ConnectionManagerID VARCHAR(100) ); CREATE TABLE PackageAnalysis ( TableRowID INT identity(1, 1) NOT NULL ,PackageSequenceNo INT ,SequenceNo INT ,RowID INT ,PackagePath VARCHAR(5000) ,PackageName VARCHAR(max) ,Category VARCHAR(1000) ,PackageCreatorName VARCHAR(1000) ,PackageProtectionLevel Varchar(100) ,TaskPath VARCHAR(max) ,ObjectName VARCHAR(500) ,ObjectType VARCHAR(max) ,ObjectTypeDescription VARCHAR(max) ,DelayValidationPropertyValue VARCHAR(10) ,ObjectValue VARCHAR(max) ,ExpressionValue VARCHAR(5000) ,ConnectionManager VARCHAR(5000) ,SourceColumn VARCHAR(5000) ,DestinationColumn VARCHAR(5000) ,SortKeyPosition varchar(10) ,DerivedValue VARCHAR(5000) ,IsDisabled VARCHAR(10) ,ResultSetParameterName VARCHAR(1000) ,ParameterBindingSequence VARCHAR(1000) ,ParameterBindingParameterName VARCHAR(1000) --,ObjectPathFrom VARCHAR(8000) --,ObjectPathTo VARCHAR(8000) ,ExecutePackageExpression VARCHAR(8000) ,ExecutedPackageName VARCHAR(8000) ,ExecutePackageConnection VARCHAR(8000) ,Script VARCHAR(max) ,Variable VARCHAR(1000) ,ConnectionManagerID VARCHAR(100) ,LookupJoins VARCHAR(8000) ,IsSortedProperty varchar(10) ,MultihashcolumnSortPosition varchar(max) ,RetainSameConnectionProperty varchar(100) ); CREATE CLUSTERED INDEX CX_ControlFlow ON PackageAnalysis (TableRowID); CREATE TABLE TblPrecedenceConstraint ( RowID INT ,PackagePath VARCHAR(2000) ,TaskFrom VARCHAR(1000) ,Taskto VARCHAR(1000) ,PrecOrder INT ,PrecOrder1 INT ,TaskType VARCHAR(1000) ); CREATE TABLE TblVariableDetails ( VariableRowID INT identity(1, 1) NOT NULL ,RowID INT ,PackagePath VARCHAR(5000) ,PackageName VARCHAR(max) ,Category VARCHAR(1000) ,PackageCreatorName VARCHAR(1000) ,TaskPath VARCHAR(max) ,ObjectName VARCHAR(500) ,ObjectType VARCHAR(max) ,ObjectValue VARCHAR(max) ,ExpressionValue VARCHAR(5000) ,VariableHexValue VARCHAR(1000) ); CREATE CLUSTERED INDEX CX_Variable ON TblVariableDetails (VariableRowID); CREATE TABLE TblParameterDetails ( ParameterRowID INT identity(1, 1) NOT NULL ,RowID INT ,PackagePath VARCHAR(5000) ,PackageName VARCHAR(max) ,Category VARCHAR(1000) ,PackageCreatorName VARCHAR(1000) ,TaskPath VARCHAR(max) ,ObjectName VARCHAR(500) ,ObjectType VARCHAR(max) ,ObjectValue VARCHAR(max) ,ExpressionValue VARCHAR(5000) ,ParameterHexValue VARCHAR(1000) ); CREATE CLUSTERED INDEX CX_Variable ON TblParameterDetails (ParameterRowID); CREATE TABLE TblControlFlowDetails ( ControlFlowDetailsRowID INT identity(1, 1) NOT NULL ,RowID INT ,TaskPath VARCHAR(8000) ,TaskName VARCHAR(2000) ,TaskTypeDescription VARCHAR(MAX) ,TaskType VARCHAR(5000) ,DelayValidationPropertyValue VARCHAR(100) ,DFTQuery XML ,SqlTaskQry XML ,ExecPkgTaskQry XML ,ScriptTaskQry XML ,IsDisabled VARCHAR(10) ,ExpressionValue VARCHAR(5000) ); CREATE CLUSTERED INDEX CX_ControlFlow ON TblControlFlowDetails ( ControlFlowDetailsRowID ,RowID ); CREATE NONCLUSTERED INDEX NCX_ControlFlow ON TblControlFlowDetails (RowID); CREATE TABLE TblScriptTaskdetails ( RowID INT ,ControlFlowDetailsRowID INT ,Script VARCHAR(max) ); CREATE CLUSTERED INDEX CX_TblScriptTaskdetails ON TblScriptTaskdetails ( ControlFlowDetailsRowID ,RowID ); CREATE TABLE TblExecutePackageTaskDetails ( RowID INT ,ControlFlowDetailsRowID INT ,ExecutePackageExpression VARCHAR(1000) ,ExecutedPackageName VARCHAR(1000) ,ExecutePackageConnection VARCHAR(1000) ); CREATE CLUSTERED INDEX CX_TblExecutePackageTaskDetails ON TblExecutePackageTaskDetails ( ControlFlowDetailsRowID ,RowID ); CREATE TABLE TblSQLTaskDetails ( RowID INT ,ControlFlowDetailsRowID INT ,ResultSetParameterName VARCHAR(1000) ,ParameterBindingSequence VARCHAR(1000) ,ParameterBindingParameterName VARCHAR(1000) ); CREATE CLUSTERED INDEX CX_TblSQLTaskDetails ON TblSQLTaskDetails ( ControlFlowDetailsRowID ,RowID ); CREATE TABLE TblDFTTaskDetails ( DataFlowDetailsRowID INT identity(1, 1) NOT NULL ,RowID INT ,DFTTaskName VARCHAR(max) ,DFTTasksPath VARCHAR(max) ,DFTTaskType VARCHAR(max) ,DFTTaskType1 VARCHAR(max) ,DFTRowSet VARCHAR(max) ,ParameterBindingParameterName VARCHAR(2000) ,DFTSQLCommand VARCHAR(max) ,DFTConnectionManager VARCHAR(max) ,Variable VARCHAR(max) ,InputQry XML ,OutputQry XML ,IsSortedProperty VARCHAR(10) ,MultihashcolumnSortPosition varchar(max) ); CREATE CLUSTERED INDEX CX_TblDFTTaskDetails ON TblDFTTaskDetails ( DataFlowDetailsRowID ,RowID ); CREATE NONCLUSTERED INDEX NCX_TblDFTTaskDetails ON TblDFTTaskDetails (RowID); CREATE TABLE TblSrcDestDetails ( DataFlowDetailsRowID INT ,RowID INT ,SourceColumn VARCHAR(8000) ,DestinationColumn VARCHAR(8000) ,SortKeyPosition varchar(10) ); CREATE CLUSTERED INDEX CX_TblSrcDestDetails ON TblSrcDestDetails ( DataFlowDetailsRowID ,RowID ); CREATE TABLE TblDerivedTaskDetails ( DataFlowDetailsRowID INT ,RowID INT ,DerivedValue VARCHAR(8000) ,SourceColumn VARCHAR(8000) ,DestinationColumn VARCHAR(8000) ); CREATE CLUSTERED INDEX CX_TblDerivedTaskDetails ON TblDerivedTaskDetails ( DataFlowDetailsRowID ,RowID ); CREATE TABLE TblLookupTaskDetails ( DataFlowDetailsRowID INT ,RowID INT ,LookupJoins VARCHAR(8000) ,SourceColumn VARCHAR(8000) ,DestinationColumn VARCHAR(8000) ); CREATE CLUSTERED INDEX CX_TblLookupTaskDetails ON TblLookupTaskDetails ( DataFlowDetailsRowID ,RowID ); --------------------------create all tables------------------------------------------- -------------------Iterate over all dtsx files from folder------------------------------ SET @Path = @Path + '\*.dtsx'; DECLARE @MyFiles TABLE ( MyID INT IDENTITY(1, 1) PRIMARY KEY ,FullPath VARCHAR(8000) ); DECLARE @CommandLine VARCHAR(8000); SELECT @CommandLine = LEFT('dir "' + @Path + '" /A-D /B /S ', 8000); INSERT INTO @MyFiles (FullPath) EXECUTE xp_cmdshell @CommandLine; DELETE FROM @MyFiles WHERE FullPath IS NULL OR FullPath = 'File Not Found' OR FullPath = 'The system cannot find the path specified.' OR FullPath = 'The system cannot find the file specified.'; --select * from @MyFiles DECLARE @FullPath VARCHAR(2000); DECLARE @counter INT = 0 ,@totalpkgcount INT; SELECT @totalpkgcount = COUNT(*) FROM @MyFiles; WHILE @counter <= @totalpkgcount BEGIN SELECT @FullPath = FullPath FROM @MyFiles WHERE MyID = @counter; DECLARE @sql NVARCHAR(max); SET @sql = ' INSERT INTO pkgStats (PackagePath,PackageXML) select ''@FullPath'' as PackagePath , cast(BulkColumn as XML) as PackageXML from openrowset(bulk ''@FullPath'', single_blob) as pkgColumn'; SELECT @sql = REPLACE(@sql, '@FullPath', @FullPath); EXEC sp_executesql @sql; SET @counter = @counter + 1; END -------------------Iterate over all dtsx files from folder------------------------------ --select * from pkgStats ------------add package creator name--------------------------- ; WITH CTE_PkgLevel AS ( SELECT RowID ,PackagePath ,PackageXML.value('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; /DTS:Executable[1]/@DTS:CreatorName', 'nvarchar(500)') AS PackageCreatorName ,PackageXML.value('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; /DTS:Executable[1]/@DTS:ProtectionLevel', 'nvarchar(500)') AS PackageProtectionLevel FROM pkgStats pkg ) UPDATE P SET PackageCreatorName = C.PackageCreatorName, PackageProtectionLevel = C.PackageProtectionLevel FROM pkgStats P INNER JOIN CTE_PkgLevel C ON P.RowID = C.RowID; ------------add package creator name--------------------------- PRINT '---------------Get all connections-----------------------------------'; WITH CTE_PkgLevel AS ( SELECT pkg.RowID ,pkg.PackagePath ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:ObjectName[1]', 'varchar(max)') AS ConnectionManagerName ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:CreationName[1]', 'varchar(max)') AS ConnectionManagerType --, cfnodes1.y.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:ConnectionString[1]', 'varchar(max)') ,cfnodes.x.query('.').query('declare namespace p1="www.microsoft.com/SqlServer/Dts";./p1:ConnectionManager/p1:ObjectData/p1:ConnectionManager') AS ConnectionStringQry ,cfnodes.x.query('.').query('declare namespace p1="www.microsoft.com/SqlServer/Dts";./p1:ConnectionManager/p1:PropertyExpression') AS ExpressionQry ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:DTSID[1]', 'varchar(100)') AS ConnectionManagerID ,pkg.PackageCreatorName FROM pkgStats pkg CROSS APPLY pkg.PackageXML.nodes('declare namespace DTS="www.microsoft.com/SqlServer/Dts";(//DTS:Executable/DTS:ConnectionManagers/*)') AS cfnodes(x) ) ,CTE_PkgConLevel AS ( SELECT pkg.RowID ,pkg.PackagePath ,pkg.ConnectionManagerName ,pkg.ConnectionManagerType ,ConnectionManagerID --,pkg.ConnectionStringQry ,( SELECT TOP 1 cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";@p1:ConnectionString[1]', 'nvarchar(max)') AS ConnectionString FROM pkg.ConnectionStringQry.nodes('./*') AS cfnodes(x) ) AS ConnectionString ,( SELECT TOP 1 cfnodes.x.value('.', 'nvarchar(max)') AS ExpressionValue FROM pkg.ExpressionQry.nodes('./*') AS cfnodes(x) ) AS ExpressionValue ,PackageCreatorName ,( SELECT TOP 1 cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";@p1:Retain[1]', 'nvarchar(max)') AS RetainSameConnectionProperty FROM pkg.ConnectionStringQry.nodes('./*') AS cfnodes(x) ) AS RetainSameConnectionProperty FROM CTE_PkgLevel pkg ) INSERT INTO PackageAnalysis ( RowID ,PackagePath ,PackageName ,Category ,PackageCreatorName ,ObjectName ,ObjectType ,DelayValidationPropertyValue ,ObjectValue ,ExpressionValue ,ConnectionManagerID ,RetainSameConnectionProperty ) SELECT DISTINCT pkg.RowID ,pkg.PackagePath ,REPLACE(pkg.PackagePath, REPLACE(@Path, '*.dtsx', ''), '') PackageName ,'Connection' AS CategoryC ,pkg.PackageCreatorName ,cast(pkg.ConnectionManagerName AS VARCHAR(max)) AS ObjectName ,cast(pkg.ConnectionManagerType AS VARCHAR(max)) AS ObjectType ,'NA' AS DelayValidationPropertyValue ,cast(pkg.ConnectionString AS VARCHAR(max)) AS ObjectValue ,cast(ExpressionValue AS VARCHAR(max)) AS ExpressionValue ,ConnectionManagerID ,RetainSameConnectionProperty FROM CTE_PkgConLevel pkg; PRINT '---------------Get all connections-----------------------------------'; PRINT '------------------------Get all variable details-------------------------------------'; WITH CTE_PkgLevel AS ( SELECT pkg.RowID ,pkg.PackagePath ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:ObjectName[1]', 'varchar(max)') AS VariableName ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:DTSID[1]', 'varchar(max)') AS VariableHexValue ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:Expression[1]', 'varchar(max)') AS ExpressionValue ,cfnodes.x.query('.').query('declare namespace p1="www.microsoft.com/SqlServer/Dts";./p1:Variable/p1:VariableValue') AS VariableQry ,PackageCreatorName FROM pkgStats pkg CROSS APPLY pkg.PackageXML.nodes('declare namespace DTS="www.microsoft.com/SqlServer/Dts";(//DTS:Executable/DTS:Variables/*)') AS cfnodes(x) ) --select * from CTE_PkgLevel ,CTE_PkgVarLevel AS ( SELECT pkg.RowID ,pkg.PackagePath ,pkg.VariableName ,pkg.ExpressionValue ,VariableHexValue ,( SELECT TOP 1 cfnodes.x.value('.', 'nvarchar(max)') AS VariableValue FROM pkg.VariableQry.nodes('./*') AS cfnodes(x) ) AS VariableValue --,pkg.ConnectionStringQry ,( SELECT TOP 1 cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";@p1:DataType[1]', 'nvarchar(max)') AS DataType FROM pkg.VariableQry.nodes('./*') AS cfnodes(x) ) AS VariableDataType ,PackageCreatorName FROM CTE_PkgLevel pkg ) INSERT INTO TblVariableDetails ( RowID ,PackagePath ,PackageName ,Category ,PackageCreatorName ,ObjectName ,ObjectType ,ObjectValue ,ExpressionValue ,VariableHexValue ) SELECT DISTINCT Tblvar.RowID ,Tblvar.PackagePath ,REPLACE(Tblvar.PackagePath, REPLACE(@Path, '*.dtsx', ''), '') PackageName ,'Variable' AS Category ,Tblvar.PackageCreatorName ,cast(Tblvar.VariableName AS VARCHAR(max)) AS TaskName ,cast(Tblvar.VariableDataType AS VARCHAR(max)) AS TaskType ,isnull(cast(Tblvar.VariableValue AS VARCHAR(max)), '') AS VariableValue ,isnull(cast(tblvar.ExpressionValue AS VARCHAR(max)), '') ExpressionValue ,VariableHexValue FROM CTE_PkgVarLevel Tblvar; INSERT INTO PackageAnalysis ( RowID ,PackagePath ,PackageName ,Category ,PackageCreatorName ,ObjectName ,ObjectType ,DelayValidationPropertyValue ,ObjectValue ,ExpressionValue ) SELECT DISTINCT Tblvar.RowID ,Tblvar.PackagePath ,PackageName ,'Variable' AS Category ,Tblvar.PackageCreatorName ,ObjectName ,ObjectType ,'NA' AS DelayValidationPropertyValue ,ObjectValue ,ExpressionValue FROM TblVariableDetails Tblvar; PRINT '------------------------Get all variable details-------------------------------------'; PRINT '------------------------Get all parameter details-------------------------------------'; WITH CTE_PkgLevel AS ( SELECT pkg.RowID ,pkg.PackagePath ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:ObjectName[1]', 'varchar(max)') AS ParameterName ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:DTSID[1]', 'varchar(max)') AS ParameterHexValue ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:Expression[1]', 'varchar(max)') AS ExpressionValue ,cfnodes.x.query('.').query('declare namespace p1="www.microsoft.com/SqlServer/Dts";./p1:PackageParameter/p1:Property') AS ParameterQry ,PackageCreatorName FROM pkgStats pkg CROSS APPLY pkg.PackageXML.nodes('declare namespace DTS="www.microsoft.com/SqlServer/Dts";(//DTS:Executable/DTS:PackageParameters/*)') AS cfnodes(x) ) --select * from CTE_PkgLevel ,CTE_PkgVarLevel AS ( SELECT pkg.RowID ,pkg.PackagePath ,pkg.ParameterName ,pkg.ExpressionValue ,ParameterHexValue ,( SELECT TOP 1 cfnodes.x.value('.', 'nvarchar(max)') AS ParameterValue FROM pkg.ParameterQry.nodes('./*') AS cfnodes(x) ) AS ParameterValue --,pkg.ConnectionStringQry ,( SELECT TOP 1 cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";@p1:DataType[1]', 'nvarchar(max)') AS DataType FROM pkg.ParameterQry.nodes('./*') AS cfnodes(x) ) AS ParameterDataType ,PackageCreatorName FROM CTE_PkgLevel pkg ) INSERT INTO tblParameterDetails( RowID ,PackagePath ,PackageName ,Category ,PackageCreatorName ,ObjectName ,ObjectType ,ObjectValue ,ExpressionValue ,ParameterHexValue ) SELECT DISTINCT Tblvar.RowID ,Tblvar.PackagePath ,REPLACE(Tblvar.PackagePath, REPLACE(@Path, '*.dtsx', ''), '') PackageName ,'Variable' AS Category ,Tblvar.PackageCreatorName ,cast(Tblvar.ParameterName AS VARCHAR(max)) AS TaskName ,cast(Tblvar.ParameterDataType AS VARCHAR(max)) AS TaskType ,isnull(cast(Tblvar.ParameterValue AS VARCHAR(max)), '') AS ParameterValue ,isnull(cast(tblvar.ExpressionValue AS VARCHAR(max)), '') ExpressionValue ,ParameterHexValue FROM CTE_PkgVarLevel Tblvar; INSERT INTO PackageAnalysis ( RowID ,PackagePath ,PackageName ,Category ,PackageCreatorName ,ObjectName ,ObjectType ,DelayValidationPropertyValue ,ObjectValue ,ExpressionValue ) SELECT DISTINCT Tblvar.RowID ,Tblvar.PackagePath ,PackageName ,'Parameter' AS Category ,Tblvar.PackageCreatorName ,ObjectName ,ObjectType ,'NA' AS DelayValidationPropertyValue ,ObjectValue ,ExpressionValue FROM tblParameterDetails Tblvar; PRINT '------------------------Get all parameter details-------------------------------------'; PRINT '----------------Get precedence constraint details------------------------------'; WITH CTE_CFPrec AS ( SELECT pkg.RowID ,pkg.PackagePath ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:From[1]', 'varchar(max)') AS TaskFrom ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:To[1]', 'nvarchar(max)') AS TaskTo --,dft.x.value('@refId[1]','varchar(max)') FROM pkgStats pkg CROSS APPLY pkg.PackageXML.nodes('declare namespace DTS="www.microsoft.com/SqlServer/Dts";//DTS:Executable/DTS:PrecedenceConstraints/*') AS cfnodes(x) ) ,CTE_DFTPrec AS ( SELECT pkg.RowID ,pkg.PackagePath ,cfnodes.x.value('./@startId[1]', 'varchar(max)') AS TaskFrom ,cfnodes.x.value('./@endId[1]', 'nvarchar(max)') AS TaskTo --,dft.x.value('@refId[1]','varchar(max)') FROM pkgStats pkg CROSS APPLY pkg.PackageXML.nodes('declare namespace DTS="www.microsoft.com/SqlServer/Dts";//DTS:Executable/DTS:ObjectData/pipeline/paths/*') AS cfnodes(x) ) INSERT INTO TblPrecedenceConstraint ( RowID ,PackagePath ,TaskFrom ,Taskto ,TaskType ) SELECT RowID ,PackagePath ,TaskFrom ,TaskTo ,TaskType FROM ( SELECT RowID ,PackagePath ,TaskFrom ,TaskTo ,'Control Flow' AS TaskType FROM CTE_CFPrec UNION ALL SELECT RowID ,PackagePath ,substring(TaskFrom, 1, charindex('.', TaskFrom) - 1) AS TaskFrom ,substring(TaskTo, 1, CHARINDEX('.', TaskTo) - 1) ,'Data Flow' FROM CTE_DFTPrec ) t; CREATE CLUSTERED INDEX CIX_TblPrecedenceConstraint ON TblPrecedenceConstraint (RowID); CREATE NONCLUSTERED INDEX NCIX_TblPrecedenceConstraint ON TblPrecedenceConstraint ( TaskFrom ,TaskTo ); SELECT DISTINCT RowID,TaskFrom,IsParentLevel,Row_number() OVER ( PARTITION BY rowid ORDER BY level) level INTO #tempprecedence1 FROM ( SELECT distinct t1.Rowid ,t1.TaskFrom ,1 AS isparentlevel , len(t1.TaskFrom) - len(replace(t1.TaskFrom, '\', '')) AS level FROM TblPrecedenceConstraint t1 LEFT JOIN TblPrecedenceConstraint t2 ON t1.rowid = t2.RowID AND t1.TaskFrom = t2.taskTo WHERE t2.taskto IS NULL )T CREATE CLUSTERED INDEX CIX_TblPrecedenceConstraint1 ON #tempprecedence1 (RowID); CREATE NONCLUSTERED INDEX NCIX_TblPrecedenceConstraint1 ON #tempprecedence1 (level); CREATE TABLE #tempprecedence2 ( ROWID INT ,TaskFrom VARCHAR(1000) ,task VARCHAR(1000) ,parentlevel INT ,LEVEL INT ); DECLARE @cntlevel INT ,@cnt INT = 1; SELECT @cntlevel = count(*) FROM #tempprecedence1; WHILE @cnt <= @cntlevel BEGIN ; WITH cte AS ( SELECT rowid ,taskfrom ,taskfrom AS task ,LEVEL ,1 AS cnt FROM #tempprecedence1 WHERE LEVEL = @cnt UNION ALL SELECT c.rowid ,c.taskfrom ,t.taskto ,LEVEL ,cnt + 1 FROM TblPrecedenceConstraint t INNER JOIN cte c ON t.RowID = c.RowID AND c.task = t.taskfrom ) INSERT INTO #tempprecedence2 ( rowid ,taskfrom ,task ,parentlevel ,LEVEL ) SELECT rowid ,taskfrom ,task ,@cnt ,cnt FROM cte; SELECT @cnt = @cnt + 1; END SELECT rowid ,task ,parentlevel ,LEVEL ,row_number() OVER ( PARTITION BY rowid ORDER BY parentlevel ,LEVEL ) trank INTO #tempprecedence3 FROM #tempprecedence2; CREATE CLUSTERED INDEX CIX_TblPrecedenceConstraint1 ON #tempprecedence3 (RowID); CREATE NONCLUSTERED INDEX NCIX_TblPrecedenceConstraint1 ON #tempprecedence3 (task); SELECT t.rowid ,isnull(t1.task,t.task) as task ,t.LEVEL tlevel ,isnull(max(t1.LEVEL),max(t.level)) level ,isnull(max(t1.trank),max(t.trank)) trank INTO #tempprecedence4 FROM #tempprecedence3 t LEFT JOIN #tempprecedence3 t1 ON t.rowid = t1.rowid AND t1.task LIKE '%' + t.task + '\%' GROUP BY t.rowid ,t1.task ,t.task ,t.LEVEL --,t1.LEVEL ORDER BY LEVEL ,trank; --select t.rowid,t1.task,t.level tlevel,t1.level, (t1.trank) trank into #tempprecedence4 --from #tempprecedence3 t --join #tempprecedence3 t1 --on t.rowid = t1.rowid --and t1.task like '%'+t.task+'%' -- order by trank SELECT t.rowid ,t.task ,replace(replace(replace(( SELECT tlevel FROM #tempprecedence4 t1 WHERE t1.rowid = t.rowid AND t1.task = t.task FOR XML path('') ), '</tlevel><tlevel>', '/'), '</tlevel>', '/'), '<tlevel>', '') sequenceno,trank INTO #tempprecedence5 FROM #tempprecedence4 t GROUP BY t.rowid ,t.task ,t.trank ORDER BY rowid ,trank; SELECT rowid,task, sequenceno, cast('/1/'+sequenceno+ cast(trank as varchar)+'/' as hierarchyid)rid into #tempprecedence5_Hierarchy FROM #tempprecedence5 SELECT rowid ,task ,row_number() OVER ( PARTITION BY rowid ORDER BY rid ) sequenceno INTO #tempprecedence6 FROM #tempprecedence5_Hierarchy; CREATE CLUSTERED INDEX CIX_TblPrecedenceConstraint1 ON #tempprecedence6 (RowID); CREATE NONCLUSTERED INDEX NCIX_TblPrecedenceConstraint1 ON #tempprecedence6 (task); /* select t1.task,t1.parentlevel,t.task as t1,row_number() over(partition by t1.rowid order by t.level) level,t.rowid into #tempprecedence3 from #tempprecedence2 t join #tempprecedence2 t1 on charindex(t.task, t1.taskFrom)>0 and t1.parentlevel >1 and t.parentlevel =1 and t.rowid =t1.rowid order by t.rowid, t1.parentlevel ,t.level select rowid, task,row_number() over(partition by rowid order by max(sequenceno)) sequenceno into #tempprecedence4 from( select distinct t1.rowid,isnull(t2.task,t1.task) Task,row_number() over(partition by t1.rowid order by t1.parentlevel,t1.level,isnull(t2.level,1)) sequenceno from #tempprecedence2 t1 left join #tempprecedence3 t2 on t1.rowid = t2.rowid and t1.task = t2.t1 where t1.parentlevel =1 )t group by rowid,task */ PRINT '----------------Get precedence constraint details------------------------------'; PRINT '----------------Get all Control flow tasks details------------------------------'; PRINT '----------------Get all data flow tasks details------------------------------'; WITH CTE_CFLevel AS ( SELECT pkg.RowID ,cfnodes.x.query('.').query('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; ./DTS:Executable[@DTS:ExecutableType=''SSIS.Pipeline.3'']/DTS:ObjectData/pipeline/components/component') DFTQuery ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:refId[1]', 'varchar(max)') AS TaskPath ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:ObjectName[1]', 'nvarchar(max)') AS TaskName ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:Description', 'nvarchar(max)') AS TaskTypeDescription ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:ExecutableType', 'nvarchar(max)') AS TaskType ,cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:DelayValidation', 'nvarchar(max)') AS DelayValidationPropertyValue ,ISNULL(cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:Disabled', 'nvarchar(max)'), 'False') AS IsDisabled ,'EvalExpression = ' + cfnodes.x.value('declare namespace p1="www.microsoft.com/SqlServer/Dts";./@p1:EvalExpression', 'nvarchar(max)') AS ForloopEvalExpression ,cfnodes.x.query('.').query('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; ./DTS:Executable[@DTS:ExecutableType=''Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ExecuteSQLTask, Microsoft.SqlServer.SQLTask, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'']/DTS:ObjectData/*') AS SqlTaskQry ,cfnodes.x.query('.').query('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; ./DTS:Executable[@DTS:ExecutableType=''SSIS.ExecutePackageTask.3'']/*') ExecPkgTaskQry ,cfnodes.x.query('.').query('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; ./DTS:Executable[@DTS:ExecutableType=''Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptTask, Microsoft.SqlServer.ScriptTask, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'']/DTS:ObjectData/ScriptProject/*') ScriptTaskQry FROM pkgStats pkg CROSS APPLY pkg.PackageXML.nodes('declare namespace DTS="www.microsoft.com/SqlServer/Dts";//DTS:Executable/DTS:Executables/*') AS cfnodes(x) ) INSERT INTO TblControlFlowDetails ( RowID ,TaskPath ,TaskName ,TaskTypeDescription ,TaskType ,DelayValidationPropertyValue ,DFTQuery ,SqlTaskQry ,ExecPkgTaskQry ,ScriptTaskQry ,IsDisabled ,ExpressionValue ) SELECT RowID ,TaskPath ,TaskName ,TaskTypeDescription ,TaskType ,DelayValidationPropertyValue ,DFTQuery ,SqlTaskQry ,ExecPkgTaskQry ,ScriptTaskQry ,IsDisabled ,ForloopEvalExpression FROM CTE_CFLevel; PRINT '---------- Insert Script task details-----------------------'; INSERT INTO TblScriptTaskdetails ( RowID ,ControlFlowDetailsRowID ,Script ) SELECT RowID ,CF.ControlFlowDetailsRowID ,cfnodes1.x.value('./ProjectItem[@Name=''ScriptMain.cs''][1]', 'varchar(max)') Script FROM TblControlFlowDetails cf CROSS APPLY Cf.ScriptTaskQry.nodes('.') AS cfnodes1(x); PRINT '---------- Insert Execute package task details-----------------------'; INSERT INTO TblExecutePackageTaskDetails ( RowID ,ControlFlowDetailsRowID ,ExecutePackageExpression ,ExecutedPackageName ,ExecutePackageConnection ) SELECT RowID ,cf.ControlFlowDetailsRowID ,cfnodes1.x.value('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; ./DTS:PropertyExpression[1]', 'varchar(1000)') ExecutePackageExpression ,cfnodes1.x.value('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; (./DTS:ObjectData/ExecutePackageTask/PackageName)[1]', 'varchar(1000)') ExecutedPackageName ,cfnodes1.x.value('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; (./DTS:ObjectData/ExecutePackageTask/Connection)[1]', 'varchar(1000)') ExecutePackageConnection FROM TblControlFlowDetails cf CROSS APPLY Cf.ExecPkgTaskQry.nodes('.') AS cfnodes1(x); UPDATE execpkg SET ExecutePackageConnection = pkg.ObjectValue FROM TblExecutePackageTaskDetails execpkg INNER JOIN packageanalysis pkg ON execpkg.RowID = pkg.RowID AND pkg.category = 'Connection' AND pkg.ConnectionManagerID = execpkg.ExecutePackageConnection; PRINT '---------- Insert Execute SQL task details-----------------------'; INSERT INTO TblSQLTaskDetails ( RowID ,ControlFlowDetailsRowID ,ParameterBindingSequence ,ParameterBindingParameterName ) SELECT DISTINCT cf.RowID ,cf.ControlFlowDetailsRowID --,cfnodes1.x.value('declare namespace SQLTask="www.microsoft.com/sqlserver/dts/tasks/sqltask"; (./@SQLTask:DtsVariableName)','varchar(1000)') as ResultSetParameterName ,cfnodes.x.value('declare namespace SQLTask="www.microsoft.com/sqlserver/dts/tasks/sqltask"; (./@SQLTask:ParameterName)', 'varchar(1000)') AS ParameterBindingSequence ,cfnodes.x.value('declare namespace SQLTask="www.microsoft.com/sqlserver/dts/tasks/sqltask"; (./@SQLTask:DtsVariableName)', 'varchar(1000)') AS ParameterBindingParameterName FROM TblControlFlowDetails cf OUTER APPLY Cf.SqlTaskQry.nodes('declare namespace SQLTask="www.microsoft.com/sqlserver/dts/tasks/sqltask";./SQLTask:SqlTaskData/SQLTask:ParameterBinding') AS cfnodes(x) ORDER BY 1 ,2 ,3; UPDATE sqltsk SET ResultSetParameterName = CF.ResultSetParameterName FROM TblSQLTaskDetails sqltsk INNER JOIN ( SELECT DISTINCT cf.RowID ,cf.ControlFlowDetailsRowID ,cast(ROW_NUMBER() OVER ( PARTITION BY cf.ControlFlowDetailsRowID ORDER BY ( SELECT 1 ) ) - 1 AS VARCHAR) rid ,cfnodes1.x.value('declare namespace SQLTask="www.microsoft.com/sqlserver/dts/tasks/sqltask"; (./@SQLTask:DtsVariableName)', 'varchar(1000)') AS ResultSetParameterName FROM TblControlFlowDetails cf OUTER APPLY Cf.SqlTaskQry.nodes('declare namespace SQLTask="www.microsoft.com/sqlserver/dts/tasks/sqltask";./SQLTask:SqlTaskData/SQLTask:ResultBinding') AS cfnodes1(x) ) CF ON sqltsk.ControlFlowDetailsRowID = CF.ControlFlowDetailsRowID AND cf.rid = ISNULL(sqltsk.ParameterBindingSequence, 0) PRINT '---------- Insert DFT details-----------------------'; INSERT INTO TblDFTTaskDetails ( RowID ,DFTTasksPath ,DFTTaskName ,DFTTaskType ,DFTTaskType1 ,DFTRowSet ,ParameterBindingParameterName ,DFTSQLCommand ,DFTConnectionManager ,Variable ,IsSortedProperty ,InputQry ,OutputQry ,MultihashcolumnSortPosition ) SELECT RowID ,dftnodes.x.value('@refId[1]', 'varchar(max)') AS DFTTasksPath ,dftnodes.x.value('@name[1]', 'varchar(max)') AS DFTTaskName ,dftnodes.x.value('@description[1]', 'varchar(max)') AS DFTTaskType ,dftnodes.x.value('@contactInfo[1]', 'varchar(max)') AS DFTTaskType1 ,dftnodes.x.value('data(./properties/property[@name=''OpenRowset''] )[1]', 'varchar(max)') DFTRowSet ,dftnodes.x.value('data(./properties/property[@name=''ParameterMapping''] )[1]', 'varchar(max)') ParameterBindingParameterName ,CASE WHEN isnull(dftnodes.x.value('data(./properties/property[@name=''SqlCommand''])[1]', 'varchar(max)'), '') = '' THEN isnull(dftnodes.x.value('data(./properties/property[@name=''SqlCommandVariable''])[1]', 'varchar(max)'), '') ELSE isnull(dftnodes.x.value('data(./properties/property[@name=''SqlCommand''])[1]', 'varchar(max)'), '') END DFTSQLCommand ,dftnodes.x.value('data(./connections/connection/@connectionManagerID)[1]', 'varchar(max)') DFTConnectionManager ,dftnodes.x.value('data(./properties/property[@name=''VariableName''] )[1]', 'varchar(max)') Variable ,dftnodes.x.value('data(./outputs/output/@isSorted)[1]', 'varchar(10)') IsSortedProperty ,lineage.x.query('.') InputQry ,outputvalue.x.query('.') OutputQry ,outputvalue.x.value('data(./properties/property[@name=''InputColumnLineageIDs''] )[1]', 'varchar(max)') as MultihashcolumnSortPosition FROM TblControlFlowDetails pkglvl CROSS APPLY pkglvl.DFTQuery.nodes('./*') AS dftnodes(x) OUTER APPLY dftnodes.x.nodes('./inputs/input/inputColumns/*') AS lineage(x) OUTER APPLY dftnodes.x.nodes('./outputs/output/outputColumns/*') AS outputvalue(x); PRINT '---------- Insert DFT details-----------------------'; PRINT '---------- Insert DFT Source and destination details-----------------------'; INSERT INTO TblSrcDestDetails ( RowID ,DataFlowDetailsRowID ,SourceColumn ,DestinationColumn ,SortKeyPosition ) SELECT RowID ,DataFlowDetailsRowID ,lineage.x.value('./@lineageId[1]', 'varchar(max)') AS SourceColumn ,COALESCE(lineage.x.value('./@name[1]', 'varchar(max)'),lineage.x.value('./@externalMetadataColumnId[1]', 'varchar(max)'), lineage.x.value('./@refId[1]', 'varchar(max)')) DestinationColumn ,lineage.x.value('./@sortKeyPosition[1]', 'varchar(200)') SortKeyPosition FROM TblDFTTaskDetails pkglvl CROSS APPLY pkglvl.InputQry.nodes('./*') AS lineage(x); INSERT INTO TblSrcDestDetails ( RowID ,DataFlowDetailsRowID ,SourceColumn ,DestinationColumn ,SortKeyPosition ) SELECT RowID ,DataFlowDetailsRowID ,lineage.x.value('./@lineageId[1]', 'varchar(max)') SourceColumn ,COALESCE(lineage.x.value('./@name[1]', 'varchar(max)'),lineage.x.value('./@externalMetadataColumnId[1]', 'varchar(max)'), lineage.x.value('./@refId[1]', 'varchar(max)')) DestinationColumn ,lineage.x.value('./@sortKeyPosition[1]', 'varchar(200)') SortKeyPosition FROM TblDFTTaskDetails pkglvl CROSS APPLY pkglvl.OutputQry.nodes('./*') AS lineage(x); PRINT '---------- Insert DFT Source and destination details-----------------------'; PRINT '---------- Insert DFT Derived task details-----------------------'; INSERT INTO TblDerivedTaskDetails ( RowID ,DataFlowDetailsRowID ,DerivedValue ,SourceColumn ,DestinationColumn ) SELECT DISTINCT RowID ,DataFlowDetailsRowID ,ISNULL(inputvalue.x.value('data(./properties/property[@description =''Derived Column Friendly Expression''])[1]', 'varchar(max)'), inputvalue.x.value('data(./properties/property[@name =''FriendlyExpression''])[1]', 'varchar(max)')) DerivedValue ,inputvalue.x.value('./@lineageId[1]', 'varchar(max)') SourceColumn ,inputvalue.x.value('./@refId[1]', 'varchar(max)') DestinationColumn FROM TblDFTTaskDetails pkglvl CROSS APPLY pkglvl.InputQry.nodes('./*') AS inputvalue(x) UNION ALL SELECT DISTINCT RowID ,DataFlowDetailsRowID ,ISNULL(outputvalue.x1.value('data(./properties/property[@description =''Derived Column Friendly Expression''])[1]', 'varchar(max)'), outputvalue.x1.value('data(./properties/property[@name =''FriendlyExpression''])[1]', 'varchar(max)')) DerivedValue ,outputvalue.x1.value('./@lineageId[1]', 'varchar(max)') SourceColumn ,outputvalue.x1.value('./@refId[1]', 'varchar(max)') DestinationColumn FROM TblDFTTaskDetails pkglvl CROSS APPLY pkglvl.OutputQry.nodes('./*') AS outputvalue(x1) WHERE DFTTASKTYPE1 LIKE '%DERIVED%'; PRINT '---------- Insert DFT Derived task details-----------------------'; PRINT '---------- Insert DFT lookup task details-----------------------'; INSERT INTO TblLookupTaskDetails ( RowID ,DataFlowDetailsRowID ,LookupJoins ,SourceColumn ,DestinationColumn ) SELECT RowID ,DataFlowDetailsRowID ,outputvalue.x.value('./@lineageId[1]', 'varchar(max)') + '----->' + outputvalue.x.value('data(./properties/property[@name =''JoinToReferenceColumn''])[1]', 'varchar(max)') LookupJoins ,outputvalue1.x.value('data(./properties/property[@name =''CopyFromReferenceColumn''])[1]', 'varchar(max)') SourceColumn ,outputvalue1.x.value('./@refId[1]', 'varchar(max)') DestinationColumn FROM TblDFTTaskDetails pkglvl CROSS APPLY pkglvl.InputQry.nodes('./*') AS outputvalue(x) CROSS APPLY pkglvl.OutputQry.nodes('./*') AS outputvalue1(x) WHERE DFTTaskType = 'Lookup' OR DFTTaskType1 LIKE '%Lookup%'; DELETE FROM TblLookupTaskDetails WHERE DestinationColumn LIKE '%Lookup Error Output%'; PRINT '---------- Insert DFT lookup task details-----------------------'; PRINT '---------- Insert DFT details in final table-----------------------'; INSERT INTO PackageAnalysis ( RowID ,PackagePath ,PackageName ,Category ,PackageCreatorName ,TaskPath ,ObjectName ,ObjectType ,ObjectTypeDescription ,DelayValidationPropertyValue ,ObjectValue ,ExpressionValue ,ConnectionManager ,SourceColumn ,DestinationColumn ,DerivedValue ,Variable ,LookupJoins ,ParameterBindingParameterName ,SortKeyPosition ,IsSortedProperty ,MultihashcolumnSortPosition ) SELECT DISTINCT dftlvl.RowID ,Pkg.PackagePath ,REPLACE(pkg.PackagePath, REPLACE(@Path, '*.dtsx', ''), '') PackageName ,cast('Data Flow Task' AS VARCHAR(max)) AS Category ,pkg.PackageCreatorName ,DFTLVL.DFTTasksPath AS TaskPath ,DFTTaskName AS TaskName ,CASE WHEN cast(CHARINDEX(';', LEFT(DFTTaskType1, 8000)) AS VARCHAR(1000)) BETWEEN 4 AND 100 THEN LEFT(cast(DFTTaskType1 AS VARCHAR(8000)), CHARINDEX(';', LEFT(DFTTaskType1, 8000)) - 1) ELSE DFTTaskType1 END AS TaskType ,cast('' AS VARCHAR(max)) AS ObjectTypeDescription ,'NA' AS DelayValidationPropertyValue ,CASE WHEN ISNULL(DFTlvl.DFTSQLCommand, '') <> '' THEN ISNULL(DFTlvl.DFTSQLCommand, '') ELSE ISNULL(DFTlvl.DFTRowSet, '') END AS ConnectionString ,cast('' AS VARCHAR(max)) AS ExpressionValue ,DFTConnectionManager AS ConnectionManager ,ISNULL(Der.SourceColumn, SrcDest.SourceColumn) ,ISNULL(Der.DestinationColumn, SrcDest.DestinationColumn) ,Der.DerivedValue ,Variable ,Lkup.LookupJoins ,DFTlvl.ParameterBindingParameterName ,SrcDest.SortKeyPosition ,DFTlvl.IsSortedProperty ,DFTlvl.MultihashcolumnSortPosition FROM TblDFTTaskDetails DFTlvl INNER JOIN pkgStats PKG ON DFTlvl.RowID = Pkg.RowID LEFT JOIN TblSrcDestDetails SrcDest ON DFTlvl.RowID = SrcDest.RowID AND DFTlvl.DataFlowDetailsRowID = SrcDest.DataFlowDetailsRowID LEFT JOIN TblDerivedTaskDetails Der ON DFTlvl.RowID = Der.RowID AND DFTlvl.DataFlowDetailsRowID = Der.DataFlowDetailsRowID LEFT JOIN TblLookupTaskDetails Lkup ON DFTlvl.RowID = Lkup.RowID AND DFTlvl.DataFlowDetailsRowID = Lkup.DataFlowDetailsRowID; PRINT '---------- Insert DFT details in final table-----------------------'; PRINT '-------------Insert control flow details in final table----------'; INSERT INTO PackageAnalysis ( RowID ,PackagePath ,PackageName ,Category ,PackageCreatorName ,TaskPath ,ObjectName ,ObjectType ,ObjectTypeDescription ,DelayValidationPropertyValue ,ObjectValue ,ResultSetParameterName ,ParameterBindingSequence ,ParameterBindingParameterName ,ExecutePackageExpression ,ExecutedPackageName ,ExecutePackageConnection ,Script ,ConnectionManagerID ,IsDisabled ,ExpressionValue ) SELECT cflvl.RowID ,Pkg.PackagePath ,REPLACE(Pkg.PackagePath, REPLACE(@Path, '*.dtsx', ''), '') PackageName ,cast('Control Flow Task' AS VARCHAR(max)) AS Category ,Pkg.PackageCreatorName ,cflvl.TaskPath ,CAST(cflvl.TaskName AS VARCHAR(max)) AS TaskName ,CAST(TaskType AS VARCHAR(max)) AS TaskType ,cast(cflvl.TaskTypeDescription AS VARCHAR(max)) AS ObjectTypeDescription ,ISNULL(NULLIF(DelayValidationPropertyValue, ''), 'False') DelayValidationPropertyValue ,( SELECT TOP 1 cfnodes.x.value('declare namespace SQLTask="www.microsoft.com/sqlserver/dts/tasks/sqltask";@SQLTask:SqlStatementSource[1]', 'nvarchar(max)') AS ConnectionString FROM cflvl.SqlTaskQry.nodes('./*') AS cfnodes(x) ) AS ConnectionString ,SQLTask.ResultSetParameterName ,SQLTask.ParameterBindingSequence ,SQLTask.ParameterBindingParameterName ,ExecPkgTask.ExecutePackageExpression ,ExecPkgTask.ExecutedPackageName ,ExecPkgTask.ExecutePackageConnection ,ScriptTsk.Script ,( SELECT TOP 1 cfnodes.x.value('declare namespace SQLTask="www.microsoft.com/sqlserver/dts/tasks/sqltask";@SQLTask:Connection[1]', 'nvarchar(max)') AS ConnectionString FROM cflvl.SqlTaskQry.nodes('./*') AS cfnodes(x) ) AS ConnectionString ,ISNULL(cflvl.IsDisabled, 'False') ,cflvl.ExpressionValue FROM TblControlFlowDetails cflvl INNER JOIN pkgStats PKG ON cflvl.RowID = Pkg.RowID LEFT JOIN TblSQLTaskDetails SQLTask ON cflvl.RowID = SQLTask.RowID AND cflvl.ControlFlowDetailsRowID = SQLTask.ControlFlowDetailsRowID LEFT JOIN TblExecutePackageTaskDetails ExecPkgTask ON cflvl.RowID = ExecPkgTask.RowID AND cflvl.ControlFlowDetailsRowID = ExecPkgTask.ControlFlowDetailsRowID LEFT JOIN TblScriptTaskdetails ScriptTsk ON cflvl.RowID = ScriptTsk.RowID AND cflvl.ControlFlowDetailsRowID = ScriptTsk.ControlFlowDetailsRowID; PRINT '-------------Insert control flow details in final table----------'; PRINT '-------------Insert Connection details in table----------'; INSERT INTO ConnectionDetails ( ConnectionManager ,ConnectionManagerID ) SELECT DISTINCT ObjectName ,ConnectionManagerID FROM PackageAnalysis WHERE Category = 'Connection'; PRINT '-------------Insert Connection details in table----------'; PRINT '-------------Update sequence of task----------'; UPDATE PA SET SequenceNo = TblPrecCon.sequenceno FROM PackageAnalysis PA INNER JOIN #tempprecedence6 TblPrecCon ON PA.RowID = TblPrecCon.RowID AND PA.TaskPath = TblPrecCon.Task; --LEFT JOIN @TblPrecedenceConstraint1 TblPrec --ON Final.RowID = TblPrec.RowID --AND Final.PackagePath = TblPrec.PackagePath --AND Final.TaskPath = TblPrec.TaskName --ORDER BY TblPrec.RowID,TblPrec.PrecOrder PRINT '--------------------update objecttype-------------------'; UPDATE PackageAnalysis SET ObjectType = 'Sequence Container' WHERE ObjectType LIKE '%STOCK:SEQUENCE%' OR ObjectType LIKE '%(Sequence Container)%' OR ObjectType LIKE '%(Container)%'; UPDATE PackageAnalysis SET ObjectType = 'Data Flow Task' WHERE ObjectType LIKE 'SSIS.Pipeline.3' OR ObjectType LIKE '%(Data Flow Task)%'; UPDATE PackageAnalysis SET ObjectType = 'For Loop Container' WHERE ObjectType LIKE '%(For Loop Container)%' OR ObjectType LIKE 'STOCK:FORLOOP'; UPDATE PackageAnalysis SET ObjectType = 'Script Task' WHERE ObjectType LIKE '%(Script Task)%'; UPDATE PackageAnalysis SET ObjectType = 'Execute SQL Task' WHERE ObjectType LIKE '%(Execute SQL Task)%' OR ObjectType LIKE '%ExecuteSQLTask%'; UPDATE PackageAnalysis SET ObjectType = 'Execute Package Task' WHERE ObjectType LIKE '%(Execute Package Task)%' OR ObjectType LIKE '%ExecutePackageTask%'; UPDATE PackageAnalysis SET ObjectType = 'Foreach Loop Container' WHERE ObjectType LIKE '%(Foreach Loop Container)%' OR ObjectType LIKE 'STOCK:FOREACHLOOP'; UPDATE PackageAnalysis SET ObjectType = 'File System Task' WHERE ObjectType LIKE '%FileSystemTask%'; UPDATE PackageAnalysis SET ObjectType = 'Script Task' WHERE ObjectType LIKE '%ScriptTask%'; UPDATE PackageAnalysis SET ObjectType = 'Send Mail Task' WHERE ObjectType LIKE '%SendMailTask%'; UPDATE PackageAnalysis SET ObjectType = 'ADO.NET:System.Data.SqlClient.SqlConnection' WHERE objecttype = 'ADO.NET:System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'; UPDATE PackageAnalysis SET ObjectType = 'ADO.NET:System.Data.Odbc.OdbcConnection' WHERE objecttype = 'ADO.NET:System.Data.Odbc.OdbcConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'; UPDATE PackageAnalysis SET ObjectType = 'Script Component' WHERE ObjectType LIKE 'Hosts user-defined data transformations, source and destination adapters' OR ObjectType = 'Executes a custom script.'; UPDATE PackageAnalysis SET ObjectType = 'INT16' WHERE objecttype = '2' --OR objecttype = '0' ; UPDATE PackageAnalysis SET ObjectType = 'INT32' WHERE objecttype = '3'; UPDATE PackageAnalysis SET ObjectType = 'BYTE' WHERE objecttype = '17'; UPDATE PackageAnalysis SET ObjectType = 'BOOLEAN' WHERE objecttype = '11'; UPDATE PackageAnalysis SET ObjectType = 'OBJECT' WHERE objecttype = '13'; UPDATE PackageAnalysis SET ObjectType = 'STRING' WHERE objecttype = '8'; UPDATE PackageAnalysis SET ObjectType = 'DOUBLE' WHERE objecttype = '5'; UPDATE PackageAnalysis SET ObjectType = 'DATETIME' WHERE objecttype = '7'; UPDATE PackageAnalysis SET ObjectType = 'INT64' WHERE objecttype = '20'; UPDATE PackageAnalysis SET ObjectType = 'ADO NET Source' WHERE objecttype = 'Extracts data from a relational database by using a .NET provider.'; UPDATE PackageAnalysis SET ObjectValue = Variable WHERE objecttype = 'Row count'; UPDATE PackageAnalysis SET PackageAnalysis.ConnectionManager = ConnectionDetails.ConnectionManager FROM PackageAnalysis INNER JOIN ConnectionDetails ON PackageAnalysis.ConnectionManagerID = ConnectionDetails.ConnectionManagerID; UPDATE PackageAnalysis SET PackageAnalysis.IsDisabled = ISNULL(IsDisabled, 'False'); DELETE FROM PackageAnalysis WHERE SourceColumn LIKE '%OLE DB Source Error Output%' AND (ObjectType LIKE '%Source%' OR ObjectType LIKE '%Destination%'); DELETE FROM PackageAnalysis WHERE SourceColumn LIKE '%Derived Column Error Output%'; DECLARE @tblparameters TABLE ( rowid INT ,ParameterBindingParameterName VARCHAR(1000) ,taskpath VARCHAR(2000) ,SplitParameterBindingParameterName VARCHAR(1000) ,NewParameterBindingParameterName VARCHAR(1000) ); INSERT INTO @tblparameters ( rowid ,ParameterBindingParameterName ,taskpath ,SplitParameterBindingParameterName ) SELECT DISTINCT rowid ,ParameterBindingParameterName ,taskpath ,O.ParameterBindingParameterNameSplit FROM ( SELECT rowid ,ParameterBindingParameterName ,taskpath ,cast('<X>' + replace(ParameterBindingParameterName, ';', '</X><X>') + '</X>' AS XML) AS ParameterBindingParameterNameSep FROM PackageAnalysis WHERE Category = 'Data Flow Task' AND ParameterBindingParameterName IS NOT NULL ) F1 CROSS APPLY ( SELECT fdata.D.value('.', 'varchar(1000)') AS ParameterBindingParameterNameSplit FROM f1.ParameterBindingParameterNameSep.nodes('X') AS fdata(D) ) O WHERE O.ParameterBindingParameterNameSplit <> ''; UPDATE P SET P.NewParameterBindingParameterName = REPLACE(SplitParameterBindingParameterName, V.VariableHexValue, 'VariableName = ' + V.ObjectName) + ',Value = ' + v.ObjectValue FROM @tblparameters P INNER JOIN TblVariableDetails v ON P.Rowid = v.Rowid AND CHARINDEX(V.VariableHexValue, SplitParameterBindingParameterName) > 0; UPDATE p SET ParameterBindingParameterName = t.NewParameterBindingParameterName FROM packageanalysis p INNER JOIN ( SELECT rowid ,taskpath ,ParameterBindingParameterName ,stuff(( SELECT ';' + NewParameterBindingParameterName FROM @tblparameters WHERE rowid = t.rowid AND taskpath = t.taskpath FOR XML PATH('') ,TYPE ,ROOT ).value('root[1]', 'nvarchar(max)'), 1, 1, '') AS NewParameterBindingParameterName FROM @tblparameters t ) t ON p.rowid = t.rowid AND p.taskpath = t.taskpath AND p.ParameterBindingParameterName = t.ParameterBindingParameterName CREATE NONCLUSTERED INDEX NCIX ON PackageAnalysis ( Rowid ,SequenceNo ); UPDATE pkg SET PackageSequenceNo = NewTableRowID FROM PackageAnalysis pkg JOIN (SELECT ROW_number() OVER(PARTITION BY RowID ORDER BY ISNULL(SequenceNo,-1)) as NewTableRowID, SequenceNo , RowID, TableRowID FROM PackageAnalysis ) newpkg ON pkg.RowID = newpkg.RowID and pkg.TableRowID = newpkg.TableRowID UPDATE pkg SET PackageProtectionLevel = CASE WHEN Stats.PackageProtectionLevel IS Null THEN 'EncryptSensitiveWithUserKey' WHEN Stats.PackageProtectionLevel = '0' THEN 'DontSaveSensitive' WHEN Stats.PackageProtectionLevel = '2' THEN 'EncryptSensitiveWithPassword' ELSE Stats.PackageProtectionLevel END FROM PackageAnalysis pkg JOIN pkgStats Stats ON pkg.RowID = Stats.RowID SELECT RowID , PackageSequenceNo , SequenceNo , '"'+ PackagePath +'"' PackagePath, '"'+ PackageName +'"' PackageName, '"'+ ISNULL(IsDisabled,'') +'"' IsDisabled, '"'+ ISNULL(Category ,'') +'"' Category, '"'+ ISNULL(PackageCreatorName ,'') +'"' PackageCreatorName, '"'+ ISNULL(PackageProtectionLevel ,'') +'"' PackageProtectionLevel, '"'+ ISNULL(TaskPath ,'') +'"' TaskPath, '"'+ ISNULL(ObjectName ,'') +'"' ObjectName, '"'+ ISNULL(ObjectType ,'') +'"' ObjectType, '"'+ ISNULL(ObjectTypeDescription ,'') +'"' ObjectTypeDescription, '"'+ ISNULL(DelayValidationPropertyValue ,'') +'"' DelayValidationPropertyValue, '"'+ ISNULL(ObjectValue ,'') +'"' ObjectValue, '"'+ ISNULL(RetainSameConnectionProperty ,'') +'"' RetainSameConnectionProperty, '"'+ ISNULL(IsSortedProperty ,'') +'"' IsSortedProperty, '"'+ ISNULL(ExpressionValue ,'') +'"' ExpressionValue, '"'+ ISNULL(ConnectionManager ,'') +'"' ConnectionManager, '"'+ ISNULL(SourceColumn ,'') +'"' SourceColumn, '"'+ ISNULL(DestinationColumn ,'') +'"' DestinationColumn, '"'+ ISNULL(SortKeyPosition ,'') +'"' SortKeyPosition, '"'+ ISNULL(MultihashcolumnSortPosition ,'') +'"' MultihashcolumnSortPosition, '"'+ ISNULL(DerivedValue ,'') +'"' DerivedValue, '"'+ ISNULL(ResultSetParameterName ,'') +'"' ResultSetParameterName, '"'+ ISNULL(ParameterBindingSequence ,'') +'"' ParameterBindingSequence, '"'+ ISNULL(ParameterBindingParameterName ,'') +'"' ParameterBindingParameterName, '"'+ ISNULL(ExecutePackageExpression ,'') +'"' ExecutePackageExpression, '"'+ ISNULL(ExecutedPackageName ,'') +'"' ExecutedPackageName, '"'+ ISNULL(ExecutePackageConnection ,'') +'"' ExecutePackageConnection, '"'+ ISNULL(Script ,'') +'"' Script, '"'+ ISNULL(Variable ,'') +'"' Variable, '"'+ ISNULL(LookupJoins ,'') +'"' LookupJoins FROM PackageAnalysis ORDER BY 3 ,1; END; GO
the_stack
SET FOREIGN_KEY_CHECKS=0; CREATE DATABASE IF NOT EXISTS `breakingpointmod` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `breakingpointmod`; -- ---------------------------- -- Table structure for buildings -- ---------------------------- DROP TABLE IF EXISTS `buildings`; CREATE TABLE `buildings` ( `id` int(8) NOT NULL AUTO_INCREMENT, `player_id` varchar(40) NOT NULL, `unique_id` varchar(60) NOT NULL, `building_id` varchar(30) NOT NULL, `building_name` varchar(40) NOT NULL DEFAULT 'Unknown', `worldspace` varchar(60) NOT NULL DEFAULT '[]', `lock` varchar(4) NOT NULL DEFAULT '0000', `explosive` tinyint(1) NOT NULL DEFAULT '0', `reinforcement` int(1) NOT NULL DEFAULT '0', `instance_id` bigint(20) NOT NULL DEFAULT '1', `lastupdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `unique_index` (`building_id`,`instance_id`), KEY `worldspace` (`worldspace`), KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of buildings -- ---------------------------- -- ---------------------------- -- Table structure for clans -- ---------------------------- DROP TABLE IF EXISTS `clans`; CREATE TABLE `clans` ( `id` mediumint(8) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `tag` varchar(8) NOT NULL, `description` varchar(512) NOT NULL, `owner_id` mediumint(8) NOT NULL DEFAULT '-1', `website` varchar(128) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of clans -- ---------------------------- -- ---------------------------- -- Table structure for clans_invites -- ---------------------------- DROP TABLE IF EXISTS `clans_invites`; CREATE TABLE `clans_invites` ( `id` mediumint(8) NOT NULL AUTO_INCREMENT, `legion_id` mediumint(8) NOT NULL, `source_id` mediumint(8) NOT NULL, `target_id` mediumint(8) NOT NULL, `invite_hash` varchar(128) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of clans_invites -- ---------------------------- -- ---------------------------- -- Table structure for combat_log -- ---------------------------- DROP TABLE IF EXISTS `combat_log`; CREATE TABLE `combat_log` ( `id` int(8) NOT NULL AUTO_INCREMENT, `player_id` varchar(40) NOT NULL, `player_name` varchar(40) NOT NULL DEFAULT 'Unknown', `character_id` varchar(40) NOT NULL DEFAULT '0', `instance` tinyint(5) NOT NULL DEFAULT '0', `lastupdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of combat_log -- ---------------------------- -- ---------------------------- -- Table structure for deployable -- ---------------------------- DROP TABLE IF EXISTS `deployable`; CREATE TABLE `deployable` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `class_name` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `uq1_deployable` (`class_name`) ) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of deployable -- ---------------------------- INSERT INTO `deployable` VALUES ('41', 'BP_BarrelFuel'); INSERT INTO `deployable` VALUES ('39', 'BP_BarrelWater'); INSERT INTO `deployable` VALUES ('11', 'BP_Cache1'); INSERT INTO `deployable` VALUES ('13', 'BP_Cache1_Hunter'); INSERT INTO `deployable` VALUES ('15', 'BP_Cache1_Nomad'); INSERT INTO `deployable` VALUES ('12', 'BP_Cache1_Outlaw'); INSERT INTO `deployable` VALUES ('14', 'BP_Cache1_Ranger'); INSERT INTO `deployable` VALUES ('16', 'BP_Cache1_Survivalist'); INSERT INTO `deployable` VALUES ('5', 'BP_CamoNet'); INSERT INTO `deployable` VALUES ('17', 'BP_Chest'); INSERT INTO `deployable` VALUES ('21', 'BP_Chest_Hunter'); INSERT INTO `deployable` VALUES ('20', 'BP_Chest_Nomad'); INSERT INTO `deployable` VALUES ('19', 'BP_Chest_Outlaw'); INSERT INTO `deployable` VALUES ('18', 'BP_Chest_Ranger'); INSERT INTO `deployable` VALUES ('22', 'BP_Chest_Survivalist'); INSERT INTO `deployable` VALUES ('1', 'BP_Crate1'); INSERT INTO `deployable` VALUES ('7', 'BP_Crate1_Hunter'); INSERT INTO `deployable` VALUES ('9', 'BP_Crate1_Nomad'); INSERT INTO `deployable` VALUES ('6', 'BP_Crate1_Outlaw'); INSERT INTO `deployable` VALUES ('8', 'BP_Crate1_Ranger'); INSERT INTO `deployable` VALUES ('10', 'BP_Crate1_Survivalist'); INSERT INTO `deployable` VALUES ('29', 'BP_GunCabinet'); INSERT INTO `deployable` VALUES ('33', 'BP_GunCabinet_Hunter'); INSERT INTO `deployable` VALUES ('32', 'BP_GunCabinet_Nomad'); INSERT INTO `deployable` VALUES ('31', 'BP_GunCabinet_Outlaw'); INSERT INTO `deployable` VALUES ('30', 'BP_GunCabinet_Ranger'); INSERT INTO `deployable` VALUES ('34', 'BP_GunCabinet_Survivalist'); INSERT INTO `deployable` VALUES ('23', 'BP_Refrigerator'); INSERT INTO `deployable` VALUES ('27', 'BP_Refrigerator_Hunter'); INSERT INTO `deployable` VALUES ('26', 'BP_Refrigerator_Nomad'); INSERT INTO `deployable` VALUES ('25', 'BP_Refrigerator_Outlaw'); INSERT INTO `deployable` VALUES ('24', 'BP_Refrigerator_Ranger'); INSERT INTO `deployable` VALUES ('28', 'BP_Refrigerator_Survivalist'); INSERT INTO `deployable` VALUES ('3', 'BP_RockStash'); INSERT INTO `deployable` VALUES ('2', 'BP_Safe'); INSERT INTO `deployable` VALUES ('37', 'BP_Stove'); INSERT INTO `deployable` VALUES ('35', 'BP_Television'); INSERT INTO `deployable` VALUES ('4', 'BP_Tent'); -- ---------------------------- -- Table structure for instance -- ---------------------------- DROP TABLE IF EXISTS `instance`; CREATE TABLE `instance` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `world_id` smallint(5) unsigned NOT NULL DEFAULT '1', `inventory` varchar(2048) NOT NULL DEFAULT '[]', `backpack` varchar(2048) NOT NULL DEFAULT '[]', PRIMARY KEY (`id`), KEY `fk1_instance` (`world_id`), CONSTRAINT `instance_ibfk_1` FOREIGN KEY (`world_id`) REFERENCES `world` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of instance -- ---------------------------- INSERT INTO `instance` VALUES ('1', '1', '[]', '[]'); INSERT INTO `instance` VALUES ('2', '1', '[]', '[]'); INSERT INTO `instance` VALUES ('3', '12', '[]', '[]'); INSERT INTO `instance` VALUES ('4', '1', '[]', '[]'); INSERT INTO `instance` VALUES ('5', '2', '[]', '[]'); INSERT INTO `instance` VALUES ('6', '3', '[]', '[]'); INSERT INTO `instance` VALUES ('7', '6', '[]', '[]'); INSERT INTO `instance` VALUES ('8', '5', '[]', '[]'); INSERT INTO `instance` VALUES ('9', '12', '[]', '[]'); INSERT INTO `instance` VALUES ('10', '12', '[]', '[]'); -- ---------------------------- -- Table structure for instance_deployable -- ---------------------------- DROP TABLE IF EXISTS `instance_deployable`; CREATE TABLE `instance_deployable` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `unique_id` varchar(60) NOT NULL, `deployable_id` smallint(5) unsigned NOT NULL, `owner_id` int(10) unsigned NOT NULL, `player_id` varchar(128) NOT NULL, `instance_id` bigint(20) unsigned NOT NULL DEFAULT '1', `worldspace` varchar(60) NOT NULL DEFAULT '[0,[0,0,0]]', `inventory` varchar(2048) NOT NULL DEFAULT '[]', `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `Hitpoints` varchar(500) NOT NULL DEFAULT '[]', `Fuel` double NOT NULL DEFAULT '0', `Damage` double NOT NULL DEFAULT '0', `lock` varchar(4) NOT NULL, `building_id` mediumint(8) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx1_instance_deployable` (`deployable_id`), KEY `idx2_instance_deployable` (`owner_id`), KEY `idx3_instance_deployable` (`instance_id`), CONSTRAINT `instance_deployable_ibfk_1` FOREIGN KEY (`instance_id`) REFERENCES `instance` (`id`), CONSTRAINT `instance_deployable_ibfk_3` FOREIGN KEY (`deployable_id`) REFERENCES `deployable` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of instance_deployable -- ---------------------------- -- ---------------------------- -- Table structure for instance_traps -- ---------------------------- DROP TABLE IF EXISTS `instance_traps`; CREATE TABLE `instance_traps` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `unique_id` varchar(60) NOT NULL, `classname` varchar(100) NOT NULL, `worldspace` varchar(60) NOT NULL, `instance_id` bigint(20) NOT NULL, `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of instance_traps -- ---------------------------- -- ---------------------------- -- Table structure for instance_vehicle -- ---------------------------- DROP TABLE IF EXISTS `instance_vehicle`; CREATE TABLE `instance_vehicle` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `instance_id` bigint(20) unsigned NOT NULL DEFAULT '1', `unique_id` varchar(60) NOT NULL, `classname` varchar(60) NOT NULL, `worldspace` varchar(60) NOT NULL DEFAULT '[0,[0,0,0]]', `inventory` varchar(2048) NOT NULL DEFAULT '[]', `parts` varchar(1024) NOT NULL DEFAULT '[]', `fuel` double NOT NULL DEFAULT '0', `damage` double NOT NULL DEFAULT '0', `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `idx3_instance_vehicle` (`instance_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of instance_vehicle -- ---------------------------- -- ---------------------------- -- Table structure for kill_log -- ---------------------------- DROP TABLE IF EXISTS `kill_log`; CREATE TABLE `kill_log` ( `id` int(8) NOT NULL AUTO_INCREMENT, `player_id` varchar(40) NOT NULL, `player_name` varchar(40) NOT NULL DEFAULT 'Unknown', `killer_id` varchar(40) NOT NULL, `killer_name` varchar(40) NOT NULL DEFAULT 'Unknown', `distance` mediumint(5) NOT NULL DEFAULT '0', `weapon` varchar(40) NOT NULL DEFAULT 'Unknown', `instance` tinyint(5) NOT NULL DEFAULT '0', `lastupdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of kill_log -- ---------------------------- -- ---------------------------- -- Table structure for profile -- ---------------------------- DROP TABLE IF EXISTS `profile`; CREATE TABLE `profile` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `unique_id` varchar(128) NOT NULL, `name` varchar(64) NOT NULL DEFAULT '', `guid` varchar(32) NOT NULL DEFAULT '', `vac` tinyint(1) NOT NULL DEFAULT '0', `vac_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `market` varchar(1024) NOT NULL DEFAULT '[]', `clan` int(4) NOT NULL DEFAULT '0', `ranger` int(6) NOT NULL DEFAULT '0', `outlaw` int(6) NOT NULL DEFAULT '0', `hunter` int(6) NOT NULL DEFAULT '0', `nomad` int(6) NOT NULL DEFAULT '0', `survivalist` int(6) NOT NULL DEFAULT '0', `engineer` int(6) NOT NULL DEFAULT '0', `undead` int(6) NOT NULL DEFAULT '0', `survival_attempts` int(3) unsigned NOT NULL DEFAULT '1', `total_survival_time` int(5) unsigned NOT NULL DEFAULT '0', `total_survivor_kills` int(4) unsigned NOT NULL DEFAULT '0', `total_zombie_kills` int(5) unsigned NOT NULL DEFAULT '0', `total_headshots` int(5) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `uq_profile` (`unique_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of profile -- ---------------------------- -- ---------------------------- -- Table structure for storage_log -- ---------------------------- DROP TABLE IF EXISTS `storage_log`; CREATE TABLE `storage_log` ( `id` int(8) NOT NULL AUTO_INCREMENT, `player_id` varchar(40) NOT NULL, `player_name` varchar(40) NOT NULL DEFAULT 'Unknown', `deployable_id` varchar(60) NOT NULL, `deployable_name` varchar(40) NOT NULL DEFAULT 'Unknown', `owner_id` varchar(40) NOT NULL, `instance` tinyint(5) NOT NULL DEFAULT '0', `lastupdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of storage_log -- ---------------------------- -- ---------------------------- -- Table structure for survivor -- ---------------------------- DROP TABLE IF EXISTS `survivor`; CREATE TABLE `survivor` ( `id` int(8) unsigned NOT NULL AUTO_INCREMENT, `unique_id` varchar(128) NOT NULL, `world_id` smallint(5) unsigned NOT NULL DEFAULT '1', `worldspace` varchar(60) NOT NULL DEFAULT '[]', `inventory` varchar(4096) NOT NULL DEFAULT '[]', `backpack` varchar(2048) NOT NULL DEFAULT '[]', `medical` varchar(255) NOT NULL DEFAULT '[false,false,false,false,false,false,false,0,12000,[],[0,0],0]', `is_dead` tinyint(3) unsigned NOT NULL DEFAULT '0', `state` varchar(128) NOT NULL DEFAULT '["","aidlpercmstpsnonwnondnon_player_idlesteady04",36]', `survivor_kills` int(3) unsigned NOT NULL DEFAULT '0', `zombie_kills` int(4) unsigned NOT NULL DEFAULT '0', `headshots` int(4) unsigned NOT NULL DEFAULT '0', `survival_time` int(3) unsigned NOT NULL DEFAULT '0', `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `start_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `class` int(6) NOT NULL DEFAULT '-1', `dog` varchar(255) NOT NULL DEFAULT '[]', `lastserver` int(50) NOT NULL DEFAULT '0', `activeserver` int(50) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx1_main` (`unique_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of survivor -- ---------------------------- -- ---------------------------- -- Table structure for world -- ---------------------------- DROP TABLE IF EXISTS `world`; CREATE TABLE `world` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL DEFAULT '0', `max_x` mediumint(9) DEFAULT '0', `max_y` mediumint(9) DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `uq_world` (`name`), KEY `idx1_world` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of world -- ---------------------------- INSERT INTO `world` VALUES ('1', 'altis', '50000', '50000'); INSERT INTO `world` VALUES ('2', 'stratis', '50000', '50000'); INSERT INTO `world` VALUES ('3', 'thirsk', '50000', '50000'); INSERT INTO `world` VALUES ('4', 'bornholm', '50000', '50000'); INSERT INTO `world` VALUES ('5', 'newhaven', '50000', '50000'); INSERT INTO `world` VALUES ('6', 'esseker', '12700', '12700'); INSERT INTO `world` VALUES ('8', 'chernarus', '14700', '15360'); INSERT INTO `world` VALUES ('9', 'namalsk', '50000', '50000'); INSERT INTO `world` VALUES ('11', 'legion', '50000', '50000'); INSERT INTO `world` VALUES ('12', 'tanoa', '50000', '50000');
the_stack
-- 2017-10-19T20:33:12.460 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Über-/ Unterzahlung',Updated=TO_TIMESTAMP('2017-10-19 20:33:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11041 ; -- 2017-10-19T20:33:20.915 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Abschreibung',Updated=TO_TIMESTAMP('2017-10-19 20:33:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11042 ; -- 2017-10-19T20:35:14.371 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,263,540523,TO_TIMESTAMP('2017-10-19 20:35:14','YYYY-MM-DD HH24:MI:SS'),100,'Y',20,TO_TIMESTAMP('2017-10-19 20:35:14','YYYY-MM-DD HH24:MI:SS'),100,'advanced edit') ; -- 2017-10-19T20:35:14.376 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540523 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID) ; -- 2017-10-19T20:35:26.606 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540698,540523,TO_TIMESTAMP('2017-10-19 20:35:26','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-10-19 20:35:26','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-19T20:35:51.116 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540698,541214,TO_TIMESTAMP('2017-10-19 20:35:51','YYYY-MM-DD HH24:MI:SS'),100,'Y','advanced edit',10,TO_TIMESTAMP('2017-10-19 20:35:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-19T20:36:06.422 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541214, SeqNo=10,Updated=TO_TIMESTAMP('2017-10-19 20:36:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547011 ; -- 2017-10-19T20:36:13.445 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541214, SeqNo=20,Updated=TO_TIMESTAMP('2017-10-19 20:36:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547012 ; -- 2017-10-19T20:36:17.817 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=540908 ; -- 2017-10-19T20:36:21.575 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Column WHERE AD_UI_Column_ID=540529 ; -- 2017-10-19T20:36:25.417 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Section_Trl WHERE AD_UI_Section_ID=540392 ; -- 2017-10-19T20:36:25.428 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Section WHERE AD_UI_Section_ID=540392 ; -- 2017-10-19T20:36:41.578 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541214, SeqNo=30,Updated=TO_TIMESTAMP('2017-10-19 20:36:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547014 ; -- 2017-10-19T20:36:49.538 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541214, SeqNo=40,Updated=TO_TIMESTAMP('2017-10-19 20:36:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547015 ; -- 2017-10-19T20:36:57.319 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541214, SeqNo=50,Updated=TO_TIMESTAMP('2017-10-19 20:36:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547016 ; -- 2017-10-19T20:37:14.401 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=540909 ; -- 2017-10-19T20:37:20.147 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Column WHERE AD_UI_Column_ID=540530 ; -- 2017-10-19T20:37:23.958 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Section_Trl WHERE AD_UI_Section_ID=540393 ; -- 2017-10-19T20:37:23.967 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Section WHERE AD_UI_Section_ID=540393 ; -- 2017-10-19T20:37:39.025 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541214, SeqNo=60,Updated=TO_TIMESTAMP('2017-10-19 20:37:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544482 ; -- 2017-10-19T20:37:47.729 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541214, SeqNo=70,Updated=TO_TIMESTAMP('2017-10-19 20:37:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544483 ; -- 2017-10-19T20:37:51.743 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_ElementGroup WHERE AD_UI_ElementGroup_ID=540457 ; -- 2017-10-19T20:37:55.316 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Column WHERE AD_UI_Column_ID=540278 ; -- 2017-10-19T20:37:59.321 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Section_Trl WHERE AD_UI_Section_ID=540198 ; -- 2017-10-19T20:37:59.326 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Section WHERE AD_UI_Section_ID=540198 ; -- 2017-10-19T20:38:07.874 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-10-19 20:38:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=541214 ; -- 2017-10-19T20:38:37.014 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-10-19 20:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547015 ; -- 2017-10-19T20:38:38.759 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAdvancedField='Y',Updated=TO_TIMESTAMP('2017-10-19 20:38:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=547016 ; -- 2017-10-19T20:46:12.366 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548075,0,540338,1000043,549102,'F',TO_TIMESTAMP('2017-10-19 20:46:12','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-10-19 20:46:12','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-19T20:46:22.021 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548074,0,540338,1000043,549103,'F',TO_TIMESTAMP('2017-10-19 20:46:21','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-10-19 20:46:21','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-19T20:46:28.907 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-10-19 20:46:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549102 ; -- 2017-10-19T20:47:13.815 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548186,0,540342,1000044,549104,'F',TO_TIMESTAMP('2017-10-19 20:47:13','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-10-19 20:47:13','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-19T20:47:24.039 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,548185,0,540342,1000044,549105,'F',TO_TIMESTAMP('2017-10-19 20:47:24','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-10-19 20:47:24','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-19T20:47:31.938 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-10-19 20:47:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549104 ; -- 2017-10-19T20:48:10.407 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-10-19 20:48:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000488 ; -- 2017-10-19T20:48:10.409 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-10-19 20:48:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000489 ; -- 2017-10-19T20:48:10.410 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-10-19 20:48:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000490 ; -- 2017-10-19T20:48:10.411 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-10-19 20:48:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000491 ; -- 2017-10-19T20:48:10.412 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-10-19 20:48:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000487 ; -- 2017-10-19T20:48:33.956 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-10-19 20:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000480 ; -- 2017-10-19T20:48:33.958 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-10-19 20:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000481 ; -- 2017-10-19T20:48:33.959 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-10-19 20:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000482 ; -- 2017-10-19T20:48:33.960 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-10-19 20:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000483 ; -- 2017-10-19T20:48:33.962 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-10-19 20:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000484 ; -- 2017-10-19T20:48:33.963 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-10-19 20:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000485 ; -- 2017-10-19T20:48:33.964 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-10-19 20:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549104 ; -- 2017-10-19T20:48:51.183 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-10-19 20:48:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000480 ; -- 2017-10-19T20:48:53.485 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-10-19 20:48:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000481 ; -- 2017-10-19T20:48:55.433 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-10-19 20:48:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000482 ; -- 2017-10-19T20:48:57.474 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-10-19 20:48:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000483 ; -- 2017-10-19T20:48:59.036 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-10-19 20:48:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000484 ; -- 2017-10-19T20:49:00.583 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-10-19 20:49:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000485 ; -- 2017-10-19T20:49:02.292 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-10-19 20:49:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549104 ; -- 2017-10-19T20:49:05.494 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-10-19 20:49:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549105 ; -- 2017-10-19T20:49:22.995 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-10-19 20:49:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000476 ; -- 2017-10-19T20:49:24.933 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-10-19 20:49:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000477 ; -- 2017-10-19T20:49:26.781 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-10-19 20:49:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000478 ; -- 2017-10-19T20:49:28.460 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-10-19 20:49:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000479 ; -- 2017-10-19T20:49:30.373 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-10-19 20:49:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549102 ; -- 2017-10-19T20:49:35.109 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-10-19 20:49:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549103 ; -- 2017-10-19T20:49:56.973 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-10-19 20:49:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000489 ; -- 2017-10-19T20:49:58.493 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-10-19 20:49:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000491 ; -- 2017-10-19T20:49:59.982 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-10-19 20:49:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000490 ; -- 2017-10-19T20:50:01.814 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-10-19 20:50:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000487 ; -- 2017-10-19T20:50:05.566 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-10-19 20:50:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000486 ; -- 2017-10-19T20:50:07.623 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N',Updated=TO_TIMESTAMP('2017-10-19 20:50:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000488 ; -- 2017-10-19T20:50:27.158 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed='N', SeqNo=0,Updated=TO_TIMESTAMP('2017-10-19 20:50:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000479 ; -- 2017-10-19T20:50:39.909 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-10-19 20:50:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000476 ; -- 2017-10-19T20:50:39.911 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-10-19 20:50:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000477 ; -- 2017-10-19T20:50:39.913 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-10-19 20:50:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000478 ; -- 2017-10-19T20:50:39.915 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-10-19 20:50:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000479 ; -- 2017-10-19T20:50:39.916 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-10-19 20:50:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549102 ; -- 2017-10-19T20:51:00.748 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='N', SeqNoGrid=0,Updated=TO_TIMESTAMP('2017-10-19 20:51:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000479 ; -- 2017-10-19T20:51:00.750 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-10-19 20:51:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000476 ; -- 2017-10-19T20:51:00.751 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-10-19 20:51:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000477 ; -- 2017-10-19T20:51:00.752 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2017-10-19 20:51:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000478 ; -- 2017-10-19T20:51:45.429 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-10-19 20:51:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549102 ; -- 2017-10-19T20:51:48.856 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-10-19 20:51:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549103 ; -- 2017-10-19T20:52:46.416 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,554839,0,540622,1000046,549106,'F',TO_TIMESTAMP('2017-10-19 20:52:46','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-10-19 20:52:46','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-19T20:52:55.048 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,554838,0,540622,1000046,549107,'F',TO_TIMESTAMP('2017-10-19 20:52:55','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-10-19 20:52:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-19T20:53:03.193 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Name='Maßeinheit',Updated=TO_TIMESTAMP('2017-10-19 20:53:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000507 ; -- 2017-10-19T20:53:20.935 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=210,Updated=TO_TIMESTAMP('2017-10-19 20:53:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549106 ; -- 2017-10-19T20:53:36.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-10-19 20:53:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000492 ; -- 2017-10-19T20:53:37.898 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-10-19 20:53:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000493 ; -- 2017-10-19T20:53:39.289 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-10-19 20:53:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000494 ; -- 2017-10-19T20:53:40.746 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-10-19 20:53:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000495 ; -- 2017-10-19T20:53:42.422 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-10-19 20:53:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000496 ; -- 2017-10-19T20:53:43.833 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-10-19 20:53:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000497 ; -- 2017-10-19T20:53:45.149 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-10-19 20:53:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000498 ; -- 2017-10-19T20:53:48.027 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-10-19 20:53:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000499 ; -- 2017-10-19T20:53:49.540 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-10-19 20:53:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000500 ; -- 2017-10-19T20:53:51.403 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-10-19 20:53:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000501 ; -- 2017-10-19T20:53:53.157 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-10-19 20:53:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000502 ; -- 2017-10-19T20:53:54.843 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-10-19 20:53:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000503 ; -- 2017-10-19T20:53:56.549 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=130,Updated=TO_TIMESTAMP('2017-10-19 20:53:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000504 ; -- 2017-10-19T20:53:58.363 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=140,Updated=TO_TIMESTAMP('2017-10-19 20:53:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000505 ; -- 2017-10-19T20:54:00.086 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=150,Updated=TO_TIMESTAMP('2017-10-19 20:54:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000506 ; -- 2017-10-19T20:54:01.906 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=160,Updated=TO_TIMESTAMP('2017-10-19 20:54:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000507 ; -- 2017-10-19T20:54:03.585 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=170,Updated=TO_TIMESTAMP('2017-10-19 20:54:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000508 ; -- 2017-10-19T20:54:05.776 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=180,Updated=TO_TIMESTAMP('2017-10-19 20:54:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000509 ; -- 2017-10-19T20:54:10.480 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=190,Updated=TO_TIMESTAMP('2017-10-19 20:54:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000510 ; -- 2017-10-19T20:54:14.383 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=200,Updated=TO_TIMESTAMP('2017-10-19 20:54:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=1000511 ; -- 2017-10-19T20:54:16.517 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=210,Updated=TO_TIMESTAMP('2017-10-19 20:54:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549106 ; -- 2017-10-19T20:54:23.467 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=220,Updated=TO_TIMESTAMP('2017-10-19 20:54:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549107 ; -- 2017-10-19T20:54:35.116 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-10-19 20:54:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000046 ; -- 2017-10-19T20:54:46.225 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-10-19 20:54:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000045 ; -- 2017-10-19T20:54:56.010 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-10-19 20:54:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000044 ; -- 2017-10-19T20:55:04.955 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-10-19 20:55:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=1000043 ; -- 2017-10-19T20:59:47.616 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 20:59:47','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoicecandidate',Description='' WHERE AD_Field_ID=546902 AND AD_Language='en_US' ; -- 2017-10-19T21:00:03.368 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:00:03','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Sales Invoice',Description='' WHERE AD_Field_ID=553181 AND AD_Language='en_US' ; -- 2017-10-19T21:00:20.435 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:00:20','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Agrregation Group' WHERE AD_Field_ID=555549 AND AD_Language='en_US' ; -- 2017-10-19T21:00:31.510 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:00:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Manual',Description='',Help='' WHERE AD_Field_ID=551089 AND AD_Language='en_US' ; -- 2017-10-19T21:00:44.512 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:00:44','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Material Tracking' WHERE AD_Field_ID=555481 AND AD_Language='en_US' ; -- 2017-10-19T21:01:03.624 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:01:03','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Material Tracking ID' WHERE AD_Field_ID=554869 AND AD_Language='en_US' ; -- 2017-10-19T21:01:17 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:01:17','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='SeqNo.',Description='' WHERE AD_Field_ID=554866 AND AD_Language='en_US' ; -- 2017-10-19T21:01:29.657 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:01:29','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='DocType Invoice' WHERE AD_Field_ID=554867 AND AD_Language='en_US' ; -- 2017-10-19T21:01:42.469 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:01:42','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoicecandidate Controller' WHERE AD_Field_ID=548750 AND AD_Language='en_US' ; -- 2017-10-19T21:02:00.226 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:02:00','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Description' WHERE AD_Field_ID=551170 AND AD_Language='en_US' ; -- 2017-10-19T21:02:29.200 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:02:29','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='To Clear',Description='',Help='' WHERE AD_Field_ID=548114 AND AD_Language='en_US' ; -- 2017-10-19T21:02:37.514 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:02:37','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Order',Description='' WHERE AD_Field_ID=546904 AND AD_Language='en_US' ; -- 2017-10-19T21:02:41.289 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:02:41','YYYY-MM-DD HH24:MI:SS'),Name='Sales Order' WHERE AD_Field_ID=546904 AND AD_Language='en_US' ; -- 2017-10-19T21:02:57.765 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:02:57','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Order Date',Description='',Help='' WHERE AD_Field_ID=546897 AND AD_Language='en_US' ; -- 2017-10-19T21:03:06.830 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:03:06','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Orderline',Description='',Help='' WHERE AD_Field_ID=546898 AND AD_Language='en_US' ; -- 2017-10-19T21:03:20.253 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:03:20','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Shipment/ Receipt',Description='' WHERE AD_Field_ID=555409 AND AD_Language='en_US' ; -- 2017-10-19T21:03:40.816 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:03:40','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Datepromised',Description='',Help='' WHERE AD_Field_ID=556919 AND AD_Language='en_US' ; -- 2017-10-19T21:04:02.428 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:04:02','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Ship Location' WHERE AD_Field_ID=555636 AND AD_Language='en_US' ; -- 2017-10-19T21:04:14.188 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:04:14','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Reference',Description='' WHERE AD_Field_ID=555142 AND AD_Language='en_US' ; -- 2017-10-19T21:04:33.673 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:04:33','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Shipmentdate',Description='' WHERE AD_Field_ID=555410 AND AD_Language='en_US' ; -- 2017-10-19T21:04:44.570 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:04:44','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Order Partner' WHERE AD_Field_ID=555715 AND AD_Language='en_US' ; -- 2017-10-19T21:04:55.426 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:04:55','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Activity',Description='',Help='' WHERE AD_Field_ID=554661 AND AD_Language='en_US' ; -- 2017-10-19T21:05:04.192 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:05:04','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Costs',Description='',Help='' WHERE AD_Field_ID=547031 AND AD_Language='en_US' ; -- 2017-10-19T21:05:14.100 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:05:14','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Product',Description='',Help='' WHERE AD_Field_ID=546906 AND AD_Language='en_US' ; -- 2017-10-19T21:05:26.444 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:05:26','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Product Category',Description='',Help='' WHERE AD_Field_ID=555851 AND AD_Language='en_US' ; -- 2017-10-19T21:05:41.170 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:05:41','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Product Type',Description='',Help='' WHERE AD_Field_ID=555849 AND AD_Language='en_US' ; -- 2017-10-19T21:05:55.275 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:05:55','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Pricing System',Description='',Help='' WHERE AD_Field_ID=548198 AND AD_Language='en_US' ; -- 2017-10-19T21:06:08.719 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:06:08','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Pricelist Version',Description='',Help='' WHERE AD_Field_ID=556415 AND AD_Language='en_US' ; -- 2017-10-19T21:06:19.796 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:06:19','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Currency',Description='',Help='' WHERE AD_Field_ID=547555 AND AD_Language='en_US' ; -- 2017-10-19T21:06:31.397 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:06:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Conversion type',Description='',Help='' WHERE AD_Field_ID=549712 AND AD_Language='en_US' ; -- 2017-10-19T21:06:44.841 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:06:44','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Tax',Description='',Help='' WHERE AD_Field_ID=554662 AND AD_Language='en_US' ; -- 2017-10-19T21:06:56.875 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:06:56','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Tax override',Description='' WHERE AD_Field_ID=555019 AND AD_Language='en_US' ; -- 2017-10-19T21:07:08.843 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:07:08','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Tax eff.' WHERE AD_Field_ID=555020 AND AD_Language='en_US' ; -- 2017-10-19T21:07:20.587 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:07:20','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Ordered Qty',Description='',Help='' WHERE AD_Field_ID=547551 AND AD_Language='en_US' ; -- 2017-10-19T21:07:31.840 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:07:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Shipped Qty',Description='',Help='' WHERE AD_Field_ID=547552 AND AD_Language='en_US' ; -- 2017-10-19T21:08:04.558 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:08:04','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Over-/ Under Qty',Description='' WHERE AD_Field_ID=554131 AND AD_Language='en_US' ; -- 2017-10-19T21:08:18.392 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:08:18','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoicerule' WHERE AD_Field_ID=546912 AND AD_Language='en_US' ; -- 2017-10-19T21:08:39.528 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:08:39','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Rule override',Description='',Help='' WHERE AD_Field_ID=548192 AND AD_Language='en_US' ; -- 2017-10-19T21:08:53.619 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:08:53','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Rule eff.' WHERE AD_Field_ID=549754 AND AD_Language='en_US' ; -- 2017-10-19T21:09:39.633 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:09:39','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Schedule',Description='',Help='' WHERE AD_Field_ID=549714 AND AD_Language='en_US' ; -- 2017-10-19T21:09:52.368 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:09:52','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Schedule Status',Description='' WHERE AD_Field_ID=549713 AND AD_Language='en_US' ; -- 2017-10-19T21:10:17.083 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:10:17','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Date Invoice from',Description='',Help='' WHERE AD_Field_ID=548972 AND AD_Language='en_US' ; -- 2017-10-19T21:10:55.540 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:10:55','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Date Invoice from override',Description='',Help='' WHERE AD_Field_ID=548973 AND AD_Language='en_US' ; -- 2017-10-19T21:11:07.251 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:11:07','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Date Invoice from eff.',Description='' WHERE AD_Field_ID=549735 AND AD_Language='en_US' ; -- 2017-10-19T21:11:21.459 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:11:21','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoicedate',Description='',Help='' WHERE AD_Field_ID=547561 AND AD_Language='en_US' ; -- 2017-10-19T21:11:37.682 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:11:37','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Accounting Date' WHERE AD_Field_ID=555397 AND AD_Language='en_US' ; -- 2017-10-19T21:11:54.433 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:11:54','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Quality Discount %' WHERE AD_Field_ID=554060 AND AD_Language='en_US' ; -- 2017-10-19T21:12:23.646 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:12:23','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Quality Discount % override' WHERE AD_Field_ID=554061 AND AD_Language='en_US' ; -- 2017-10-19T21:12:38.601 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:12:38','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Quality Discount % eff.' WHERE AD_Field_ID=553212 AND AD_Language='en_US' ; -- 2017-10-19T21:13:00.967 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:13:00','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty with Issues',Description='' WHERE AD_Field_ID=554062 AND AD_Language='en_US' ; -- 2017-10-19T21:13:18.608 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:13:18','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='In Dispute',Description='',Help='' WHERE AD_Field_ID=554063 AND AD_Language='en_US' ; -- 2017-10-19T21:15:45.198 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:15:45','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty with Issues eff.',Description='' WHERE AD_Field_ID=555544 AND AD_Language='en_US' ; -- 2017-10-19T21:15:56.578 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:15:56','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Quality Note' WHERE AD_Field_ID=553926 AND AD_Language='en_US' ; -- 2017-10-19T21:16:11.420 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:16:11','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Quality Discount Reason' WHERE AD_Field_ID=554132 AND AD_Language='en_US' ; -- 2017-10-19T21:16:24.184 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:16:24','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price',Description='',Help='' WHERE AD_Field_ID=552878 AND AD_Language='en_US' ; -- 2017-10-19T21:16:35.668 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:16:35','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price override',Help='' WHERE AD_Field_ID=552879 AND AD_Language='en_US' ; -- 2017-10-19T21:16:56.836 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:16:56','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price incl. Tax override' WHERE AD_Field_ID=555436 AND AD_Language='en_US' ; -- 2017-10-19T21:17:09.630 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:17:09','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Discount %',Description='',Help='' WHERE AD_Field_ID=547032 AND AD_Language='en_US' ; -- 2017-10-19T21:17:25.448 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:17:25','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Discount override %',Description='',Help='' WHERE AD_Field_ID=547033 AND AD_Language='en_US' ; -- 2017-10-19T21:17:39.357 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:17:39','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price eff.',Help='' WHERE AD_Field_ID=547029 AND AD_Language='en_US' ; -- 2017-10-19T21:17:51.718 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:17:51','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price eff. override',Description='',Help='' WHERE AD_Field_ID=547030 AND AD_Language='en_US' ; -- 2017-10-19T21:18:08.551 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:18:08','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price net eff.' WHERE AD_Field_ID=555411 AND AD_Language='en_US' ; -- 2017-10-19T21:18:21.415 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:18:21','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Name Bill Partner' WHERE AD_Field_ID=555850 AND AD_Language='en_US' ; -- 2017-10-19T21:18:44.942 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:18:44','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='EDI Recipient',Description='' WHERE AD_Field_ID=556203 AND AD_Language='en_US' ; -- 2017-10-19T21:18:57.261 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:18:57','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='EDI Enabled' WHERE AD_Field_ID=556235 AND AD_Language='en_US' ; -- 2017-10-19T21:19:08 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:19:08','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Bill Partner',Description='' WHERE AD_Field_ID=546910 AND AD_Language='en_US' ; -- 2017-10-19T21:19:20.535 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:19:20','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Location',Description='' WHERE AD_Field_ID=546911 AND AD_Language='en_US' ; -- 2017-10-19T21:19:31.686 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:19:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Contact',Description='' WHERE AD_Field_ID=546909 AND AD_Language='en_US' ; -- 2017-10-19T21:19:48.121 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:19:48','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty Invoiced',Description='',Help='' WHERE AD_Field_ID=547554 AND AD_Language='en_US' ; -- 2017-10-19T21:19:57.650 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:19:57','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='UOM',Description='',Help='' WHERE AD_Field_ID=554200 AND AD_Language='en_US' ; -- 2017-10-19T21:20:25.113 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:20:25','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Qty before Quality Discount' WHERE AD_Field_ID=555542 AND AD_Language='en_US' ; -- 2017-10-19T21:20:57.279 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:20:57','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty Invoice before Quality Discount override',Description='',Help='' WHERE AD_Field_ID=548190 AND AD_Language='en_US' ; -- 2017-10-19T21:21:22.498 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:21:22','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty to Invoice eff.',Description='' WHERE AD_Field_ID=546908 AND AD_Language='en_US' ; -- 2017-10-19T21:21:42.041 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:21:42','YYYY-MM-DD HH24:MI:SS'),Name='Qty to Invoice in Price UOM',Description='' WHERE AD_Field_ID=554677 AND AD_Language='en_US' ; -- 2017-10-19T21:21:50.167 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:21:50','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price UOM' WHERE AD_Field_ID=554361 AND AD_Language='en_US' ; -- 2017-10-19T21:21:57.935 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:21:57','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty TU' WHERE AD_Field_ID=555434 AND AD_Language='en_US' ; -- 2017-10-19T21:22:06.186 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:22:06','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Total of Order' WHERE AD_Field_ID=554865 AND AD_Language='en_US' ; -- 2017-10-19T21:22:29.550 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:22:29','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Order Total without Discount' WHERE AD_Field_ID=555407 AND AD_Language='en_US' ; -- 2017-10-19T21:22:44.625 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:22:44','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Line Netamount',Description='' WHERE AD_Field_ID=555477 AND AD_Language='en_US' ; -- 2017-10-19T21:23:11.914 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:23:11','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Approved for Invoicing' WHERE AD_Field_ID=554872 AND AD_Language='en_US' ; -- 2017-10-19T21:23:39.899 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:23:39','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Shipment/ Receipt Approval' WHERE AD_Field_ID=555480 AND AD_Language='en_US' ; -- 2017-10-19T21:23:59.229 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-19 21:23:59','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Net Amount to Invoice',Description='' WHERE AD_Field_ID=547553 AND AD_Language='en_US' ; -- 2017-10-20T06:01:05.655 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:01:05','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoiced Amount',Description='',Help='' WHERE AD_Field_ID=548199 AND AD_Language='en_US' ; -- 2017-10-20T06:01:19.023 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:01:19','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Split Amount',Help='' WHERE AD_Field_ID=551679 AND AD_Language='en_US' ; -- 2017-10-20T06:01:33.595 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:01:33','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Description='' WHERE AD_Field_ID=548259 AND AD_Language='en_US' ; -- 2017-10-20T06:01:53.642 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:01:53','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Aggregation Header' WHERE AD_Field_ID=551671 AND AD_Language='en_US' ; -- 2017-10-20T06:02:11.961 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:02:11','YYYY-MM-DD HH24:MI:SS'),Name='Line Aggregation',Description='',Help=' <li>Die Kandidaten gehören zu selben Rechnung (d.h. Rechnungsempfänger, Währung usw. sind gleich)</li> <li>Die Kandidaten haben das gleiche Merkmal</li> </ul>' WHERE AD_Field_ID=548260 AND AD_Language='en_US' ; -- 2017-10-20T06:02:16.935 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:02:16','YYYY-MM-DD HH24:MI:SS'),Help='' WHERE AD_Field_ID=548260 AND AD_Language='en_US' ; -- 2017-10-20T06:02:26.113 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:02:26','YYYY-MM-DD HH24:MI:SS'),Name='Header Aggregation' WHERE AD_Field_ID=551671 AND AD_Language='en_US' ; -- 2017-10-20T06:02:48.027 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:02:48','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Agrregation Suffix',Description='',Help='' WHERE AD_Field_ID=548261 AND AD_Language='en_US' ; -- 2017-10-20T06:03:02.541 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:03:02','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Responsible',Description='' WHERE AD_Field_ID=551579 AND AD_Language='en_US' ; -- 2017-10-20T06:03:17.611 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:03:17','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Recompute',Description='',Help='' WHERE AD_Field_ID=546901 AND AD_Language='en_US' ; -- 2017-10-20T06:03:26.532 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:03:26','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Error',Description='' WHERE AD_Field_ID=548749 AND AD_Language='en_US' ; -- 2017-10-20T06:03:36.013 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:03:36','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Processing' WHERE AD_Field_ID=555869 AND AD_Language='en_US' ; -- 2017-10-20T06:04:07.096 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:04:07','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoiced completely' WHERE AD_Field_ID=555694 AND AD_Language='en_US' ; -- 2017-10-20T06:04:23.011 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:04:23','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoiced completely override' WHERE AD_Field_ID=555693 AND AD_Language='en_US' ; -- 2017-10-20T06:04:46.572 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:04:46','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoiced completely eff.',Description='',Help='' WHERE AD_Field_ID=548115 AND AD_Language='en_US' ; -- 2017-10-20T06:05:34.891 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:05:34','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Update Status',Description='',Help='' WHERE AD_Field_ID=546913 AND AD_Language='en_US' ; -- 2017-10-20T06:05:50.511 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:05:50','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Error in Invoicing' WHERE AD_Field_ID=549596 AND AD_Language='en_US' ; -- 2017-10-20T06:06:06.186 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:06:06','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Description Header' WHERE AD_Field_ID=551903 AND AD_Language='en_US' ; -- 2017-10-20T06:06:18.103 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:06:18','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Bottom Description' WHERE AD_Field_ID=551904 AND AD_Language='en_US' ; -- 2017-10-20T06:06:34.383 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:06:34','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Printed',Description='',Help='' WHERE AD_Field_ID=554837 AND AD_Language='en_US' ; -- 2017-10-20T06:07:03.507 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:07:03','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Quality Discount %' WHERE AD_Field_ID=553211 AND AD_Language='en_US' ; -- 2017-10-20T06:07:16.389 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:07:16','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Note',Description='' WHERE AD_Field_ID=548751 AND AD_Language='en_US' ; -- 2017-10-20T06:07:47.100 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:07:47','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Header Aggregation override' WHERE AD_Field_ID=555547 AND AD_Language='en_US' ; -- 2017-10-20T06:08:00.186 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:08:00','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price incl. Tax' WHERE AD_Field_ID=555435 AND AD_Language='en_US' ; -- 2017-10-20T06:08:22.301 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:08:22','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Aggregration Group' WHERE AD_Field_ID=555546 AND AD_Language='en_US' ; -- 2017-10-20T06:08:53.348 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:08:53','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Header Aggregation Preset' WHERE AD_Field_ID=555548 AND AD_Language='en_US' ; -- 2017-10-20T06:10:23.606 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:10:23','YYYY-MM-DD HH24:MI:SS'),Name='Line Net Amount' WHERE AD_Field_ID=555477 AND AD_Language='en_US' ; -- 2017-10-20T06:13:01.414 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:13:01','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Candidates',Description='',Help='' WHERE AD_Tab_ID=540279 AND AD_Language='en_US' ; -- 2017-10-20T06:13:47.893 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:13:47','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Flatrate Allocation',Description='' WHERE AD_Tab_ID=540338 AND AD_Language='en_US' ; -- 2017-10-20T06:14:16.070 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:14:16','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoiceline Allocation',Description='',Help='' WHERE AD_Tab_ID=540342 AND AD_Language='en_US' ; -- 2017-10-20T06:14:33.699 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:14:33','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Shipment/ Receipt Allocation' WHERE AD_Tab_ID=540665 AND AD_Language='en_US' ; -- 2017-10-20T06:14:39.564 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:14:39','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Tab_ID=540622 AND AD_Language='en_US' ; -- 2017-10-20T06:15:02.886 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:15:02','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Candidate to Clear' WHERE AD_Field_ID=548078 AND AD_Language='en_US' ; -- 2017-10-20T06:15:18.046 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:15:18','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Flatrate Term' WHERE AD_Field_ID=548512 AND AD_Language='en_US' ; -- 2017-10-20T06:15:48.657 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:15:48','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Flatrate Invoicing Record' WHERE AD_Field_ID=548079 AND AD_Language='en_US' ; -- 2017-10-20T06:16:00.207 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:16:00','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Candidate',Description='' WHERE AD_Field_ID=548073 AND AD_Language='en_US' ; -- 2017-10-20T06:16:27.803 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:16:27','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Clearing Invoice' WHERE AD_Field_ID=548077 AND AD_Language='en_US' ; -- 2017-10-20T06:18:06.203 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:18:06','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Candidate',Description='' WHERE AD_Field_ID=548187 AND AD_Language='en_US' ; -- 2017-10-20T06:18:21.621 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:18:21','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoiceline',Description='',Help='' WHERE AD_Field_ID=548189 AND AD_Language='en_US' ; -- 2017-10-20T06:18:33.261 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:18:33','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty invoiced',Description='' WHERE AD_Field_ID=548194 AND AD_Language='en_US' ; -- 2017-10-20T06:18:44.027 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:18:44','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Docstatus' WHERE AD_Field_ID=548193 AND AD_Language='en_US' ; -- 2017-10-20T06:18:53.241 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:18:53','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Description='' WHERE AD_Field_ID=548745 AND AD_Language='en_US' ; -- 2017-10-20T06:19:02.900 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:19:02','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Note',Description='',Help='' WHERE AD_Field_ID=556176 AND AD_Language='en_US' ; -- 2017-10-20T06:19:38.139 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:19:38','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty to invoice override',Description='',Help='' WHERE AD_Field_ID=557544 AND AD_Language='en_US' ; -- 2017-10-20T06:19:48.264 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:19:48','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price override',Help='' WHERE AD_Field_ID=557545 AND AD_Language='en_US' ; -- 2017-10-20T06:20:55.967 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:20:55','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoiceline Allocation' WHERE AD_Field_ID=548188 AND AD_Language='en_US' ; -- 2017-10-20T06:21:40.592 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:21:40','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Candidate',Description='' WHERE AD_Field_ID=555484 AND AD_Language='en_US' ; -- 2017-10-20T06:21:56.558 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:21:56','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Shipment/ Receipt Line',Description='',Help='' WHERE AD_Field_ID=555485 AND AD_Language='en_US' ; -- 2017-10-20T06:22:08.606 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:22:08','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty Delivered',Description='',Help='' WHERE AD_Field_ID=555488 AND AD_Language='en_US' ; -- 2017-10-20T06:22:27.306 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:22:27','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Shipment/ Receipt approval' WHERE AD_Field_ID=555489 AND AD_Language='en_US' ; -- 2017-10-20T06:22:53.032 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:22:53','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='SeqNo.',Description='',Help='' WHERE AD_Field_ID=554844 AND AD_Language='en_US' ; -- 2017-10-20T06:23:04.841 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:23:04','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Printed' WHERE AD_Field_ID=554857 AND AD_Language='en_US' ; -- 2017-10-20T06:23:16.759 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:23:16','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Print before' WHERE AD_Field_ID=554845 AND AD_Language='en_US' ; -- 2017-10-20T06:23:38.905 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:23:38','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Print Details override' WHERE AD_Field_ID=554870 AND AD_Language='en_US' ; -- 2017-10-20T06:23:49.345 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:23:49','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Product',Description='',Help='' WHERE AD_Field_ID=554846 AND AD_Language='en_US' ; -- 2017-10-20T06:24:31.674 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:24:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Manufacturing Order' WHERE AD_Field_ID=556430 AND AD_Language='en_US' ; -- 2017-10-20T06:24:40.962 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:24:40','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Note',Description='',Help='' WHERE AD_Field_ID=554848 AND AD_Language='en_US' ; -- 2017-10-20T06:24:49.521 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:24:49','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Description' WHERE AD_Field_ID=554847 AND AD_Language='en_US' ; -- 2017-10-20T06:24:57.243 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:24:57','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Field_ID=554862 AND AD_Language='en_US' ; -- 2017-10-20T06:25:14.258 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:25:14','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Ordered Qty in Price UOM',Description='',Help='' WHERE AD_Field_ID=554852 AND AD_Language='en_US' ; -- 2017-10-20T06:25:23.986 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:25:23','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price',Description='',Help='' WHERE AD_Field_ID=554854 AND AD_Language='en_US' ; -- 2017-10-20T06:25:34.771 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:25:34','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price',Description='',Help='' WHERE AD_Field_ID=554855 AND AD_Language='en_US' ; -- 2017-10-20T06:25:46.315 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:25:46','YYYY-MM-DD HH24:MI:SS'),Name='Price Actual' WHERE AD_Field_ID=554855 AND AD_Language='en_US' ; -- 2017-10-20T06:25:59.112 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:25:59','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Discount %',Description='',Help='' WHERE AD_Field_ID=554856 AND AD_Language='en_US' ; -- 2017-10-20T06:26:09.531 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:26:09','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Price UOM' WHERE AD_Field_ID=554853 AND AD_Language='en_US' ; -- 2017-10-20T06:26:18.373 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:26:18','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty',Description='',Help='' WHERE AD_Field_ID=554850 AND AD_Language='en_US' ; -- 2017-10-20T06:26:26.863 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:26:26','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='UOM',Description='',Help='' WHERE AD_Field_ID=554851 AND AD_Language='en_US' ; -- 2017-10-20T06:26:35.245 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:26:35','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice' WHERE AD_Field_ID=554842 AND AD_Language='en_US' ; -- 2017-10-20T06:26:45.696 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:26:45','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoiceline',Description='',Help='' WHERE AD_Field_ID=554843 AND AD_Language='en_US' ; -- 2017-10-20T06:26:50.660 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:26:50','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Field_ID=554863 AND AD_Language='en_US' ; -- 2017-10-20T06:27:10.332 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:27:10','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Packing Instruction (TU)' WHERE AD_Field_ID=554868 AND AD_Language='en_US' ; -- 2017-10-20T06:27:17.253 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:27:17','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty TU' WHERE AD_Field_ID=554864 AND AD_Language='en_US' ; -- 2017-10-20T06:27:32.212 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:27:32','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Attributes',Description='' WHERE AD_Field_ID=554849 AND AD_Language='en_US' ; -- 2017-10-20T06:27:43.446 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:27:43','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Invoice Candidate',Description='' WHERE AD_Field_ID=554861 AND AD_Language='en_US' ; -- 2017-10-20T06:28:00.069 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-20 06:28:00','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Field_ID=554841 AND AD_Language='en_US' ;
the_stack
-- -- Copyright 2014 Internet2 -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- insert into subject values('hawi','person','Harry Windsor'); insert into subjectattribute values('hawi','loginid','hawi','hawi'); insert into subjectattribute values('hawi','name','Harry Windsor',lower('Harry Windsor')); insert into subjectattribute values('hawi','description','Harry Windsor',lower('Harry Windsor')); insert into subject values('hata','person','Harry Tarbuck'); insert into subjectattribute values('hata','loginid','hata','hata'); insert into subjectattribute values('hata','name','Harry Tarbuck',lower('Harry Tarbuck')); insert into subjectattribute values('hata','description','Harry Tarbuck',lower('Harry Tarbuck')); insert into subject values('hapo','person','Harry Porter'); insert into subjectattribute values('hapo','loginid','hapo','hapo'); insert into subjectattribute values('hapo','name','Harry Porter',lower('Harry Porter')); insert into subjectattribute values('hapo','description','Harry Porter',lower('Harry Porter')); insert into subject values('habe','person','Harry Benson'); insert into subjectattribute values('habe','loginid','habe','habe'); insert into subjectattribute values('habe','name','Harry Benson',lower('Harry Benson')); insert into subjectattribute values('habe','description','Harry Benson',lower('Harry Benson')); insert into subject values('hato','person','Harry Townsend'); insert into subjectattribute values('hato','loginid','hato','hato'); insert into subjectattribute values('hato','name','Harry Townsend',lower('Harry Townsend')); insert into subjectattribute values('hato','description','Harry Townsend',lower('Harry Townsend')); insert into subject values('hado','person','Harry Dolphin'); insert into subjectattribute values('hado','loginid','hado','hado'); insert into subjectattribute values('hado','name','Harry Dolphin',lower('Harry Dolphin')); insert into subjectattribute values('hado','description','Harry Dolphin',lower('Harry Dolphin')); insert into subject values('hama','person','Harry Masterson'); insert into subjectattribute values('hama','loginid','hama','hama'); insert into subjectattribute values('hama','name','Harry Masterson',lower('Harry Masterson')); insert into subjectattribute values('hama','description','Harry Masterson',lower('Harry Masterson')); insert into subject values('haed','person','Harry Edwards'); insert into subjectattribute values('haed','loginid','haed','haed'); insert into subjectattribute values('haed','name','Harry Edwards',lower('Harry Edwards')); insert into subjectattribute values('haed','description','Harry Edwards',lower('Harry Edwards')); insert into subject values('habu','person','Harry Bush'); insert into subjectattribute values('habu','loginid','habu','habu'); insert into subjectattribute values('habu','name','Harry Bush',lower('Harry Bush')); insert into subjectattribute values('habu','description','Harry Bush',lower('Harry Bush')); insert into subject values('habr','person','Harry Brooks'); insert into subjectattribute values('habr','loginid','habr','habr'); insert into subjectattribute values('habr','name','Harry Brooks',lower('Harry Brooks')); insert into subjectattribute values('habr','description','Harry Brooks',lower('Harry Brooks')); insert into subject values('haco','person','Harry Collins'); insert into subjectattribute values('haco','loginid','haco','haco'); insert into subjectattribute values('haco','name','Harry Collins',lower('Harry Collins')); insert into subjectattribute values('haco','description','Harry Collins',lower('Harry Collins')); insert into subject values('habl','person','Harry Blair'); insert into subjectattribute values('habl','loginid','habl','habl'); insert into subjectattribute values('habl','name','Harry Blair',lower('Harry Blair')); insert into subjectattribute values('habl','description','Harry Blair',lower('Harry Blair')); insert into subject values('elwi','person','Elizabeth Windsor'); insert into subjectattribute values('elwi','loginid','elwi','elwi'); insert into subjectattribute values('elwi','name','Elizabeth Windsor',lower('Elizabeth Windsor')); insert into subjectattribute values('elwi','description','Elizabeth Windsor',lower('Elizabeth Windsor')); insert into subject values('elta','person','Elizabeth Tarbuck'); insert into subjectattribute values('elta','loginid','elta','elta'); insert into subjectattribute values('elta','name','Elizabeth Tarbuck',lower('Elizabeth Tarbuck')); insert into subjectattribute values('elta','description','Elizabeth Tarbuck',lower('Elizabeth Tarbuck')); insert into subject values('elpo','person','Elizabeth Porter'); insert into subjectattribute values('elpo','loginid','elpo','elpo'); insert into subjectattribute values('elpo','name','Elizabeth Porter',lower('Elizabeth Porter')); insert into subjectattribute values('elpo','description','Elizabeth Porter',lower('Elizabeth Porter')); insert into subject values('elbe','person','Elizabeth Benson'); insert into subjectattribute values('elbe','loginid','elbe','elbe'); insert into subjectattribute values('elbe','name','Elizabeth Benson',lower('Elizabeth Benson')); insert into subjectattribute values('elbe','description','Elizabeth Benson',lower('Elizabeth Benson')); insert into subject values('elto','person','Elizabeth Townsend'); insert into subjectattribute values('elto','loginid','elto','elto'); insert into subjectattribute values('elto','name','Elizabeth Townsend',lower('Elizabeth Townsend')); insert into subjectattribute values('elto','description','Elizabeth Townsend',lower('Elizabeth Townsend')); insert into subject values('eldo','person','Elizabeth Dolphin'); insert into subjectattribute values('eldo','loginid','eldo','eldo'); insert into subjectattribute values('eldo','name','Elizabeth Dolphin',lower('Elizabeth Dolphin')); insert into subjectattribute values('eldo','description','Elizabeth Dolphin',lower('Elizabeth Dolphin')); insert into subject values('elma','person','Elizabeth Masterson'); insert into subjectattribute values('elma','loginid','elma','elma'); insert into subjectattribute values('elma','name','Elizabeth Masterson',lower('Elizabeth Masterson')); insert into subjectattribute values('elma','description','Elizabeth Masterson',lower('Elizabeth Masterson')); insert into subject values('eled','person','Elizabeth Edwards'); insert into subjectattribute values('eled','loginid','eled','eled'); insert into subjectattribute values('eled','name','Elizabeth Edwards',lower('Elizabeth Edwards')); insert into subjectattribute values('eled','description','Elizabeth Edwards',lower('Elizabeth Edwards')); insert into subject values('elbu','person','Elizabeth Bush'); insert into subjectattribute values('elbu','loginid','elbu','elbu'); insert into subjectattribute values('elbu','name','Elizabeth Bush',lower('Elizabeth Bush')); insert into subjectattribute values('elbu','description','Elizabeth Bush',lower('Elizabeth Bush')); insert into subject values('elbr','person','Elizabeth Brooks'); insert into subjectattribute values('elbr','loginid','elbr','elbr'); insert into subjectattribute values('elbr','name','Elizabeth Brooks',lower('Elizabeth Brooks')); insert into subjectattribute values('elbr','description','Elizabeth Brooks',lower('Elizabeth Brooks')); insert into subject values('elco','person','Elizabeth Collins'); insert into subjectattribute values('elco','loginid','elco','elco'); insert into subjectattribute values('elco','name','Elizabeth Collins',lower('Elizabeth Collins')); insert into subjectattribute values('elco','description','Elizabeth Collins',lower('Elizabeth Collins')); insert into subject values('elbl','person','Elizabeth Blair'); insert into subjectattribute values('elbl','loginid','elbl','elbl'); insert into subjectattribute values('elbl','name','Elizabeth Blair',lower('Elizabeth Blair')); insert into subjectattribute values('elbl','description','Elizabeth Blair',lower('Elizabeth Blair')); insert into subject values('mowi','person','Monica Windsor'); insert into subjectattribute values('mowi','loginid','mowi','mowi'); insert into subjectattribute values('mowi','name','Monica Windsor',lower('Monica Windsor')); insert into subjectattribute values('mowi','description','Monica Windsor',lower('Monica Windsor')); insert into subject values('mota','person','Monica Tarbuck'); insert into subjectattribute values('mota','loginid','mota','mota'); insert into subjectattribute values('mota','name','Monica Tarbuck',lower('Monica Tarbuck')); insert into subjectattribute values('mota','description','Monica Tarbuck',lower('Monica Tarbuck')); insert into subject values('mopo','person','Monica Porter'); insert into subjectattribute values('mopo','loginid','mopo','mopo'); insert into subjectattribute values('mopo','name','Monica Porter',lower('Monica Porter')); insert into subjectattribute values('mopo','description','Monica Porter',lower('Monica Porter')); insert into subject values('mobe','person','Monica Benson'); insert into subjectattribute values('mobe','loginid','mobe','mobe'); insert into subjectattribute values('mobe','name','Monica Benson',lower('Monica Benson')); insert into subjectattribute values('mobe','description','Monica Benson',lower('Monica Benson')); insert into subject values('moto','person','Monica Townsend'); insert into subjectattribute values('moto','loginid','moto','moto'); insert into subjectattribute values('moto','name','Monica Townsend',lower('Monica Townsend')); insert into subjectattribute values('moto','description','Monica Townsend',lower('Monica Townsend')); insert into subject values('modo','person','Monica Dolphin'); insert into subjectattribute values('modo','loginid','modo','modo'); insert into subjectattribute values('modo','name','Monica Dolphin',lower('Monica Dolphin')); insert into subjectattribute values('modo','description','Monica Dolphin',lower('Monica Dolphin')); insert into subject values('moma','person','Monica Masterson'); insert into subjectattribute values('moma','loginid','moma','moma'); insert into subjectattribute values('moma','name','Monica Masterson',lower('Monica Masterson')); insert into subjectattribute values('moma','description','Monica Masterson',lower('Monica Masterson')); insert into subject values('moed','person','Monica Edwards'); insert into subjectattribute values('moed','loginid','moed','moed'); insert into subjectattribute values('moed','name','Monica Edwards',lower('Monica Edwards')); insert into subjectattribute values('moed','description','Monica Edwards',lower('Monica Edwards')); insert into subject values('mobu','person','Monica Bush'); insert into subjectattribute values('mobu','loginid','mobu','mobu'); insert into subjectattribute values('mobu','name','Monica Bush',lower('Monica Bush')); insert into subjectattribute values('mobu','description','Monica Bush',lower('Monica Bush')); insert into subject values('mobr','person','Monica Brooks'); insert into subjectattribute values('mobr','loginid','mobr','mobr'); insert into subjectattribute values('mobr','name','Monica Brooks',lower('Monica Brooks')); insert into subjectattribute values('mobr','description','Monica Brooks',lower('Monica Brooks')); insert into subject values('moco','person','Monica Collins'); insert into subjectattribute values('moco','loginid','moco','moco'); insert into subjectattribute values('moco','name','Monica Collins',lower('Monica Collins')); insert into subjectattribute values('moco','description','Monica Collins',lower('Monica Collins')); insert into subject values('mobl','person','Monica Blair'); insert into subjectattribute values('mobl','loginid','mobl','mobl'); insert into subjectattribute values('mobl','name','Monica Blair',lower('Monica Blair')); insert into subjectattribute values('mobl','description','Monica Blair',lower('Monica Blair')); insert into subject values('pewi','person','Peter Windsor'); insert into subjectattribute values('pewi','loginid','pewi','pewi'); insert into subjectattribute values('pewi','name','Peter Windsor',lower('Peter Windsor')); insert into subjectattribute values('pewi','description','Peter Windsor',lower('Peter Windsor')); insert into subject values('peta','person','Peter Tarbuck'); insert into subjectattribute values('peta','loginid','peta','peta'); insert into subjectattribute values('peta','name','Peter Tarbuck',lower('Peter Tarbuck')); insert into subjectattribute values('peta','description','Peter Tarbuck',lower('Peter Tarbuck')); insert into subject values('pepo','person','Peter Porter'); insert into subjectattribute values('pepo','loginid','pepo','pepo'); insert into subjectattribute values('pepo','name','Peter Porter',lower('Peter Porter')); insert into subjectattribute values('pepo','description','Peter Porter',lower('Peter Porter')); insert into subject values('pebe','person','Peter Benson'); insert into subjectattribute values('pebe','loginid','pebe','pebe'); insert into subjectattribute values('pebe','name','Peter Benson',lower('Peter Benson')); insert into subjectattribute values('pebe','description','Peter Benson',lower('Peter Benson')); insert into subject values('peto','person','Peter Townsend'); insert into subjectattribute values('peto','loginid','peto','peto'); insert into subjectattribute values('peto','name','Peter Townsend',lower('Peter Townsend')); insert into subjectattribute values('peto','description','Peter Townsend',lower('Peter Townsend')); insert into subject values('pedo','person','Peter Dolphin'); insert into subjectattribute values('pedo','loginid','pedo','pedo'); insert into subjectattribute values('pedo','name','Peter Dolphin',lower('Peter Dolphin')); insert into subjectattribute values('pedo','description','Peter Dolphin',lower('Peter Dolphin')); insert into subject values('pema','person','Peter Masterson'); insert into subjectattribute values('pema','loginid','pema','pema'); insert into subjectattribute values('pema','name','Peter Masterson',lower('Peter Masterson')); insert into subjectattribute values('pema','description','Peter Masterson',lower('Peter Masterson')); insert into subject values('peed','person','Peter Edwards'); insert into subjectattribute values('peed','loginid','peed','peed'); insert into subjectattribute values('peed','name','Peter Edwards',lower('Peter Edwards')); insert into subjectattribute values('peed','description','Peter Edwards',lower('Peter Edwards')); insert into subject values('pebu','person','Peter Bush'); insert into subjectattribute values('pebu','loginid','pebu','pebu'); insert into subjectattribute values('pebu','name','Peter Bush',lower('Peter Bush')); insert into subjectattribute values('pebu','description','Peter Bush',lower('Peter Bush')); insert into subject values('pebr','person','Peter Brooks'); insert into subjectattribute values('pebr','loginid','pebr','pebr'); insert into subjectattribute values('pebr','name','Peter Brooks',lower('Peter Brooks')); insert into subjectattribute values('pebr','description','Peter Brooks',lower('Peter Brooks')); insert into subject values('peco','person','Peter Collins'); insert into subjectattribute values('peco','loginid','peco','peco'); insert into subjectattribute values('peco','name','Peter Collins',lower('Peter Collins')); insert into subjectattribute values('peco','description','Peter Collins',lower('Peter Collins')); insert into subject values('pebl','person','Peter Blair'); insert into subjectattribute values('pebl','loginid','pebl','pebl'); insert into subjectattribute values('pebl','name','Peter Blair',lower('Peter Blair')); insert into subjectattribute values('pebl','description','Peter Blair',lower('Peter Blair')); insert into subject values('bawi','person','Barry Windsor'); insert into subjectattribute values('bawi','loginid','bawi','bawi'); insert into subjectattribute values('bawi','name','Barry Windsor',lower('Barry Windsor')); insert into subjectattribute values('bawi','description','Barry Windsor',lower('Barry Windsor')); insert into subject values('bata','person','Barry Tarbuck'); insert into subjectattribute values('bata','loginid','bata','bata'); insert into subjectattribute values('bata','name','Barry Tarbuck',lower('Barry Tarbuck')); insert into subjectattribute values('bata','description','Barry Tarbuck',lower('Barry Tarbuck')); insert into subject values('bapo','person','Barry Porter'); insert into subjectattribute values('bapo','loginid','bapo','bapo'); insert into subjectattribute values('bapo','name','Barry Porter',lower('Barry Porter')); insert into subjectattribute values('bapo','description','Barry Porter',lower('Barry Porter')); insert into subject values('babe','person','Barry Benson'); insert into subjectattribute values('babe','loginid','babe','babe'); insert into subjectattribute values('babe','name','Barry Benson',lower('Barry Benson')); insert into subjectattribute values('babe','description','Barry Benson',lower('Barry Benson')); insert into subject values('bato','person','Barry Townsend'); insert into subjectattribute values('bato','loginid','bato','bato'); insert into subjectattribute values('bato','name','Barry Townsend',lower('Barry Townsend')); insert into subjectattribute values('bato','description','Barry Townsend',lower('Barry Townsend')); insert into subject values('bado','person','Barry Dolphin'); insert into subjectattribute values('bado','loginid','bado','bado'); insert into subjectattribute values('bado','name','Barry Dolphin',lower('Barry Dolphin')); insert into subjectattribute values('bado','description','Barry Dolphin',lower('Barry Dolphin')); insert into subject values('bama','person','Barry Masterson'); insert into subjectattribute values('bama','loginid','bama','bama'); insert into subjectattribute values('bama','name','Barry Masterson',lower('Barry Masterson')); insert into subjectattribute values('bama','description','Barry Masterson',lower('Barry Masterson')); insert into subject values('baed','person','Barry Edwards'); insert into subjectattribute values('baed','loginid','baed','baed'); insert into subjectattribute values('baed','name','Barry Edwards',lower('Barry Edwards')); insert into subjectattribute values('baed','description','Barry Edwards',lower('Barry Edwards')); insert into subject values('babu','person','Barry Bush'); insert into subjectattribute values('babu','loginid','babu','babu'); insert into subjectattribute values('babu','name','Barry Bush',lower('Barry Bush')); insert into subjectattribute values('babu','description','Barry Bush',lower('Barry Bush')); insert into subject values('babr','person','Barry Brooks'); insert into subjectattribute values('babr','loginid','babr','babr'); insert into subjectattribute values('babr','name','Barry Brooks',lower('Barry Brooks')); insert into subjectattribute values('babr','description','Barry Brooks',lower('Barry Brooks')); insert into subject values('baco','person','Barry Collins'); insert into subjectattribute values('baco','loginid','baco','baco'); insert into subjectattribute values('baco','name','Barry Collins',lower('Barry Collins')); insert into subjectattribute values('baco','description','Barry Collins',lower('Barry Collins')); insert into subject values('babl','person','Barry Blair'); insert into subjectattribute values('babl','loginid','babl','babl'); insert into subjectattribute values('babl','name','Barry Blair',lower('Barry Blair')); insert into subjectattribute values('babl','description','Barry Blair',lower('Barry Blair')); insert into subject values('jawi','person','Jane Windsor'); insert into subjectattribute values('jawi','loginid','jawi','jawi'); insert into subjectattribute values('jawi','name','Jane Windsor',lower('Jane Windsor')); insert into subjectattribute values('jawi','description','Jane Windsor',lower('Jane Windsor')); insert into subject values('jata','person','Jane Tarbuck'); insert into subjectattribute values('jata','loginid','jata','jata'); insert into subjectattribute values('jata','name','Jane Tarbuck',lower('Jane Tarbuck')); insert into subjectattribute values('jata','description','Jane Tarbuck',lower('Jane Tarbuck')); insert into subject values('japo','person','Jane Porter'); insert into subjectattribute values('japo','loginid','japo','japo'); insert into subjectattribute values('japo','name','Jane Porter',lower('Jane Porter')); insert into subjectattribute values('japo','description','Jane Porter',lower('Jane Porter')); insert into subject values('jabe','person','Jane Benson'); insert into subjectattribute values('jabe','loginid','jabe','jabe'); insert into subjectattribute values('jabe','name','Jane Benson',lower('Jane Benson')); insert into subjectattribute values('jabe','description','Jane Benson',lower('Jane Benson')); insert into subject values('jato','person','Jane Townsend'); insert into subjectattribute values('jato','loginid','jato','jato'); insert into subjectattribute values('jato','name','Jane Townsend',lower('Jane Townsend')); insert into subjectattribute values('jato','description','Jane Townsend',lower('Jane Townsend')); insert into subject values('jado','person','Jane Dolphin'); insert into subjectattribute values('jado','loginid','jado','jado'); insert into subjectattribute values('jado','name','Jane Dolphin',lower('Jane Dolphin')); insert into subjectattribute values('jado','description','Jane Dolphin',lower('Jane Dolphin')); insert into subject values('jama','person','Jane Masterson'); insert into subjectattribute values('jama','loginid','jama','jama'); insert into subjectattribute values('jama','name','Jane Masterson',lower('Jane Masterson')); insert into subjectattribute values('jama','description','Jane Masterson',lower('Jane Masterson')); insert into subject values('jaed','person','Jane Edwards'); insert into subjectattribute values('jaed','loginid','jaed','jaed'); insert into subjectattribute values('jaed','name','Jane Edwards',lower('Jane Edwards')); insert into subjectattribute values('jaed','description','Jane Edwards',lower('Jane Edwards')); insert into subject values('jabu','person','Jane Bush'); insert into subjectattribute values('jabu','loginid','jabu','jabu'); insert into subjectattribute values('jabu','name','Jane Bush',lower('Jane Bush')); insert into subjectattribute values('jabu','description','Jane Bush',lower('Jane Bush')); insert into subject values('jabr','person','Jane Brooks'); insert into subjectattribute values('jabr','loginid','jabr','jabr'); insert into subjectattribute values('jabr','name','Jane Brooks',lower('Jane Brooks')); insert into subjectattribute values('jabr','description','Jane Brooks',lower('Jane Brooks')); insert into subject values('jaco','person','Jane Collins'); insert into subjectattribute values('jaco','loginid','jaco','jaco'); insert into subjectattribute values('jaco','name','Jane Collins',lower('Jane Collins')); insert into subjectattribute values('jaco','description','Jane Collins',lower('Jane Collins')); insert into subject values('jabl','person','Jane Blair'); insert into subjectattribute values('jabl','loginid','jabl','jabl'); insert into subjectattribute values('jabl','name','Jane Blair',lower('Jane Blair')); insert into subjectattribute values('jabl','description','Jane Blair',lower('Jane Blair')); insert into subject values('iawi','person','Ian Windsor'); insert into subjectattribute values('iawi','loginid','iawi','iawi'); insert into subjectattribute values('iawi','name','Ian Windsor',lower('Ian Windsor')); insert into subjectattribute values('iawi','description','Ian Windsor',lower('Ian Windsor')); insert into subject values('iata','person','Ian Tarbuck'); insert into subjectattribute values('iata','loginid','iata','iata'); insert into subjectattribute values('iata','name','Ian Tarbuck',lower('Ian Tarbuck')); insert into subjectattribute values('iata','description','Ian Tarbuck',lower('Ian Tarbuck')); insert into subject values('iapo','person','Ian Porter'); insert into subjectattribute values('iapo','loginid','iapo','iapo'); insert into subjectattribute values('iapo','name','Ian Porter',lower('Ian Porter')); insert into subjectattribute values('iapo','description','Ian Porter',lower('Ian Porter')); insert into subject values('iabe','person','Ian Benson'); insert into subjectattribute values('iabe','loginid','iabe','iabe'); insert into subjectattribute values('iabe','name','Ian Benson',lower('Ian Benson')); insert into subjectattribute values('iabe','description','Ian Benson',lower('Ian Benson')); insert into subject values('iato','person','Ian Townsend'); insert into subjectattribute values('iato','loginid','iato','iato'); insert into subjectattribute values('iato','name','Ian Townsend',lower('Ian Townsend')); insert into subjectattribute values('iato','description','Ian Townsend',lower('Ian Townsend')); insert into subject values('iado','person','Ian Dolphin'); insert into subjectattribute values('iado','loginid','iado','iado'); insert into subjectattribute values('iado','name','Ian Dolphin',lower('Ian Dolphin')); insert into subjectattribute values('iado','description','Ian Dolphin',lower('Ian Dolphin')); insert into subject values('iama','person','Ian Masterson'); insert into subjectattribute values('iama','loginid','iama','iama'); insert into subjectattribute values('iama','name','Ian Masterson',lower('Ian Masterson')); insert into subjectattribute values('iama','description','Ian Masterson',lower('Ian Masterson')); insert into subject values('iaed','person','Ian Edwards'); insert into subjectattribute values('iaed','loginid','iaed','iaed'); insert into subjectattribute values('iaed','name','Ian Edwards',lower('Ian Edwards')); insert into subjectattribute values('iaed','description','Ian Edwards',lower('Ian Edwards')); insert into subject values('iabu','person','Ian Bush'); insert into subjectattribute values('iabu','loginid','iabu','iabu'); insert into subjectattribute values('iabu','name','Ian Bush',lower('Ian Bush')); insert into subjectattribute values('iabu','description','Ian Bush',lower('Ian Bush')); insert into subject values('iabr','person','Ian Brooks'); insert into subjectattribute values('iabr','loginid','iabr','iabr'); insert into subjectattribute values('iabr','name','Ian Brooks',lower('Ian Brooks')); insert into subjectattribute values('iabr','description','Ian Brooks',lower('Ian Brooks')); insert into subject values('iaco','person','Ian Collins'); insert into subjectattribute values('iaco','loginid','iaco','iaco'); insert into subjectattribute values('iaco','name','Ian Collins',lower('Ian Collins')); insert into subjectattribute values('iaco','description','Ian Collins',lower('Ian Collins')); insert into subject values('iabl','person','Ian Blair'); insert into subjectattribute values('iabl','loginid','iabl','iabl'); insert into subjectattribute values('iabl','name','Ian Blair',lower('Ian Blair')); insert into subjectattribute values('iabl','description','Ian Blair',lower('Ian Blair')); insert into subject values('jowi','person','John Windsor'); insert into subjectattribute values('jowi','loginid','jowi','jowi'); insert into subjectattribute values('jowi','name','John Windsor',lower('John Windsor')); insert into subjectattribute values('jowi','description','John Windsor',lower('John Windsor')); insert into subject values('jota','person','John Tarbuck'); insert into subjectattribute values('jota','loginid','jota','jota'); insert into subjectattribute values('jota','name','John Tarbuck',lower('John Tarbuck')); insert into subjectattribute values('jota','description','John Tarbuck',lower('John Tarbuck')); insert into subject values('jopo','person','John Porter'); insert into subjectattribute values('jopo','loginid','jopo','jopo'); insert into subjectattribute values('jopo','name','John Porter',lower('John Porter')); insert into subjectattribute values('jopo','description','John Porter',lower('John Porter')); insert into subject values('jobe','person','John Benson'); insert into subjectattribute values('jobe','loginid','jobe','jobe'); insert into subjectattribute values('jobe','name','John Benson',lower('John Benson')); insert into subjectattribute values('jobe','description','John Benson',lower('John Benson')); insert into subject values('joto','person','John Townsend'); insert into subjectattribute values('joto','loginid','joto','joto'); insert into subjectattribute values('joto','name','John Townsend',lower('John Townsend')); insert into subjectattribute values('joto','description','John Townsend',lower('John Townsend')); insert into subject values('jodo','person','John Dolphin'); insert into subjectattribute values('jodo','loginid','jodo','jodo'); insert into subjectattribute values('jodo','name','John Dolphin',lower('John Dolphin')); insert into subjectattribute values('jodo','description','John Dolphin',lower('John Dolphin')); insert into subject values('joma','person','John Masterson'); insert into subjectattribute values('joma','loginid','joma','joma'); insert into subjectattribute values('joma','name','John Masterson',lower('John Masterson')); insert into subjectattribute values('joma','description','John Masterson',lower('John Masterson')); insert into subject values('joed','person','John Edwards'); insert into subjectattribute values('joed','loginid','joed','joed'); insert into subjectattribute values('joed','name','John Edwards',lower('John Edwards')); insert into subjectattribute values('joed','description','John Edwards',lower('John Edwards')); insert into subject values('jobu','person','John Bush'); insert into subjectattribute values('jobu','loginid','jobu','jobu'); insert into subjectattribute values('jobu','name','John Bush',lower('John Bush')); insert into subjectattribute values('jobu','description','John Bush',lower('John Bush')); insert into subject values('jobr','person','John Brooks'); insert into subjectattribute values('jobr','loginid','jobr','jobr'); insert into subjectattribute values('jobr','name','John Brooks',lower('John Brooks')); insert into subjectattribute values('jobr','description','John Brooks',lower('John Brooks')); insert into subject values('joco','person','John Collins'); insert into subjectattribute values('joco','loginid','joco','joco'); insert into subjectattribute values('joco','name','John Collins',lower('John Collins')); insert into subjectattribute values('joco','description','John Collins',lower('John Collins')); insert into subject values('jobl','person','John Blair'); insert into subjectattribute values('jobl','loginid','jobl','jobl'); insert into subjectattribute values('jobl','name','John Blair',lower('John Blair')); insert into subjectattribute values('jobl','description','John Blair',lower('John Blair')); insert into subject values('kewi','person','Keith Windsor'); insert into subjectattribute values('kewi','loginid','kewi','kewi'); insert into subjectattribute values('kewi','name','Keith Windsor',lower('Keith Windsor')); insert into subjectattribute values('kewi','description','Keith Windsor',lower('Keith Windsor')); insert into subject values('keta','person','Keith Tarbuck'); insert into subjectattribute values('keta','loginid','keta','keta'); insert into subjectattribute values('keta','name','Keith Tarbuck',lower('Keith Tarbuck')); insert into subjectattribute values('keta','description','Keith Tarbuck',lower('Keith Tarbuck')); insert into subject values('kepo','person','Keith Porter'); insert into subjectattribute values('kepo','loginid','kepo','kepo'); insert into subjectattribute values('kepo','name','Keith Porter',lower('Keith Porter')); insert into subjectattribute values('kepo','description','Keith Porter',lower('Keith Porter')); insert into subject values('kebe','person','Keith Benson'); insert into subjectattribute values('kebe','loginid','kebe','kebe'); insert into subjectattribute values('kebe','name','Keith Benson',lower('Keith Benson')); insert into subjectattribute values('kebe','description','Keith Benson',lower('Keith Benson')); insert into subject values('keto','person','Keith Townsend'); insert into subjectattribute values('keto','loginid','keto','keto'); insert into subjectattribute values('keto','name','Keith Townsend',lower('Keith Townsend')); insert into subjectattribute values('keto','description','Keith Townsend',lower('Keith Townsend')); insert into subject values('kedo','person','Keith Dolphin'); insert into subjectattribute values('kedo','loginid','kedo','kedo'); insert into subjectattribute values('kedo','name','Keith Dolphin',lower('Keith Dolphin')); insert into subjectattribute values('kedo','description','Keith Dolphin',lower('Keith Dolphin')); insert into subject values('kema','person','Keith Masterson'); insert into subjectattribute values('kema','loginid','kema','kema'); insert into subjectattribute values('kema','name','Keith Masterson',lower('Keith Masterson')); insert into subjectattribute values('kema','description','Keith Masterson',lower('Keith Masterson')); insert into subject values('keed','person','Keith Edwards'); insert into subjectattribute values('keed','loginid','keed','keed'); insert into subjectattribute values('keed','name','Keith Edwards',lower('Keith Edwards')); insert into subjectattribute values('keed','description','Keith Edwards',lower('Keith Edwards')); insert into subject values('kebu','person','Keith Bush'); insert into subjectattribute values('kebu','loginid','kebu','kebu'); insert into subjectattribute values('kebu','name','Keith Bush',lower('Keith Bush')); insert into subjectattribute values('kebu','description','Keith Bush',lower('Keith Bush')); insert into subject values('kebr','person','Keith Brooks'); insert into subjectattribute values('kebr','loginid','kebr','kebr'); insert into subjectattribute values('kebr','name','Keith Brooks',lower('Keith Brooks')); insert into subjectattribute values('kebr','description','Keith Brooks',lower('Keith Brooks')); insert into subject values('keco','person','Keith Collins'); insert into subjectattribute values('keco','loginid','keco','keco'); insert into subjectattribute values('keco','name','Keith Collins',lower('Keith Collins')); insert into subjectattribute values('keco','description','Keith Collins',lower('Keith Collins')); insert into subject values('kebl','person','Keith Blair'); insert into subjectattribute values('kebl','loginid','kebl','kebl'); insert into subjectattribute values('kebl','name','Keith Blair',lower('Keith Blair')); insert into subjectattribute values('kebl','description','Keith Blair',lower('Keith Blair')); insert into subject values('fiwi','person','Fiona Windsor'); insert into subjectattribute values('fiwi','loginid','fiwi','fiwi'); insert into subjectattribute values('fiwi','name','Fiona Windsor',lower('Fiona Windsor')); insert into subjectattribute values('fiwi','description','Fiona Windsor',lower('Fiona Windsor')); insert into subject values('fita','person','Fiona Tarbuck'); insert into subjectattribute values('fita','loginid','fita','fita'); insert into subjectattribute values('fita','name','Fiona Tarbuck',lower('Fiona Tarbuck')); insert into subjectattribute values('fita','description','Fiona Tarbuck',lower('Fiona Tarbuck')); insert into subject values('fipo','person','Fiona Porter'); insert into subjectattribute values('fipo','loginid','fipo','fipo'); insert into subjectattribute values('fipo','name','Fiona Porter',lower('Fiona Porter')); insert into subjectattribute values('fipo','description','Fiona Porter',lower('Fiona Porter')); insert into subject values('fibe','person','Fiona Benson'); insert into subjectattribute values('fibe','loginid','fibe','fibe'); insert into subjectattribute values('fibe','name','Fiona Benson',lower('Fiona Benson')); insert into subjectattribute values('fibe','description','Fiona Benson',lower('Fiona Benson')); insert into subject values('fito','person','Fiona Townsend'); insert into subjectattribute values('fito','loginid','fito','fito'); insert into subjectattribute values('fito','name','Fiona Townsend',lower('Fiona Townsend')); insert into subjectattribute values('fito','description','Fiona Townsend',lower('Fiona Townsend')); insert into subject values('fido','person','Fiona Dolphin'); insert into subjectattribute values('fido','loginid','fido','fido'); insert into subjectattribute values('fido','name','Fiona Dolphin',lower('Fiona Dolphin')); insert into subjectattribute values('fido','description','Fiona Dolphin',lower('Fiona Dolphin')); insert into subject values('fima','person','Fiona Masterson'); insert into subjectattribute values('fima','loginid','fima','fima'); insert into subjectattribute values('fima','name','Fiona Masterson',lower('Fiona Masterson')); insert into subjectattribute values('fima','description','Fiona Masterson',lower('Fiona Masterson')); insert into subject values('fied','person','Fiona Edwards'); insert into subjectattribute values('fied','loginid','fied','fied'); insert into subjectattribute values('fied','name','Fiona Edwards',lower('Fiona Edwards')); insert into subjectattribute values('fied','description','Fiona Edwards',lower('Fiona Edwards')); insert into subject values('fibu','person','Fiona Bush'); insert into subjectattribute values('fibu','loginid','fibu','fibu'); insert into subjectattribute values('fibu','name','Fiona Bush',lower('Fiona Bush')); insert into subjectattribute values('fibu','description','Fiona Bush',lower('Fiona Bush')); insert into subject values('fibr','person','Fiona Brooks'); insert into subjectattribute values('fibr','loginid','fibr','fibr'); insert into subjectattribute values('fibr','name','Fiona Brooks',lower('Fiona Brooks')); insert into subjectattribute values('fibr','description','Fiona Brooks',lower('Fiona Brooks')); insert into subject values('fico','person','Fiona Collins'); insert into subjectattribute values('fico','loginid','fico','fico'); insert into subjectattribute values('fico','name','Fiona Collins',lower('Fiona Collins')); insert into subjectattribute values('fico','description','Fiona Collins',lower('Fiona Collins')); insert into subject values('fibl','person','Fiona Blair'); insert into subjectattribute values('fibl','loginid','fibl','fibl'); insert into subjectattribute values('fibl','name','Fiona Blair',lower('Fiona Blair')); insert into subjectattribute values('fibl','description','Fiona Blair',lower('Fiona Blair')); insert into subject values('stwi','person','Steven Windsor'); insert into subjectattribute values('stwi','loginid','stwi','stwi'); insert into subjectattribute values('stwi','name','Steven Windsor',lower('Steven Windsor')); insert into subjectattribute values('stwi','description','Steven Windsor',lower('Steven Windsor')); insert into subject values('stta','person','Steven Tarbuck'); insert into subjectattribute values('stta','loginid','stta','stta'); insert into subjectattribute values('stta','name','Steven Tarbuck',lower('Steven Tarbuck')); insert into subjectattribute values('stta','description','Steven Tarbuck',lower('Steven Tarbuck')); insert into subject values('stpo','person','Steven Porter'); insert into subjectattribute values('stpo','loginid','stpo','stpo'); insert into subjectattribute values('stpo','name','Steven Porter',lower('Steven Porter')); insert into subjectattribute values('stpo','description','Steven Porter',lower('Steven Porter')); insert into subject values('stbe','person','Steven Benson'); insert into subjectattribute values('stbe','loginid','stbe','stbe'); insert into subjectattribute values('stbe','name','Steven Benson',lower('Steven Benson')); insert into subjectattribute values('stbe','description','Steven Benson',lower('Steven Benson')); insert into subject values('stto','person','Steven Townsend'); insert into subjectattribute values('stto','loginid','stto','stto'); insert into subjectattribute values('stto','name','Steven Townsend',lower('Steven Townsend')); insert into subjectattribute values('stto','description','Steven Townsend',lower('Steven Townsend')); insert into subject values('stdo','person','Steven Dolphin'); insert into subjectattribute values('stdo','loginid','stdo','stdo'); insert into subjectattribute values('stdo','name','Steven Dolphin',lower('Steven Dolphin')); insert into subjectattribute values('stdo','description','Steven Dolphin',lower('Steven Dolphin')); insert into subject values('stma','person','Steven Masterson'); insert into subjectattribute values('stma','loginid','stma','stma'); insert into subjectattribute values('stma','name','Steven Masterson',lower('Steven Masterson')); insert into subjectattribute values('stma','description','Steven Masterson',lower('Steven Masterson')); insert into subject values('sted','person','Steven Edwards'); insert into subjectattribute values('sted','loginid','sted','sted'); insert into subjectattribute values('sted','name','Steven Edwards',lower('Steven Edwards')); insert into subjectattribute values('sted','description','Steven Edwards',lower('Steven Edwards')); insert into subject values('stbu','person','Steven Bush'); insert into subjectattribute values('stbu','loginid','stbu','stbu'); insert into subjectattribute values('stbu','name','Steven Bush',lower('Steven Bush')); insert into subjectattribute values('stbu','description','Steven Bush',lower('Steven Bush')); insert into subject values('stbr','person','Steven Brooks'); insert into subjectattribute values('stbr','loginid','stbr','stbr'); insert into subjectattribute values('stbr','name','Steven Brooks',lower('Steven Brooks')); insert into subjectattribute values('stbr','description','Steven Brooks',lower('Steven Brooks')); insert into subject values('stco','person','Steven Collins'); insert into subjectattribute values('stco','loginid','stco','stco'); insert into subjectattribute values('stco','name','Steven Collins',lower('Steven Collins')); insert into subjectattribute values('stco','description','Steven Collins',lower('Steven Collins')); insert into subject values('stbl','person','Steven Blair'); insert into subjectattribute values('stbl','loginid','stbl','stbl'); insert into subjectattribute values('stbl','name','Steven Blair',lower('Steven Blair')); insert into subjectattribute values('stbl','description','Steven Blair',lower('Steven Blair')); insert into subject values('mawi','person','Margaret Windsor'); insert into subjectattribute values('mawi','loginid','mawi','mawi'); insert into subjectattribute values('mawi','name','Margaret Windsor',lower('Margaret Windsor')); insert into subjectattribute values('mawi','description','Margaret Windsor',lower('Margaret Windsor')); insert into subject values('mata','person','Margaret Tarbuck'); insert into subjectattribute values('mata','loginid','mata','mata'); insert into subjectattribute values('mata','name','Margaret Tarbuck',lower('Margaret Tarbuck')); insert into subjectattribute values('mata','description','Margaret Tarbuck',lower('Margaret Tarbuck')); insert into subject values('mapo','person','Margaret Porter'); insert into subjectattribute values('mapo','loginid','mapo','mapo'); insert into subjectattribute values('mapo','name','Margaret Porter',lower('Margaret Porter')); insert into subjectattribute values('mapo','description','Margaret Porter',lower('Margaret Porter')); insert into subject values('mabe','person','Margaret Benson'); insert into subjectattribute values('mabe','loginid','mabe','mabe'); insert into subjectattribute values('mabe','name','Margaret Benson',lower('Margaret Benson')); insert into subjectattribute values('mabe','description','Margaret Benson',lower('Margaret Benson')); insert into subject values('mato','person','Margaret Townsend'); insert into subjectattribute values('mato','loginid','mato','mato'); insert into subjectattribute values('mato','name','Margaret Townsend',lower('Margaret Townsend')); insert into subjectattribute values('mato','description','Margaret Townsend',lower('Margaret Townsend')); insert into subject values('mado','person','Margaret Dolphin'); insert into subjectattribute values('mado','loginid','mado','mado'); insert into subjectattribute values('mado','name','Margaret Dolphin',lower('Margaret Dolphin')); insert into subjectattribute values('mado','description','Margaret Dolphin',lower('Margaret Dolphin')); insert into subject values('mama','person','Margaret Masterson'); insert into subjectattribute values('mama','loginid','mama','mama'); insert into subjectattribute values('mama','name','Margaret Masterson',lower('Margaret Masterson')); insert into subjectattribute values('mama','description','Margaret Masterson',lower('Margaret Masterson')); insert into subject values('maed','person','Margaret Edwards'); insert into subjectattribute values('maed','loginid','maed','maed'); insert into subjectattribute values('maed','name','Margaret Edwards',lower('Margaret Edwards')); insert into subjectattribute values('maed','description','Margaret Edwards',lower('Margaret Edwards')); insert into subject values('mabu','person','Margaret Bush'); insert into subjectattribute values('mabu','loginid','mabu','mabu'); insert into subjectattribute values('mabu','name','Margaret Bush',lower('Margaret Bush')); insert into subjectattribute values('mabu','description','Margaret Bush',lower('Margaret Bush')); insert into subject values('mabr','person','Margaret Brooks'); insert into subjectattribute values('mabr','loginid','mabr','mabr'); insert into subjectattribute values('mabr','name','Margaret Brooks',lower('Margaret Brooks')); insert into subjectattribute values('mabr','description','Margaret Brooks',lower('Margaret Brooks')); insert into subject values('maco','person','Margaret Collins'); insert into subjectattribute values('maco','loginid','maco','maco'); insert into subjectattribute values('maco','name','Margaret Collins',lower('Margaret Collins')); insert into subjectattribute values('maco','description','Margaret Collins',lower('Margaret Collins')); insert into subject values('mabl','person','Margaret Blair'); insert into subjectattribute values('mabl','loginid','mabl','mabl'); insert into subjectattribute values('mabl','name','Margaret Blair',lower('Margaret Blair')); insert into subjectattribute values('mabl','description','Margaret Blair',lower('Margaret Blair')); commit;
the_stack
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: May 02, 2017 at 06:33 AM -- Server version: 10.1.19-MariaDB -- PHP Version: 5.5.38 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `inventory` -- -- -------------------------------------------------------- -- -- Table structure for table `categories` -- CREATE TABLE `categories` ( `id` int(11) NOT NULL, `type` varchar(100) NOT NULL, `description` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `categories` -- INSERT INTO `categories` (`id`, `type`, `description`) VALUES (1, 'Shampoo', 'Hair Product'), (2, 'Gel', 'Hair styling'), (3, 'Cosmetics', 'Grooming products'), (4, 'Color', 'Hair colour and dyes'); -- -------------------------------------------------------- -- -- Table structure for table `employees` -- CREATE TABLE `employees` ( `id` int(11) NOT NULL, `firstname` varchar(100) NOT NULL, `lastname` varchar(100) NOT NULL, `username` varchar(40) NOT NULL, `password` varchar(100) NOT NULL, `phone` varchar(100) NOT NULL, `address` text NOT NULL, `type` enum('admin','employee') NOT NULL DEFAULT 'employee' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `employees` -- INSERT INTO `employees` (`id`, `firstname`, `lastname`, `username`, `password`, `phone`, `address`, `type`) VALUES (1, 'john', 'cena', 'admin', 'd033e22ae348aeb5660fc2140aec35850c4da997', '0099887766', 'New York, USA', 'admin'), (2, 'Martha', 'Jones', 'user', '12dea96fec20593566ab75692c9949596833adc9', '123456789', 'Seattle', 'employee'); -- -------------------------------------------------------- -- -- Table structure for table `invoices` -- CREATE TABLE `invoices` ( `id` varchar(13) NOT NULL, `employeeId` int(11) NOT NULL, `total` double NOT NULL, `vat` double NOT NULL, `discount` double NOT NULL, `payable` double NOT NULL, `paid` double NOT NULL, `returned` double NOT NULL, `datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `invoices` -- INSERT INTO `invoices` (`id`, `employeeId`, `total`, `vat`, `discount`, `payable`, `paid`, `returned`, `datetime`) VALUES ('1491729973342', 2, 760, 19, 5, 774, 800, 26, '2017-01-09 15:26:13'), ('1491730560516', 2, 370, 9.25, 5, 374.25, 375, 0.75, '2017-01-09 15:36:00'), ('1492165305284', 2, 270, 6.75, 5, 271.75, 280, 8.25, '2017-01-14 16:21:45'), ('1492189349464', 2, 490, 12.25, 5, 497.25, 500, 2.75, '2017-02-14 23:02:29'), ('1492189946488', 2, 190, 4.75, 5, 189.75, 200, 10.25, '2017-02-14 23:12:26'), ('1492190099626', 2, 120, 3, 5, 118, 120, 2, '2017-04-14 23:14:59'), ('1492190341116', 2, 65, 1.625, 5, 61.625, 62, 0.375, '2017-04-14 23:19:01'), ('1492191099328', 2, 190, 4.75, 5, 189.75, 190, 0.25, '2017-04-14 23:31:39'), ('1492192975710', 2, 770, 19.25, 5, 784.25, 1000, 215.75, '2017-04-15 00:02:55'), ('1492193361407', 2, 865, 21.625, 5, 881.625, 900, 18.375, '2017-03-15 00:09:21'), ('1492313070538', 2, 275, 6.875, 5, 276.875, 300, 23.125, '2017-03-16 09:24:30'), ('1493699328760', 2, 70, 1.75, 5, 66.75, 70, 3.25, '2017-05-02 10:28:48'), ('1493699482352', 2, 190, 4.75, 5, 189.75, 190, 0.25, '2017-05-02 10:31:22'); -- -------------------------------------------------------- -- -- Table structure for table `products` -- CREATE TABLE `products` ( `id` int(11) NOT NULL, `categoryId` int(11) NOT NULL, `supplierId` int(11) NOT NULL, `name` varchar(100) NOT NULL, `price` double NOT NULL, `quantity` double NOT NULL, `description` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `products` -- INSERT INTO `products` (`id`, `categoryId`, `supplierId`, `name`, `price`, `quantity`, `description`) VALUES (1, 1, 1, 'Clinical Solutions', 165, 47, 'Anti-dandruff shampoo'), (2, 1, 1, 'Classic Clean', 120, 144, 'General shampoo'), (3, 4, 2, 'HiColor', 190, 33, 'Red Color 50g box'), (4, 2, 2, 'Wax', 65, 38, 'Hair wax'), (5, 3, 3, 'Power Light', 70, 93, 'Freshness Cream'), (6, 3, 3, 'Oil Clear', 160, 294, 'Face Wash'), (7, 3, 6, 'Brylcreem (Red)', 300, 128, 'Light glossy hold'), (8, 3, 1, 'Brylcreem (Green)', 105, 0, 'Anti-dandruff'); -- -------------------------------------------------------- -- -- Table structure for table `purchases` -- CREATE TABLE `purchases` ( `id` int(11) NOT NULL, `productId` int(11) NOT NULL, `supplierId` int(11) NOT NULL, `quantity` double NOT NULL, `price` double NOT NULL, `total` double NOT NULL, `datetime` datetime DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `purchases` -- INSERT INTO `purchases` (`id`, `productId`, `supplierId`, `quantity`, `price`, `total`, `datetime`) VALUES (1, 1, 1, 5, 165, 825, '2017-03-14 00:00:00'), (2, 2, 2, 6, 120, 720, '2017-03-09 00:00:00'), (3, 1, 1, 1, 24, 24, '2017-05-02 10:02:47'), (4, 1, 1, 2, 20, 40, '2017-05-02 10:10:37'); -- -------------------------------------------------------- -- -- Table structure for table `sales` -- CREATE TABLE `sales` ( `id` int(11) NOT NULL, `invoiceId` varchar(13) NOT NULL, `productId` int(11) NOT NULL, `quantity` double NOT NULL, `price` int(11) NOT NULL, `total` double NOT NULL, `datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `sales` -- INSERT INTO `sales` (`id`, `invoiceId`, `productId`, `quantity`, `price`, `total`, `datetime`) VALUES (1, '1491729973342', 7, 2, 300, 600, '2017-04-09 15:26:13'), (2, '1491729973342', 6, 1, 160, 160, '2017-04-09 15:26:13'), (3, '1491730560516', 2, 2, 120, 240, '2017-04-09 15:36:00'), (4, '1491730560516', 4, 2, 65, 130, '2017-04-09 15:36:00'), (5, '1492165305284', 5, 2, 70, 140, '2017-04-14 16:21:45'), (6, '1492165305284', 4, 2, 65, 130, '2017-04-14 16:21:45'), (7, '1492189349464', 1, 2, 165, 330, '2017-01-14 23:02:29'), (8, '1492189349464', 6, 1, 160, 160, '2017-04-14 23:02:29'), (9, '1492189946488', 3, 1, 190, 190, '2017-04-14 23:12:26'), (10, '1492190099626', 2, 1, 120, 120, '2017-04-14 23:14:59'), (11, '1492190341116', 4, 1, 65, 65, '2017-04-14 23:19:01'), (12, '1492191099328', 3, 1, 190, 190, '2017-04-14 23:31:39'), (13, '1492192975710', 6, 2, 160, 320, '2017-04-15 00:02:55'), (14, '1492192975710', 2, 1, 120, 120, '2017-04-15 00:02:55'), (15, '1492192975710', 1, 2, 165, 330, '2017-02-15 00:02:55'), (16, '1492193361407', 3, 2, 190, 380, '2017-04-15 00:09:21'), (17, '1492193361407', 1, 1, 165, 165, '2017-03-15 00:09:21'), (18, '1492193361407', 6, 2, 160, 320, '2017-04-15 00:09:21'), (19, '1492313070538', 5, 3, 70, 210, '2017-04-16 09:24:30'), (20, '1492313070538', 4, 1, 65, 65, '2017-04-16 09:24:30'), (21, '1493699482352', 3, 1, 190, 190, '2017-05-02 10:31:22'); -- -------------------------------------------------------- -- -- Table structure for table `suppliers` -- CREATE TABLE `suppliers` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `phone` varchar(100) NOT NULL, `address` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `suppliers` -- INSERT INTO `suppliers` (`id`, `name`, `phone`, `address`) VALUES (1, 'Head & Shoulder', '00000000', 'USA'), (2, 'Loreal', '1111111', 'France'), (3, 'Garnier', '22222222', 'France'), (4, 'Set Wet', '444444', 'India'), (5, 'Layer', '555555', 'India'), (6, 'Brylcreem', '777777', 'UK'), (7, 'Gatsby', '8888888', 'Canada'); -- -- Indexes for dumped tables -- -- -- Indexes for table `categories` -- ALTER TABLE `categories` ADD PRIMARY KEY (`id`); -- -- Indexes for table `employees` -- ALTER TABLE `employees` ADD PRIMARY KEY (`id`); -- -- Indexes for table `invoices` -- ALTER TABLE `invoices` ADD PRIMARY KEY (`id`); -- -- Indexes for table `products` -- ALTER TABLE `products` ADD PRIMARY KEY (`id`), ADD KEY `categoryId` (`categoryId`), ADD KEY `supplierId` (`supplierId`); -- -- Indexes for table `purchases` -- ALTER TABLE `purchases` ADD PRIMARY KEY (`id`), ADD KEY `productId` (`productId`), ADD KEY `supplierId` (`supplierId`); -- -- Indexes for table `sales` -- ALTER TABLE `sales` ADD PRIMARY KEY (`id`), ADD KEY `productId` (`productId`), ADD KEY `invoiceId` (`invoiceId`); -- -- Indexes for table `suppliers` -- ALTER TABLE `suppliers` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `categories` -- ALTER TABLE `categories` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `employees` -- ALTER TABLE `employees` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `products` -- ALTER TABLE `products` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `purchases` -- ALTER TABLE `purchases` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `sales` -- ALTER TABLE `sales` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22; -- -- AUTO_INCREMENT for table `suppliers` -- ALTER TABLE `suppliers` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- Constraints for dumped tables -- -- -- Constraints for table `products` -- ALTER TABLE `products` ADD CONSTRAINT `products_ibfk_1` FOREIGN KEY (`categoryId`) REFERENCES `categories` (`id`), ADD CONSTRAINT `products_ibfk_2` FOREIGN KEY (`supplierId`) REFERENCES `suppliers` (`id`); -- -- Constraints for table `purchases` -- ALTER TABLE `purchases` ADD CONSTRAINT `purchases_ibfk_1` FOREIGN KEY (`productId`) REFERENCES `products` (`id`), ADD CONSTRAINT `purchases_ibfk_2` FOREIGN KEY (`supplierId`) REFERENCES `suppliers` (`id`); -- -- Constraints for table `sales` -- ALTER TABLE `sales` ADD CONSTRAINT `sales_ibfk_1` FOREIGN KEY (`productId`) REFERENCES `products` (`id`), ADD CONSTRAINT `sales_ibfk_2` FOREIGN KEY (`invoiceId`) REFERENCES `invoices` (`id`); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
the_stack
-- 2020-11-20T10:14:25.326Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:14:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=220 ; -- 2020-11-20T10:15:00.796Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3887 ; -- 2020-11-20T10:16:31.571Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:16:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=554162 ; -- 2020-11-20T10:17:00.169Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:17:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=550690 ; -- 2020-11-20T10:17:22.748Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:17:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=550689 ; -- 2020-11-20T10:17:41.953Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:17:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=550688 ; -- 2020-11-20T10:19:03.290Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:19:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=548290 ; -- 2020-11-20T10:19:24.358Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:19:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=549002 ; -- 2020-11-20T10:19:44.357Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:19:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=549004 ; -- 2020-11-20T10:20:01.950Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:20:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=549003 ; -- 2020-11-20T10:22:53.064Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:22:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11264 ; -- 2020-11-20T10:23:20.671Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:23:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11257 ; -- 2020-11-20T10:23:56.726Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsAllowLogging='N',Updated=TO_TIMESTAMP('2020-11-20 12:23:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=545143 ; update ad_table set ischangelog = 'Y',Updated=TO_TIMESTAMP('2020-11-20 12:23:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 where tablename in ( 'AD_BoilerPlate', 'AD_BoilerPlate_Trl', 'AD_Client', 'AD_ClientInfo', 'AD_Column', 'AD_ColumnCallout', 'AD_Element', 'AD_Element_Link', 'AD_Element_Trl', 'AD_EntityType', 'AD_Field', 'AD_Field_ContextMenu', 'AD_Field_Trl', 'AD_FieldGroup', 'AD_FieldGroup_Trl', 'AD_LabelPrinter', 'AD_LabelPrinterFunction', 'AD_Language', 'AD_Menu', 'AD_Menu_Trl', 'AD_MigrationScript', 'AD_Org', 'AD_OrgInfo', 'AD_Printer', 'AD_Printer_Tray', 'AD_PrinterHW', 'AD_PrinterHW_Calibration', 'AD_PrinterHW_MediaSize', 'AD_PrinterHW_MediaTray', 'AD_PrinterRouting', 'AD_PrintFormatItem', 'AD_Process', 'AD_Ref_List', 'AD_Ref_List_Trl', 'AD_Ref_Table', 'AD_Reference', 'AD_Reference_Trl', 'AD_Relation', 'AD_RelationType', 'AD_Role', 'AD_Role_Included', 'AD_Role_OrgAccess', 'AD_Role_PermRequest', 'AD_Role_Record_Access_Config', 'AD_Scheduler', 'AD_Scheduler_Para', 'AD_System', 'AD_Tab', 'AD_Tab_Callout', 'AD_Tab_Trl', 'AD_Table', 'AD_Table_Access', 'AD_Table_Process', 'AD_Table_ScriptValidator', 'AD_Table_Trl', 'AD_Tree', 'AD_TreeBar', 'AD_TreeNode', 'AD_TreeNodeBP', 'AD_TreeNodeCMC', 'AD_TreeNodeCMM', 'AD_TreeNodeCMS', 'AD_TreeNodeCMT', 'AD_TreeNodeMM', 'AD_TreeNodePR', 'AD_TreeNodeU1', 'AD_TreeNodeU2', 'AD_TreeNodeU3', 'AD_TreeNodeU4', 'AD_User_Roles', 'AD_UserQuery', 'AD_Val_Rule', 'AD_Window', 'AD_Window_Access', 'AD_Window_Trl', 'C_AcctSchema', 'C_AcctSchema_Default', 'C_AcctSchema_Element', 'C_AcctSchema_GL', 'C_Activity', 'C_AllocationHdr', 'C_AllocationLine', 'C_Async_Batch', 'C_Async_Batch_Type', 'C_Bank', 'C_BankAccount', 'C_BankStatement', 'C_BankStatementLine', 'C_BankStatementLine_Ref', 'C_BP_BankAccount_Acct', 'C_BP_Customer_Acct', 'C_BP_DocLine_Sort', 'C_BP_EDI', 'C_BP_Employee_Acct', 'C_BP_Group', 'C_BP_Group_Acct', 'C_BPartner_Allotment', 'C_BPartner_Attribute', 'C_Country', 'C_Country_Trl', 'C_Currency', 'C_Customs_Invoice', 'C_Customs_Invoice_Line', 'C_Dunning', 'C_DunningDoc', 'C_DunningDoc_Line', 'C_DunningDoc_Line_Source', 'C_DunningLevel', 'C_DunningLevel_Trl', 'C_Greeting', 'C_Greeting_Trl', 'C_OrderTax', 'C_Payment', 'C_Payment_Request', 'C_Payment_Reservation', 'C_Payment_Reservation_Capture', 'C_PaymentAllocate', 'C_PaymentBatch', 'C_PaymentProcessor', 'C_PaymentTerm', 'C_PaymentTerm_Trl', 'C_PaySelection', 'C_Period', 'C_Period_Trl', 'C_PeriodControl', 'C_Phase', 'C_Phonecall_Schedule', 'C_Phonecall_Schema', 'C_Phonecall_Schema_Version', 'C_Phonecall_Schema_Version_Line', 'C_Postal', 'C_PricingRule', 'C_Project', 'C_Project_Acct', 'C_Project_User', 'C_PurchaseCandidate', 'C_RfQ', 'C_RfQLine', 'C_RfQLineQty', 'C_RfQResponse', 'C_RfQResponseLine', 'C_RfQResponseLineQty', 'C_Tax', 'C_Tax_Trl', 'C_TaxBase', 'C_TaxCategory', 'C_TaxCategory_Trl', 'C_UOM', 'C_UOM_Conversion', 'C_UOM_Trl', 'C_Year', 'DD_Order', 'DD_OrderLine', 'ESR_Import', 'ESR_ImportLine', 'EXP_Format', 'EXP_FormatLine', 'Fact_Acct', 'Fact_Acct_ActivityChangeRequest', 'Fact_Acct_ActivityChangeRequest_Source_v', 'Fact_Acct_Balance', 'Fact_Acct_EndingBalance', 'Fact_Acct_Log', 'Fact_Acct_Summary', 'M_Allergen_Trace', 'M_Allergen_Trace_Trl', 'AD_Sequence', 'C_Queue_WorkPackage', 'M_Product_Allergen_Trace'); update ad_table set ischangelog = 'N',Updated=TO_TIMESTAMP('2020-11-20 12:23:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 where tablename in ('AD_EventLog', 'C_Queue_WorkPackage_Param');
the_stack
--1. Update latest_update field to new date DO $_$ BEGIN PERFORM VOCABULARY_PACK.SetLatestUpdate( pVocabularyName => 'ICD10', pVocabularyDate => (SELECT vocabulary_date FROM sources.icdclaml LIMIT 1), pVocabularyVersion => (SELECT vocabulary_version FROM sources.icdclaml LIMIT 1), pVocabularyDevSchema => 'DEV_ICD10' ); END $_$; --2. Truncate all working tables TRUNCATE TABLE concept_stage; TRUNCATE TABLE concept_relationship_stage; TRUNCATE TABLE concept_synonym_stage; TRUNCATE TABLE pack_content_stage; TRUNCATE TABLE drug_strength_stage; --3. Create temporary tables with classes and modifiers from XML source --modifier classes DROP TABLE IF EXISTS modifier_classes; CREATE UNLOGGED TABLE modifier_classes AS SELECT s1.modifierclass_code, s1.modifierclass_modifier, s1.superclass_code, s1.rubric_id, s1.rubric_kind, l.rubric_label FROM ( SELECT * FROM ( SELECT (xpath('./@code', i.xmlfield))[1]::VARCHAR modifierclass_code, (xpath('./@modifier', i.xmlfield))[1]::VARCHAR modifierclass_modifier, (xpath('./SuperClass/@code', i.xmlfield))[1]::VARCHAR superclass_code, UNNEST(xpath('./Rubric/@id', i.xmlfield))::VARCHAR rubric_id, UNNEST(xpath('./Rubric/@kind', i.xmlfield))::VARCHAR rubric_kind, UNNEST(xpath('./Rubric', i.xmlfield)) rubric_label FROM ( SELECT UNNEST(xpath('/ClaML/ModifierClass', i.xmlfield)) xmlfield FROM sources.icdclaml i ) AS i ) AS s0 ) AS s1 LEFT JOIN LATERAL(SELECT STRING_AGG(ltrim(REGEXP_REPLACE(rubric_label, '\t', '', 'g')), '') AS rubric_label FROM ( SELECT UNNEST(xpath('//text()', s1.rubric_label))::VARCHAR rubric_label ) AS s0) l ON TRUE; --classes DROP TABLE IF EXISTS classes; CREATE UNLOGGED TABLE classes AS WITH classes AS ( SELECT s1.class_code, s1.rubric_kind, s1.superclass_code, l.rubric_label FROM ( SELECT * FROM ( SELECT (xpath('./@code', i.xmlfield))[1]::VARCHAR class_code, l.superclass_code, UNNEST(xpath('./Rubric/@kind', i.xmlfield))::VARCHAR rubric_kind, UNNEST(xpath('./Rubric', i.xmlfield)) rubric_label FROM ( SELECT UNNEST(xpath('/ClaML/Class', i.xmlfield)) xmlfield FROM sources.icdclaml i ) AS i LEFT JOIN LATERAL(SELECT UNNEST(xpath('./SuperClass/@code', i.xmlfield))::VARCHAR superclass_code) l ON TRUE ) AS s0 ) AS s1 LEFT JOIN LATERAL(SELECT STRING_AGG(ltrim(REGEXP_REPLACE(rubric_label, '\t', '', 'g')), '') AS rubric_label FROM ( SELECT UNNEST(xpath('//text()', s1.rubric_label))::VARCHAR rubric_label ) AS s0) l ON TRUE ) --modify classes_table replacing preferred name to preferredLong where it's possible SELECT a.class_code, a.rubric_kind, a.superclass_code, COALESCE(b.rubric_label, a.rubric_label) AS rubric_label FROM classes a LEFT JOIN classes b ON a.class_code = b.class_code AND a.rubric_kind = 'preferred' AND b.rubric_kind = 'preferredLong' WHERE a.rubric_kind <> 'preferredLong'; --4. Fill the concept_stage INSERT INTO concept_stage ( concept_name, domain_id, vocabulary_id, concept_class_id, standard_concept, concept_code, valid_start_date, valid_end_date, invalid_reason ) WITH codes_need_modified AS ( --define all the concepts having modifiers, use filter a.rubric_kind ='modifierlink' SELECT DISTINCT a.class_code, a.rubric_label, a.superclass_code, b.class_code AS concept_code, b.rubric_label AS concept_name, b.superclass_code AS super_concept_code FROM classes a JOIN classes b ON b.class_code LIKE a.class_code || '%' WHERE a.rubric_kind = 'modifierlink' AND b.rubric_kind = 'preferred' AND b.class_code NOT LIKE '%-%' ), codes AS ( SELECT a.*, b.modifierclass_code, b.rubric_label AS modifer_name FROM codes_need_modified a LEFT JOIN modifier_classes b ON SUBSTRING(b.modifierclass_modifier,'^...(.*?)_') = a.class_code AND b.rubric_kind = 'preferred' AND modifierclass_modifier != 'I70M10_4' --looks like a bug ), concepts_modifiers AS ( --add all the modifiers using patterns described in a table --'I70M10_4' with or without gangrene related to gout, seems to be a bug, modifier says [See site code at the beginning of this chapter] SELECT a.concept_code || b.modifierclass_code AS concept_code, CASE WHEN b.modifer_name = 'Kimmelstiel-Wilson syndromeN08.3' --only one modifier that has capital letter in it THEN REGEXP_REPLACE(a.concept_name, '[A-Z]\d\d(\.|-|$).*', '','g') || ', ' || REGEXP_REPLACE(b.modifer_name, '[A-Z]\d\d(\.|-|$).*', '','g') -- remove related code (A52.7) ELSE REGEXP_REPLACE(a.concept_name, '[A-Z]\d\d(\.|-|$).*', '','g') || ', ' || LOWER(REGEXP_REPLACE(b.modifer_name, '[A-Z]\d\d(\.|-|$).*', '','g')) END AS concept_name FROM codes a JOIN codes b ON ( ( SUBSTRING(a.rubric_label, '\D\d\d') = b.concept_code AND a.rubric_label = b.rubric_label AND a.class_code != b.class_code ) OR ( a.rubric_label = '[See at the beginning of this block for subdivisions]' AND a.rubric_label = b.rubric_label AND a.class_code != b.class_code AND b.concept_code = 'K25' ) OR ( a.rubric_label = '[See site code at the beginning of this chapter]' AND a.rubric_label = b.rubric_label AND a.class_code != b.class_code AND b.concept_code LIKE '_00' AND SUBSTRING(b.concept_code, '^\D') = SUBSTRING(a.concept_code, '^\D') AND a.concept_code NOT LIKE 'M91%' -- seems to be ICD10 bag, M91% don't need additional modifiers AND a.concept_code NOT LIKE 'M21.4%' --Flat foot [pes planus] (acquired) ) ) WHERE ( ( a.concept_code NOT LIKE '%.%' AND b.modifierclass_code LIKE '%.%' ) OR ( a.concept_code LIKE '%.%' AND b.modifierclass_code NOT LIKE '%.%' ) ) UNION --basic modifiers having relationship modifier - concept SELECT a.concept_code || a.modifierclass_code AS concept_code, a.concept_name || ', ' || a.modifer_name FROM codes a WHERE ( ( a.concept_code NOT LIKE '%.%' AND a.modifierclass_code LIKE '%.%' ) OR ( a.concept_code LIKE '%.%' AND a.modifierclass_code NOT LIKE '%.%' ) ) AND a.modifierclass_code IS NOT NULL ) SELECT concept_name, NULL AS domain_id, 'ICD10' AS vocabulary_id, CASE WHEN length(concept_code) = 3 THEN 'ICD10 Hierarchy' ELSE 'ICD10 code' END AS concept_class_id, NULL AS standard_concept, concept_code, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = 'ICD10' ) AS valid_start_date, TO_DATE('20991231', 'YYYYMMDD') AS valid_end_date, NULL AS invalid_reason FROM ( --full list of concepts SELECT * FROM concepts_modifiers UNION SELECT class_code, CASE WHEN rubric_label LIKE 'Emergency use of%' THEN rubric_label ELSE REGEXP_REPLACE(rubric_label, '[A-Z]\d\d(\.|-|$).*', '','g') -- remove related code (A52.7) i.e. Late syphilis of kidneyA52.7 but except of cases like "Emergency use of U07.0" END AS concept_name FROM classes WHERE rubric_kind = 'preferred' AND class_code NOT LIKE '%-%' ) AS s0 WHERE concept_code ~ '[A-Z]\d\d.*' AND concept_code !~ 'M(21.3|21.5|21.6|21.7|21.8|24.3|24.7|54.2|54.3|54.4|54.5|54.6|65.3|65.4|70.0|70.2|70.3|70.4|70.5|70.6|70.7|71.2|72.0|72.1|72.2|76.1|76.2|76.3|76.4|76.5|76.6|76.7|76.8|76.9|77.0|77.1|77.2|77.3|77.4|77.5|79.4|85.2|88.0|94.0)+\d+' -- add chapters UNION ALL SELECT rubric_label AS concept_name, 'Observation' AS domain_id, 'ICD10' AS vocabulary_id, 'ICD10 Chapter' AS concept_class_id, NULL AS standard_concept, class_code AS concept_code, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = 'ICD10' ) AS valid_start_date, TO_DATE('20991231', 'YYYYMMDD') AS valid_end_date, NULL AS invalid_reason FROM classes WHERE class_code ~ '^V\D|^I\D|^X\D|^V$|^I$|^X$' AND rubric_kind = 'preferred' -- add subchapters UNION ALL SELECT rubric_label AS concept_name, 'Condition' AS domain_id, 'ICD10' AS vocabulary_id, 'ICD10 SubChapter' AS concept_class_id, NULL AS standard_concept, class_code AS concept_code, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = 'ICD10' ) AS valid_start_date, TO_DATE('20991231', 'YYYYMMDD') AS valid_end_date, NULL AS invalid_reason FROM classes WHERE class_code LIKE '%-%' AND rubric_kind = 'preferred'; UPDATE concept_stage cs SET concept_name = i.new_name FROM ( SELECT c.concept_code, cs.concept_name || ' ' || LOWER(c.concept_name) AS new_name FROM concept_stage c LEFT JOIN classes cl ON c.concept_code = cl.class_code LEFT JOIN concept_stage cs ON cl.superclass_code = cs.concept_code WHERE c.concept_code ~ '((Y06)|(Y07)).+' AND rubric_kind = 'preferred' UNION ALL SELECT c.concept_code, c.concept_name || ' as the cause of abnormal reaction of the patient, or of later complication, without mention of misadventure at the time of the procedure' FROM concept_stage c WHERE c.concept_code ~ '((Y83)|(Y84)).+' AND c.concept_code != 'Y83-Y84' UNION ALL SELECT c.concept_code, 'Adverse effects in the therapeutic use of ' || LOWER(concept_name) FROM concept_stage c WHERE concept_code >= 'Y40' AND concept_code < 'Y60' UNION ALL SELECT c.concept_code, REPLACE(cs.concept_name, 'during%', '') || ' ' || LOWER(c.concept_name) FROM concept_stage c LEFT JOIN classes cl ON c.concept_code = cl.class_code LEFT JOIN concept_stage cs ON cl.superclass_code = cs.concept_code WHERE c.concept_code ~ '((Y60)|(Y61)|(Y62)).+' AND rubric_kind = 'preferred' ) i WHERE cs.concept_code = i.concept_code; --5. Working with concept_manual table DO $_$ BEGIN PERFORM VOCABULARY_PACK.ProcessManualConcepts(); END $_$; --6. Working with concept_relationship_manual table DO $_$ BEGIN PERFORM VOCABULARY_PACK.ProcessManualRelationships(); END $_$; --7. Working with replacement mappings DO $_$ BEGIN PERFORM VOCABULARY_PACK.CheckReplacementMappings(); END $_$; --8. Add mapping from deprecated to fresh concepts DO $_$ BEGIN PERFORM VOCABULARY_PACK.AddFreshMAPSTO(); END $_$; --9. Deprecate 'Maps to' mappings to deprecated and upgraded concepts DO $_$ BEGIN PERFORM VOCABULARY_PACK.DeprecateWrongMAPSTO(); END $_$; --10. Add "subsumes" relationship between concepts where the concept_code is like of another CREATE INDEX IF NOT EXISTS trgm_idx ON concept_stage USING GIN (concept_code devv5.gin_trgm_ops); --for LIKE patterns ANALYZE concept_stage; INSERT INTO concept_relationship_stage ( concept_code_1, concept_code_2, vocabulary_id_1, vocabulary_id_2, relationship_id, valid_start_date, valid_end_date, invalid_reason ) SELECT c1.concept_code AS concept_code_1, c2.concept_code AS concept_code_2, c1.vocabulary_id AS vocabulary_id_1, c1.vocabulary_id AS vocabulary_id_2, 'Subsumes' AS relationship_id, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = c1.vocabulary_id ) AS valid_start_date, TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL AS invalid_reason FROM concept_stage c1, concept_stage c2 WHERE c2.concept_code LIKE c1.concept_code || '%' AND c1.concept_code <> c2.concept_code AND NOT EXISTS ( SELECT 1 FROM concept_relationship_stage r_int WHERE r_int.concept_code_1 = c1.concept_code AND r_int.concept_code_2 = c2.concept_code AND r_int.relationship_id = 'Subsumes' ) AND c2.concept_class_id NOT IN ( 'ICD10 Chapter', 'ICD10 SubChapter' ) AND c1.concept_class_id NOT IN ( 'ICD10 Chapter', 'ICD10 SubChapter' ); DROP INDEX trgm_idx; --11. Update domain_id for ICD10 from SNOMED, OMOP Extension UPDATE concept_stage cs SET domain_id = i.domain_id FROM ( SELECT DISTINCT cs1.concept_code, FIRST_VALUE(c2.domain_id) OVER ( PARTITION BY cs1.concept_code ORDER BY CASE c2.domain_id WHEN 'Condition' THEN 1 WHEN 'Observation' THEN 2 WHEN 'Procedure' THEN 3 WHEN 'Measurement' THEN 4 WHEN 'Device' THEN 5 ELSE 6 END ) AS domain_id FROM concept_relationship_stage crs JOIN concept_stage cs1 ON cs1.concept_code = crs.concept_code_1 AND cs1.vocabulary_id = crs.vocabulary_id_1 AND cs1.vocabulary_id = 'ICD10' JOIN concept c2 ON c2.concept_code = crs.concept_code_2 AND c2.vocabulary_id = crs.vocabulary_id_2 AND c2.vocabulary_id IN ('SNOMED', 'OMOP Extension') WHERE crs.relationship_id = 'Maps to' AND crs.invalid_reason IS NULL UNION ALL SELECT DISTINCT cs1.concept_code, FIRST_VALUE(c2.domain_id) OVER ( PARTITION BY cs1.concept_code ORDER BY CASE c2.domain_id WHEN 'Condition' THEN 1 WHEN 'Observation' THEN 2 WHEN 'Procedure' THEN 3 WHEN 'Measurement' THEN 4 WHEN 'Device' THEN 5 ELSE 6 END ) FROM concept_relationship cr JOIN concept c1 ON c1.concept_id = cr.concept_id_1 AND c1.vocabulary_id = 'ICD10' JOIN concept c2 ON c2.concept_id = cr.concept_id_2 AND c2.vocabulary_id IN ('SNOMED', 'OMOP Extension') JOIN concept_stage cs1 ON cs1.concept_code = c1.concept_code AND cs1.vocabulary_id = c1.vocabulary_id WHERE cr.relationship_id = 'Maps to' AND cr.invalid_reason IS NULL AND NOT EXISTS ( SELECT 1 FROM concept_relationship_stage crs_int WHERE crs_int.concept_code_1 = cs1.concept_code AND crs_int.vocabulary_id_1 = cs1.vocabulary_id AND crs_int.relationship_id = cr.relationship_id ) ) i WHERE i.concept_code = cs.concept_code AND cs.vocabulary_id = 'ICD10'; --TODO: check why the actual U* code limitation is not used. --Only unassigned Emergency use codes (starting with U) don't have mappings to SNOMED, put Observation as closest meaning to Unknown domain UPDATE concept_stage SET domain_id = 'Observation' WHERE domain_id IS NULL; --12. Check for NULL in domain_id ALTER TABLE concept_stage ALTER COLUMN domain_id SET NOT NULL; ALTER TABLE concept_stage ALTER COLUMN domain_id DROP NOT NULL; --13. Add hierarchical relationships --add relationship from chapters to subchapters and vice versa INSERT INTO concept_relationship_stage ( concept_code_1, concept_code_2, vocabulary_id_1, vocabulary_id_2, relationship_id, valid_start_date, valid_end_date, invalid_reason ) SELECT superclass_code AS concept_code_1, class_code AS concept_code_2, 'ICD10' AS vocabulary_id_1, 'ICD10' AS vocabulary_id_2, 'Subsumes' AS relationship_id, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = 'ICD10' ) AS valid_start_date, TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL AS invalid_reason FROM classes WHERE class_code LIKE '%-%' AND rubric_kind = 'preferred' AND superclass_code ~ '^V\D|^I\D|^X\D|^V$|^I$|^X$' UNION ALL SELECT class_code AS concept_code_1, superclass_code AS concept_code_2, 'ICD10' AS vocabulary_id_1, 'ICD10' AS vocabulary_id_2, 'Is a' AS relationship_id, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = 'ICD10' ) AS valid_start_date, TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL AS invalid_reason FROM classes WHERE class_code LIKE '%-%' AND rubric_kind = 'preferred' AND superclass_code ~ '^V\D|^I\D|^X\D|^V$|^I$|^X$'; --add relationship from subchapters to blocks and vice versa INSERT INTO concept_relationship_stage ( concept_code_1, concept_code_2, vocabulary_id_1, vocabulary_id_2, relationship_id, valid_start_date, valid_end_date, invalid_reason ) SELECT superclass_code AS concept_code_1, class_code AS concept_code_2, 'ICD10' AS vocabulary_id_1, 'ICD10' AS vocabulary_id_2, 'Subsumes' AS relationship_id, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = 'ICD10' ) AS valid_start_date, TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL AS invalid_reason FROM classes WHERE rubric_kind = 'preferred' AND superclass_code LIKE '%-%' UNION ALL SELECT class_code AS concept_code_1, superclass_code AS concept_code_2, 'ICD10' AS vocabulary_id_1, 'ICD10' AS vocabulary_id_2, 'Is a' AS relationship_id, ( SELECT latest_update FROM vocabulary WHERE vocabulary_id = 'ICD10' ) AS valid_start_date, TO_DATE('20991231', 'yyyymmdd') AS valid_end_date, NULL AS invalid_reason FROM classes WHERE rubric_kind = 'preferred' AND superclass_code LIKE '%-%'; --14. Add mapping from deprecated to fresh concepts for 'Maps to value' DO $_$ BEGIN PERFORM VOCABULARY_PACK.AddFreshMapsToValue(); END $_$; --15. Build reverse relationship. This is necessary for next point INSERT INTO concept_relationship_stage ( concept_code_1, concept_code_2, vocabulary_id_1, vocabulary_id_2, relationship_id, valid_start_date, valid_end_date, invalid_reason ) SELECT crs.concept_code_2, crs.concept_code_1, crs.vocabulary_id_2, crs.vocabulary_id_1, r.reverse_relationship_id, crs.valid_start_date, crs.valid_end_date, crs.invalid_reason FROM concept_relationship_stage crs JOIN relationship r ON r.relationship_id = crs.relationship_id WHERE NOT EXISTS ( -- the inverse record SELECT 1 FROM concept_relationship_stage i WHERE crs.concept_code_1 = i.concept_code_2 AND crs.concept_code_2 = i.concept_code_1 AND crs.vocabulary_id_1 = i.vocabulary_id_2 AND crs.vocabulary_id_2 = i.vocabulary_id_1 AND r.reverse_relationship_id = i.relationship_id ); --16. Deprecate all relationships in concept_relationship that aren't exist in concept_relationship_stage INSERT INTO concept_relationship_stage ( concept_code_1, concept_code_2, vocabulary_id_1, vocabulary_id_2, relationship_id, valid_start_date, valid_end_date, invalid_reason ) SELECT a.concept_code, b.concept_code, a.vocabulary_id, b.vocabulary_id, relationship_id, r.valid_start_date, CURRENT_DATE, 'D' FROM concept a JOIN concept_relationship r ON a.concept_id = concept_id_1 AND r.invalid_reason IS NULL JOIN concept b ON b.concept_id = concept_id_2 WHERE 'ICD10' IN ( a.vocabulary_id, b.vocabulary_id ) AND NOT EXISTS ( SELECT 1 FROM concept_relationship_stage crs_int WHERE crs_int.concept_code_1 = a.concept_code AND crs_int.concept_code_2 = b.concept_code AND crs_int.vocabulary_id_1 = a.vocabulary_id AND crs_int.vocabulary_id_2 = b.vocabulary_id AND crs_int.relationship_id = r.relationship_id ) AND a.concept_class_id NOT IN ( 'ICD10 SubChapter', 'ICD10 Chapter' ) AND b.concept_class_id NOT IN ( 'ICD10 SubChapter', 'ICD10 Chapter' ); --17. Clean up DROP TABLE modifier_classes; DROP TABLE classes; -- At the end, the three tables concept_stage, concept_relationship_stage and concept_synonym_stage should be ready to be fed into the generic_update.sql script
the_stack
CREATE FOREIGN TABLE test_stj_stream (id int, data jsonb, val float8, col1 int, col2 int, col0 int) SERVER pipelinedb; -- Simple joins CREATE TABLE test_stj_t0 (tid integer, data text, val float8); INSERT INTO test_stj_t0 (tid, data, val) VALUES (0, '0', 0.1); INSERT INTO test_stj_t0 (tid, data, val) VALUES (0, '1', 1.2); INSERT INTO test_stj_t0 (tid, data, val) VALUES (1, '2', 2.3); INSERT INTO test_stj_t0 (tid, data, val) VALUES (1, '3', 3.4); INSERT INTO test_stj_t0 (tid, data, val) VALUES (2, '4', 4.5); INSERT INTO test_stj_t0 (tid, data, val) VALUES (2, '5', 5.6); INSERT INTO test_stj_t0 (tid, data, val) VALUES (3, '6', 6.7); INSERT INTO test_stj_t0 (tid, data, val) VALUES (4, '0', 4.0); INSERT INTO test_stj_t0 (tid, data, val) VALUES (0, '7', -2.3); INSERT INTO test_stj_t0 (tid, data, val) VALUES (0, '8', -3.4); INSERT INTO test_stj_t0 (tid, data, val) VALUES (1, '9', -4.5); INSERT INTO test_stj_t0 (tid, data, val) VALUES (2, '10', -5.6); INSERT INTO test_stj_t0 (tid, data, val) VALUES (7, '[0, 1]', -6.7); INSERT INTO test_stj_t0 (tid, data, val) VALUES (7, '"0"', -6.7); INSERT INTO test_stj_t0 (tid, data, val) VALUES (7, '"1"', -6.7); SELECT pg_sleep(0.1); CREATE VIEW test_stj0 AS SELECT s.id::integer, t.tid, t.data FROM test_stj_stream s JOIN test_stj_t0 t ON s.id = t.tid; CREATE VIEW test_stj1 AS SELECT s.id::integer, t.tid, t.data, s.data as jdata FROM test_stj_t0 t JOIN test_stj_stream s ON s.id = t.tid WHERE s.data::jsonb = '[0, 1]'; CREATE VIEW test_stj2 AS SELECT test_stj_stream.id::integer, test_stj_t0.val FROM test_stj_t0, test_stj_stream WHERE test_stj_t0.tid = 0; CREATE VIEW test_stj3 AS SELECT s.id::integer, t.val, s.data::json FROM test_stj_t0 t JOIN test_stj_stream s ON s.id = t.tid AND s.id = t.val; INSERT INTO test_stj_stream (id, data) VALUES (0, '[0, 1]'); INSERT INTO test_stj_stream (id, data) VALUES (0, '{"key": 4}'); INSERT INTO test_stj_stream (id, data) VALUES (1, '4'); INSERT INTO test_stj_stream (id, data) VALUES (2, '[1, 0]'); INSERT INTO test_stj_stream (id, data) VALUES (2, '{ "key": [0, 1] }'); INSERT INTO test_stj_stream (id, data) VALUES (3, '42'); INSERT INTO test_stj_stream (id, data) VALUES (4, '"matched"'); SELECT * FROM test_stj0 ORDER BY id; SELECT * FROM test_stj1 ORDER BY id; SELECT * FROM test_stj2 ORDER BY id, val; SELECT * FROM test_stj3 ORDER BY id; -- Stream-table joins involving multiple tables CREATE TABLE test_stj_t1 (jid jsonb, data jsonb); INSERT INTO test_stj_t1 (jid, data) VALUES ('[0, 1]', '"json string"'); INSERT INTO test_stj_t1 (jid, data) VALUES ('"0"', '71'); INSERT INTO test_stj_t1 (jid, data) VALUES ('"1"', '[1, 2, 4, 8, 16]'); INSERT INTO test_stj_t1 (jid, data) VALUES ('[1, 0]', '{"key": "v"}'); INSERT INTO test_stj_t1 (jid, data) VALUES ('2', '["one", "two", "three"]'); INSERT INTO test_stj_t1 (jid, data) VALUES ('3', '["four", 5, "six"]'); INSERT INTO test_stj_t1 (jid, data) VALUES ('4', '{"k0": {"k1": "v"}}'); INSERT INTO test_stj_t1 (jid, data) VALUES ('{}', '0'); INSERT INTO test_stj_t1 (jid, data) VALUES ('[0, 1]', '["strrrr", "iiing"]'); INSERT INTO test_stj_t1 (jid, data) VALUES ('[]', '[{}, {}]'); INSERT INTO test_stj_t1 (jid, data) VALUES ('"0"', '[[]]'); INSERT INTO test_stj_t1 (jid, data) VALUES ('"1"', '[32, 64, 128]'); SELECT pg_sleep(0.1); CREATE VIEW test_stj4 AS SELECT t1.jid, s.data::jsonb AS stream_data, t0.data as table_data FROM test_stj_t1 t1 JOIN test_stj_stream s ON t1.jid = s.data JOIN test_stj_t0 t0 ON t0.data::jsonb = t1.jid; INSERT INTO test_stj_stream (id, data) VALUES (0, '[0, 1]'); INSERT INTO test_stj_stream (id, data) VALUES (0, '{"key": 4}'); INSERT INTO test_stj_stream (id, data) VALUES (1, '4'); INSERT INTO test_stj_stream (id, data) VALUES (2, '[1, 0]'); INSERT INTO test_stj_stream (id, data) VALUES (2, '{ "key": [0, 1] }'); INSERT INTO test_stj_stream (id, data) VALUES (3, '42'); INSERT INTO test_stj_stream (id, data) VALUES (4, '"not here"'); SELECT * FROM test_stj4 ORDER BY jid; -- Stream-table joins with GROUP BYs and aggregates CREATE TABLE test_stj_t2 (id integer, str text, val float); INSERT INTO test_stj_t2 (id, str, val) VALUES (0, 'str0', 101.1); INSERT INTO test_stj_t2 (id, str, val) VALUES (1, 'str1', 202.2); INSERT INTO test_stj_t2 (id, str, val) VALUES (2, 'str2', 42.42); INSERT INTO test_stj_t2 (id, str, val) VALUES (3, 'not here', 1000.1); SELECT pg_sleep(0.1); CREATE VIEW test_stj5 AS SELECT s.id::integer, t.str, sum(s.val::float8 + t.val) FROM test_stj_stream s JOIN test_stj_t2 t ON s.id = t.id GROUP BY s.id, t.str; INSERT INTO test_stj_stream (id, val) VALUES (0, -101.1); INSERT INTO test_stj_stream (id, val) VALUES (1, -202.2); INSERT INTO test_stj_stream (id, val) VALUES (4, 2000.201); INSERT INTO test_stj_t2 (id, str, val) VALUES (5, 'joined', 52.0); SELECT pg_sleep(0.1); INSERT INTO test_stj_stream (id, val) VALUES (5, 0.52); SELECT * FROM test_stj5 ORDER BY id; CREATE TABLE test_stj_t3 (col0 integer, col1 integer, col2 integer, col3 integer); INSERT INTO test_stj_t3 (col0, col1, col2, col3) VALUES (0, 0, 0, 42); INSERT INTO test_stj_t3 (col0, col1, col2, col3) VALUES (0, 1, 1, 1000); SELECT pg_sleep(0.1); CREATE VIEW test_stj6 AS SELECT t.col2, sum(s.col0::integer + t.col3) FROM test_stj_stream s JOIN test_stj_t3 t ON s.col1::integer = t.col1 GROUP BY t.col2; INSERT INTO test_stj_stream (col0, col1, col2) VALUES (400, 1, 0); INSERT INTO test_stj_stream (col0, col1, col2) VALUES (0, 0, 0); INSERT INTO test_stj_stream (col0, col1, col2) VALUES (-1200, 1, 0); SELECT * FROM test_stj6 ORDER BY col2; CREATE VIEW stj_no_tl AS SELECT COUNT(*) FROM test_stj_stream JOIN test_stj_t0 ON test_stj_stream.id::integer = test_stj_t0.tid; INSERT INTO test_stj_stream (id) VALUES (0); SELECT * FROM stj_no_tl; CREATE TABLE test_stj_location (locid integer); CREATE TABLE test_stj_blocks (locid integer, ip inet); CREATE INDEX loc_index ON test_stj_location(locid); INSERT INTO test_stj_location (locid) VALUES (42); INSERT INTO test_stj_blocks (locid, ip) VALUES (42, '0.0.0.0'); CREATE VIEW test_stj7 AS SELECT (test_stj_stream.data::jsonb->>'key')::text, avg((test_stj_stream.data::jsonb->>'value')::decimal), test_stj_location.locid FROM test_stj_stream, test_stj_blocks JOIN test_stj_location USING(locid) WHERE test_stj_blocks.ip = (test_stj_stream.data::jsonb->>'ip')::inet GROUP BY (test_stj_stream.data::jsonb->>'key')::text, test_stj_location.locid; INSERT INTO test_stj_stream (data) VALUES ('{"key": "1", "value": 42.42, "ip": "0.0.0.0"}'); INSERT INTO test_stj_stream (data) VALUES ('{"key": "1", "value": 420.42, "ip": "0.0.0.0"}'); INSERT INTO test_stj_stream (data) VALUES ('{"key": "2", "value": 4200.42, "ip": "0.0.0.0"}'); INSERT INTO test_stj_stream (data) VALUES ('{"key": "2", "value": 42020.42, "ip": "0.0.0.0"}'); SELECT pg_sleep(0.1); SELECT * FROM test_stj7; CREATE VIEW test_stj8 AS SELECT (test_stj_stream.data::jsonb#>>'{header,game}')::text as game, (test_stj_stream.data::jsonb#>>'{body,peripheryID}')::text as peripheryID, to_timestamp((test_stj_stream.data::jsonb#>>'{body,time}')::int) as created_at, avg((test_stj_stream.data::jsonb#>>'{body,avgRoundTripTime}')::decimal) as avgrtt, test_stj_location.locid FROM test_stj_stream, test_stj_blocks JOIN test_stj_location USING(locid) WHERE test_stj_blocks.ip = (test_stj_stream.data::jsonb#>>'{body,clientIP}')::inet GROUP BY game, peripheryID, created_at, test_stj_location.locid; INSERT INTO test_stj_stream (data) VALUES ('{"header": {"ver": 1, "op_type": 402, "op_asset": null, "spa_id": 6333813, "game": "wot", "creation_time": 1427713483, "reserved1": null, "reserved2": null}, "body": {"peripheryID": 101, "arenaID": 2128201, "arenaGeometryID": 24, "arenaGameplayID": 1, "time": 1427712977, "clientIP": "0.0.0.0", "packetsReceived": 6264, "packetsSent": 5059, "packetsResent": 4, "minRoundTripTime": 0.043896623, "maxRoundTripTime": 0.68855155, "avgRoundTripTime": 10}}'); INSERT INTO test_stj_stream (data) VALUES ('{"header": {"ver": 1, "op_type": 402, "op_asset": null, "spa_id": 6333813, "game": "wot", "creation_time": 1427713483, "reserved1": null, "reserved2": null}, "body": {"peripheryID": 101, "arenaID": 2128201, "arenaGeometryID": 24, "arenaGameplayID": 1, "time": 1427712977, "clientIP": "0.0.0.0", "packetsReceived": 6264, "packetsSent": 5059, "packetsResent": 4, "minRoundTripTime": 0.043896623, "maxRoundTripTime": 0.68855155, "avgRoundTripTime": 20}}'); INSERT INTO test_stj_stream (data) VALUES ('{"header": {"ver": 1, "op_type": 402, "op_asset": null, "spa_id": 6333813, "game": "wot", "creation_time": 1427713483, "reserved1": null, "reserved2": null}, "body": {"peripheryID": 101, "arenaID": 2128201, "arenaGeometryID": 24, "arenaGameplayID": 1, "time": 1427712977, "clientIP": "0.0.0.0", "packetsReceived": 6264, "packetsSent": 5059, "packetsResent": 4, "minRoundTripTime": 0.043896623, "maxRoundTripTime": 0.68855155, "avgRoundTripTime": 30}}'); SELECT pg_sleep(0.1); SELECT * FROM test_stj8; DROP FOREIGN TABLE test_stj_stream CASCADE; -- Regression test for join with empty table. CREATE FOREIGN TABLE test_stj_empty_stream (x int) SERVER pipelinedb; CREATE TABLE test_stj_empty (x int); CREATE VIEW test_stj_empty_join AS SELECT test_stj_empty_stream.x::int FROM test_stj_empty_stream JOIN test_stj_empty ON test_stj_empty_stream.x = test_stj_empty.x; INSERT INTO test_stj_empty_stream (x) VALUES (0); SELECT * FROM test_stj_empty_join; -- STJ involving sliding windows CREATE FOREIGN TABLE test_stj_sw0_s (x integer, y integer) SERVER pipelinedb; CREATE TABLE test_stj_sw0_t AS SELECT x, x AS y FROM generate_series(0, 99) AS x; CREATE VIEW test_stj_sw0 AS SELECT s.x, s.y, t.x AS t_x, count(*) FROM test_stj_sw0_s s JOIN test_stj_sw0_t t USING (x) WHERE (s.arrival_timestamp > clock_timestamp() - interval '4 seconds') GROUP by s.x, s.y, t_x; INSERT INTO test_stj_sw0_s (x, y) SELECT x, x AS y FROM generate_series(0, 9) AS x; INSERT INTO test_stj_sw0_s (x, y) SELECT x, x AS y FROM generate_series(0, 9) AS x; INSERT INTO test_stj_sw0_s (x, y) SELECT x, x AS y FROM generate_series(0, 9) AS x; SELECT * FROM test_stj_sw0 ORDER BY x, y, t_x; SELECT pg_sleep(5); SELECT * FROM test_stj_sw0 ORDER BY x, y, t_x; DROP VIEW test_stj_sw0; DROP FOREIGN TABLE test_stj_sw0_s CASCADE; DROP TABLE test_stj_sw0_t; CREATE TABLE test_stj_t4 (x integer, y integer, z integer); CREATE FUNCTION test_stj_foo(integer) RETURNS integer AS $$ BEGIN RETURN 0; END $$ LANGUAGE plpgsql; CREATE FOREIGN TABLE stj_deps_stream (x int) SERVER pipelinedb; CREATE VIEW stj_deps AS SELECT test_stj_foo(s.x::integer), t.x FROM stj_deps_stream s JOIN test_stj_t4 t ON s.x = t.x; -- Table columns being joined on can't be dropped, but unused columns can be ALTER TABLE test_stj_t4 DROP COLUMN y; -- Functions used by CVs can't be dropped DROP FUNCTION test_stj_foo(integer); DROP VIEW stj_deps; -- Now we can drop everything ALTER TABLE test_stj_t4 DROP COLUMN x; DROP TABLE test_stj_t4; DROP FUNCTION test_stj_foo(integer); DROP FOREIGN TABLE stj_deps_stream CASCADE; -- Stream-view joins CREATE FOREIGN TABLE test_svj_stream (tid int) SERVER pipelinedb; CREATE VIEW test_stj_v0 AS SELECT * from test_stj_t0; CREATE VIEW svj AS SELECT COUNT(*) FROM test_svj_stream s JOIN test_stj_v0 v ON s.tid::integer = v.tid; INSERT INTO test_svj_stream (tid) SELECT 0 FROM generate_series(1, 1000); INSERT INTO test_svj_stream (tid) SELECT 1 FROM generate_series(1, 1000); SELECT pg_sleep(0.1); SELECT * FROM svj; DROP VIEW svj; DROP VIEW test_stj_v0; DROP FOREIGN TABLE test_svj_stream CASCADE; DROP TABLE test_stj_t0; DROP TABLE test_stj_t1; DROP TABLE test_stj_t2; DROP TABLE test_stj_t3; DROP TABLE test_stj_location; DROP TABLE test_stj_blocks; DROP TABLE test_stj_empty CASCADE; -- Join types CREATE TABLE test_stj_t (x int); INSERT INTO test_stj_t (x) SELECT generate_series(0, 1000) AS x; CREATE FOREIGN TABLE test_stj_stream (x int) SERVER pipelinedb; CREATE VIEW test_stj_inner AS SELECT s.x, count(*) FROM test_stj_stream AS s JOIN test_stj_t AS t ON (s.x = t.x) GROUP BY s.x; CREATE VIEW test_stj_left AS SELECT s.x, count(*) FROM test_stj_stream AS s LEFT JOIN test_stj_t AS t ON (s.x = t.x) GROUP BY s.x; CREATE VIEW test_stj_right AS SELECT s.x, count(*) FROM test_stj_t AS t RIGHT JOIN test_stj_stream AS s ON (s.x = t.x) GROUP BY s.x; CREATE VIEW test_stj_anti AS SELECT s.x, count(*) FROM test_stj_stream AS s LEFT JOIN test_stj_t AS t ON (s.x = t.x) WHERE t.x IS NULL GROUP BY s.x; CREATE VIEW test_stj_semi AS SELECT s.x, count(*) FROM test_stj_stream AS s WHERE EXISTS (SELECT 1 FROM test_stj_t AS t WHERE t.x = s.x) GROUP BY s.x; CREATE VIEW test_stj_cross AS SELECT s.x, count(*) FROM test_stj_stream AS s, test_stj_t AS t GROUP BY s.x; INSERT INTO test_stj_stream (x) SELECT generate_series(0, 5) AS x; INSERT INTO test_stj_stream (x) SELECT generate_series(2000, 2005) AS x; SELECT * FROM test_stj_inner ORDER BY x; SELECT * FROM test_stj_left ORDER BY x; SELECT * FROM test_stj_right ORDER BY x; SELECT * FROM test_stj_anti ORDER BY x; SELECT * FROM test_stj_semi ORDER BY x; SELECT * FROM test_stj_cross ORDER BY x; SELECT pipelinedb.truncate_continuous_view('test_stj_inner'); SELECT pipelinedb.truncate_continuous_view('test_stj_left'); SELECT pipelinedb.truncate_continuous_view('test_stj_right'); SELECT pipelinedb.truncate_continuous_view('test_stj_anti'); SELECT pipelinedb.truncate_continuous_view('test_stj_semi'); SELECT pipelinedb.truncate_continuous_view('test_stj_cross'); CREATE INDEX test_stj_t_idx ON test_stj_t (x); ANALYZE test_stj_t; INSERT INTO test_stj_stream (x) SELECT generate_series(0, 5) AS x; INSERT INTO test_stj_stream (x) SELECT generate_series(2000, 2005) AS x; SELECT * FROM test_stj_inner ORDER BY x; SELECT * FROM test_stj_left ORDER BY x; SELECT * FROM test_stj_right ORDER BY x; SELECT * FROM test_stj_anti ORDER BY x; SELECT * FROM test_stj_semi ORDER BY x; SELECT * FROM test_stj_cross ORDER BY x; DROP FOREIGN TABLE test_stj_stream CASCADE; DROP TABLE test_stj_t; CREATE TABLE partitioned_t ( key integer, value text ) PARTITION BY LIST (key); CREATE TABLE partitioned_t_0 PARTITION OF partitioned_t FOR VALUES IN (0); CREATE TABLE partitioned_t_1 PARTITION OF partitioned_t FOR VALUES IN (1); CREATE TABLE partitioned_t_2 PARTITION OF partitioned_t FOR VALUES IN (2); CREATE TABLE partitioned_t_3 PARTITION OF partitioned_t FOR VALUES IN (3); CREATE TABLE partitioned_t_4 PARTITION OF partitioned_t FOR VALUES IN (4); CREATE TABLE partitioned_t_5 PARTITION OF partitioned_t FOR VALUES IN (5); CREATE TABLE partitioned_t_6 PARTITION OF partitioned_t FOR VALUES IN (6); CREATE TABLE partitioned_t_7 PARTITION OF partitioned_t FOR VALUES IN (7); CREATE TABLE partitioned_t_8 PARTITION OF partitioned_t FOR VALUES IN (8); CREATE TABLE partitioned_t_9 PARTITION OF partitioned_t FOR VALUES IN (9); INSERT INTO partitioned_t SELECT x, 'key' || x AS key FROM generate_series(0, 9) x; CREATE FOREIGN TABLE partitioned_s ( key integer ) SERVER pipelinedb; CREATE VIEW partitioned_stj WITH (action=materialize) AS SELECT t.key, t.value, count(*) FROM partitioned_t t JOIN partitioned_s s ON t.key = s.key GROUP BY t.key, t.value; INSERT INTO partitioned_s SELECT x FROM generate_series(0, 9) x; SELECT * FROM partitioned_stj ORDER BY key, value; INSERT INTO partitioned_s SELECT x FROM generate_series(0, 5) x; SELECT * FROM partitioned_stj ORDER BY key, value; INSERT INTO partitioned_s SELECT x FROM generate_series(0, 3) x; SELECT * FROM partitioned_stj ORDER BY key, value; DROP FOREIGN TABLE partitioned_s CASCADE; DROP TABLE partitioned_t;
the_stack
-- where7.test -- -- db eval { -- CREATE TABLE t2(a INTEGER PRIMARY KEY,b,c,d,e,f TEXT,g); -- INSERT INTO t2 VALUES(1,11,1001,1.001,100.1,'bcdefghij','yxwvuts'); -- INSERT INTO t2 VALUES(2,22,1001,2.002,100.1,'cdefghijk','yxwvuts'); -- INSERT INTO t2 VALUES(3,33,1001,3.0029999999999997,100.1,'defghijkl','xwvutsr'); -- INSERT INTO t2 VALUES(4,44,2002,4.004,200.2,'efghijklm','xwvutsr'); -- INSERT INTO t2 VALUES(5,55,2002,5.004999999999999,200.2,'fghijklmn','xwvutsr'); -- INSERT INTO t2 VALUES(6,66,2002,6.005999999999999,200.2,'ghijklmno','xwvutsr'); -- INSERT INTO t2 VALUES(7,77,3003,7.007,300.29999999999995,'hijklmnop','xwvutsr'); -- INSERT INTO t2 VALUES(8,88,3003,8.008,300.29999999999995,'ijklmnopq','wvutsrq'); -- INSERT INTO t2 VALUES(9,99,3003,9.008999999999999,300.29999999999995,'jklmnopqr','wvutsrq'); -- INSERT INTO t2 VALUES(10,110,4004,10.009999999999998,400.4,'klmnopqrs','wvutsrq'); -- INSERT INTO t2 VALUES(11,121,4004,11.011,400.4,'lmnopqrst','wvutsrq'); -- INSERT INTO t2 VALUES(12,132,4004,12.011999999999999,400.4,'mnopqrstu','wvutsrq'); -- INSERT INTO t2 VALUES(13,143,5005,13.012999999999998,500.5,'nopqrstuv','vutsrqp'); -- INSERT INTO t2 VALUES(14,154,5005,14.014,500.5,'opqrstuvw','vutsrqp'); -- INSERT INTO t2 VALUES(15,165,5005,15.014999999999999,500.5,'pqrstuvwx','vutsrqp'); -- INSERT INTO t2 VALUES(16,176,6006,16.016,600.5999999999999,'qrstuvwxy','vutsrqp'); -- INSERT INTO t2 VALUES(17,187,6006,17.017,600.5999999999999,'rstuvwxyz','vutsrqp'); -- INSERT INTO t2 VALUES(18,198,6006,18.017999999999997,600.5999999999999,'stuvwxyza','utsrqpo'); -- INSERT INTO t2 VALUES(19,209,7007,19.019,700.6999999999999,'tuvwxyzab','utsrqpo'); -- INSERT INTO t2 VALUES(20,220,7007,20.019999999999996,700.6999999999999,'uvwxyzabc','utsrqpo'); -- INSERT INTO t2 VALUES(21,231,7007,21.020999999999997,700.6999999999999,'vwxyzabcd','utsrqpo'); -- INSERT INTO t2 VALUES(22,242,8008,22.022,800.8,'wxyzabcde','utsrqpo'); -- INSERT INTO t2 VALUES(23,253,8008,23.022999999999996,800.8,'xyzabcdef','tsrqpon'); -- INSERT INTO t2 VALUES(24,264,8008,24.023999999999997,800.8,'yzabcdefg','tsrqpon'); -- INSERT INTO t2 VALUES(25,275,9009,25.025,900.9,'zabcdefgh','tsrqpon'); -- INSERT INTO t2 VALUES(26,286,9009,26.025999999999996,900.9,'abcdefghi','tsrqpon'); -- INSERT INTO t2 VALUES(27,297,9009,27.026999999999997,900.9,'bcdefghij','tsrqpon'); -- INSERT INTO t2 VALUES(28,308,10010,28.028,1001.0,'cdefghijk','srqponm'); -- INSERT INTO t2 VALUES(29,319,10010,29.028999999999996,1001.0,'defghijkl','srqponm'); -- INSERT INTO t2 VALUES(30,330,10010,30.029999999999998,1001.0,'efghijklm','srqponm'); -- INSERT INTO t2 VALUES(31,341,11011,31.030999999999995,1101.1,'fghijklmn','srqponm'); -- INSERT INTO t2 VALUES(32,352,11011,32.032,1101.1,'ghijklmno','srqponm'); -- INSERT INTO t2 VALUES(33,363,11011,33.032999999999994,1101.1,'hijklmnop','rqponml'); -- INSERT INTO t2 VALUES(34,374,12012,34.034,1201.1999999999998,'ijklmnopq','rqponml'); -- INSERT INTO t2 VALUES(35,385,12012,35.035,1201.1999999999998,'jklmnopqr','rqponml'); -- INSERT INTO t2 VALUES(36,396,12012,36.035999999999994,1201.1999999999998,'klmnopqrs','rqponml'); -- INSERT INTO t2 VALUES(37,407,13013,37.037,1301.3,'lmnopqrst','rqponml'); -- INSERT INTO t2 VALUES(38,418,13013,38.038,1301.3,'mnopqrstu','qponmlk'); -- INSERT INTO t2 VALUES(39,429,13013,39.038999999999994,1301.3,'nopqrstuv','qponmlk'); -- INSERT INTO t2 VALUES(40,440,14014,40.03999999999999,1401.3999999999999,'opqrstuvw','qponmlk'); -- INSERT INTO t2 VALUES(41,451,14014,41.041,1401.3999999999999,'pqrstuvwx','qponmlk'); -- INSERT INTO t2 VALUES(42,462,14014,42.041999999999994,1401.3999999999999,'qrstuvwxy','qponmlk'); -- INSERT INTO t2 VALUES(43,473,15015,43.04299999999999,1501.5,'rstuvwxyz','ponmlkj'); -- INSERT INTO t2 VALUES(44,484,15015,44.044,1501.5,'stuvwxyza','ponmlkj'); -- INSERT INTO t2 VALUES(45,495,15015,45.044999999999995,1501.5,'tuvwxyzab','ponmlkj'); -- INSERT INTO t2 VALUES(46,506,16016,46.04599999999999,1601.6,'uvwxyzabc','ponmlkj'); -- INSERT INTO t2 VALUES(47,517,16016,47.047,1601.6,'vwxyzabcd','ponmlkj'); -- INSERT INTO t2 VALUES(48,528,16016,48.047999999999995,1601.6,'wxyzabcde','onmlkji'); -- INSERT INTO t2 VALUES(49,539,17017,49.04899999999999,1701.6999999999998,'xyzabcdef','onmlkji'); -- INSERT INTO t2 VALUES(50,550,17017,50.05,1701.6999999999998,'yzabcdefg','onmlkji'); -- INSERT INTO t2 VALUES(51,561,17017,51.050999999999995,1701.6999999999998,'zabcdefgh','onmlkji'); -- INSERT INTO t2 VALUES(52,572,18018,52.05199999999999,1801.8,'abcdefghi','onmlkji'); -- INSERT INTO t2 VALUES(53,583,18018,53.053,1801.8,'bcdefghij','nmlkjih'); -- INSERT INTO t2 VALUES(54,594,18018,54.053999999999995,1801.8,'cdefghijk','nmlkjih'); -- INSERT INTO t2 VALUES(55,605,19019,55.05499999999999,1901.8999999999999,'defghijkl','nmlkjih'); -- INSERT INTO t2 VALUES(56,616,19019,56.056,1901.8999999999999,'efghijklm','nmlkjih'); -- INSERT INTO t2 VALUES(57,627,19019,57.056999999999995,1901.8999999999999,'fghijklmn','nmlkjih'); -- INSERT INTO t2 VALUES(58,638,20020,58.05799999999999,2002.0,'ghijklmno','mlkjihg'); -- INSERT INTO t2 VALUES(59,649,20020,59.05899999999999,2002.0,'hijklmnop','mlkjihg'); -- INSERT INTO t2 VALUES(60,660,20020,60.059999999999995,2002.0,'ijklmnopq','mlkjihg'); -- INSERT INTO t2 VALUES(61,671,21021,61.06099999999999,2102.1,'jklmnopqr','mlkjihg'); -- INSERT INTO t2 VALUES(62,682,21021,62.06199999999999,2102.1,'klmnopqrs','mlkjihg'); -- INSERT INTO t2 VALUES(63,693,21021,63.062999999999995,2102.1,'lmnopqrst','lkjihgf'); -- INSERT INTO t2 VALUES(64,704,22022,64.064,2202.2,'mnopqrstu','lkjihgf'); -- INSERT INTO t2 VALUES(65,715,22022,65.065,2202.2,'nopqrstuv','lkjihgf'); -- INSERT INTO t2 VALUES(66,726,22022,66.06599999999999,2202.2,'opqrstuvw','lkjihgf'); -- INSERT INTO t2 VALUES(67,737,23023,67.067,2302.2999999999997,'pqrstuvwx','lkjihgf'); -- INSERT INTO t2 VALUES(68,748,23023,68.068,2302.2999999999997,'qrstuvwxy','kjihgfe'); -- INSERT INTO t2 VALUES(69,759,23023,69.06899999999999,2302.2999999999997,'rstuvwxyz','kjihgfe'); -- INSERT INTO t2 VALUES(70,770,24024,70.07,2402.3999999999996,'stuvwxyza','kjihgfe'); -- INSERT INTO t2 VALUES(71,781,24024,71.071,2402.3999999999996,'tuvwxyzab','kjihgfe'); -- INSERT INTO t2 VALUES(72,792,24024,72.07199999999999,2402.3999999999996,'uvwxyzabc','kjihgfe'); -- INSERT INTO t2 VALUES(73,803,25025,73.073,2502.5,'vwxyzabcd','jihgfed'); -- INSERT INTO t2 VALUES(74,814,25025,74.074,2502.5,'wxyzabcde','jihgfed'); -- INSERT INTO t2 VALUES(75,825,25025,75.07499999999999,2502.5,'xyzabcdef','jihgfed'); -- INSERT INTO t2 VALUES(76,836,26026,76.076,2602.6,'yzabcdefg','jihgfed'); -- INSERT INTO t2 VALUES(77,847,26026,77.077,2602.6,'zabcdefgh','jihgfed'); -- INSERT INTO t2 VALUES(78,858,26026,78.07799999999999,2602.6,'abcdefghi','ihgfedc'); -- INSERT INTO t2 VALUES(79,869,27027,79.079,2702.7,'bcdefghij','ihgfedc'); -- INSERT INTO t2 VALUES(80,880,27027,80.07999999999998,2702.7,'cdefghijk','ihgfedc'); -- INSERT INTO t2 VALUES(81,891,27027,81.08099999999999,2702.7,'defghijkl','ihgfedc'); -- INSERT INTO t2 VALUES(82,902,28028,82.082,2802.7999999999997,'efghijklm','ihgfedc'); -- INSERT INTO t2 VALUES(83,913,28028,83.08299999999998,2802.7999999999997,'fghijklmn','hgfedcb'); -- INSERT INTO t2 VALUES(84,924,28028,84.08399999999999,2802.7999999999997,'ghijklmno','hgfedcb'); -- INSERT INTO t2 VALUES(85,935,29029,85.085,2902.8999999999996,'hijklmnop','hgfedcb'); -- INSERT INTO t2 VALUES(86,946,29029,86.08599999999998,2902.8999999999996,'ijklmnopq','hgfedcb'); -- INSERT INTO t2 VALUES(87,957,29029,87.08699999999999,2902.8999999999996,'jklmnopqr','hgfedcb'); -- INSERT INTO t2 VALUES(88,968,30030,88.088,3003.0,'klmnopqrs','gfedcba'); -- INSERT INTO t2 VALUES(89,979,30030,89.08899999999998,3003.0,'lmnopqrst','gfedcba'); -- INSERT INTO t2 VALUES(90,990,30030,90.08999999999999,3003.0,'mnopqrstu','gfedcba'); -- INSERT INTO t2 VALUES(91,1001,31031,91.091,3103.1,'nopqrstuv','gfedcba'); -- INSERT INTO t2 VALUES(92,1012,31031,92.09199999999998,3103.1,'opqrstuvw','gfedcba'); -- INSERT INTO t2 VALUES(93,1023,31031,93.09299999999999,3103.1,'pqrstuvwx','fedcbaz'); -- INSERT INTO t2 VALUES(94,1034,32032,94.094,3203.2,'qrstuvwxy','fedcbaz'); -- INSERT INTO t2 VALUES(95,1045,32032,95.09499999999998,3203.2,'rstuvwxyz','fedcbaz'); -- INSERT INTO t2 VALUES(96,1056,32032,96.09599999999999,3203.2,'stuvwxyza','fedcbaz'); -- INSERT INTO t2 VALUES(97,1067,33033,97.097,3303.2999999999997,'tuvwxyzab','fedcbaz'); -- INSERT INTO t2 VALUES(98,1078,33033,98.09799999999998,3303.2999999999997,'uvwxyzabc','edcbazy'); -- INSERT INTO t2 VALUES(99,1089,33033,99.09899999999999,3303.2999999999997,'vwxyzabcd','edcbazy'); -- INSERT INTO t2 VALUES(100,1100,34034,100.1,3403.3999999999996,'wxyzabcde','edcbazy'); -- CREATE INDEX t2b ON t2(b); -- CREATE INDEX t2c ON t2(c); -- CREATE INDEX t2d ON t2(d); -- CREATE INDEX t2e ON t2(e); -- CREATE INDEX t2f ON t2(f); -- CREATE INDEX t2g ON t2(g); -- CREATE TABLE t3(a INTEGER PRIMARY KEY,b,c,d,e,f TEXT,g); -- INSERT INTO t3 SELECT * FROM t2; -- CREATE INDEX t3b ON t3(b,c); -- CREATE INDEX t3c ON t3(c,e); -- CREATE INDEX t3d ON t3(d,g); -- CREATE INDEX t3e ON t3(e,f,g); -- CREATE INDEX t3f ON t3(f,b,d,c); -- CREATE INDEX t3g ON t3(g,f); -- } CREATE TABLE t2(a INTEGER PRIMARY KEY,b,c,d,e,f TEXT,g); INSERT INTO t2 VALUES(1,11,1001,1.001,100.1,'bcdefghij','yxwvuts'); INSERT INTO t2 VALUES(2,22,1001,2.002,100.1,'cdefghijk','yxwvuts'); INSERT INTO t2 VALUES(3,33,1001,3.0029999999999997,100.1,'defghijkl','xwvutsr'); INSERT INTO t2 VALUES(4,44,2002,4.004,200.2,'efghijklm','xwvutsr'); INSERT INTO t2 VALUES(5,55,2002,5.004999999999999,200.2,'fghijklmn','xwvutsr'); INSERT INTO t2 VALUES(6,66,2002,6.005999999999999,200.2,'ghijklmno','xwvutsr'); INSERT INTO t2 VALUES(7,77,3003,7.007,300.29999999999995,'hijklmnop','xwvutsr'); INSERT INTO t2 VALUES(8,88,3003,8.008,300.29999999999995,'ijklmnopq','wvutsrq'); INSERT INTO t2 VALUES(9,99,3003,9.008999999999999,300.29999999999995,'jklmnopqr','wvutsrq'); INSERT INTO t2 VALUES(10,110,4004,10.009999999999998,400.4,'klmnopqrs','wvutsrq'); INSERT INTO t2 VALUES(11,121,4004,11.011,400.4,'lmnopqrst','wvutsrq'); INSERT INTO t2 VALUES(12,132,4004,12.011999999999999,400.4,'mnopqrstu','wvutsrq'); INSERT INTO t2 VALUES(13,143,5005,13.012999999999998,500.5,'nopqrstuv','vutsrqp'); INSERT INTO t2 VALUES(14,154,5005,14.014,500.5,'opqrstuvw','vutsrqp'); INSERT INTO t2 VALUES(15,165,5005,15.014999999999999,500.5,'pqrstuvwx','vutsrqp'); INSERT INTO t2 VALUES(16,176,6006,16.016,600.5999999999999,'qrstuvwxy','vutsrqp'); INSERT INTO t2 VALUES(17,187,6006,17.017,600.5999999999999,'rstuvwxyz','vutsrqp'); INSERT INTO t2 VALUES(18,198,6006,18.017999999999997,600.5999999999999,'stuvwxyza','utsrqpo'); INSERT INTO t2 VALUES(19,209,7007,19.019,700.6999999999999,'tuvwxyzab','utsrqpo'); INSERT INTO t2 VALUES(20,220,7007,20.019999999999996,700.6999999999999,'uvwxyzabc','utsrqpo'); INSERT INTO t2 VALUES(21,231,7007,21.020999999999997,700.6999999999999,'vwxyzabcd','utsrqpo'); INSERT INTO t2 VALUES(22,242,8008,22.022,800.8,'wxyzabcde','utsrqpo'); INSERT INTO t2 VALUES(23,253,8008,23.022999999999996,800.8,'xyzabcdef','tsrqpon'); INSERT INTO t2 VALUES(24,264,8008,24.023999999999997,800.8,'yzabcdefg','tsrqpon'); INSERT INTO t2 VALUES(25,275,9009,25.025,900.9,'zabcdefgh','tsrqpon'); INSERT INTO t2 VALUES(26,286,9009,26.025999999999996,900.9,'abcdefghi','tsrqpon'); INSERT INTO t2 VALUES(27,297,9009,27.026999999999997,900.9,'bcdefghij','tsrqpon'); INSERT INTO t2 VALUES(28,308,10010,28.028,1001.0,'cdefghijk','srqponm'); INSERT INTO t2 VALUES(29,319,10010,29.028999999999996,1001.0,'defghijkl','srqponm'); INSERT INTO t2 VALUES(30,330,10010,30.029999999999998,1001.0,'efghijklm','srqponm'); INSERT INTO t2 VALUES(31,341,11011,31.030999999999995,1101.1,'fghijklmn','srqponm'); INSERT INTO t2 VALUES(32,352,11011,32.032,1101.1,'ghijklmno','srqponm'); INSERT INTO t2 VALUES(33,363,11011,33.032999999999994,1101.1,'hijklmnop','rqponml'); INSERT INTO t2 VALUES(34,374,12012,34.034,1201.1999999999998,'ijklmnopq','rqponml'); INSERT INTO t2 VALUES(35,385,12012,35.035,1201.1999999999998,'jklmnopqr','rqponml'); INSERT INTO t2 VALUES(36,396,12012,36.035999999999994,1201.1999999999998,'klmnopqrs','rqponml'); INSERT INTO t2 VALUES(37,407,13013,37.037,1301.3,'lmnopqrst','rqponml'); INSERT INTO t2 VALUES(38,418,13013,38.038,1301.3,'mnopqrstu','qponmlk'); INSERT INTO t2 VALUES(39,429,13013,39.038999999999994,1301.3,'nopqrstuv','qponmlk'); INSERT INTO t2 VALUES(40,440,14014,40.03999999999999,1401.3999999999999,'opqrstuvw','qponmlk'); INSERT INTO t2 VALUES(41,451,14014,41.041,1401.3999999999999,'pqrstuvwx','qponmlk'); INSERT INTO t2 VALUES(42,462,14014,42.041999999999994,1401.3999999999999,'qrstuvwxy','qponmlk'); INSERT INTO t2 VALUES(43,473,15015,43.04299999999999,1501.5,'rstuvwxyz','ponmlkj'); INSERT INTO t2 VALUES(44,484,15015,44.044,1501.5,'stuvwxyza','ponmlkj'); INSERT INTO t2 VALUES(45,495,15015,45.044999999999995,1501.5,'tuvwxyzab','ponmlkj'); INSERT INTO t2 VALUES(46,506,16016,46.04599999999999,1601.6,'uvwxyzabc','ponmlkj'); INSERT INTO t2 VALUES(47,517,16016,47.047,1601.6,'vwxyzabcd','ponmlkj'); INSERT INTO t2 VALUES(48,528,16016,48.047999999999995,1601.6,'wxyzabcde','onmlkji'); INSERT INTO t2 VALUES(49,539,17017,49.04899999999999,1701.6999999999998,'xyzabcdef','onmlkji'); INSERT INTO t2 VALUES(50,550,17017,50.05,1701.6999999999998,'yzabcdefg','onmlkji'); INSERT INTO t2 VALUES(51,561,17017,51.050999999999995,1701.6999999999998,'zabcdefgh','onmlkji'); INSERT INTO t2 VALUES(52,572,18018,52.05199999999999,1801.8,'abcdefghi','onmlkji'); INSERT INTO t2 VALUES(53,583,18018,53.053,1801.8,'bcdefghij','nmlkjih'); INSERT INTO t2 VALUES(54,594,18018,54.053999999999995,1801.8,'cdefghijk','nmlkjih'); INSERT INTO t2 VALUES(55,605,19019,55.05499999999999,1901.8999999999999,'defghijkl','nmlkjih'); INSERT INTO t2 VALUES(56,616,19019,56.056,1901.8999999999999,'efghijklm','nmlkjih'); INSERT INTO t2 VALUES(57,627,19019,57.056999999999995,1901.8999999999999,'fghijklmn','nmlkjih'); INSERT INTO t2 VALUES(58,638,20020,58.05799999999999,2002.0,'ghijklmno','mlkjihg'); INSERT INTO t2 VALUES(59,649,20020,59.05899999999999,2002.0,'hijklmnop','mlkjihg'); INSERT INTO t2 VALUES(60,660,20020,60.059999999999995,2002.0,'ijklmnopq','mlkjihg'); INSERT INTO t2 VALUES(61,671,21021,61.06099999999999,2102.1,'jklmnopqr','mlkjihg'); INSERT INTO t2 VALUES(62,682,21021,62.06199999999999,2102.1,'klmnopqrs','mlkjihg'); INSERT INTO t2 VALUES(63,693,21021,63.062999999999995,2102.1,'lmnopqrst','lkjihgf'); INSERT INTO t2 VALUES(64,704,22022,64.064,2202.2,'mnopqrstu','lkjihgf'); INSERT INTO t2 VALUES(65,715,22022,65.065,2202.2,'nopqrstuv','lkjihgf'); INSERT INTO t2 VALUES(66,726,22022,66.06599999999999,2202.2,'opqrstuvw','lkjihgf'); INSERT INTO t2 VALUES(67,737,23023,67.067,2302.2999999999997,'pqrstuvwx','lkjihgf'); INSERT INTO t2 VALUES(68,748,23023,68.068,2302.2999999999997,'qrstuvwxy','kjihgfe'); INSERT INTO t2 VALUES(69,759,23023,69.06899999999999,2302.2999999999997,'rstuvwxyz','kjihgfe'); INSERT INTO t2 VALUES(70,770,24024,70.07,2402.3999999999996,'stuvwxyza','kjihgfe'); INSERT INTO t2 VALUES(71,781,24024,71.071,2402.3999999999996,'tuvwxyzab','kjihgfe'); INSERT INTO t2 VALUES(72,792,24024,72.07199999999999,2402.3999999999996,'uvwxyzabc','kjihgfe'); INSERT INTO t2 VALUES(73,803,25025,73.073,2502.5,'vwxyzabcd','jihgfed'); INSERT INTO t2 VALUES(74,814,25025,74.074,2502.5,'wxyzabcde','jihgfed'); INSERT INTO t2 VALUES(75,825,25025,75.07499999999999,2502.5,'xyzabcdef','jihgfed'); INSERT INTO t2 VALUES(76,836,26026,76.076,2602.6,'yzabcdefg','jihgfed'); INSERT INTO t2 VALUES(77,847,26026,77.077,2602.6,'zabcdefgh','jihgfed'); INSERT INTO t2 VALUES(78,858,26026,78.07799999999999,2602.6,'abcdefghi','ihgfedc'); INSERT INTO t2 VALUES(79,869,27027,79.079,2702.7,'bcdefghij','ihgfedc'); INSERT INTO t2 VALUES(80,880,27027,80.07999999999998,2702.7,'cdefghijk','ihgfedc'); INSERT INTO t2 VALUES(81,891,27027,81.08099999999999,2702.7,'defghijkl','ihgfedc'); INSERT INTO t2 VALUES(82,902,28028,82.082,2802.7999999999997,'efghijklm','ihgfedc'); INSERT INTO t2 VALUES(83,913,28028,83.08299999999998,2802.7999999999997,'fghijklmn','hgfedcb'); INSERT INTO t2 VALUES(84,924,28028,84.08399999999999,2802.7999999999997,'ghijklmno','hgfedcb'); INSERT INTO t2 VALUES(85,935,29029,85.085,2902.8999999999996,'hijklmnop','hgfedcb'); INSERT INTO t2 VALUES(86,946,29029,86.08599999999998,2902.8999999999996,'ijklmnopq','hgfedcb'); INSERT INTO t2 VALUES(87,957,29029,87.08699999999999,2902.8999999999996,'jklmnopqr','hgfedcb'); INSERT INTO t2 VALUES(88,968,30030,88.088,3003.0,'klmnopqrs','gfedcba'); INSERT INTO t2 VALUES(89,979,30030,89.08899999999998,3003.0,'lmnopqrst','gfedcba'); INSERT INTO t2 VALUES(90,990,30030,90.08999999999999,3003.0,'mnopqrstu','gfedcba'); INSERT INTO t2 VALUES(91,1001,31031,91.091,3103.1,'nopqrstuv','gfedcba'); INSERT INTO t2 VALUES(92,1012,31031,92.09199999999998,3103.1,'opqrstuvw','gfedcba'); INSERT INTO t2 VALUES(93,1023,31031,93.09299999999999,3103.1,'pqrstuvwx','fedcbaz'); INSERT INTO t2 VALUES(94,1034,32032,94.094,3203.2,'qrstuvwxy','fedcbaz'); INSERT INTO t2 VALUES(95,1045,32032,95.09499999999998,3203.2,'rstuvwxyz','fedcbaz'); INSERT INTO t2 VALUES(96,1056,32032,96.09599999999999,3203.2,'stuvwxyza','fedcbaz'); INSERT INTO t2 VALUES(97,1067,33033,97.097,3303.2999999999997,'tuvwxyzab','fedcbaz'); INSERT INTO t2 VALUES(98,1078,33033,98.09799999999998,3303.2999999999997,'uvwxyzabc','edcbazy'); INSERT INTO t2 VALUES(99,1089,33033,99.09899999999999,3303.2999999999997,'vwxyzabcd','edcbazy'); INSERT INTO t2 VALUES(100,1100,34034,100.1,3403.3999999999996,'wxyzabcde','edcbazy'); CREATE INDEX t2b ON t2(b); CREATE INDEX t2c ON t2(c); CREATE INDEX t2d ON t2(d); CREATE INDEX t2e ON t2(e); CREATE INDEX t2f ON t2(f); CREATE INDEX t2g ON t2(g); CREATE TABLE t3(a INTEGER PRIMARY KEY,b,c,d,e,f TEXT,g); INSERT INTO t3 SELECT * FROM t2; CREATE INDEX t3b ON t3(b,c); CREATE INDEX t3c ON t3(c,e); CREATE INDEX t3d ON t3(d,g); CREATE INDEX t3e ON t3(e,f,g); CREATE INDEX t3f ON t3(f,b,d,c); CREATE INDEX t3g ON t3(g,f);
the_stack
-- 2019-09-10T05:16:02.204Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_ImpFormat SET Description='Einfaches Datenformat für Inventurbelege mit wenigen Feldern', Name='Inventur Minimal',Updated=TO_TIMESTAMP('2019-09-10 07:16:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ImpFormat_ID=540044 ; -- 2019-09-10T05:16:23.058Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_ImpFormat_Row SET AD_Column_ID=9764,Updated=TO_TIMESTAMP('2019-09-10 07:16:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ImpFormat_Row_ID=541368 ; -- 2019-09-10T05:16:25.484Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_ImpFormat_Row SET StartNo=3,Updated=TO_TIMESTAMP('2019-09-10 07:16:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ImpFormat_Row_ID=541369 ; -- 2019-09-10T05:16:32.505Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_ImpFormat_Row SET StartNo=4,Updated=TO_TIMESTAMP('2019-09-10 07:16:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_ImpFormat_Row_ID=541370 ; -- 2019-09-10T05:17:49.376Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Help='"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewegung.',Updated=TO_TIMESTAMP('2019-09-10 07:17:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1037 AND AD_Language='fr_CH' ; -- 2019-09-10T05:17:49.415Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1037,'fr_CH') ; -- 2019-09-10T05:17:57.153Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Help='"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewegung.', IsTranslated='Y',Updated=TO_TIMESTAMP('2019-09-10 07:17:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1037 AND AD_Language='de_CH' ; -- 2019-09-10T05:17:57.155Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1037,'de_CH') ; -- 2019-09-10T05:18:04.681Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Help='"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewegung.', IsTranslated='Y',Updated=TO_TIMESTAMP('2019-09-10 07:18:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=1037 AND AD_Language='de_DE' ; -- 2019-09-10T05:18:04.683Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(1037,'de_DE') ; -- 2019-09-10T05:18:04.693Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(1037,'de_DE') ; -- 2019-09-10T05:18:04.694Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='MovementDate', Name='Bewegungsdatum', Description='Datum, an dem eine Produkt in oder aus dem Bestand bewegt wurde', Help='"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewegung.' WHERE AD_Element_ID=1037 ; -- 2019-09-10T05:18:04.698Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='MovementDate', Name='Bewegungsdatum', Description='Datum, an dem eine Produkt in oder aus dem Bestand bewegt wurde', Help='"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewegung.', AD_Element_ID=1037 WHERE UPPER(ColumnName)='MOVEMENTDATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2019-09-10T05:18:04.700Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='MovementDate', Name='Bewegungsdatum', Description='Datum, an dem eine Produkt in oder aus dem Bestand bewegt wurde', Help='"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewegung.' WHERE AD_Element_ID=1037 AND IsCentrallyMaintained='Y' ; -- 2019-09-10T05:18:04.701Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Bewegungsdatum', Description='Datum, an dem eine Produkt in oder aus dem Bestand bewegt wurde', Help='"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewegung.' WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=1037) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 1037) ; -- 2019-09-10T05:18:04.714Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Bewegungsdatum', Description='Datum, an dem eine Produkt in oder aus dem Bestand bewegt wurde', Help='"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewegung.', CommitWarning = NULL WHERE AD_Element_ID = 1037 ; -- 2019-09-10T05:18:04.716Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Bewegungsdatum', Description='Datum, an dem eine Produkt in oder aus dem Bestand bewegt wurde', Help='"Bewegungs-Datum" bezeichnet das Datum, zu dem das Produkt in oder aus dem Bestand bewegt wurde Dies ist das Ergebnis einer Auslieferung, eines Wareneingangs oder einer Warenbewegung.' WHERE AD_Element_ID = 1037 ; -- 2019-09-10T05:18:04.717Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Bewegungsdatum', Description = 'Datum, an dem eine Produkt in oder aus dem Bestand bewegt wurde', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 1037 ; -- 2019-09-10T05:18:58.140Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577058,0,'InventoryDate',TO_TIMESTAMP('2019-09-10 07:18:58','YYYY-MM-DD HH24:MI:SS'),100,'Datum zu dem die Inventur gilt, d.h. Belegedatum des Inventurbelegs','D','Y','Inventurdatum','Inventurdatum',TO_TIMESTAMP('2019-09-10 07:18:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2019-09-10T05:18:58.141Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577058 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2019-09-10T05:19:13.929Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Document date of the inventory document', IsTranslated='Y',Updated=TO_TIMESTAMP('2019-09-10 07:19:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577058 AND AD_Language='en_US' ; -- 2019-09-10T05:19:13.930Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577058,'en_US') ; -- 2019-09-10T05:19:17.117Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-09-10 07:19:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577058 AND AD_Language='de_DE' ; -- 2019-09-10T05:19:17.119Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577058,'de_DE') ; -- 2019-09-10T05:19:17.126Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577058,'de_DE') ; -- 2019-09-10T05:19:19.669Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-09-10 07:19:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577058 AND AD_Language='de_CH' ; -- 2019-09-10T05:19:19.675Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577058,'de_CH') ; -- 2019-09-10T05:28:13.284Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET AD_Element_ID=577058, ColumnName='InventoryDate', Description='Datum zu dem die Inventur gilt, d.h. Belegedatum des Inventurbelegs', Help=NULL, Name='Inventurdatum',Updated=TO_TIMESTAMP('2019-09-10 07:28:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=9764 ; -- 2019-09-10T05:28:13.286Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Inventurdatum', Description='Datum zu dem die Inventur gilt, d.h. Belegedatum des Inventurbelegs', Help=NULL WHERE AD_Column_ID=9764 ; -- 2019-09-10T05:28:13.288Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_Column_Translation_From_AD_Element(577058) ; /* DDL */ select db_alter_table('I_Inventory', 'ALTER TABLE I_Inventory RENAME COLUMN MovementDate TO InventoryDate;');
the_stack
-- Create our own copies of these test tables in our own -- schema (see qp_functions_in_contexts_setup.sql) CREATE SCHEMA qp_funcs_in_select; set search_path='qp_funcs_in_select', 'qp_funcs_in_contexts'; CREATE TABLE foo (a int, b int); INSERT INTO foo select i, i+1 from generate_series(1,10) i; CREATE TABLE bar (c int, d int); INSERT INTO bar select i, i+1 from generate_series(1,10) i; ANALYZE foo; ANALYZE bar; -- @description function_in_select_column_0.sql SELECT func1_nosql_vol(a) FROM foo order by 1; -- @description function_in_select_column_1.sql SELECT func1_nosql_stb(a) FROM foo order by 1; -- @description function_in_select_column_2.sql SELECT func1_nosql_imm(a) FROM foo order by 1; -- @description function_in_select_column_3.sql SELECT func1_sql_int_vol(a) FROM foo order by 1; -- @description function_in_select_column_4.sql SELECT func1_sql_int_stb(a) FROM foo order by 1; -- @description function_in_select_column_5.sql SELECT func1_sql_int_imm(a) FROM foo order by 1; -- @description function_in_select_column_6.sql SELECT func1_sql_setint_vol(a) FROM foo order by 1; -- @description function_in_select_column_7.sql SELECT func1_sql_setint_stb(a) FROM foo order by 1; -- @description function_in_select_column_8.sql SELECT func1_sql_setint_imm(a) FROM foo order by 1; -- @description function_in_select_column_9.sql SELECT func1_read_int_sql_vol(a) FROM foo order by 1; -- @description function_in_select_column_10.sql SELECT func1_read_int_sql_stb(a) FROM foo order by 1; -- @description function_in_select_column_11.sql SELECT func1_read_setint_sql_vol(a) FROM foo order by 1; -- @description function_in_select_column_12.sql SELECT func1_read_setint_sql_stb(a) FROM foo order by 1; -- @description function_in_select_column_13.sql begin; SELECT func1_mod_int_vol(a) FROM foo order by 1; rollback; -- @description function_in_select_column_14.sql begin; SELECT func1_mod_int_stb(a) FROM foo order by 1; rollback; -- @description function_in_select_column_15.sql begin; SELECT func1_mod_setint_vol(a) FROM foo order by 1; rollback; -- @description function_in_select_column_16.sql begin; SELECT func1_mod_setint_stb(a) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_0.sql SELECT func1_nosql_vol(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_1.sql SELECT func1_nosql_vol(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_2.sql SELECT func1_nosql_vol(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_3.sql SELECT func1_nosql_vol(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_4.sql SELECT func1_nosql_vol(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_5.sql SELECT func1_nosql_vol(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_6.sql SELECT func1_nosql_vol(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_7.sql SELECT func1_nosql_vol(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_8.sql begin; SELECT func1_nosql_vol(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_9.sql begin; SELECT func1_nosql_vol(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_10.sql SELECT func1_nosql_stb(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_11.sql SELECT func1_nosql_stb(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_12.sql SELECT func1_nosql_stb(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_13.sql SELECT func1_nosql_stb(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_14.sql SELECT func1_nosql_stb(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_15.sql SELECT func1_nosql_stb(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_16.sql SELECT func1_nosql_stb(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_17.sql SELECT func1_nosql_stb(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_18.sql begin; SELECT func1_nosql_stb(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_19.sql begin; SELECT func1_nosql_stb(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_20.sql SELECT func1_nosql_imm(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_21.sql SELECT func1_nosql_imm(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_22.sql SELECT func1_nosql_imm(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_23.sql SELECT func1_nosql_imm(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_24.sql SELECT func1_nosql_imm(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_25.sql SELECT func1_nosql_imm(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_26.sql SELECT func1_nosql_imm(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_27.sql SELECT func1_nosql_imm(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_28.sql begin; SELECT func1_nosql_imm(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_29.sql begin; SELECT func1_nosql_imm(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_30.sql SELECT func1_sql_int_vol(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_31.sql SELECT func1_sql_int_vol(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_32.sql SELECT func1_sql_int_vol(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_33.sql SELECT func1_sql_int_vol(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_34.sql SELECT func1_sql_int_vol(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_35.sql SELECT func1_sql_int_vol(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_36.sql SELECT func1_sql_int_vol(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_37.sql SELECT func1_sql_int_vol(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_38.sql begin; SELECT func1_sql_int_vol(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_39.sql begin; SELECT func1_sql_int_vol(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_40.sql SELECT func1_sql_int_stb(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_41.sql SELECT func1_sql_int_stb(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_42.sql SELECT func1_sql_int_stb(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_43.sql SELECT func1_sql_int_stb(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_44.sql SELECT func1_sql_int_stb(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_45.sql SELECT func1_sql_int_stb(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_46.sql SELECT func1_sql_int_stb(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_47.sql SELECT func1_sql_int_stb(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_48.sql begin; SELECT func1_sql_int_stb(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_49.sql begin; SELECT func1_sql_int_stb(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_50.sql SELECT func1_sql_int_imm(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_51.sql SELECT func1_sql_int_imm(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_52.sql SELECT func1_sql_int_imm(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_53.sql SELECT func1_sql_int_imm(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_54.sql SELECT func1_sql_int_imm(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_55.sql SELECT func1_sql_int_imm(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_56.sql SELECT func1_sql_int_imm(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_57.sql SELECT func1_sql_int_imm(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_58.sql begin; SELECT func1_sql_int_imm(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_59.sql begin; SELECT func1_sql_int_imm(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_60.sql SELECT func1_sql_setint_vol(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_61.sql SELECT func1_sql_setint_vol(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_62.sql SELECT func1_sql_setint_vol(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_63.sql SELECT func1_sql_setint_vol(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_64.sql SELECT func1_sql_setint_vol(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_65.sql SELECT func1_sql_setint_vol(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_66.sql SELECT func1_sql_setint_vol(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_67.sql SELECT func1_sql_setint_vol(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_68.sql begin; SELECT func1_sql_setint_vol(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_69.sql begin; SELECT func1_sql_setint_vol(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_70.sql SELECT func1_sql_setint_stb(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_71.sql SELECT func1_sql_setint_stb(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_72.sql SELECT func1_sql_setint_stb(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_73.sql SELECT func1_sql_setint_stb(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_74.sql SELECT func1_sql_setint_stb(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_75.sql SELECT func1_sql_setint_stb(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_76.sql SELECT func1_sql_setint_stb(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_77.sql SELECT func1_sql_setint_stb(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_78.sql begin; SELECT func1_sql_setint_stb(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_79.sql begin; SELECT func1_sql_setint_stb(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_80.sql SELECT func1_sql_setint_imm(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_81.sql SELECT func1_sql_setint_imm(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_82.sql SELECT func1_sql_setint_imm(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_83.sql SELECT func1_sql_setint_imm(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_84.sql SELECT func1_sql_setint_imm(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_85.sql SELECT func1_sql_setint_imm(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_86.sql SELECT func1_sql_setint_imm(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_87.sql SELECT func1_sql_setint_imm(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_88.sql begin; SELECT func1_sql_setint_imm(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_89.sql begin; SELECT func1_sql_setint_imm(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_90.sql SELECT func1_read_int_sql_vol(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_91.sql SELECT func1_read_int_sql_vol(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_92.sql SELECT func1_read_int_sql_vol(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_93.sql SELECT func1_read_int_sql_vol(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_94.sql SELECT func1_read_int_sql_vol(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_95.sql SELECT func1_read_int_sql_vol(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_96.sql SELECT func1_read_int_sql_vol(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_97.sql SELECT func1_read_int_sql_vol(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_98.sql begin; SELECT func1_read_int_sql_vol(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_99.sql begin; SELECT func1_read_int_sql_vol(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_100.sql SELECT func1_read_int_sql_stb(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_101.sql SELECT func1_read_int_sql_stb(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_102.sql SELECT func1_read_int_sql_stb(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_103.sql SELECT func1_read_int_sql_stb(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_104.sql SELECT func1_read_int_sql_stb(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_105.sql SELECT func1_read_int_sql_stb(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_106.sql SELECT func1_read_int_sql_stb(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_107.sql SELECT func1_read_int_sql_stb(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_108.sql begin; SELECT func1_read_int_sql_stb(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_109.sql begin; SELECT func1_read_int_sql_stb(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_110.sql SELECT func1_read_setint_sql_vol(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_111.sql SELECT func1_read_setint_sql_vol(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_112.sql SELECT func1_read_setint_sql_vol(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_113.sql SELECT func1_read_setint_sql_vol(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_114.sql SELECT func1_read_setint_sql_vol(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_115.sql SELECT func1_read_setint_sql_vol(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_116.sql SELECT func1_read_setint_sql_vol(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_117.sql SELECT func1_read_setint_sql_vol(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_118.sql begin; SELECT func1_read_setint_sql_vol(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_119.sql begin; SELECT func1_read_setint_sql_vol(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_120.sql SELECT func1_read_setint_sql_stb(func2_nosql_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_121.sql SELECT func1_read_setint_sql_stb(func2_nosql_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_122.sql SELECT func1_read_setint_sql_stb(func2_nosql_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_123.sql SELECT func1_read_setint_sql_stb(func2_sql_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_124.sql SELECT func1_read_setint_sql_stb(func2_sql_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_125.sql SELECT func1_read_setint_sql_stb(func2_sql_int_imm(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_126.sql SELECT func1_read_setint_sql_stb(func2_read_int_vol(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_127.sql SELECT func1_read_setint_sql_stb(func2_read_int_stb(a)) FROM foo order by 1; -- @description function_in_select_column_withfunc2_128.sql begin; SELECT func1_read_setint_sql_stb(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_129.sql begin; SELECT func1_read_setint_sql_stb(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_130.sql begin; SELECT func1_mod_int_vol(func2_nosql_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_131.sql begin; SELECT func1_mod_int_vol(func2_nosql_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_132.sql begin; SELECT func1_mod_int_vol(func2_nosql_imm(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_133.sql begin; SELECT func1_mod_int_vol(func2_sql_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_134.sql begin; SELECT func1_mod_int_vol(func2_sql_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_135.sql begin; SELECT func1_mod_int_vol(func2_sql_int_imm(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_136.sql begin; SELECT func1_mod_int_vol(func2_read_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_137.sql begin; SELECT func1_mod_int_vol(func2_read_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_138.sql begin; SELECT func1_mod_int_vol(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_139.sql begin; SELECT func1_mod_int_vol(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_140.sql begin; SELECT func1_mod_int_stb(func2_nosql_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_141.sql begin; SELECT func1_mod_int_stb(func2_nosql_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_142.sql begin; SELECT func1_mod_int_stb(func2_nosql_imm(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_143.sql begin; SELECT func1_mod_int_stb(func2_sql_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_144.sql begin; SELECT func1_mod_int_stb(func2_sql_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_145.sql begin; SELECT func1_mod_int_stb(func2_sql_int_imm(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_146.sql begin; SELECT func1_mod_int_stb(func2_read_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_147.sql begin; SELECT func1_mod_int_stb(func2_read_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_148.sql begin; SELECT func1_mod_int_stb(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_149.sql begin; SELECT func1_mod_int_stb(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_150.sql begin; SELECT func1_mod_setint_vol(func2_nosql_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_151.sql begin; SELECT func1_mod_setint_vol(func2_nosql_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_152.sql begin; SELECT func1_mod_setint_vol(func2_nosql_imm(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_153.sql begin; SELECT func1_mod_setint_vol(func2_sql_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_154.sql begin; SELECT func1_mod_setint_vol(func2_sql_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_155.sql begin; SELECT func1_mod_setint_vol(func2_sql_int_imm(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_156.sql begin; SELECT func1_mod_setint_vol(func2_read_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_157.sql begin; SELECT func1_mod_setint_vol(func2_read_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_158.sql begin; SELECT func1_mod_setint_vol(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_159.sql begin; SELECT func1_mod_setint_vol(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_160.sql begin; SELECT func1_mod_setint_stb(func2_nosql_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_161.sql begin; SELECT func1_mod_setint_stb(func2_nosql_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_162.sql begin; SELECT func1_mod_setint_stb(func2_nosql_imm(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_163.sql begin; SELECT func1_mod_setint_stb(func2_sql_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_164.sql begin; SELECT func1_mod_setint_stb(func2_sql_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_165.sql begin; SELECT func1_mod_setint_stb(func2_sql_int_imm(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_166.sql begin; SELECT func1_mod_setint_stb(func2_read_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_167.sql begin; SELECT func1_mod_setint_stb(func2_read_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_168.sql begin; SELECT func1_mod_setint_stb(func2_mod_int_vol(a)) FROM foo order by 1; rollback; -- @description function_in_select_column_withfunc2_169.sql begin; SELECT func1_mod_setint_stb(func2_mod_int_stb(a)) FROM foo order by 1; rollback; -- @description function_in_select_constant_0.sql SELECT func1_nosql_vol(5) FROM foo order by 1; -- @description function_in_select_constant_1.sql SELECT func1_nosql_stb(5) FROM foo order by 1; -- @description function_in_select_constant_2.sql SELECT func1_nosql_imm(5) FROM foo order by 1; -- @description function_in_select_constant_3.sql SELECT func1_sql_int_vol(5) FROM foo order by 1; -- @description function_in_select_constant_4.sql SELECT func1_sql_int_stb(5) FROM foo order by 1; -- @description function_in_select_constant_5.sql SELECT func1_sql_int_imm(5) FROM foo order by 1; -- @description function_in_select_constant_6.sql SELECT func1_sql_setint_vol(5) FROM foo order by 1; -- @description function_in_select_constant_7.sql SELECT func1_sql_setint_stb(5) FROM foo order by 1; -- @description function_in_select_constant_8.sql SELECT func1_sql_setint_imm(5) FROM foo order by 1; -- @description function_in_select_constant_9.sql SELECT func1_read_int_sql_vol(5) FROM foo order by 1; -- @description function_in_select_constant_10.sql SELECT func1_read_int_sql_stb(5) FROM foo order by 1; -- @description function_in_select_constant_11.sql SELECT func1_read_setint_sql_vol(5) FROM foo order by 1; -- @description function_in_select_constant_12.sql SELECT func1_read_setint_sql_stb(5) FROM foo order by 1; -- @description function_in_select_constant_13.sql begin; SELECT func1_mod_int_vol(5) FROM foo order by 1; rollback; -- @description function_in_select_constant_14.sql begin; SELECT func1_mod_int_stb(5) FROM foo order by 1; rollback; -- @description function_in_select_constant_15.sql begin; SELECT func1_mod_setint_vol(5) FROM foo order by 1; rollback; -- @description function_in_select_constant_16.sql begin; SELECT func1_mod_setint_stb(5) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_0.sql SELECT func1_nosql_vol(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_1.sql SELECT func1_nosql_vol(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_2.sql SELECT func1_nosql_vol(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_3.sql SELECT func1_nosql_vol(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_4.sql SELECT func1_nosql_vol(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_5.sql SELECT func1_nosql_vol(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_6.sql SELECT func1_nosql_vol(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_7.sql SELECT func1_nosql_vol(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_8.sql begin; SELECT func1_nosql_vol(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_9.sql begin; SELECT func1_nosql_vol(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_10.sql SELECT func1_nosql_stb(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_11.sql SELECT func1_nosql_stb(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_12.sql SELECT func1_nosql_stb(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_13.sql SELECT func1_nosql_stb(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_14.sql SELECT func1_nosql_stb(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_15.sql SELECT func1_nosql_stb(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_16.sql SELECT func1_nosql_stb(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_17.sql SELECT func1_nosql_stb(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_18.sql begin; SELECT func1_nosql_stb(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_19.sql begin; SELECT func1_nosql_stb(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_20.sql SELECT func1_nosql_imm(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_21.sql SELECT func1_nosql_imm(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_22.sql SELECT func1_nosql_imm(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_23.sql SELECT func1_nosql_imm(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_24.sql SELECT func1_nosql_imm(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_25.sql SELECT func1_nosql_imm(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_26.sql SELECT func1_nosql_imm(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_27.sql SELECT func1_nosql_imm(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_28.sql begin; SELECT func1_nosql_imm(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_29.sql begin; SELECT func1_nosql_imm(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_30.sql SELECT func1_sql_int_vol(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_31.sql SELECT func1_sql_int_vol(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_32.sql SELECT func1_sql_int_vol(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_33.sql SELECT func1_sql_int_vol(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_34.sql SELECT func1_sql_int_vol(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_35.sql SELECT func1_sql_int_vol(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_36.sql SELECT func1_sql_int_vol(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_37.sql SELECT func1_sql_int_vol(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_38.sql begin; SELECT func1_sql_int_vol(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_39.sql begin; SELECT func1_sql_int_vol(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_40.sql SELECT func1_sql_int_stb(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_41.sql SELECT func1_sql_int_stb(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_42.sql SELECT func1_sql_int_stb(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_43.sql SELECT func1_sql_int_stb(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_44.sql SELECT func1_sql_int_stb(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_45.sql SELECT func1_sql_int_stb(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_46.sql SELECT func1_sql_int_stb(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_47.sql SELECT func1_sql_int_stb(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_48.sql begin; SELECT func1_sql_int_stb(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_49.sql begin; SELECT func1_sql_int_stb(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_50.sql SELECT func1_sql_int_imm(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_51.sql SELECT func1_sql_int_imm(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_52.sql SELECT func1_sql_int_imm(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_53.sql SELECT func1_sql_int_imm(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_54.sql SELECT func1_sql_int_imm(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_55.sql SELECT func1_sql_int_imm(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_56.sql SELECT func1_sql_int_imm(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_57.sql SELECT func1_sql_int_imm(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_58.sql begin; SELECT func1_sql_int_imm(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_59.sql begin; SELECT func1_sql_int_imm(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_60.sql SELECT func1_sql_setint_vol(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_61.sql SELECT func1_sql_setint_vol(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_62.sql SELECT func1_sql_setint_vol(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_63.sql SELECT func1_sql_setint_vol(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_64.sql SELECT func1_sql_setint_vol(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_65.sql SELECT func1_sql_setint_vol(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_66.sql SELECT func1_sql_setint_vol(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_67.sql SELECT func1_sql_setint_vol(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_68.sql begin; SELECT func1_sql_setint_vol(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_69.sql begin; SELECT func1_sql_setint_vol(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_70.sql SELECT func1_sql_setint_stb(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_71.sql SELECT func1_sql_setint_stb(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_72.sql SELECT func1_sql_setint_stb(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_73.sql SELECT func1_sql_setint_stb(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_74.sql SELECT func1_sql_setint_stb(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_75.sql SELECT func1_sql_setint_stb(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_76.sql SELECT func1_sql_setint_stb(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_77.sql SELECT func1_sql_setint_stb(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_78.sql begin; SELECT func1_sql_setint_stb(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_79.sql begin; SELECT func1_sql_setint_stb(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_80.sql SELECT func1_sql_setint_imm(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_81.sql SELECT func1_sql_setint_imm(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_82.sql SELECT func1_sql_setint_imm(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_83.sql SELECT func1_sql_setint_imm(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_84.sql SELECT func1_sql_setint_imm(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_85.sql SELECT func1_sql_setint_imm(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_86.sql SELECT func1_sql_setint_imm(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_87.sql SELECT func1_sql_setint_imm(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_88.sql begin; SELECT func1_sql_setint_imm(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_89.sql begin; SELECT func1_sql_setint_imm(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_90.sql SELECT func1_read_int_sql_vol(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_91.sql SELECT func1_read_int_sql_vol(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_92.sql SELECT func1_read_int_sql_vol(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_93.sql SELECT func1_read_int_sql_vol(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_94.sql SELECT func1_read_int_sql_vol(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_95.sql SELECT func1_read_int_sql_vol(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_96.sql SELECT func1_read_int_sql_vol(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_97.sql SELECT func1_read_int_sql_vol(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_98.sql begin; SELECT func1_read_int_sql_vol(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_99.sql begin; SELECT func1_read_int_sql_vol(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_100.sql SELECT func1_read_int_sql_stb(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_101.sql SELECT func1_read_int_sql_stb(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_102.sql SELECT func1_read_int_sql_stb(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_103.sql SELECT func1_read_int_sql_stb(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_104.sql SELECT func1_read_int_sql_stb(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_105.sql SELECT func1_read_int_sql_stb(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_106.sql SELECT func1_read_int_sql_stb(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_107.sql SELECT func1_read_int_sql_stb(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_108.sql begin; SELECT func1_read_int_sql_stb(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_109.sql begin; SELECT func1_read_int_sql_stb(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_110.sql SELECT func1_read_setint_sql_vol(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_111.sql SELECT func1_read_setint_sql_vol(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_112.sql SELECT func1_read_setint_sql_vol(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_113.sql SELECT func1_read_setint_sql_vol(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_114.sql SELECT func1_read_setint_sql_vol(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_115.sql SELECT func1_read_setint_sql_vol(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_116.sql SELECT func1_read_setint_sql_vol(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_117.sql SELECT func1_read_setint_sql_vol(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_118.sql begin; SELECT func1_read_setint_sql_vol(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_119.sql begin; SELECT func1_read_setint_sql_vol(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_120.sql SELECT func1_read_setint_sql_stb(func2_nosql_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_121.sql SELECT func1_read_setint_sql_stb(func2_nosql_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_122.sql SELECT func1_read_setint_sql_stb(func2_nosql_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_123.sql SELECT func1_read_setint_sql_stb(func2_sql_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_124.sql SELECT func1_read_setint_sql_stb(func2_sql_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_125.sql SELECT func1_read_setint_sql_stb(func2_sql_int_imm(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_126.sql SELECT func1_read_setint_sql_stb(func2_read_int_vol(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_127.sql SELECT func1_read_setint_sql_stb(func2_read_int_stb(5)) FROM foo order by 1; -- @description function_in_select_constant_withfunc2_128.sql begin; SELECT func1_read_setint_sql_stb(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_129.sql begin; SELECT func1_read_setint_sql_stb(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_130.sql begin; SELECT func1_mod_int_vol(func2_nosql_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_131.sql begin; SELECT func1_mod_int_vol(func2_nosql_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_132.sql begin; SELECT func1_mod_int_vol(func2_nosql_imm(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_133.sql begin; SELECT func1_mod_int_vol(func2_sql_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_134.sql begin; SELECT func1_mod_int_vol(func2_sql_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_135.sql begin; SELECT func1_mod_int_vol(func2_sql_int_imm(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_136.sql begin; SELECT func1_mod_int_vol(func2_read_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_137.sql begin; SELECT func1_mod_int_vol(func2_read_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_138.sql begin; SELECT func1_mod_int_vol(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_139.sql begin; SELECT func1_mod_int_vol(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_140.sql begin; SELECT func1_mod_int_stb(func2_nosql_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_141.sql begin; SELECT func1_mod_int_stb(func2_nosql_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_142.sql begin; SELECT func1_mod_int_stb(func2_nosql_imm(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_143.sql begin; SELECT func1_mod_int_stb(func2_sql_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_144.sql begin; SELECT func1_mod_int_stb(func2_sql_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_145.sql begin; SELECT func1_mod_int_stb(func2_sql_int_imm(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_146.sql begin; SELECT func1_mod_int_stb(func2_read_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_147.sql begin; SELECT func1_mod_int_stb(func2_read_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_148.sql begin; SELECT func1_mod_int_stb(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_149.sql begin; SELECT func1_mod_int_stb(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_150.sql begin; SELECT func1_mod_setint_vol(func2_nosql_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_151.sql begin; SELECT func1_mod_setint_vol(func2_nosql_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_152.sql begin; SELECT func1_mod_setint_vol(func2_nosql_imm(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_153.sql begin; SELECT func1_mod_setint_vol(func2_sql_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_154.sql begin; SELECT func1_mod_setint_vol(func2_sql_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_155.sql begin; SELECT func1_mod_setint_vol(func2_sql_int_imm(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_156.sql begin; SELECT func1_mod_setint_vol(func2_read_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_157.sql begin; SELECT func1_mod_setint_vol(func2_read_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_158.sql begin; SELECT func1_mod_setint_vol(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_159.sql begin; SELECT func1_mod_setint_vol(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_160.sql begin; SELECT func1_mod_setint_stb(func2_nosql_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_161.sql begin; SELECT func1_mod_setint_stb(func2_nosql_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_162.sql begin; SELECT func1_mod_setint_stb(func2_nosql_imm(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_163.sql begin; SELECT func1_mod_setint_stb(func2_sql_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_164.sql begin; SELECT func1_mod_setint_stb(func2_sql_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_165.sql begin; SELECT func1_mod_setint_stb(func2_sql_int_imm(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_166.sql begin; SELECT func1_mod_setint_stb(func2_read_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_167.sql begin; SELECT func1_mod_setint_stb(func2_read_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_168.sql begin; SELECT func1_mod_setint_stb(func2_mod_int_vol(5)) FROM foo order by 1; rollback; -- @description function_in_select_constant_withfunc2_169.sql begin; SELECT func1_mod_setint_stb(func2_mod_int_stb(5)) FROM foo order by 1; rollback; -- @description function_in_select_notable_0.sql SELECT func1_nosql_vol(5) order by 1; -- @description function_in_select_notable_1.sql SELECT func1_nosql_stb(5) order by 1; -- @description function_in_select_notable_2.sql SELECT func1_nosql_imm(5) order by 1; -- @description function_in_select_notable_3.sql SELECT func1_sql_int_vol(5) order by 1; -- @description function_in_select_notable_4.sql SELECT func1_sql_int_stb(5) order by 1; -- @description function_in_select_notable_5.sql SELECT func1_sql_int_imm(5) order by 1; -- @description function_in_select_notable_6.sql SELECT func1_sql_setint_vol(5) order by 1; -- @description function_in_select_notable_7.sql SELECT func1_sql_setint_stb(5) order by 1; -- @description function_in_select_notable_8.sql SELECT func1_sql_setint_imm(5) order by 1; -- @description function_in_select_notable_9.sql SELECT func1_read_int_sql_vol(5) order by 1; -- @description function_in_select_notable_10.sql SELECT func1_read_int_sql_stb(5) order by 1; -- @description function_in_select_notable_11.sql SELECT func1_read_setint_sql_vol(5) order by 1; -- @description function_in_select_notable_12.sql SELECT func1_read_setint_sql_stb(5) order by 1; -- @description function_in_select_notable_13.sql begin; SELECT func1_mod_int_vol(5) order by 1; rollback; -- @description function_in_select_notable_14.sql begin; SELECT func1_mod_int_stb(5) order by 1; rollback; -- @description function_in_select_notable_15.sql begin; SELECT func1_mod_setint_vol(5) order by 1; rollback; -- @description function_in_select_notable_16.sql begin; SELECT func1_mod_setint_stb(5) order by 1; rollback; -- @description function_in_select_notable_withfunc2_0.sql SELECT func1_nosql_vol(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_1.sql SELECT func1_nosql_vol(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_2.sql SELECT func1_nosql_vol(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_3.sql SELECT func1_nosql_vol(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_4.sql SELECT func1_nosql_vol(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_5.sql SELECT func1_nosql_vol(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_6.sql SELECT func1_nosql_vol(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_7.sql SELECT func1_nosql_vol(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_8.sql begin; SELECT func1_nosql_vol(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_9.sql begin; SELECT func1_nosql_vol(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_10.sql SELECT func1_nosql_stb(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_11.sql SELECT func1_nosql_stb(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_12.sql SELECT func1_nosql_stb(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_13.sql SELECT func1_nosql_stb(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_14.sql SELECT func1_nosql_stb(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_15.sql SELECT func1_nosql_stb(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_16.sql SELECT func1_nosql_stb(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_17.sql SELECT func1_nosql_stb(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_18.sql begin; SELECT func1_nosql_stb(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_19.sql begin; SELECT func1_nosql_stb(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_20.sql SELECT func1_nosql_imm(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_21.sql SELECT func1_nosql_imm(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_22.sql SELECT func1_nosql_imm(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_23.sql SELECT func1_nosql_imm(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_24.sql SELECT func1_nosql_imm(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_25.sql SELECT func1_nosql_imm(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_26.sql SELECT func1_nosql_imm(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_27.sql SELECT func1_nosql_imm(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_28.sql begin; SELECT func1_nosql_imm(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_29.sql begin; SELECT func1_nosql_imm(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_30.sql SELECT func1_sql_int_vol(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_31.sql SELECT func1_sql_int_vol(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_32.sql SELECT func1_sql_int_vol(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_33.sql SELECT func1_sql_int_vol(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_34.sql SELECT func1_sql_int_vol(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_35.sql SELECT func1_sql_int_vol(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_36.sql SELECT func1_sql_int_vol(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_37.sql SELECT func1_sql_int_vol(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_38.sql begin; SELECT func1_sql_int_vol(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_39.sql begin; SELECT func1_sql_int_vol(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_40.sql SELECT func1_sql_int_stb(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_41.sql SELECT func1_sql_int_stb(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_42.sql SELECT func1_sql_int_stb(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_43.sql SELECT func1_sql_int_stb(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_44.sql SELECT func1_sql_int_stb(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_45.sql SELECT func1_sql_int_stb(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_46.sql SELECT func1_sql_int_stb(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_47.sql SELECT func1_sql_int_stb(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_48.sql begin; SELECT func1_sql_int_stb(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_49.sql begin; SELECT func1_sql_int_stb(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_50.sql SELECT func1_sql_int_imm(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_51.sql SELECT func1_sql_int_imm(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_52.sql SELECT func1_sql_int_imm(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_53.sql SELECT func1_sql_int_imm(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_54.sql SELECT func1_sql_int_imm(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_55.sql SELECT func1_sql_int_imm(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_56.sql SELECT func1_sql_int_imm(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_57.sql SELECT func1_sql_int_imm(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_58.sql begin; SELECT func1_sql_int_imm(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_59.sql begin; SELECT func1_sql_int_imm(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_60.sql SELECT func1_sql_setint_vol(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_61.sql SELECT func1_sql_setint_vol(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_62.sql SELECT func1_sql_setint_vol(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_63.sql SELECT func1_sql_setint_vol(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_64.sql SELECT func1_sql_setint_vol(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_65.sql SELECT func1_sql_setint_vol(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_66.sql SELECT func1_sql_setint_vol(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_67.sql SELECT func1_sql_setint_vol(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_68.sql begin; SELECT func1_sql_setint_vol(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_69.sql begin; SELECT func1_sql_setint_vol(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_70.sql SELECT func1_sql_setint_stb(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_71.sql SELECT func1_sql_setint_stb(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_72.sql SELECT func1_sql_setint_stb(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_73.sql SELECT func1_sql_setint_stb(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_74.sql SELECT func1_sql_setint_stb(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_75.sql SELECT func1_sql_setint_stb(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_76.sql SELECT func1_sql_setint_stb(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_77.sql SELECT func1_sql_setint_stb(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_78.sql begin; SELECT func1_sql_setint_stb(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_79.sql begin; SELECT func1_sql_setint_stb(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_80.sql SELECT func1_sql_setint_imm(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_81.sql SELECT func1_sql_setint_imm(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_82.sql SELECT func1_sql_setint_imm(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_83.sql SELECT func1_sql_setint_imm(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_84.sql SELECT func1_sql_setint_imm(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_85.sql SELECT func1_sql_setint_imm(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_86.sql SELECT func1_sql_setint_imm(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_87.sql SELECT func1_sql_setint_imm(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_88.sql begin; SELECT func1_sql_setint_imm(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_89.sql begin; SELECT func1_sql_setint_imm(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_90.sql SELECT func1_read_int_sql_vol(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_91.sql SELECT func1_read_int_sql_vol(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_92.sql SELECT func1_read_int_sql_vol(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_93.sql SELECT func1_read_int_sql_vol(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_94.sql SELECT func1_read_int_sql_vol(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_95.sql SELECT func1_read_int_sql_vol(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_96.sql SELECT func1_read_int_sql_vol(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_97.sql SELECT func1_read_int_sql_vol(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_98.sql begin; SELECT func1_read_int_sql_vol(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_99.sql begin; SELECT func1_read_int_sql_vol(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_100.sql SELECT func1_read_int_sql_stb(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_101.sql SELECT func1_read_int_sql_stb(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_102.sql SELECT func1_read_int_sql_stb(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_103.sql SELECT func1_read_int_sql_stb(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_104.sql SELECT func1_read_int_sql_stb(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_105.sql SELECT func1_read_int_sql_stb(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_106.sql SELECT func1_read_int_sql_stb(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_107.sql SELECT func1_read_int_sql_stb(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_108.sql begin; SELECT func1_read_int_sql_stb(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_109.sql begin; SELECT func1_read_int_sql_stb(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_110.sql SELECT func1_read_setint_sql_vol(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_111.sql SELECT func1_read_setint_sql_vol(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_112.sql SELECT func1_read_setint_sql_vol(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_113.sql SELECT func1_read_setint_sql_vol(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_114.sql SELECT func1_read_setint_sql_vol(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_115.sql SELECT func1_read_setint_sql_vol(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_116.sql SELECT func1_read_setint_sql_vol(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_117.sql SELECT func1_read_setint_sql_vol(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_118.sql begin; SELECT func1_read_setint_sql_vol(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_119.sql begin; SELECT func1_read_setint_sql_vol(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_120.sql SELECT func1_read_setint_sql_stb(func2_nosql_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_121.sql SELECT func1_read_setint_sql_stb(func2_nosql_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_122.sql SELECT func1_read_setint_sql_stb(func2_nosql_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_123.sql SELECT func1_read_setint_sql_stb(func2_sql_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_124.sql SELECT func1_read_setint_sql_stb(func2_sql_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_125.sql SELECT func1_read_setint_sql_stb(func2_sql_int_imm(5)) order by 1; -- @description function_in_select_notable_withfunc2_126.sql SELECT func1_read_setint_sql_stb(func2_read_int_vol(5)) order by 1; -- @description function_in_select_notable_withfunc2_127.sql SELECT func1_read_setint_sql_stb(func2_read_int_stb(5)) order by 1; -- @description function_in_select_notable_withfunc2_128.sql begin; SELECT func1_read_setint_sql_stb(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_129.sql begin; SELECT func1_read_setint_sql_stb(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_130.sql begin; SELECT func1_mod_int_vol(func2_nosql_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_131.sql begin; SELECT func1_mod_int_vol(func2_nosql_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_132.sql begin; SELECT func1_mod_int_vol(func2_nosql_imm(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_133.sql begin; SELECT func1_mod_int_vol(func2_sql_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_134.sql begin; SELECT func1_mod_int_vol(func2_sql_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_135.sql begin; SELECT func1_mod_int_vol(func2_sql_int_imm(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_136.sql begin; SELECT func1_mod_int_vol(func2_read_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_137.sql begin; SELECT func1_mod_int_vol(func2_read_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_138.sql begin; SELECT func1_mod_int_vol(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_139.sql begin; SELECT func1_mod_int_vol(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_140.sql begin; SELECT func1_mod_int_stb(func2_nosql_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_141.sql begin; SELECT func1_mod_int_stb(func2_nosql_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_142.sql begin; SELECT func1_mod_int_stb(func2_nosql_imm(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_143.sql begin; SELECT func1_mod_int_stb(func2_sql_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_144.sql begin; SELECT func1_mod_int_stb(func2_sql_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_145.sql begin; SELECT func1_mod_int_stb(func2_sql_int_imm(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_146.sql begin; SELECT func1_mod_int_stb(func2_read_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_147.sql begin; SELECT func1_mod_int_stb(func2_read_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_148.sql begin; SELECT func1_mod_int_stb(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_149.sql begin; SELECT func1_mod_int_stb(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_150.sql begin; SELECT func1_mod_setint_vol(func2_nosql_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_151.sql begin; SELECT func1_mod_setint_vol(func2_nosql_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_152.sql begin; SELECT func1_mod_setint_vol(func2_nosql_imm(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_153.sql begin; SELECT func1_mod_setint_vol(func2_sql_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_154.sql begin; SELECT func1_mod_setint_vol(func2_sql_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_155.sql begin; SELECT func1_mod_setint_vol(func2_sql_int_imm(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_156.sql begin; SELECT func1_mod_setint_vol(func2_read_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_157.sql begin; SELECT func1_mod_setint_vol(func2_read_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_158.sql begin; SELECT func1_mod_setint_vol(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_159.sql begin; SELECT func1_mod_setint_vol(func2_mod_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_160.sql begin; SELECT func1_mod_setint_stb(func2_nosql_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_161.sql begin; SELECT func1_mod_setint_stb(func2_nosql_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_162.sql begin; SELECT func1_mod_setint_stb(func2_nosql_imm(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_163.sql begin; SELECT func1_mod_setint_stb(func2_sql_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_164.sql begin; SELECT func1_mod_setint_stb(func2_sql_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_165.sql begin; SELECT func1_mod_setint_stb(func2_sql_int_imm(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_166.sql begin; SELECT func1_mod_setint_stb(func2_read_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_167.sql begin; SELECT func1_mod_setint_stb(func2_read_int_stb(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_168.sql begin; SELECT func1_mod_setint_stb(func2_mod_int_vol(5)) order by 1; rollback; -- @description function_in_select_notable_withfunc2_169.sql begin; SELECT func1_mod_setint_stb(func2_mod_int_stb(5)) order by 1; rollback;
the_stack
-- -- ------------------------------------------------------ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!50503 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `accessibility_for_disabilities` -- DROP TABLE IF EXISTS `accessibility_for_disabilities`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `accessibility_for_disabilities` ( `id` varchar(250) NOT NULL COMMENT 'Each entry must have a unique identifier', `location_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the location for which the entry describes the accessibility provision', `accessibility` text COMMENT 'Description of assistance or infrastructure that facilitate access to clients with disabilities.', `details` text COMMENT 'Any further details relating to the relevant accessibility arrangements at this location. E.g. whether advance notice is required to use an accessibility facility.', PRIMARY KEY (`id`), KEY `location_id` (`location_id`), CONSTRAINT `accessibility_for_disabilities_ibfk_1` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`), CONSTRAINT `accessibility_for_disabilities_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `accessibility_for_disabilities_chk_2` CHECK ((length(`location_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `contact` -- DROP TABLE IF EXISTS `contact`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `contact` ( `id` varchar(250) NOT NULL COMMENT 'Each contact must have a unique identifier', `organization_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the organization for which this is a contact', `service_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the service for which this is a contact', `service_at_location_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the ''service at location'' table entry, when this contact is specific to a service in a particular location.', `name` text COMMENT 'The name of the person', `title` text COMMENT 'The job title of the person', `department` text COMMENT 'The department that the person is part of', `email` text COMMENT 'The email address of the person', PRIMARY KEY (`id`), KEY `organization_id` (`organization_id`), KEY `service_id` (`service_id`), KEY `service_at_location_id` (`service_at_location_id`), CONSTRAINT `contact_ibfk_1` FOREIGN KEY (`organization_id`) REFERENCES `organization` (`id`), CONSTRAINT `contact_ibfk_2` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `contact_ibfk_3` FOREIGN KEY (`service_at_location_id`) REFERENCES `service_at_location` (`id`), CONSTRAINT `contact_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `contact_chk_2` CHECK ((length(`organization_id`) <= 250)), CONSTRAINT `contact_chk_3` CHECK ((length(`service_id`) <= 250)), CONSTRAINT `contact_chk_4` CHECK ((length(`service_at_location_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `eligibility` -- DROP TABLE IF EXISTS `eligibility`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `eligibility` ( `id` varchar(250) NOT NULL COMMENT 'Each entry must have a unique identifier', `service_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the service for which this entry describes the eligibility criteria', PRIMARY KEY (`id`), KEY `service_id` (`service_id`), CONSTRAINT `eligibility_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `eligibility_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `eligibility_chk_2` CHECK ((length(`service_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `funding` -- DROP TABLE IF EXISTS `funding`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `funding` ( `id` varchar(250) NOT NULL COMMENT 'Each entry must have a unique identifier', `organization_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the organization in receipt of this funding.', `service_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the service in receipt of this funding', `source` text COMMENT 'A free text description of the source of funds for this organization or service.', PRIMARY KEY (`id`), KEY `service_id` (`service_id`), KEY `organization_id` (`organization_id`), CONSTRAINT `funding_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `funding_ibfk_2` FOREIGN KEY (`organization_id`) REFERENCES `organization` (`id`), CONSTRAINT `funding_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `funding_chk_2` CHECK ((length(`organization_id`) <= 250)), CONSTRAINT `funding_chk_3` CHECK ((length(`service_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `language` -- DROP TABLE IF EXISTS `language`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `language` ( `id` varchar(250) NOT NULL COMMENT 'Each language must have a unique identifier', `service_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the service for which the entry describes the languages in which services are delivered', `location_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the location for which the entry describes the languages in which services are delivered', `language` text COMMENT 'Languages, other than English, in which the service is delivered. Languages are listed as ISO639-1 codes.', PRIMARY KEY (`id`), KEY `service_id` (`service_id`), KEY `location_id` (`location_id`), CONSTRAINT `language_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `language_ibfk_2` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`), CONSTRAINT `language_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `language_chk_2` CHECK ((length(`service_id`) <= 250)), CONSTRAINT `language_chk_3` CHECK ((length(`location_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `location` -- DROP TABLE IF EXISTS `location`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `location` ( `id` varchar(250) NOT NULL COMMENT 'Each location must have a unique identifier', `organization_id` varchar(250) DEFAULT NULL COMMENT 'Each location entry should be linked to a single organization. This is the organization that is responsible for maintaining information about this location. The identifier of the organization should be given here. Details of the services the organization delivers at this location should be provided in the services_at_location table.', `name` text COMMENT 'The name of the location', `alternate_name` text COMMENT 'An alternative name for the location', `description` text COMMENT 'A description of this location.', `transportation` text COMMENT 'A description of the access to public or private transportation to and from the location.', `latitude` float DEFAULT NULL COMMENT 'Y coordinate of location expressed in decimal degrees in WGS84 datum.', `longitude` float DEFAULT NULL COMMENT 'X coordinate of location expressed in decimal degrees in WGS84 datum.', PRIMARY KEY (`id`), KEY `organization_id` (`organization_id`), CONSTRAINT `location_ibfk_1` FOREIGN KEY (`organization_id`) REFERENCES `organization` (`id`), CONSTRAINT `location_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `location_chk_2` CHECK ((length(`organization_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `meta_table_description` -- DROP TABLE IF EXISTS `meta_table_description`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `meta_table_description` ( `id` varchar(250) NOT NULL COMMENT 'Each entry must have a unique identifier', `name` text, `language` text, `character_set` text, PRIMARY KEY (`id`), CONSTRAINT `meta_table_description_chk_1` CHECK ((length(`id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `metadata` -- DROP TABLE IF EXISTS `metadata`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `metadata` ( `id` varchar(250) NOT NULL COMMENT 'Each entry must have a unique identifier', `resource_id` text NOT NULL COMMENT 'Each service, program. location, address, or contact will have a unique identifier.', `resource_type` enum('organization','program','service','service_attribute','other_attribute','service_at_location','location','phone','contact','schedule','funding','eligibility','service_area','accessibility_for_disabilities','taxonomy_term') NOT NULL COMMENT 'The type of entity being referenced', `last_action_date` datetime NOT NULL COMMENT 'The date when data was changed.', `last_action_type` text NOT NULL COMMENT 'The kind of change made to the data; eg create, update, delete', `field_name` text NOT NULL COMMENT 'The name of field that has been modified', `previous_value` text NOT NULL COMMENT 'The previous value of a field that has been updated', `replacement_value` text NOT NULL COMMENT 'The new value of a field that has been updated', `updated_by` text NOT NULL COMMENT 'The name of the person who updated a value', PRIMARY KEY (`id`), CONSTRAINT `metadata_chk_1` CHECK ((length(`id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `organization` -- DROP TABLE IF EXISTS `organization`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `organization` ( `id` varchar(250) NOT NULL COMMENT 'Each organization must have a unique identifier.', `name` text NOT NULL COMMENT 'The official or public name of the organization.', `alternate_name` text COMMENT 'Alternative or commonly used name for the organization.', `description` text NOT NULL COMMENT 'A brief summary about the organization. It can contain markup such as HTML or Markdown.', `email` text COMMENT 'The contact e-mail address for the organization.', `url` text COMMENT 'The URL (website address) of the organization.', `tax_status` text COMMENT 'Government assigned tax designation for tax-exempt organizations.', `tax_id` text COMMENT 'A government issued identifier used for the purpose of tax administration.', `year_incorporated` date DEFAULT NULL COMMENT 'The year in which the organization was legally formed.', `legal_status` text COMMENT 'The legal status defines the conditions that an organization is operating under; e.g. non-profit, private corporation or a government organization.', PRIMARY KEY (`id`), CONSTRAINT `organization_chk_1` CHECK ((length(`id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `other_attribute` -- DROP TABLE IF EXISTS `other_attribute`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `other_attribute` ( `id` varchar(250) NOT NULL COMMENT 'Each other_attribute entry should have a unique identifier.', `link_id` text NOT NULL COMMENT 'The identifier of the entity to which this taxonomy term applies.', `link_type` enum('organization','program','service','service_at_location','location','phone','contact','physical_address','postal_address','schedule','funding','eligibility','service_area','required_document','payment_accepted','language','accessibility_for_disabilities') NOT NULL COMMENT 'The identifier of the entity to which this taxonomy term applies.', `taxonomy_term_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of this taxonomy term from the taxonomy table.', PRIMARY KEY (`id`), KEY `taxonomy_term_id` (`taxonomy_term_id`), CONSTRAINT `other_attribute_ibfk_1` FOREIGN KEY (`taxonomy_term_id`) REFERENCES `taxonomy_term` (`id`), CONSTRAINT `other_attribute_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `other_attribute_chk_2` CHECK ((length(`taxonomy_term_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `payment_accepted` -- DROP TABLE IF EXISTS `payment_accepted`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `payment_accepted` ( `id` varchar(250) NOT NULL COMMENT 'Each entry must have a unique identifier', `service_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the services for which the entry describes the accepted payment methods', `payment` text COMMENT 'The methods of payment accepted for the service', PRIMARY KEY (`id`), KEY `service_id` (`service_id`), CONSTRAINT `payment_accepted_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `payment_accepted_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `payment_accepted_chk_2` CHECK ((length(`service_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `phone` -- DROP TABLE IF EXISTS `phone`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `phone` ( `id` varchar(250) NOT NULL COMMENT 'Each entry must have a unique identifier', `location_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the location where this phone number is located', `service_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the service for which this is the phone number', `organization_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the organization for which this is the phone number', `contact_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the contact for which this is the phone number', `service_at_location_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the ''service at location'' table entry, when this phone number is specific to a service in a particular location.', `number` text NOT NULL COMMENT 'The phone number', `extension` float DEFAULT NULL COMMENT 'The extension of the phone number', `type` enum('text','voice','fax','cell','video','pager','textphone') DEFAULT NULL COMMENT 'Indicates the type of phone service, drawing from the RFC6350 list of types (text (for SMS), voice, fax, cell, video, pager, textphone).', `language` text COMMENT 'A comma separated list of ISO 639-1, or ISO 639-2 [language codes](available at http://www.loc.gov/standards/iso639-2/php/code_list.php) to represent the languages available from this phone service. The three-letter codes from ISO 639-2 provide greater accuracy when describing variants of languages, which may be relevant to particular communities.', `description` text COMMENT 'A description providing extra information about the phone service (e.g. any special arrangements for accessing, or details of availability at particular times.', `department` text COMMENT '(Deprecated) The department for which this is the phone number. This field is deprecated and will be removed in a future version of HSDS.', PRIMARY KEY (`id`), KEY `organization_id` (`organization_id`), KEY `location_id` (`location_id`), KEY `service_id` (`service_id`), KEY `contact_id` (`contact_id`), KEY `service_at_location_id` (`service_at_location_id`), CONSTRAINT `phone_ibfk_1` FOREIGN KEY (`organization_id`) REFERENCES `organization` (`id`), CONSTRAINT `phone_ibfk_2` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`), CONSTRAINT `phone_ibfk_3` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `phone_ibfk_4` FOREIGN KEY (`contact_id`) REFERENCES `contact` (`id`), CONSTRAINT `phone_ibfk_5` FOREIGN KEY (`service_at_location_id`) REFERENCES `service_at_location` (`id`), CONSTRAINT `phone_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `phone_chk_2` CHECK ((length(`location_id`) <= 250)), CONSTRAINT `phone_chk_3` CHECK ((length(`service_id`) <= 250)), CONSTRAINT `phone_chk_4` CHECK ((length(`organization_id`) <= 250)), CONSTRAINT `phone_chk_5` CHECK ((length(`contact_id`) <= 250)), CONSTRAINT `phone_chk_6` CHECK ((length(`service_at_location_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `physical_address` -- DROP TABLE IF EXISTS `physical_address`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `physical_address` ( `id` varchar(250) NOT NULL COMMENT 'Each physical address must have a unique identifier.', `location_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the location for which this is the address.', `attention` text COMMENT 'The person or entity whose attention should be sought at the location (Often included as ''care of'' component of an address.)', `address_1` text NOT NULL COMMENT 'The first line(s) of the address, including office, building number and street.', `address_2` text COMMENT '(Deprecated) A second (additional) line of address information. (This field is deprecated: we recommend including all address information before ''city'' as a comma or newline separated list in address_1. There is no guarantee that systems will read this line of address information.)', `address_3` text COMMENT '(Deprecated) A third (additional) line of address information. (This field is deprecated: we recommend including all address information before ''city'' as a comma or newline separated list in address_1. There is no guarantee that systems will read this line of address information.)', `address_4` text COMMENT '(Deprecated) The fourth (additional) line of address information. (This field is deprecated: we recommend including all address information before ''city'' as a comma or newline separated list in address_1. There is no guarantee that systems will read this line of address information.)', `city` text NOT NULL COMMENT 'The city in which the address is located.', `region` text COMMENT 'The region in which the address is located (optional).', `state_province` text NOT NULL COMMENT 'The state or province in which the address is located.', `postal_code` text NOT NULL COMMENT 'The postal code for the address.', `country` text NOT NULL COMMENT 'The country in which the address is located. This should be given as an ISO 3361-1 country code (two letter abbreviation).', PRIMARY KEY (`id`), KEY `location_id` (`location_id`), CONSTRAINT `physical_address_ibfk_1` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`), CONSTRAINT `physical_address_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `physical_address_chk_2` CHECK ((length(`location_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `postal_address` -- DROP TABLE IF EXISTS `postal_address`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `postal_address` ( `id` varchar(250) NOT NULL COMMENT 'Each postal address must have a unique identifier', `location_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the location for which this is the postal address.', `attention` text COMMENT 'The person or entity whose attention should be sought at the location (Often included as ''care of'' component of an address.)', `address_1` text NOT NULL COMMENT 'The first line(s) of the address, including office, building number and street.', `address_2` text COMMENT '(Deprecated) A second (additional) line of address information. (This field is deprecated: we recommend including all address information before ''city'' as a comma or newline separated list in address_1. There is no guarantee that systems will read this line of address information.)', `address_3` text COMMENT '(Deprecated) A third (additional) line of address information. (This field is deprecated: we recommend including all address information before ''city'' as a comma or newline separated list in address_1. There is no guarantee that systems will read this line of address information.)', `address_4` text COMMENT '(Deprecated) The fourth (additional) line of address information. (This field is deprecated: we recommend including all address information before ''city'' as a comma or newline separated list in address_1. There is no guarantee that systems will read this line of address information.)', `city` text NOT NULL COMMENT 'The city in which the address is located.', `region` text COMMENT 'The region in which the address is located (optional).', `state_province` text NOT NULL COMMENT 'The state or province in which the address is located.', `postal_code` text NOT NULL COMMENT 'The postal code for the address.', `country` text NOT NULL COMMENT 'The country in which the address is located. This should be given as an ISO 3361-1 country code (two letter abbreviation)', PRIMARY KEY (`id`), KEY `location_id` (`location_id`), CONSTRAINT `postal_address_ibfk_1` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`), CONSTRAINT `postal_address_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `postal_address_chk_2` CHECK ((length(`location_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `program` -- DROP TABLE IF EXISTS `program`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `program` ( `id` varchar(250) NOT NULL COMMENT 'Each program must have a unique identifier.', `organization_id` varchar(250) NOT NULL COMMENT 'Each program must belong to a single organization. The identifier of the organization should be given here.', `name` text NOT NULL COMMENT 'The name of the program', `alternate_name` text COMMENT 'An alternative name for the program', PRIMARY KEY (`id`), KEY `organization_id` (`organization_id`), CONSTRAINT `program_ibfk_1` FOREIGN KEY (`organization_id`) REFERENCES `organization` (`id`), CONSTRAINT `program_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `program_chk_2` CHECK ((length(`organization_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `required_document` -- DROP TABLE IF EXISTS `required_document`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `required_document` ( `id` varchar(250) NOT NULL COMMENT 'Each document must have a unique identifier', `service_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the service for which this entry describes the required document', `document` text COMMENT 'The document required to apply for or receive the service. e.g. ''Government-issued ID'', ''EU Passport''', PRIMARY KEY (`id`), KEY `service_id` (`service_id`), CONSTRAINT `required_document_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `required_document_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `required_document_chk_2` CHECK ((length(`service_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `schedule` -- DROP TABLE IF EXISTS `schedule`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `schedule` ( `id` varchar(250) NOT NULL COMMENT 'Each entry must have a unique identifier', `service_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the service for which this is the regular schedule', `location_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the location for which this is the regular schedule', `service_at_location_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the ''service at location'' table entry, when this schedule is specific to a service in a particular location.', `valid_from` date DEFAULT NULL COMMENT 'The date from which the schedule information is valid.', `valid_to` date DEFAULT NULL COMMENT 'The last date on which the schedule information is valid.', `dtstart` date DEFAULT NULL COMMENT 'iCal - The date of the first event is the schedule. Necessary when using the ''interval'' feature, optional otherwise.', `timezone` float DEFAULT NULL COMMENT 'The timezone that all dates are expressed as, expressed as a UTC offset. Dates are assumed to be UTC otherwise.', `until` date DEFAULT NULL COMMENT 'iCal - The date of the last occurence of the recurring event.', `count` date DEFAULT NULL COMMENT 'iCal - The number of times that the event occurs. Use this instead of ''until'', if appropriate.', `wkst` date DEFAULT NULL COMMENT 'iCal - The day on which the week starts, eg MO.', `freq` enum('DAILY','WEEKLY','MONTHLY','YEARLY') DEFAULT NULL COMMENT 'iCal - How often the frequency repeats. E.g. Frequency use one of WEEKLY or MONTHLY.', `interval` float DEFAULT NULL COMMENT 'iCal - How often the frequency repeats. E.g. Interval 2 for Frequency WEEKLY gives Fortnightly', `byday` text COMMENT 'iCal - Comma seperated days of the week. E.g. SU,MO,TU,WE,TH,FR,SA. Where freq is MONTHLY each part can be preceded by a positive or negative integer to represent which occurrence in a month; e.g. 2MO is the second Monday in a month. -1FR is the last Friday', `byweekno` text COMMENT 'iCal - Comma seperated numeric weeks of the year if freq is WEEKLY. Can be negative to represent weeks before the end of the year; e.g. -5 is the 5th to last week in a year.', `bymonthday` float DEFAULT NULL COMMENT 'iCal - Comma separated numeric days of the month if frequency is MONTHLY. Can be negative to represent days before the end of the month; e.g. -5 is the 5th to last day in a month.', `byyearday` float DEFAULT NULL COMMENT 'iCal - Comma separated numeric days of the month if frequency is YEARLY. Can be negative to represent days before the end of the year; e.g. -1 is the last day in a year.', `description` text COMMENT 'Human readable description of the availability of the service.', `opens_at` time DEFAULT NULL COMMENT 'The time when a service or location opens. This should use HH:MM format and should include timezone information, either adding the suffix ''Z'' when the date is in UTC, or including an offset from UTC (e.g. 09:00-05:00 for 9am EST.)', `closes_at` time DEFAULT NULL COMMENT 'The time when a service or location closes. This should use HH:MM format and should include timezone information, either adding the suffix ''Z'' when the date is in UTC, or including an offset from UTC (e.g. 09:00-05:00 for 9am EST.)', PRIMARY KEY (`id`), KEY `location_id` (`location_id`), KEY `service_id` (`service_id`), KEY `service_at_location_id` (`service_at_location_id`), CONSTRAINT `schedule_ibfk_1` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`), CONSTRAINT `schedule_ibfk_2` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `schedule_ibfk_3` FOREIGN KEY (`service_at_location_id`) REFERENCES `service_at_location` (`id`), CONSTRAINT `schedule_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `schedule_chk_2` CHECK ((length(`service_id`) <= 250)), CONSTRAINT `schedule_chk_3` CHECK ((length(`location_id`) <= 250)), CONSTRAINT `schedule_chk_4` CHECK ((length(`service_at_location_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `service` -- DROP TABLE IF EXISTS `service`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `service` ( `id` varchar(250) NOT NULL COMMENT 'Each service must have a unique identifier.', `organization_id` varchar(250) NOT NULL COMMENT 'The identifier of the organization that provides this service.', `program_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the program this service is delivered under.', `name` text NOT NULL COMMENT 'The official or public name of the service.', `alternate_name` text COMMENT 'Alternative or commonly used name for a service.', `description` text COMMENT 'A description of the service.', `url` text COMMENT 'URL of the service', `email` text COMMENT 'Email address for the service', `status` enum('active','inactive','defunct','temporarily closed') NOT NULL COMMENT 'The current status of the service.', `interpretation_services` text COMMENT 'A description of any interpretation services available for accessing this service.', `application_process` text COMMENT 'The steps needed to access the service.', `wait_time` text COMMENT 'Time a client may expect to wait before receiving a service.', `fees` text COMMENT 'Details of any charges for service users to access this service.', `accreditations` text COMMENT 'Details of any accreditations. Accreditation is the formal evaluation of an organization or program against best practice standards set by an accrediting organization.', `licenses` text COMMENT 'An organization may have a license issued by a government entity to operate legally. A list of any such licenses can be provided here.', PRIMARY KEY (`id`), KEY `organization_id` (`organization_id`), KEY `program_id` (`program_id`), CONSTRAINT `service_ibfk_1` FOREIGN KEY (`organization_id`) REFERENCES `organization` (`id`), CONSTRAINT `service_ibfk_2` FOREIGN KEY (`program_id`) REFERENCES `program` (`id`), CONSTRAINT `service_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `service_chk_2` CHECK ((length(`organization_id`) <= 250)), CONSTRAINT `service_chk_3` CHECK ((length(`program_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `service_area` -- DROP TABLE IF EXISTS `service_area`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `service_area` ( `id` varchar(250) NOT NULL COMMENT 'Each service area must have a unique identifier', `service_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of the service for which this entry describes the service area', `service_area` text COMMENT 'The geographic area where a service is available. This is a free-text description, and so may be precise or indefinite as necessary.', `description` text COMMENT 'A more detailed description of this service area. Used to provide any additional information that cannot be communicated using the structured area and geometry fields.', PRIMARY KEY (`id`), KEY `service_id` (`service_id`), CONSTRAINT `service_area_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `service_area_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `service_area_chk_2` CHECK ((length(`service_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `service_at_location` -- DROP TABLE IF EXISTS `service_at_location`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `service_at_location` ( `id` varchar(250) NOT NULL COMMENT 'Each entry must have a unique identifier.', `service_id` varchar(250) NOT NULL COMMENT 'The identifier of the service at a given location.', `location_id` varchar(250) NOT NULL COMMENT 'The identifier of the location where this service operates.', `description` text COMMENT 'Any additional information that should be displayed to users about the service at this specific location.', PRIMARY KEY (`id`), KEY `service_id` (`service_id`), KEY `location_id` (`location_id`), CONSTRAINT `service_at_location_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `service_at_location_ibfk_2` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`), CONSTRAINT `service_at_location_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `service_at_location_chk_2` CHECK ((length(`service_id`) <= 250)), CONSTRAINT `service_at_location_chk_3` CHECK ((length(`location_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `service_attribute` -- DROP TABLE IF EXISTS `service_attribute`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `service_attribute` ( `id` varchar(250) NOT NULL COMMENT 'Each service_attribute entry should have a unique identifier.', `service_id` varchar(250) NOT NULL COMMENT 'The identifier of the service to which this taxonomy term applies.', `taxonomy_term_id` varchar(250) DEFAULT NULL COMMENT 'The identifier of this taxonomy term from the taxonomy table.', PRIMARY KEY (`id`), KEY `service_id` (`service_id`), KEY `taxonomy_term_id` (`taxonomy_term_id`), CONSTRAINT `service_attribute_ibfk_1` FOREIGN KEY (`service_id`) REFERENCES `service` (`id`), CONSTRAINT `service_attribute_ibfk_2` FOREIGN KEY (`taxonomy_term_id`) REFERENCES `taxonomy_term` (`id`), CONSTRAINT `service_attribute_chk_1` CHECK ((length(`id`) <= 250)), CONSTRAINT `service_attribute_chk_2` CHECK ((length(`service_id`) <= 250)), CONSTRAINT `service_attribute_chk_3` CHECK ((length(`taxonomy_term_id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `taxonomy_term` -- DROP TABLE IF EXISTS `taxonomy_term`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `taxonomy_term` ( `id` varchar(250) NOT NULL COMMENT 'Each taxonomy term must have a unique identifier, within the scope of the dataset', `term` text NOT NULL COMMENT 'The taxonomy term itself.', `description` text NOT NULL COMMENT 'What the term means', `parent_id` text COMMENT 'If this is a child term in a hierarchical taxonomy, give the identifier of the parent category. For top-level categories, this should be left blank.', `taxonomy` text COMMENT 'If this is an established taxonomy, detail which taxonomy is in use. For example, AIRS or Open Eligibility. If possible, provide a URI.', `language` text COMMENT 'An ISO 639-1, or ISO 639-2 [language code](available at http://www.loc.gov/standards/iso639-2/php/code_list.php) to represent the language of the term. The three-letter codes from ISO 639-2 provide greater accuracy when describing variants of languages, which may be relevant to particular communities.', PRIMARY KEY (`id`), CONSTRAINT `taxonomy_term_chk_1` CHECK ((length(`id`) <= 250)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
the_stack
PRINT 'Inserting Sales.Customers' GO -- BuyingGroupID 1 is for individual buyers and is used -- in the AddCustomers procedure, this one populates -- corporate companies DECLARE buyinggroup CURSOR FOR SELECT [BuyingGroupID], [BuyingGroupName] FROM [Sales].[BuyingGroups] WHERE [ValidTo] = '9999-12-31 23:59:59.9999999' AND [BuyingGroupID] > 1 DECLARE @BuyingGroupID AS INT DECLARE @BuyingGroupName AS NVARCHAR(50) DECLARE @CurrentDateTime AS DATETIME2(7) = '20130101'; DECLARE @EndOfTime AS DATETIME2(7) = '99991231 23:59:59.9999999'; DECLARE @myCityID AS INT DECLARE @myCityName AS NVARCHAR(50) DECLARE @myStateProvinceCode AS NVARCHAR(5) DECLARE @myStateProvinceName AS NVARCHAR(50) DECLARE @myAreaCode AS NVARCHAR(3) DECLARE @myFirstName AS NVARCHAR(20) DECLARE @myLastName AS NVARCHAR(20) DECLARE @myFullName AS NVARCHAR(40) DECLARE @myEmail AS NVARCHAR(200) -- Variables / Constants for People table DECLARE @PersonID AS INT = 1000 DECLARE @FullName AS NVARCHAR(50) DECLARE @PreferredName AS NVARCHAR(50) DECLARE @IsPermittedToLogon AS BIT = 0 DECLARE @LogonName AS NVARCHAR(50) = 'NO LOGON' DECLARE @IsExternalLogonProvider AS BIT = 0 DECLARE @HashedPassword AS VARBINARY(MAX) = NULL DECLARE @IsSystemUser AS BIT = 0 DECLARE @IsEmployee AS BIT = 0 DECLARE @IsSalesperson AS BIT = 0 DECLARE @UserPreferences AS NVARCHAR(MAX) = NULL DECLARE @PhoneNumber AS NVARCHAR(20) DECLARE @FaxNumber AS NVARCHAR(20) DECLARE @EmailAddress AS NVARCHAR(256) DECLARE @LastEditedBy AS INT = 1 DECLARE @personMainContact AS INT DECLARE @personSecondaryContact AS INT DECLARE @loopCounter AS INT DECLARE @myEmailDomain AS NVARCHAR(256) -- Variables/Constants for the Customer table DECLARE @CustomerID AS INT = 0 DECLARE @CustomerName AS NVARCHAR(100) DECLARE @BillToCustomerID AS INT DECLARE @CustomerCategoryID AS INT DECLARE @PrimaryContactPersonID AS INT DECLARE @AlternateContactPersonID AS INT DECLARE @DeliveryMethodID AS INT DECLARE @DeliveryCityID AS INT DECLARE @PostalCityID AS INT DECLARE @CreditLimit AS DECIMAL(18,2) = NULL DECLARE @AccountOpenedDate AS DATE = '20130101' DECLARE @StandardDiscountPercentage AS DECIMAL(18,3) = 0 DECLARE @IsStatementSent AS BIT = 0 DECLARE @IsOnCreditHold AS BIT = 0 DECLARE @PaymentDays AS INT = 7 DECLARE @DeliveryRun AS NVARCHAR(5) = '' DECLARE @RunPosition AS NVARCHAR(5) = '' DECLARE @WebsiteURL AS NVARCHAR(256) DECLARE @DeliveryAddressLine1 AS NVARCHAR(60) DECLARE @DeliveryAddressLine2 AS NVARCHAR(60) DECLARE @DeliveryPostalCode AS NVARCHAR(10) DECLARE @DeliveryLocation AS GEOGRAPHY DECLARE @PostalAddressLine1 AS NVARCHAR(60) DECLARE @PostalAddressLine2 AS NVARCHAR(60) DECLARE @PostalPostalCode AS NVARCHAR(10) DECLARE @UsedCityIDs AS TABLE (UsedCityID INT) DECLARE @LoopWhileTrue AS BIT = 1 DECLARE @CityCount AS INT = 0 DECLARE @CorporateCustomerCategoryID AS INT DECLARE @numberOfRandomCustomers AS INT DECLARE @currentRandomCustomerNumber AS INT -- Get the highest PERSON ID from the Person table SELECT @PersonID = MAX(PersonID) FROM [Application].[People] -- Get the customer category ID for corporate, as all head -- offices will be of the Corporate customer category type SELECT @CorporateCustomerCategoryID = CustomerCategoryID FROM [Sales].[CustomerCategories] WHERE CustomerCategoryName = 'Corporate' OPEN buyinggroup FETCH NEXT FROM buyinggroup INTO @BuyingGroupID, @BuyingGroupName WHILE (@@FETCH_STATUS <> -1) BEGIN -- Get a buying group to insert data for SELECT @BuyingGroupID, @BuyingGroupName -- Get a random city for the customer and home office EXEC [DataLoadSimulation].[GetRandomCity] @CityID = @myCityID OUTPUT , @CityName = @myCityName OUTPUT , @StateProvinceCode = @myStateProvinceCode OUTPUT , @StateProvinceName = @myStateProvinceName OUTPUT , @AreaCode = @myAreaCode OUTPUT -- Get the website URL for the buying group EXEC [DataLoadSimulation].[GetBuyingGroupDomain] @BuyingGroup = @BuyingGroupName , @WebDomain = @WebsiteURL OUTPUT , @EmailDomain = @myEmailDomain OUTPUT -- Get payment days for this customer, we will use it for -- both the home office and sub offices EXEC [DataLoadSimulation].[GetRandomPaymentDays] @RandomPaymentDays = @PaymentDays OUTPUT -- We will need the IDs of the person for inserting into -- the new customer record, so grab them now SET @personMainContact = @PersonID + 1 SET @personSecondaryContact = @PersonID + 2 -- Loop to insert the two contacts SET @loopCounter = 0 WHILE @loopCounter < 2 BEGIN -- Get a random ficticious person for the first buyer EXEC [DataLoadSimulation].[GetFicticiousName] @FirstName = @myFirstName OUTPUT , @LastName = @myLastName OUTPUT , @FullName = @myFullName OUTPUT , @Email = @myEmail OUTPUT -- Insert the buyers for the home office buying group SET @PersonID = @PersonID + 1 -- Note we do mean to increment every time -- Copy name data from the GetFicticiousName proc SET @FullName = @myFullName SET @PreferredName = @myFirstName SET @EmailAddress = @myEmail + '@' + @myEmailDomain + '.com' -- Generate random phone numbers EXEC [DataLoadSimulation].[GetBogativePhoneNumber] @AreaCode = @myAreaCode , @PhoneNumber = @PhoneNumber OUTPUT EXEC [DataLoadSimulation].[GetBogativePhoneNumber] @AreaCode = @myAreaCode , @PhoneNumber = @FaxNumber OUTPUT -- Insert the new person INSERT [Application].People (PersonID, FullName, PreferredName, IsPermittedToLogon, LogonName, IsExternalLogonProvider, HashedPassword, IsSystemUser, IsEmployee, IsSalesperson, UserPreferences, PhoneNumber, FaxNumber, EmailAddress, LastEditedBy, ValidFrom, ValidTo) VALUES (@PersonID, @FullName, @PreferredName, @IsPermittedToLogon, @LogonName, @IsExternalLogonProvider, @HashedPassword, @IsSystemUser, @IsEmployee, @IsSalesperson, @UserPreferences, @PhoneNumber, @FaxNumber, @EmailAddress, @LastEditedBy, @CurrentDateTime, @EndOfTime) SET @loopCounter = @loopCounter + 1 END -- WHILE @loopCounter < 2 -- Insert the Home Office customer SET @CustomerID = @CustomerID + 1 SET @CustomerName = @BuyingGroupName + ' (Head Office)' SET @BillToCustomerID = @CustomerID -- BillToCustomerID will be the head office SET @CustomerCategoryID = 3 SET @DeliveryCityID = @myCityID SET @PostalCityID = @myCityID -- Get a random delivery method EXEC [DataLoadSimulation].[GetRandomDeliveryMethod] @RandomDeliveryMethod = @DeliveryMethodID OUTPUT -- Generate random phone numbers EXEC [DataLoadSimulation].[GetBogativePhoneNumber] @AreaCode = @myAreaCode , @PhoneNumber = @PhoneNumber OUTPUT EXEC [DataLoadSimulation].[GetBogativePhoneNumber] @AreaCode = @myAreaCode , @PhoneNumber = @FaxNumber OUTPUT -- Get the Delivery Address EXEC [DataLoadSimulation].[GetRandomStreet] @randomStreet = @DeliveryAddressLine1 OUTPUT; EXEC [DataLoadSimulation].[GetRandomSecondaryAddress] @randomSecondaryAddress = @DeliveryAddressLine2 OUTPUT; -- Get the Postal Address EXEC [DataLoadSimulation].[GetRandomStreet] @randomStreet = @PostalAddressLine1 OUTPUT; EXEC [DataLoadSimulation].[GetRandomSecondaryAddress] @randomSecondaryAddress = @PostalAddressLine2 OUTPUT; -- Get the geography for this location SET @DeliveryLocation = [DataLoadSimulation].[GetCityLocation] (@myCityID) -- Generate some bogative postal codes EXEC [DataLoadSimulation].[GetBogativePostalCode] @CityID = @myCityID , @PostalCode = @DeliveryPostalCode OUTPUT EXEC [DataLoadSimulation].[GetBogativePostalCode] @CityID = @myCityID , @PostalCode = @PostalPostalCode OUTPUT SET @CreditLimit = CEILING(RAND() * 30) * 100 + 1000; INSERT Sales.Customers (CustomerID, CustomerName, BillToCustomerID, CustomerCategoryID, BuyingGroupID, PrimaryContactPersonID, AlternateContactPersonID, DeliveryMethodID, DeliveryCityID, PostalCityID, CreditLimit, AccountOpenedDate, StandardDiscountPercentage, IsStatementSent, IsOnCreditHold, PaymentDays, PhoneNumber, FaxNumber, DeliveryRun, RunPosition, WebsiteURL, DeliveryAddressLine1, DeliveryAddressLine2, DeliveryPostalCode, DeliveryLocation, PostalAddressLine1, PostalAddressLine2, PostalPostalCode, LastEditedBy, ValidFrom, ValidTo) VALUES (@CustomerID, @CustomerName, @BillToCustomerID, @CorporateCustomerCategoryID, @BuyingGroupID, @personMainContact, @personSecondaryContact, @DeliveryMethodID, @DeliveryCityID, @PostalCityID, @CreditLimit, @AccountOpenedDate, @StandardDiscountPercentage, @IsStatementSent, @IsOnCreditHold, @PaymentDays, @PhoneNumber, @FaxNumber, @DeliveryRun, @RunPosition, @WebsiteURL, @DeliveryAddressLine1, @DeliveryAddressLine1, @DeliveryPostalCode, @DeliveryLocation, @PostalAddressLine1, @PostalAddressLine2, @PostalPostalCode, @LastEditedBy, @CurrentDateTime, @EndOfTime); -- Begin Inserting a random number of customers for the buying group -- Randomly get a number of customers between 3 and 200 SET @numberOfRandomCustomers = (ABS(CHECKSUM(NEWID())) % 197 ) + 3 SET @currentRandomCustomerNumber = 2 -- Reset for this round DELETE FROM @UsedCityIDs WHILE @currentRandomCustomerNumber <= @numberOfRandomCustomers BEGIN -- Get a random city for the customer and sub office making -- sure we only use a city once SET @LoopWhileTrue = 1 SET @CityCount = 0 WHILE @LoopWhileTrue = 1 BEGIN EXEC [DataLoadSimulation].[GetRandomCity] @CityID = @myCityID OUTPUT , @CityName = @myCityName OUTPUT , @StateProvinceCode = @myStateProvinceCode OUTPUT , @StateProvinceName = @myStateProvinceName OUTPUT , @AreaCode = @myAreaCode OUTPUT SELECT @CityCount = COUNT(*) FROM @UsedCityIDs WHERE UsedCityID = @myCityID IF (@CityCount = 0) BEGIN INSERT @UsedCityIDs (UsedCityID) VALUES (@myCityID) SET @LoopWhileTrue = 0 END END -- WHILE @LoopWhileTrue = 1 -- Insert a contact person -- Get a random ficticious person for the sub office buyer EXEC [DataLoadSimulation].[GetFicticiousName] @FirstName = @myFirstName OUTPUT , @LastName = @myLastName OUTPUT , @FullName = @myFullName OUTPUT , @Email = @myEmail OUTPUT -- Insert the buyer for the sub office buying group SET @PersonID = @PersonID + 1 -- Note we do mean to increment every time -- Copy name data from the GetFicticiousName proc SET @FullName = @myFullName SET @PreferredName = @myFirstName SET @EmailAddress = @myEmail + '@' + @myEmailDomain + '.com' -- Generate random phone numbers EXEC [DataLoadSimulation].[GetBogativePhoneNumber] @AreaCode = @myAreaCode , @PhoneNumber = @PhoneNumber OUTPUT EXEC [DataLoadSimulation].[GetBogativePhoneNumber] @AreaCode = @myAreaCode , @PhoneNumber = @FaxNumber OUTPUT -- Insert the new person INSERT [Application].People (PersonID, FullName, PreferredName, IsPermittedToLogon, LogonName, IsExternalLogonProvider, HashedPassword, IsSystemUser, IsEmployee, IsSalesperson, UserPreferences, PhoneNumber, FaxNumber, EmailAddress, LastEditedBy, ValidFrom, ValidTo) VALUES (@PersonID, @FullName, @PreferredName, @IsPermittedToLogon, @LogonName, @IsExternalLogonProvider, @HashedPassword, @IsSystemUser, @IsEmployee, @IsSalesperson, @UserPreferences, @PhoneNumber, @FaxNumber, @EmailAddress, @LastEditedBy, @CurrentDateTime, @EndOfTime) -- The secondary contact for the suboffices is the primary for the main office SET @personSecondaryContact = @personMainContact -- Insert the Sub Office customer SET @CustomerID = @CustomerID + 1 SET @CustomerName = @BuyingGroupName + ' (' + @myCityName + ', ' + @myStateProvinceCode + ')' SET @DeliveryCityID = @myCityID SET @PostalCityID = @myCityID -- Get a random delivery method EXEC [DataLoadSimulation].[GetRandomDeliveryMethod] @RandomDeliveryMethod = @DeliveryMethodID OUTPUT -- Generate random phone numbers EXEC [DataLoadSimulation].[GetBogativePhoneNumber] @AreaCode = @myAreaCode , @PhoneNumber = @PhoneNumber OUTPUT EXEC [DataLoadSimulation].[GetBogativePhoneNumber] @AreaCode = @myAreaCode , @PhoneNumber = @FaxNumber OUTPUT -- Get the Delivery Address EXEC [DataLoadSimulation].[GetRandomStreet] @randomStreet = @DeliveryAddressLine1 OUTPUT; EXEC [DataLoadSimulation].[GetRandomSecondaryAddress] @randomSecondaryAddress = @DeliveryAddressLine2 OUTPUT; -- Get the Postal Address EXEC [DataLoadSimulation].[GetRandomStreet] @randomStreet = @PostalAddressLine1 OUTPUT; EXEC [DataLoadSimulation].[GetRandomSecondaryAddress] @randomSecondaryAddress = @PostalAddressLine2 OUTPUT; -- Get the geography for this location SET @DeliveryLocation = [DataLoadSimulation].[GetCityLocation] (@myCityID) -- Generate some bogative postal codes EXEC [DataLoadSimulation].[GetBogativePostalCode] @CityID = @myCityID , @PostalCode = @DeliveryPostalCode OUTPUT EXEC [DataLoadSimulation].[GetBogativePostalCode] @CityID = @myCityID , @PostalCode = @PostalPostalCode OUTPUT -- Get a random customer category for this sub office EXEC [DataLoadSimulation].[GetRandomCustomerCategory] @RandomCustomerCategoryID = @CustomerCategoryID OUTPUT SET @CreditLimit = CEILING(RAND() * 30) * 100 + 1000; INSERT Sales.Customers (CustomerID, CustomerName, BillToCustomerID, CustomerCategoryID, BuyingGroupID, PrimaryContactPersonID, AlternateContactPersonID, DeliveryMethodID, DeliveryCityID, PostalCityID, CreditLimit, AccountOpenedDate, StandardDiscountPercentage, IsStatementSent, IsOnCreditHold, PaymentDays, PhoneNumber, FaxNumber, DeliveryRun, RunPosition, WebsiteURL, DeliveryAddressLine1, DeliveryAddressLine2, DeliveryPostalCode, DeliveryLocation, PostalAddressLine1, PostalAddressLine2, PostalPostalCode, LastEditedBy, ValidFrom, ValidTo) VALUES (@CustomerID, @CustomerName, @BillToCustomerID, @CustomerCategoryID, @BuyingGroupID, @PersonID, @personSecondaryContact, @DeliveryMethodID, @DeliveryCityID, @PostalCityID, @CreditLimit, @AccountOpenedDate, @StandardDiscountPercentage, @IsStatementSent, @IsOnCreditHold, @PaymentDays, @PhoneNumber, @FaxNumber, @DeliveryRun, @RunPosition, @WebsiteURL, @DeliveryAddressLine1, @DeliveryAddressLine1, @DeliveryPostalCode, @DeliveryLocation, @PostalAddressLine1, @PostalAddressLine2, @PostalPostalCode, @LastEditedBy, @CurrentDateTime, @EndOfTime) SET @currentRandomCustomerNumber = @currentRandomCustomerNumber + 1 END -- Move to next site -- Move to next buying group FETCH NEXT FROM buyinggroup INTO @BuyingGroupID, @BuyingGroupName END CLOSE buyinggroup DEALLOCATE buyinggroup
the_stack
-- 2017-11-25T11:15:17.028 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Window_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsCreateNew,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy,WEBUI_NameBrowse) VALUES ('W',0,540980,0,540253,TO_TIMESTAMP('2017-11-25 11:15:16','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','_Zählbestand_Einkauf','Y','N','N','N','N','Zählbestand Einkauf',TO_TIMESTAMP('2017-11-25 11:15:16','YYYY-MM-DD HH24:MI:SS'),100,'Zählbestand Einkauf') ; -- 2017-11-25T11:15:17.041 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=540980 AND NOT EXISTS (SELECT 1 FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID) ; -- 2017-11-25T11:15:17.042 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 540980, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=540980) ; -- 2017-11-25T11:15:17.636 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000052 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:17.638 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540791 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:17.639 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000053 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:17.640 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000061 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:17.640 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000069 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:17.641 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540980 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:19.591 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000052 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:19.592 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540791 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:19.592 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540980 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:19.592 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000053 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:19.593 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000061 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:19.593 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=1000012, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=1000069 AND AD_Tree_ID=10 ; -- 2017-11-25T11:15:29.773 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Window SET Name='Zählbestand Einkauf',Updated=TO_TIMESTAMP('2017-11-25 11:15:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=540253 ; -- 2017-11-25T11:15:29.782 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Description=NULL, IsActive='Y', Name='Zählbestand Einkauf',Updated=TO_TIMESTAMP('2017-11-25 11:15:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=540587 ; -- 2017-11-25T11:16:17.491 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Window_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:16:17','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Stock Control Purchase' WHERE AD_Window_ID=540253 AND AD_Language='en_US' ; -- 2017-11-25T11:16:44.556 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,540649,540541,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100,'main') ; -- 2017-11-25T11:16:44.558 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540541 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID) ; -- 2017-11-25T11:16:44.613 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540721,540541,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:44.656 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540722,540541,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100,'Y',20,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:44.700 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540721,541251,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:44.749 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555213,0,540649,541251,549352,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100,'Datum des Belegs','The Document Date indicates the date the document was generated. It may or may not be the same as the accounting date.','Y','N','Y','Y','N','Belegdatum',10,10,0,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:44.782 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555215,0,540649,541251,549353,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N','Beschreibung',20,20,0,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:45.021 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555214,0,540649,541251,549354,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100,'Checkbox sagt aus, ob der Beleg verarbeitet wurde. ','Verarbeitete Belege dürfen in der Regel nich mehr geändert werden.','Y','N','Y','Y','N','Verarbeitet',30,30,0,TO_TIMESTAMP('2017-11-25 11:16:44','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:45.061 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy,Value) VALUES (0,0,540650,540542,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100,'main') ; -- 2017-11-25T11:16:45.063 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Section_Trl (AD_Language,AD_UI_Section_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_UI_Section_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_UI_Section t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_UI_Section_ID=540542 AND NOT EXISTS (SELECT 1 FROM AD_UI_Section_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_UI_Section_ID=t.AD_UI_Section_ID) ; -- 2017-11-25T11:16:45.101 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Column (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_Section_ID,Created,CreatedBy,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,0,540723,540542,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100,'Y',10,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:45.138 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,UIStyle,Updated,UpdatedBy) VALUES (0,0,540723,541252,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100,'Y','default',10,'primary',TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:45.182 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,556187,0,540650,541252,549355,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100,'Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst','"Reihenfolge" bestimmt die Reihenfolge der Einträge','Y','N','N','Y','N','Reihenfolge',0,10,0,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:45.222 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555222,0,540650,541252,549356,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100,'Produkt, Leistung, Artikel','Bezeichnet eine Einheit, die in dieser Organisation gekauft oder verkauft wird.','Y','N','N','Y','N','Produkt',0,20,0,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:45.268 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555223,0,540650,541252,549357,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100,'Merkmals Ausprägungen zum Produkt','The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.','Y','N','N','Y','N','Merkmale',0,30,0,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:45.308 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,Description,Help,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555221,0,540650,541252,549358,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100,'Gezählte Menge','"Zählmenge" zeigt die tatsächlich ermittelte Menge für ein Produkt im Bestand an.','Y','N','N','Y','N','Zählmenge',0,40,0,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:16:45.351 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555299,0,540650,541252,549359,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','Produktionsstätte',0,50,0,TO_TIMESTAMP('2017-11-25 11:16:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:24:29.531 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540722,541253,TO_TIMESTAMP('2017-11-25 11:24:28','YYYY-MM-DD HH24:MI:SS'),100,'Y','flags',10,TO_TIMESTAMP('2017-11-25 11:24:28','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:24:33.184 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_ElementGroup (AD_Client_ID,AD_Org_ID,AD_UI_Column_ID,AD_UI_ElementGroup_ID,Created,CreatedBy,IsActive,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,540722,541254,TO_TIMESTAMP('2017-11-25 11:24:33','YYYY-MM-DD HH24:MI:SS'),100,'Y','org',20,TO_TIMESTAMP('2017-11-25 11:24:33','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:24:44.923 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET AD_UI_ElementGroup_ID=541253, SeqNo=10,Updated=TO_TIMESTAMP('2017-11-25 11:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549354 ; -- 2017-11-25T11:25:09.418 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555210,0,540649,541254,549360,'F',TO_TIMESTAMP('2017-11-25 11:25:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-11-25 11:25:09','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:25:22.614 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555209,0,540649,541254,549361,'F',TO_TIMESTAMP('2017-11-25 11:25:22','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-11-25 11:25:22','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:25:28.569 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-11-25 11:25:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549360 ; -- 2017-11-25T11:25:39.572 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=10,Updated=TO_TIMESTAMP('2017-11-25 11:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549352 ; -- 2017-11-25T11:25:39.573 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=20,Updated=TO_TIMESTAMP('2017-11-25 11:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549353 ; -- 2017-11-25T11:25:39.575 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=30,Updated=TO_TIMESTAMP('2017-11-25 11:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549354 ; -- 2017-11-25T11:25:39.576 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=40,Updated=TO_TIMESTAMP('2017-11-25 11:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549360 ; -- 2017-11-25T11:30:43.346 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555217,0,540650,541252,549362,'F',TO_TIMESTAMP('2017-11-25 11:30:43','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-11-25 11:30:43','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:30:55.807 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,555216,0,540650,541252,549363,'F',TO_TIMESTAMP('2017-11-25 11:30:55','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-11-25 11:30:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-11-25T11:32:51.082 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-11-25 11:32:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549362 ; -- 2017-11-25T11:33:21.527 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=10,Updated=TO_TIMESTAMP('2017-11-25 11:33:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549355 ; -- 2017-11-25T11:33:21.529 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=20,Updated=TO_TIMESTAMP('2017-11-25 11:33:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549356 ; -- 2017-11-25T11:33:21.530 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=30,Updated=TO_TIMESTAMP('2017-11-25 11:33:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549358 ; -- 2017-11-25T11:33:21.532 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=40,Updated=TO_TIMESTAMP('2017-11-25 11:33:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549359 ; -- 2017-11-25T11:33:21.534 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=50,Updated=TO_TIMESTAMP('2017-11-25 11:33:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549362 ; -- 2017-11-25T11:39:30.706 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Attribute',Updated=TO_TIMESTAMP('2017-11-25 11:39:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555223 ; -- 2017-11-25T11:39:53.632 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:39:53','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='SeqNo.',Description='',Help='' WHERE AD_Field_ID=556187 AND AD_Language='en_US' ; -- 2017-11-25T11:40:05.119 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:40:05','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Product',Description='',Help='' WHERE AD_Field_ID=555222 AND AD_Language='en_US' ; -- 2017-11-25T11:40:16.639 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:40:16','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Attributes',Description='' WHERE AD_Field_ID=555223 AND AD_Language='en_US' ; -- 2017-11-25T11:40:27.378 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:40:27','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Qty Count',Description='',Help='' WHERE AD_Field_ID=555221 AND AD_Language='en_US' ; -- 2017-11-25T11:40:38.075 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:40:38','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Plant' WHERE AD_Field_ID=555299 AND AD_Language='en_US' ; -- 2017-11-25T11:41:01.764 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:41:01','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Stock Control Purchase' WHERE AD_Field_ID=555220 AND AD_Language='en_US' ; -- 2017-11-25T11:41:12.701 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:41:12','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Product Group' WHERE AD_Field_ID=556184 AND AD_Language='en_US' ; -- 2017-11-25T11:41:25.841 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:41:25','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Productname',Description='' WHERE AD_Field_ID=556186 AND AD_Language='en_US' ; -- 2017-11-25T11:41:41.851 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:41:41','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Stock Control Purchase Record' WHERE AD_Field_ID=555219 AND AD_Language='en_US' ; -- 2017-11-25T11:42:03.071 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:42:03','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Date',Description='' WHERE AD_Field_ID=555213 AND AD_Language='en_US' ; -- 2017-11-25T11:42:09.394 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Datum',Updated=TO_TIMESTAMP('2017-11-25 11:42:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=555213 ; -- 2017-11-25T11:42:19.397 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:42:19','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Description' WHERE AD_Field_ID=555215 AND AD_Language='en_US' ; -- 2017-11-25T11:44:25.905 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:44:25','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Stock Control Purchase' WHERE AD_Field_ID=555212 AND AD_Language='en_US' ; -- 2017-11-25T11:44:40.835 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:44:40','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Processed',Description='' WHERE AD_Field_ID=555214 AND AD_Language='en_US' ; -- 2017-11-25T11:44:53.689 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:44:53','YYYY-MM-DD HH24:MI:SS'),Description='',Help='' WHERE AD_Field_ID=555211 AND AD_Language='en_US' ; -- 2017-11-25T11:45:41.977 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-11-25 11:45:41','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Product' WHERE AD_Tab_ID=540650 AND AD_Language='en_US' ;
the_stack
-- This file should undo anything in `up.sql` CREATE OR REPLACE FUNCTION payment_service.subscriptions_charge() RETURNS json LANGUAGE plpgsql AS $function$ declare _result json; _subscription payment_service.subscriptions; _last_paid_payment payment_service.catalog_payments; _new_payment payment_service.catalog_payments; _affected_subscriptions_ids uuid[]; _total_affected integer; begin _total_affected := 0; -- get all subscriptions that not have any pending payment and last paid payment is over interval for _subscription IN (select s.* from payment_service.subscriptions s join project_service.projects p on p.id = s.project_id and p.platform_id = s.platform_id left join lateral ( -- get last paid payment after interval select cp.* from payment_service.catalog_payments cp where cp.subscription_id = s.id and cp.status = 'paid' order by cp.created_at desc limit 1 ) as last_paid_payment on true left join lateral ( -- get last paymnent (sometimes we can have a pending, refused... after a paid) -- and ensure that payment is greater or same that is paid select cp.* from payment_service.catalog_payments cp where cp.subscription_id = s.id and cp.created_at > last_paid_payment.created_at order by cp.created_at desc limit 1 ) as last_payment on true where last_paid_payment.id is not null and payment_service.next_charge_at(s) <= now() and (last_payment.id is null or last_payment.status in ('paid')) -- check only for subscriptions that in paid and p.status = 'online' and s.status in ('active')) loop _new_payment := payment_service.generate_new_catalog_payment(_subscription); if _new_payment.id is not null then _total_affected := _total_affected + 1; _affected_subscriptions_ids := array_append(_affected_subscriptions_ids, _subscription.id); end if; end loop; _result := json_build_object( 'total_affected', _total_affected, 'affected_ids', _affected_subscriptions_ids ); return _result; end; $function$; CREATE OR REPLACE FUNCTION payment_service.refuse_expired_slip_payments() RETURNS json LANGUAGE plpgsql AS $function$ declare _payment payment_service.catalog_payments; _last_subscription_payment payment_service.catalog_payments; _last_paid_subscription_payment payment_service.catalog_payments; _subscription payment_service.subscriptions; _result json; _affected_subscriptions_ids uuid[]; _total_affected_subscriptions integer default 0; _affected_payments_ids uuid[]; _total_affected_payments integer default 0; _should_transit_subscription_to_inactive boolean default true; _recharged_payment payment_service.catalog_payments; _recharged_payment_ids uuid[]; begin -- get all boleto that already expired +3 days from expiration date for _payment in (select cp.* from payment_service.catalog_payments cp where data ->> 'payment_method' = 'boleto' and cp.status = 'pending' and (cp.gateway_general_data ->> 'boleto_expiration_date')::timestamp is not null and core.weekdays_from(3, (cp.gateway_general_data ->> 'boleto_expiration_date')::timestamp) < now() ) loop -- if payment is from subscription if _payment.subscription_id is not null then -- get last payment from subscription select * from payment_service.catalog_payments where subscription_id = _payment.subscription_id order by created_at desc limit 1 into _last_subscription_payment; -- get last paid payment from subscription select * from payment_service.catalog_payments where subscription_id = _payment.subscription_id and status = 'paid' order by created_at desc limit 1 into _last_paid_subscription_payment; -- get subscription select * from payment_service.subscriptions where id = _payment.subscription_id into _subscription; end if; -- transition payment to refused if payment_service.transition_to(_payment, 'refused', row_to_json(_payment.*)) then _total_affected_payments := _total_affected_payments + 1; _affected_payments_ids := array_append(_affected_payments_ids, _payment.id); if _subscription.id is not null and _subscription.status not in ('canceling', 'canceled', 'deleted') then if _last_paid_subscription_payment.id is not null then _should_transit_subscription_to_inactive := ( select count(1) >= 3 from payment_service.catalog_payments where status in ('refused') and subscription_id = _last_paid_subscription_payment.subscription_id and created_at > _last_paid_subscription_payment.created_at and id <> _last_paid_subscription_payment.id ); else _should_transit_subscription_to_inactive := ( select count(1) >= 3 from payment_service.catalog_payments where status in ('refused') and subscription_id = _last_subscription_payment.subscription_id -- and created_at > _last_subscription_payment.created_at and id <> _last_subscription_payment.id ); end if; -- if payment is the same of last_payment if _payment.id = _last_subscription_payment.id and _last_paid_subscription_payment.id is null OR ( _last_paid_subscription_payment.created_at + (core.get_setting('subscription_interval'))::interval ) <= now() then -- should generate new payment while _should_transit_subscription_to_inactive is false if _should_transit_subscription_to_inactive then if payment_service.transition_to(_subscription, 'inactive', row_to_json(_subscription.*)) then _total_affected_subscriptions := _total_affected_subscriptions + 1; _affected_subscriptions_ids := array_append(_affected_subscriptions_ids, _subscription.id); end if; else _recharged_payment := payment_service.recharge_subscription(_subscription); _recharged_payment_ids := array_append(_recharged_payment_ids, _recharged_payment.id); end if; end if; end if; end if; end loop; _result := json_build_object( 'total_subscriptions_affected', _total_affected_subscriptions, 'affected_subscriptions_ids', _affected_subscriptions_ids, 'total_payments_affected', _total_affected_payments, 'affected_payments_ids', _affected_payments_ids, 'recharged_payment_ids', _recharged_payment_ids ); return _result; end; $function$; CREATE OR REPLACE VIEW "payment_service_api"."payments" AS SELECT cp.id, cp.subscription_id, ((cp.data ->> 'amount'::text))::numeric AS amount, cp.project_id, cp.status, payment_service.paid_transition_at(cp.*) AS paid_at, cp.created_at, p.status AS project_status, p.mode AS project_mode, (cp.data ->> 'payment_method'::text) AS payment_method, CASE WHEN core.is_owner_or_admin(cp.user_id) THEN ((cp.data ->> 'customer'::text))::json ELSE NULL::json END AS billing_data, CASE WHEN ((core.is_owner_or_admin(cp.user_id) OR core.is_owner_or_admin(p.user_id)) AND ((cp.data ->> 'payment_method'::text) = 'credit_card'::text)) THEN json_build_object('first_digits', (cp.gateway_general_data ->> 'card_first_digits'::text), 'last_digits', (cp.gateway_general_data ->> 'card_last_digits'::text), 'brand', (cp.gateway_general_data ->> 'card_brand'::text), 'country', (cp.gateway_general_data ->> 'card_country'::text)) WHEN ((core.is_owner_or_admin(cp.user_id) OR core.is_owner_or_admin(p.user_id)) AND ((cp.data ->> 'payment_method'::text) = 'boleto'::text)) THEN json_build_object('barcode', (cp.gateway_general_data ->> 'boleto_barcode'::text), 'url', (cp.gateway_general_data ->> 'boleto_url'::text), 'expiration_date', ((cp.gateway_general_data ->> 'boleto_expiration_date'::text))::timestamp without time zone) ELSE NULL::json END AS payment_method_details, (cp.gateway_general_data ->> 'gateway_id'::text) AS gateway_id FROM (((payment_service.catalog_payments cp JOIN project_service.projects p ON ((p.id = cp.project_id))) JOIN community_service.users u ON ((u.id = cp.user_id))) LEFT JOIN payment_service.subscriptions s ON ((s.id = cp.subscription_id))) WHERE ((s.status <> 'deleted'::payment_service.subscription_status) AND (cp.platform_id = core.current_platform_id()) AND (core.is_owner_or_admin(cp.user_id) OR core.is_owner_or_admin(p.user_id))) ORDER BY cp.created_at DESC; CREATE OR REPLACE FUNCTION payment_service.automatic_recharge_or_inactive_card_subscriptions() RETURNS json LANGUAGE plpgsql SECURITY DEFINER AS $function$ declare _subscription payment_service.subscriptions; _last_paid_payment payment_service.catalog_payments; _last_payment payment_service.catalog_payments; _recharged_payment payment_service.catalog_payments; _should_transit_subscription_to_inactive boolean default false; _result json; _affected_subscriptions_ids uuid[]; _total_affected_subscriptions integer default 0; _recharged_payment_ids uuid[]; begin for _subscription in ( select s.* from payment_service.subscriptions s left join lateral ( select * from payment_service.catalog_payments cp where cp.subscription_id = s.id and cp.subscription_id is not null order by cp.created_at desc limit 1 ) as lp on true where s.status in ('active', 'started') and (s.checkout_data ->> 'payment_method')::text = 'credit_card' and lp.status = 'refused' and ((lp.created_at::date + '4 days'::interval) <= now()) and (payment_service.next_charge_at(s)) <= now() ) loop _last_paid_payment := null; _last_payment := null; _should_transit_subscription_to_inactive := false; -- get last paid payment from subscription select * from payment_service.catalog_payments cp where cp.subscription_id = _subscription.id and cp.subscription_id is not null and cp.status = 'paid' order by cp.created_at desc limit 1 into _last_paid_payment; -- get last payment generated on subscription select * from payment_service.catalog_payments cp where cp.subscription_id = _subscription.id and cp.subscription_id is not null order by cp.created_at desc limit 1 into _last_payment; if _last_paid_payment.id is not null then _should_transit_subscription_to_inactive := ( select count(1) >= 3 from payment_service.catalog_payments cp where cp.subscription_id = _subscription.id and cp.subscription_id is not null and cp.status = 'refused' and cp.created_at > _last_paid_payment.created_at ); else _should_transit_subscription_to_inactive := ( select count(1) >= 3 from payment_service.catalog_payments cp where cp.subscription_id = _subscription.id and cp.subscription_id is not null and cp.status = 'refused' ); end if; if _should_transit_subscription_to_inactive then perform payment_service.transition_to(_subscription, 'inactive', row_to_json(_subscription)); _total_affected_subscriptions := _total_affected_subscriptions + 1; _affected_subscriptions_ids := array_append(_affected_subscriptions_ids, _subscription.id); elsif ((_last_payment.status = 'refused') and ((_last_payment.created_at + '4 days'::interval) < now())) then _total_affected_subscriptions := _total_affected_subscriptions + 1; _affected_subscriptions_ids := array_append(_affected_subscriptions_ids, _subscription.id); _recharged_payment := payment_service.recharge_subscription(_subscription); _recharged_payment_ids := array_append(_recharged_payment_ids, _recharged_payment.id); end if; end loop; _result := json_build_object( 'total_subscriptions_affected', _total_affected_subscriptions, 'affected_subscriptions_ids', _affected_subscriptions_ids, 'recharged_payment_ids', _recharged_payment_ids ); return _result; end $function$; CREATE OR REPLACE FUNCTION payment_service.inactive_invalid_subscriptions() RETURNS json LANGUAGE plpgsql AS $function$ declare _subscription payment_service.subscriptions; _affected_subscriptions uuid[]; begin for _subscription in ( select s.* from payment_service.subscriptions s left join lateral ( select * from payment_service.catalog_payments cp where cp.subscription_id = s.id order by cp.created_at desc limit 1 ) as lp on true left join lateral ( select * from payment_service.catalog_payments cp where cp.subscription_id = s.id and cp.status = 'paid' order by cp.created_at desc limit 1 ) as lp_paid on true left join lateral ( select count(1) from payment_service.catalog_payments cp where cp.subscription_id = s.id and cp.id <> coalesce(lp_paid.id, lp.id) and cp.status in ('refused', 'pending') and (case when lp_paid.id is not null then cp.created_at > lp_paid.created_at else true end) ) as retries on true where s.status in ('started', 'active') and lp.status in ('refused', 'error') and (lp_paid.id is null OR (lp_paid.created_at + core.get_setting('subscription_interval')::interval < now())) and ( case when lp.status = 'error' then true else retries.count >= 3 end) ) loop _affected_subscriptions := array_append(_affected_subscriptions, _subscription.id); perform payment_service.transition_to(_subscription, 'inactive', row_to_json(_subscription)); end loop; return json_build_object( 'affected_subscriptions', _affected_subscriptions, 'total_affected_subscriptions', array_length(_affected_subscriptions, 1) ); end; $function$; CREATE OR REPLACE FUNCTION payment_service.recharge_subscription(payment_service.subscriptions) RETURNS payment_service.catalog_payments LANGUAGE plpgsql AS $function$ declare _last_payment payment_service.catalog_payments; _generated_payment payment_service.catalog_payments; begin -- get last payment from subscription select * from payment_service.catalog_payments where subscription_id = $1.id order by created_at desc limit 1 into _last_payment; -- if last payment is pending and is a boleto if _last_payment.status = 'pending' and $1.checkout_data->> 'payment_method'::text = 'boleto' then -- if boleto expiration date already in past turn payment to refused and generate a new payment for subscription if (_last_payment.gateway_general_data->>'boleto_expiration_date')::date <= now()::date then -- turn current payment to refused if payment_service.transition_to(_last_payment, 'refused', row_to_json(_last_payment)) then -- generate a new payment _generated_payment := payment_service.generate_new_catalog_payment($1); end if; else -- return last payment when still not expired _generated_payment := _last_payment; end if; -- if last payment is refused should generate new payment elsif _last_payment.status = 'refused' then -- generate a new payment _generated_payment := payment_service.generate_new_catalog_payment($1); -- when not match with any conditions should return the last payment else _generated_payment := _last_payment; end if; return _generated_payment; end; $function$; CREATE OR REPLACE FUNCTION payment_service.refuse_expired_slip_payments() RETURNS json LANGUAGE plpgsql AS $function$ declare _payment payment_service.catalog_payments; _last_subscription_payment payment_service.catalog_payments; _last_paid_subscription_payment payment_service.catalog_payments; _subscription payment_service.subscriptions; _result json; _affected_subscriptions_ids uuid[]; _total_affected_subscriptions integer default 0; _affected_payments_ids uuid[]; _total_affected_payments integer default 0; _should_transit_subscription_to_inactive boolean default true; _recharged_payment payment_service.catalog_payments; _recharged_payment_ids uuid[]; begin -- get all boleto that already expired +3 days from expiration date for _payment in (select cp.* from payment_service.catalog_payments cp where data ->> 'payment_method' = 'boleto' and cp.status = 'pending' and (cp.gateway_general_data ->> 'boleto_expiration_date')::timestamp is not null and core.weekdays_from(3, (cp.gateway_general_data ->> 'boleto_expiration_date')::timestamp) < now() ) loop -- if payment is from subscription if _payment.subscription_id is not null then -- get last payment from subscription select * from payment_service.catalog_payments where subscription_id = _payment.subscription_id order by created_at desc limit 1 into _last_subscription_payment; -- get last paid payment from subscription select * from payment_service.catalog_payments where subscription_id = _payment.subscription_id and status = 'paid' order by created_at desc limit 1 into _last_paid_subscription_payment; -- get subscription select * from payment_service.subscriptions where id = _payment.subscription_id into _subscription; end if; -- transition payment to refused if payment_service.transition_to(_payment, 'refused', row_to_json(_payment.*)) then _total_affected_payments := _total_affected_payments + 1; _affected_payments_ids := array_append(_affected_payments_ids, _payment.id); if _subscription.id is not null and _subscription.status not in ('canceling', 'canceled', 'deleted') then if _last_paid_subscription_payment.id is not null then _should_transit_subscription_to_inactive := ( select count(1) >= 3 from payment_service.catalog_payments where status in ('refused') and subscription_id = _last_paid_subscription_payment.subscription_id and created_at > _last_paid_subscription_payment.created_at and id <> _last_paid_subscription_payment.id ); else _should_transit_subscription_to_inactive := ( select count(1) >= 3 from payment_service.catalog_payments where status in ('refused') and subscription_id = _last_subscription_payment.subscription_id -- and created_at > _last_subscription_payment.created_at and id <> _last_subscription_payment.id ); end if; -- if payment is the same of last_payment if _payment.id = _last_subscription_payment.id and _last_paid_subscription_payment.id is null OR ( _last_paid_subscription_payment.created_at + (core.get_setting('subscription_interval'))::interval ) <= now() then -- should generate new payment while _should_transit_subscription_to_inactive is false if _should_transit_subscription_to_inactive then if payment_service.transition_to(_subscription, 'inactive', row_to_json(_subscription.*)) then _total_affected_subscriptions := _total_affected_subscriptions + 1; _affected_subscriptions_ids := array_append(_affected_subscriptions_ids, _subscription.id); end if; else _recharged_payment := payment_service.recharge_subscription(_subscription); _recharged_payment_ids := array_append(_recharged_payment_ids, _recharged_payment.id); end if; end if; end if; end if; end loop; _result := json_build_object( 'total_subscriptions_affected', _total_affected_subscriptions, 'affected_subscriptions_ids', _affected_subscriptions_ids, 'total_payments_affected', _total_affected_payments, 'affected_payments_ids', _affected_payments_ids, 'recharged_payment_ids', _recharged_payment_ids ); return _result; end; $function$; CREATE OR REPLACE FUNCTION payment_service.subscriptions_server_error_rescue_charge() RETURNS json LANGUAGE plpgsql AS $function$ declare _result json; _affected_subscriptions_ids uuid[]; _total_affected integer; _subscription_payment payment_service.catalog_payments; begin _total_affected := 0; for _subscription_payment IN (select last_payment.* from payment_service.subscriptions s join lateral ( select * from payment_service.catalog_payments cp where cp.subscription_id = s.id order by created_at desc limit 1 ) as last_payment on true where s.status = 'active' and last_payment.status in('error') and last_payment.error_retry_at is null and ( case last_payment.status when 'error' then last_payment.gateway_cached_data is null OR ( (select true from json_array_elements_text(last_payment.gateway_cached_data::json) as el where el::json ->> 'message' ~* 'error' and el::json ->> 'type' is null) AND json_array_length(last_payment.gateway_cached_data::json) = 1 ) else last_payment.gateway_cached_data is null end ) ) loop perform pg_notify('process_payments_channel', json_build_object( 'id', _subscription_payment.id, 'subscription_id', _subscription_payment.subscription_id, 'rescued_at', now() )::text); update payment_service.catalog_payments set error_retry_at = now() where id = _subscription_payment.id; _total_affected := _total_affected + 1; _affected_subscriptions_ids := array_append(_affected_subscriptions_ids, _subscription_payment.subscription_id); end loop; _result := json_build_object( 'total_affected', _total_affected, 'affected_ids', _affected_subscriptions_ids ); return _result; end; $function$;
the_stack
--/************************************************************************* -- (c) Copyright IBM Corp. 2007 All rights reserved. -- -- The following sample of source code ("Sample") is owned by International -- Business Machines Corporation or one of its subsidiaries ("IBM") and is -- copyrighted and licensed, not sold. You may use, copy, modify, and -- distribute the Sample in any form without payment to IBM, for the purpose of -- assisting you in the development of your applications. -- -- The Sample code is provided to you on an "AS IS" basis, without warranty of -- any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR -- IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do -- not allow for the exclusion or limitation of implied warranties, so the above -- limitations or exclusions may not apply to you. IBM shall not be liable for -- any damages you suffer as a result of using, copying, modifying or -- distributing the Sample, even if IBM has been advised of the possibility of -- such damages. -- ************************************************************************* -- -- SAMPLE FILE NAME: xmldecomposition.db2 -- -- PURPOSE: To demonstrate annotated XML schema decomposition -- -- USER SCENARIO: -- A bookstore has books for sale and the descriptive information about -- each book is stored as an XML document. The store owner needs to store -- these details in different relational tables with referential -- constraints for easy retreival of data. -- The Bookstore that has two types of customers, retail customers and -- corporate customers. Corporate customers do bulk purchases of books -- for their company libraries. The store has a DBA for maintaining -- the database, the store manager runs queries on different tables -- to view the book sales. The information about books returned by -- customers due to damage or due to exchange with some other book -- is stored as xml document in books_returned table. At the end of -- the day a batch process decomposes these XML documents to update -- the books available status with the latest information. The batch -- process uses the DECOMPOSE XML DOCUMENTS command to decompose -- binary or XML column data into relational tables. -- -- SOLUTION: -- The store manager must have an annotated schema based on which the XML data -- can be decomposed. Once a valid annotated schema for the instance document -- is ready, it needs to be registered with the XML schema repository with -- the decomposition option enabled. Also, the tables in which the data will be -- decomposed must exist before the schema is registered. The user can -- decompose the instance documents and store the data in the relational -- tables using annotated XML Decomposition. -- -- -- PREREQUISITE: -- The instance documents and the annotated schema must exist in the same -- directory as the sample. -- Copy bookdetails.xsd, booksreturned.xsd, bookdetails.xml, -- booksreturned.del, booksreturned1.xml, booksreturned2.xml, booksreturned3.xml, -- setupfordecomposition.db2 and cleanupfordecomposition.db2 from directory -- <install_path>/sqllib/samples/xml/data in UNIX and -- <install_path>\sqllib\samples\xml\data in Windows to the working directory. -- -- EXECUTION: i) db2 -tvf setupfordecomposition.db2 (setup script -- to create the required tables and populate them) -- ii) db2 -tvf xmldecomposition.db2 (execute the sample) -- iii) db2 -tvf cleanupfordecomposition.db2 (clean up -- script to drop all the objects created) -- -- INPUTS: NONE -- -- OUTPUTS: Decomposition of XML documents according to the dependencies -- specified in the annotated XML schema. -- -- OUTPUT FILE: xmldecomposition.out (available in the online documentation) -- -- SQL STATEMENTS USED: -- REGISTER XMLSCHEMA -- COMPLETE XMLSCHEMA -- DECOMPOSE XML DOCUMENT -- DECOMPOSE XML DOCUMENTS IN -- CREATE -- SELECT -- DROP -- -- ************************************************************************* -- For more information about the command line processor (CLP) scripts, -- see the README file. -- For information on using SQL statements, see the SQL Reference. -- -- For the latest information on programming, building, and running DB2 -- applications, visit the DB2 application development website: -- http://www.software.ibm.com/data/db2/udb/ad -- ************************************************************************* -- -- SAMPLE DESCRIPTION -- -- ************************************************************************* -- 1. Register the annotated XML schemas. -- 2. Decompose a single XML document using the registered XML schema. -- 3. Decompose XML documents using the registered XML schema from -- 3.1. An XML column. -- 3.2. A BLOB column. -- 4. Decompose XML documents from an XML column resulted by -- 4.1. Join operation -- 4.2. Union operation -- *************************************************************************/ -- /************************************************************************* -- SETUP -- execute setupfordecomposition.db2 -- **************************************************************************/ -- setupfordecomposition.db2 will create required tables and populate them. -- Connect to the SAMPLE database CONNECT TO sample; -- /************************************************************************* -- 1. Register the annotated XML schemas. -- *************************************************************************/ -- Register the XML schemas containing annotations REGISTER XMLSCHEMA 'http://book.com/bookdetails.xsd' FROM 'bookdetails.xsd' AS xdb.bookdetails; REGISTER XMLSCHEMA 'http://book.com/booksreturned.xsd' FROM 'booksreturned.xsd' AS xdb.booksreturned; -- Complete XML schema registration COMPLETE XMLSCHEMA xdb.bookdetails ENABLE DECOMPOSITION; COMPLETE XMLSCHEMA xdb.booksreturned ENABLE DECOMPOSITION; -- Check catalog tables for information regarding the newly registered schemas. SELECT status, decomposition, decomposition_version FROM SYSIBM.SYSXSROBJECTS where XSROBJECTNAME IN ('BOOKDETAILS', 'BOOKSRETURNED'); -- /************************************************************************* -- 2. Decompose a single XML document using the registered XML schema. -- *************************************************************************/ -- Decompose a single XML document DECOMPOSE XML DOCUMENT bookdetails.xml XMLSCHEMA xdb.bookdetails VALIDATE; -- check the results of the decomposition SELECT * FROM admin.book_author WHERE authid=532; SELECT * FROM xdb.books_avail; SELECT isbn,chptnum,SUBSTR(chpttitle,1,15),SUBSTR(chptcontent,1,25) FROM xdb.book_contents; -- cleanup the data from relational tables to see -- decomposed data. DELETE FROM xdb.books_avail; -- /************************************************************************* -- 3.1. Decompose XML documents from an XML column. -- *************************************************************************/ -- Decompose XML documents DECOMPOSE XML DOCUMENTS IN SELECT customerID, booksreturned FROM xdb.books_returned XMLSCHEMA xdb.booksreturned VALIDATE MESSAGES errorreport.xml; -- check the results of the decomposition SELECT * FROM xdb.books_avail; -- cleanup the data from relational tables to see -- decomposed data. DELETE FROM xdb.books_avail; -- /************************************************************************* -- 3.2. Decompose XML documents from a BLOB column. -- *************************************************************************/ -- Decompose XML documents DECOMPOSE XML DOCUMENTS IN SELECT supplierID, booksinfo from xdb.books_received_BLOB XMLSCHEMA xdb.booksreturned VALIDATE MESSAGES errorreport.xml; -- check the results of the decomposition SELECT * FROM xdb.books_avail; -- cleanup the data from relational tables to see -- decomposed data. DELETE FROM xdb.books_avail; -- /************************************************************************* -- 4.1. Decompose XML documents from an XML column resulted by Join operation. -- *************************************************************************/ DECOMPOSE XML DOCUMENTS IN SELECT id, data FROM( SELECT br.customerID as id, br.booksreturned AS info FROM xdb.books_returned as br,xdb.books_received as bc WHERE XMLEXISTS('$bi/books/book[@isbn] = $bid/books/book[@isbn]' PASSING br.booksreturned as "bi", bc.booksinfo as "bid")) AS temp(id,data) XMLSCHEMA xdb.booksreturned VALIDATE CONTINUE_ON_ERROR MESSAGES errorreport.xml; -- check the results of the decomposition SELECT * FROM xdb.books_avail; -- cleanup the data from relational tables to see -- decomposed data. DELETE FROM xdb.books_avail; -- /************************************************************************* -- 4.2. Decompose XML documents from an XML column resulted by Union operation. -- *************************************************************************/ DECOMPOSE XML DOCUMENTS IN SELECT id, data FROM( SELECT customerID as cid, booksreturned AS info FROM xdb.books_returned WHERE XMLEXISTS('$bk/books/book[author="Carl"]' PASSING booksreturned AS "bk") UNION ALL SELECT supplierID as sid, booksinfo AS books FROM xdb.books_received WHERE XMLEXISTS('$br/books/book[author="Carl"]' PASSING booksinfo AS "br")) AS temp(id,data) XMLSCHEMA xdb.booksreturned VALIDATE CONTINUE_ON_ERROR MESSAGES errorreport.xml; -- check the results of the decomposition SELECT * FROM xdb.books_avail; -- cleanup the data from relational tables to see -- decomposed data. DELETE FROM xdb.books_avail; -- /************************************************************************* -- CLEANUP -- execute cleanupfordecomposition.db2 -- **************************************************************************/ -- Commit the work and reset the connection COMMIT; CONNECT RESET;
the_stack
-- CreateEnum CREATE TYPE "EnumEntityAction" AS ENUM ('View', 'Create', 'Update', 'Delete', 'Search'); -- CreateEnum CREATE TYPE "EnumEntityPermissionType" AS ENUM ('AllRoles', 'Granular', 'Disabled'); -- CreateEnum CREATE TYPE "EnumDataType" AS ENUM ('SingleLineText', 'MultiLineText', 'Email', 'WholeNumber', 'DateTime', 'DecimalNumber', 'Lookup', 'MultiSelectOptionSet', 'OptionSet', 'Boolean', 'Id', 'CreatedAt', 'UpdatedAt', 'GeographicLocation', 'Roles', 'Username', 'Password'); -- CreateEnum CREATE TYPE "EnumBlockType" AS ENUM ('AppSettings', 'Flow', 'ConnectorRestApi', 'ConnectorRestApiCall', 'ConnectorSoapApi', 'ConnectorFile', 'EntityApi', 'EntityApiEndpoint', 'FlowApi', 'Layout', 'CanvasPage', 'EntityPage', 'Document'); -- CreateEnum CREATE TYPE "ActionStepStatus" AS ENUM ('Waiting', 'Running', 'Failed', 'Success'); -- CreateEnum CREATE TYPE "EnumLogLevel" AS ENUM ('Error', 'Warning', 'Info', 'Debug'); -- CreateEnum CREATE TYPE "EnumDeploymentStatus" AS ENUM ('Completed', 'Waiting', 'Failed', 'Removed'); -- CreateTable CREATE TABLE "Account" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "email" TEXT NOT NULL, "firstName" TEXT NOT NULL, "lastName" TEXT NOT NULL, "password" TEXT NOT NULL, "currentUserId" TEXT, "githubId" TEXT, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "Organization" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "name" TEXT NOT NULL, "defaultTimeZone" TEXT NOT NULL, "address" TEXT NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "User" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "accountId" TEXT NOT NULL, "organizationId" TEXT NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "UserRole" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "userId" TEXT NOT NULL, "role" TEXT NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "ApiToken" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "name" TEXT NOT NULL, "userId" TEXT NOT NULL, "token" TEXT NOT NULL, "previewChars" TEXT NOT NULL, "lastAccessAt" TIMESTAMP(3) NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "App" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "organizationId" TEXT NOT NULL, "name" TEXT NOT NULL, "description" TEXT NOT NULL, "color" TEXT NOT NULL DEFAULT E'#20A4F3', "githubToken" TEXT, "githubTokenCreatedDate" TIMESTAMP(3), "githubSyncEnabled" BOOLEAN NOT NULL DEFAULT false, "githubRepo" TEXT, "githubBranch" TEXT, "githubLastSync" TIMESTAMP(3), "githubLastMessage" TEXT, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "AppRole" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "appId" TEXT NOT NULL, "name" TEXT NOT NULL, "displayName" TEXT NOT NULL, "description" TEXT, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "Commit" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "appId" TEXT NOT NULL, "userId" TEXT NOT NULL, "message" TEXT NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "Entity" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "appId" TEXT NOT NULL, "name" TEXT NOT NULL, "displayName" TEXT NOT NULL, "pluralDisplayName" TEXT NOT NULL, "description" TEXT, "lockedByUserId" TEXT, "lockedAt" TIMESTAMP(3), "deletedAt" TIMESTAMP(3), PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "EntityVersion" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "entityId" TEXT NOT NULL, "versionNumber" INTEGER NOT NULL, "name" TEXT NOT NULL, "displayName" TEXT NOT NULL, "pluralDisplayName" TEXT NOT NULL, "description" TEXT, "commitId" TEXT, "deleted" BOOLEAN, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "EntityPermission" ( "id" TEXT NOT NULL, "entityVersionId" TEXT NOT NULL, "action" "EnumEntityAction" NOT NULL, "type" "EnumEntityPermissionType" NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "EntityPermissionRole" ( "id" TEXT NOT NULL, "entityVersionId" TEXT NOT NULL, "action" "EnumEntityAction" NOT NULL, "appRoleId" TEXT NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "EntityPermissionField" ( "id" TEXT NOT NULL, "permissionId" TEXT NOT NULL, "fieldPermanentId" TEXT NOT NULL, "entityVersionId" TEXT NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "EntityField" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "entityVersionId" TEXT NOT NULL, "permanentId" TEXT NOT NULL, "name" TEXT NOT NULL, "displayName" TEXT NOT NULL, "dataType" "EnumDataType" NOT NULL, "properties" JSONB NOT NULL, "required" BOOLEAN NOT NULL, "searchable" BOOLEAN NOT NULL, "description" TEXT NOT NULL, "position" INTEGER, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "Block" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "appId" TEXT NOT NULL, "parentBlockId" TEXT, "blockType" "EnumBlockType" NOT NULL, "displayName" TEXT NOT NULL, "description" TEXT, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "BlockVersion" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, "blockId" TEXT NOT NULL, "versionNumber" INTEGER NOT NULL, "label" TEXT NOT NULL, "inputParameters" JSONB, "outputParameters" JSONB, "settings" JSONB NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "Action" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "ActionStep" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "message" TEXT NOT NULL, "status" "ActionStepStatus" NOT NULL, "completedAt" TIMESTAMP(3), "actionId" TEXT NOT NULL, "name" TEXT NOT NULL DEFAULT E'', PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "ActionLog" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "message" TEXT NOT NULL, "meta" JSONB NOT NULL, "level" "EnumLogLevel" NOT NULL, "stepId" TEXT NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "Build" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "appId" TEXT NOT NULL, "userId" TEXT NOT NULL, "version" TEXT NOT NULL, "message" TEXT, "actionId" TEXT NOT NULL, "images" TEXT[], "containerStatusQuery" JSONB, "containerStatusUpdatedAt" TIMESTAMP(3), "commitId" TEXT, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "Release" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "version" TEXT NOT NULL, "description" TEXT, "commitId" TEXT NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "Environment" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "appId" TEXT NOT NULL, "name" TEXT NOT NULL, "description" TEXT, "address" TEXT NOT NULL, PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "Deployment" ( "id" TEXT NOT NULL, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "userId" TEXT NOT NULL, "buildId" TEXT NOT NULL, "environmentId" TEXT NOT NULL, "status" "EnumDeploymentStatus" NOT NULL, "message" TEXT, "actionId" TEXT NOT NULL, "statusQuery" JSONB, "statusUpdatedAt" TIMESTAMP(3), PRIMARY KEY ("id") ); -- CreateTable CREATE TABLE "_BuildToEntityVersion" ( "A" TEXT NOT NULL, "B" TEXT NOT NULL ); -- CreateTable CREATE TABLE "_EntityPermissionFieldToEntityPermissionRole" ( "A" TEXT NOT NULL, "B" TEXT NOT NULL ); -- CreateTable CREATE TABLE "_BlockVersionToBuild" ( "A" TEXT NOT NULL, "B" TEXT NOT NULL ); -- CreateIndex CREATE UNIQUE INDEX "Account.email_unique" ON "Account"("email"); -- CreateIndex CREATE UNIQUE INDEX "Account.currentUserId_unique" ON "Account"("currentUserId"); -- CreateIndex CREATE UNIQUE INDEX "Organization.name_unique" ON "Organization"("name"); -- CreateIndex CREATE UNIQUE INDEX "User.accountId_organizationId_unique" ON "User"("accountId", "organizationId"); -- CreateIndex CREATE UNIQUE INDEX "UserRole.userId_role_unique" ON "UserRole"("userId", "role"); -- CreateIndex CREATE UNIQUE INDEX "ApiToken.userId_name_unique" ON "ApiToken"("userId", "name"); -- CreateIndex CREATE UNIQUE INDEX "App.organizationId_name_unique" ON "App"("organizationId", "name"); -- CreateIndex CREATE UNIQUE INDEX "AppRole.appId_displayName_unique" ON "AppRole"("appId", "displayName"); -- CreateIndex CREATE UNIQUE INDEX "AppRole.appId_name_unique" ON "AppRole"("appId", "name"); -- CreateIndex CREATE UNIQUE INDEX "Entity.appId_displayName_unique" ON "Entity"("appId", "displayName"); -- CreateIndex CREATE UNIQUE INDEX "Entity.appId_name_unique" ON "Entity"("appId", "name"); -- CreateIndex CREATE UNIQUE INDEX "Entity.appId_pluralDisplayName_unique" ON "Entity"("appId", "pluralDisplayName"); -- CreateIndex CREATE UNIQUE INDEX "EntityVersion.entityId_versionNumber_unique" ON "EntityVersion"("entityId", "versionNumber"); -- CreateIndex CREATE UNIQUE INDEX "EntityPermission.entityVersionId_action_unique" ON "EntityPermission"("entityVersionId", "action"); -- CreateIndex CREATE UNIQUE INDEX "EntityPermissionRole.entityVersionId_action_appRoleId_unique" ON "EntityPermissionRole"("entityVersionId", "action", "appRoleId"); -- CreateIndex CREATE UNIQUE INDEX "EntityPermissionField.permissionId_fieldPermanentId_unique" ON "EntityPermissionField"("permissionId", "fieldPermanentId"); -- CreateIndex CREATE UNIQUE INDEX "EntityField.entityVersionId_displayName_unique" ON "EntityField"("entityVersionId", "displayName"); -- CreateIndex CREATE UNIQUE INDEX "EntityField.entityVersionId_name_unique" ON "EntityField"("entityVersionId", "name"); -- CreateIndex CREATE UNIQUE INDEX "EntityField.entityVersionId_permanentId_unique" ON "EntityField"("entityVersionId", "permanentId"); -- CreateIndex CREATE UNIQUE INDEX "Block.appId_displayName_unique" ON "Block"("appId", "displayName"); -- CreateIndex CREATE UNIQUE INDEX "BlockVersion.blockId_versionNumber_unique" ON "BlockVersion"("blockId", "versionNumber"); -- CreateIndex CREATE INDEX "ActionStep.actionId_index" ON "ActionStep"("actionId"); -- CreateIndex CREATE INDEX "ActionLog.stepId_index" ON "ActionLog"("stepId"); -- CreateIndex CREATE UNIQUE INDEX "Build.appId_version_unique" ON "Build"("appId", "version"); -- CreateIndex CREATE UNIQUE INDEX "Environment.appId_name_unique" ON "Environment"("appId", "name"); -- CreateIndex CREATE UNIQUE INDEX "_BuildToEntityVersion_AB_unique" ON "_BuildToEntityVersion"("A", "B"); -- CreateIndex CREATE INDEX "_BuildToEntityVersion_B_index" ON "_BuildToEntityVersion"("B"); -- CreateIndex CREATE UNIQUE INDEX "_EntityPermissionFieldToEntityPermissionRole_AB_unique" ON "_EntityPermissionFieldToEntityPermissionRole"("A", "B"); -- CreateIndex CREATE INDEX "_EntityPermissionFieldToEntityPermissionRole_B_index" ON "_EntityPermissionFieldToEntityPermissionRole"("B"); -- CreateIndex CREATE UNIQUE INDEX "_BlockVersionToBuild_AB_unique" ON "_BlockVersionToBuild"("A", "B"); -- CreateIndex CREATE INDEX "_BlockVersionToBuild_B_index" ON "_BlockVersionToBuild"("B"); -- AddForeignKey ALTER TABLE "Account" ADD FOREIGN KEY ("currentUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "User" ADD FOREIGN KEY ("accountId") REFERENCES "Account"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "User" ADD FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "UserRole" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "ApiToken" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "App" ADD FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "AppRole" ADD FOREIGN KEY ("appId") REFERENCES "App"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Commit" ADD FOREIGN KEY ("appId") REFERENCES "App"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Commit" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Entity" ADD FOREIGN KEY ("appId") REFERENCES "App"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Entity" ADD FOREIGN KEY ("lockedByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "EntityVersion" ADD FOREIGN KEY ("commitId") REFERENCES "Commit"("id") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "EntityVersion" ADD FOREIGN KEY ("entityId") REFERENCES "Entity"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "EntityPermission" ADD FOREIGN KEY ("entityVersionId") REFERENCES "EntityVersion"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "EntityPermissionRole" ADD FOREIGN KEY ("appRoleId") REFERENCES "AppRole"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "EntityPermissionRole" ADD FOREIGN KEY ("entityVersionId", "action") REFERENCES "EntityPermission"("entityVersionId", "action") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "EntityPermissionField" ADD FOREIGN KEY ("fieldPermanentId", "entityVersionId") REFERENCES "EntityField"("permanentId", "entityVersionId") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "EntityPermissionField" ADD FOREIGN KEY ("permissionId") REFERENCES "EntityPermission"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "EntityField" ADD FOREIGN KEY ("entityVersionId") REFERENCES "EntityVersion"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Block" ADD FOREIGN KEY ("appId") REFERENCES "App"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Block" ADD FOREIGN KEY ("parentBlockId") REFERENCES "Block"("id") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "BlockVersion" ADD FOREIGN KEY ("blockId") REFERENCES "Block"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "ActionStep" ADD FOREIGN KEY ("actionId") REFERENCES "Action"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "ActionLog" ADD FOREIGN KEY ("stepId") REFERENCES "ActionStep"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Build" ADD FOREIGN KEY ("actionId") REFERENCES "Action"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Build" ADD FOREIGN KEY ("appId") REFERENCES "App"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Build" ADD FOREIGN KEY ("commitId") REFERENCES "Commit"("id") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Build" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Release" ADD FOREIGN KEY ("commitId") REFERENCES "Commit"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Environment" ADD FOREIGN KEY ("appId") REFERENCES "App"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Deployment" ADD FOREIGN KEY ("actionId") REFERENCES "Action"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Deployment" ADD FOREIGN KEY ("buildId") REFERENCES "Build"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Deployment" ADD FOREIGN KEY ("environmentId") REFERENCES "Environment"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Deployment" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_BuildToEntityVersion" ADD FOREIGN KEY ("A") REFERENCES "Build"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_BuildToEntityVersion" ADD FOREIGN KEY ("B") REFERENCES "EntityVersion"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_EntityPermissionFieldToEntityPermissionRole" ADD FOREIGN KEY ("A") REFERENCES "EntityPermissionField"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_EntityPermissionFieldToEntityPermissionRole" ADD FOREIGN KEY ("B") REFERENCES "EntityPermissionRole"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_BlockVersionToBuild" ADD FOREIGN KEY ("A") REFERENCES "BlockVersion"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_BlockVersionToBuild" ADD FOREIGN KEY ("B") REFERENCES "Build"("id") ON DELETE CASCADE ON UPDATE CASCADE;
the_stack
-- Licensed to the Apache Software Foundation (ASF) under one -- or more contributor license agreements. See the NOTICE file -- distributed with this work for additional information -- regarding copyright ownership. The ASF licenses this file -- to you under the Apache License, Version 2.0 (the -- "License"); you may not use this file except in compliance -- with the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, -- software distributed under the License is distributed on an -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -- KIND, either express or implied. See the License for the -- specific language governing permissions and limitations -- under the License. --; -- Schema upgrade from 2.2.7 to 2.2.8; --; ALTER TABLE `cloud`.`mshost` ADD COLUMN `runid` bigint NOT NULL DEFAULT 0 COMMENT 'run id, combined with msid to form a cluster session'; ALTER TABLE `cloud`.`mshost` ADD COLUMN `state` varchar(10) NOT NULL default 'Down'; ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `limit_cpu_use` tinyint(1) NOT NULL DEFAULT 0 ; ALTER TABLE `cloud`.`service_offering` ADD COLUMN `limit_cpu_use` tinyint(1) NOT NULL DEFAULT 0 ; ALTER TABLE `cloud`.`service_offering` ADD COLUMN `default_use` tinyint(1) NOT NULL DEFAULT 0 ; ALTER TABLE `cloud`.`service_offering` ADD COLUMN `vm_type` varchar(32) COMMENT 'type of offering specified for system offerings'; ALTER TABLE `cloud`.`storage_pool` MODIFY `host_address` varchar(255) NOT NULL; DROP TABLE IF EXISTS `cloud`.`certificate`; CREATE TABLE IF NOT EXISTS `cloud`.`keystore` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `name` varchar(64) NOT NULL COMMENT 'unique name for the certifiation', `certificate` text NOT NULL COMMENT 'the actual certificate being stored in the db', `key` text NOT NULL COMMENT 'private key associated wih the certificate', `domain_suffix` varchar(256) NOT NULL COMMENT 'DNS domain suffix associated with the certificate', PRIMARY KEY (`id`), UNIQUE(name) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `cloud`.`cmd_exec_log` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `host_id` bigint unsigned NOT NULL COMMENT 'host id of the system VM agent that command is sent to', `instance_id` bigint unsigned NOT NULL COMMENT 'instance id of the system VM that command is executed on', `command_name` varchar(255) NOT NULL COMMENT 'command name', `weight` integer NOT NULL DEFAULT 1 COMMENT 'command weight in consideration of the load factor added to host that is executing the command', `created` datetime NOT NULL COMMENT 'date created', PRIMARY KEY (`id`), INDEX `i_cmd_exec_log__host_id`(`host_id`), INDEX `i_cmd_exec_log__instance_id`(`instance_id`), CONSTRAINT `fk_cmd_exec_log_ref__inst_id` FOREIGN KEY (`instance_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `cloud`.`network_tags` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `network_id` bigint unsigned NOT NULL COMMENT 'id of the network', `tag` varchar(255) NOT NULL COMMENT 'tag', PRIMARY KEY (`id`), CONSTRAINT `fk_network_tags__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`), UNIQUE KEY(`network_id`, `tag`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `cloud`.`firewall_rules_cidrs` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `firewall_rule_id` bigint(20) unsigned NOT NULL COMMENT 'firewall rule id', `source_cidr` varchar(18) DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_firewall_cidrs_firewall_rules` (`firewall_rule_id`), CONSTRAINT `fk_firewall_cidrs_firewall_rules` FOREIGN KEY (`firewall_rule_id`) REFERENCES `firewall_rules` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `cloud`.`secondary_storage_vm` ADD COLUMN `role` varchar(64) NOT NULL DEFAULT 'templateProcessor'; INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) VALUES ('Network', 'DEFAULT', 'management-server', 'vm.network.throttling.rate', 200, 'Default data transfer rate in megabits per second allowed in user vm\'s default network.'); DELETE FROM `cloud`.`configuration` where name='guest.ip.network'; DELETE FROM `cloud`.`configuration` where name='guest.netmask'; ALTER TABLE `cloud`.`host_pod_ref` ADD COLUMN `removed` datetime COMMENT 'date removed if not null'; ALTER TABLE `cloud`.`host_pod_ref` MODIFY `name` varchar(255); ALTER TABLE `cloud`.`host_pod_ref` ADD COLUMN `external_dhcp` tinyint NOT NULL DEFAULT 0 COMMENT 'Is this Pod using external DHCP'; ALTER TABLE `cloud`.`security_group` DROP COLUMN `account_name`; ALTER TABLE `cloud`.`security_ingress_rule` DROP COLUMN `allowed_security_group`; ALTER TABLE `cloud`.`security_ingress_rule` DROP COLUMN `allowed_sec_grp_acct`; ALTER TABLE `cloud`.`data_center` ADD COLUMN `zone_token` varchar(255); ALTER TABLE `cloud`.`data_center` ADD INDEX `i_data_center__zone_token`(`zone_token`); ALTER TABLE `cloud`.`vm_template` ADD COLUMN `source_template_id` bigint unsigned COMMENT 'Id of the original template, if this template is created from snapshot'; ALTER TABLE `cloud`.`op_dc_link_local_ip_address_alloc` ADD INDEX `i_op_dc_link_local_ip_address_alloc__pod_id`(`pod_id`); ALTER TABLE `cloud`.`op_dc_link_local_ip_address_alloc` ADD INDEX `i_op_dc_link_local_ip_address_alloc__data_center_id`(`data_center_id`); ALTER TABLE `cloud`.`op_dc_link_local_ip_address_alloc` ADD INDEX `i_op_dc_link_local_ip_address_alloc__nic_id_reservation_id`(`nic_id`,`reservation_id`); INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (139, 7, 'Other PV (32-bit)'); INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (140, 7, 'Other PV (64-bit)'); INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other PV (32-bit)', 139); INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('XenServer', 'Other PV (64-bit)', 140); ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `shared_source_nat_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides the shared source nat service'; CREATE TABLE IF NOT EXISTS `cloud`.`op_host_transfer` ( `id` bigint unsigned UNIQUE NOT NULL COMMENT 'Id of the host', `initial_mgmt_server_id` bigint unsigned COMMENT 'management server the host is transfered from', `future_mgmt_server_id` bigint unsigned COMMENT 'management server the host is transfered to', `state` varchar(32) NOT NULL COMMENT 'the transfer state of the host', `created` datetime NOT NULL COMMENT 'date created', PRIMARY KEY (`id`), CONSTRAINT `fk_op_host_transfer__id` FOREIGN KEY `fk_op_host_transfer__id` (`id`) REFERENCES `host` (`id`) ON DELETE CASCADE, CONSTRAINT `fk_op_host_transfer__initial_mgmt_server_id` FOREIGN KEY `fk_op_host_transfer__initial_mgmt_server_id`(`initial_mgmt_server_id`) REFERENCES `mshost`(`msid`), CONSTRAINT `fk_op_host_transfer__future_mgmt_server_id` FOREIGN KEY `fk_op_host_transfer__future_mgmt_server_id`(`future_mgmt_server_id`) REFERENCES `mshost`(`msid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `cloud`.`snapshots` ADD COLUMN `swift_id` bigint unsigned; ALTER TABLE `cloud`.`snapshots` ADD COLUMN `swift_name` varchar(255); ALTER TABLE `cloud`.`snapshots` ADD COLUMN `sechost_id` bigint unsigned; CREATE TABLE IF NOT EXISTS `cloud`.`swift` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `hostname` varchar(255), `account` varchar(255) COMMENT ' account in swift', `username` varchar(255) COMMENT ' username in swift', `token` varchar(255) COMMENT 'token for this user', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `vm_type` varchar(32) NOT NULL; UPDATE vm_instance set vm_type=type; ALTER TABLE `cloud`.`networks` ADD COLUMN `is_domain_specific` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if network is domain specific, 0 false otherwise'; INSERT INTO configuration (`category`, `instance`, `component`, `name`, `value`, `description`) VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'allow.subdomain.network.access', 'true', 'Allow subdomains to use networks dedicated to their parent domain(s)'); INSERT INTO configuration (`category`, `instance`, `component`, `name`, `value`, `description`) VALUES ('Advanced', 'DEFAULT', 'management-server', 'encode.api.response', 'false', 'Do UTF-8 encoding for the api response, false by default'); DELETE FROM load_balancer_vm_map WHERE instance_id IN (SELECT id FROM vm_instance WHERE removed IS NOT NULL); INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'management-server', 'hypervisor.list', 'KVM,XenServer,VMware,BareMetal', 'The list of hypervisors that this deployment will use.'); UPDATE IGNORE configuration set name='guest.domain.suffix' where name='domain.suffix'; INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'AgentManager', 'guest.domain.suffix', 'cloud.internal', 'Default domain name for vms inside virtualized networks fronted by router'); DELETE FROM configuration WHERE name='domain.suffix'; ALTER TABLE `cloud`.`user` ADD COLUMN `registration_token` varchar(255) default NULL; ALTER TABLE `cloud`.`user` ADD COLUMN `is_registered` tinyint NOT NULL DEFAULT 0; ALTER TABLE `cloud`.`data_center` ADD COLUMN `removed` datetime; CREATE INDEX `i_op_lock__mac_ip_thread` on `op_lock` (`mac`, `ip`, `thread`); UPDATE `cloud`.`mshost` set removed=NULL where removed IS NOT NULL; INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vmware.management.portgroup', 'Management Network', 'Specify the management network name(for ESXi hosts)'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vmware.additional.vnc.portrange.start', '59000', 'Start port number of additional VNC port range'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vmware.additional.vnc.portrange.size', '1000', 'Start port number of additional VNC port range'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Console Proxy', 'DEFAULT', 'AgentManager', 'consoleproxy.management.state', 'Auto', 'console proxy service management state'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Console Proxy', 'DEFAULT', 'AgentManager', 'consoleproxy.management.state.last', 'Auto', 'last console proxy service management state'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'cluster.message.timeout.seconds', '300', 'Time (in seconds) to wait before a inter-management server message post times out.');
the_stack
drop materialized view renal_readmission_cohort_v5; create materialized view renal_readmission_cohort_v5 as -- Get the first ICU stay of each adult with first_admissions as (select icud.subject_id, icud.hadm_id as first_hadm_id, icud.icustay_id as first_icustay_id, icud.hospital_admit_dt as first_hadm_admit_dt, icud.hospital_disch_dt as first_hadm_disch_dt, icud.icustay_intime as first_icustay_intime, icud.icustay_outtime as first_icustay_outtime, extract(day from icud.icustay_intime-icud.hospital_admit_dt) as days_btw_hosp_icu_admit, extract(day from icud.hospital_disch_dt-icud.icustay_outtime) as days_btw_hosp_icu_disch, icud.icustay_expire_flg as icu_mort_first_admission, icud.hospital_expire_flg as hosp_mort_first_admission, d.admission_source_descr as first_hadm_source, case when lower(d.admission_source_descr) like '%emergency%' then 'Y' else 'N' end as ED_admission, case when icud.icustay_admit_age>150 then 91.4 else round(icud.icustay_admit_age,1) end as age_first_icustay, icud.gender, d.ethnicity_descr as race, round(icud.icustay_los/60/24,2) as first_icustay_los, icud.icustay_first_service, icud.sapsi_first as first_icustay_admit_saps, case when msa.hadm_id is not null then 'Y' else 'N' end as first_hadm_sepsis from mimic2v26.icustay_detail icud left join mimic2v26.demographic_detail d on icud.hadm_id=d.hadm_id left join mimic2devel.martin_sepsis_admissions msa on icud.hadm_id=msa.hadm_id where icud.subject_icustay_seq=1 and icud.icustay_age_group='adult' and icud.hadm_id is not null and icud.icustay_id is not null -- and icud.subject_id < 100 ) --select * from first_admissions; --23,455 rows -- Get all repeat ICU admissions following the first hospital admissions , readmissions as (select fa.*, icud.hadm_id as second_hadm_id, icud.icustay_id as second_icustay_id, icud.hospital_admit_dt as second_hadm_admit_dt, icud.icustay_intime as second_icustay_intime, case when icud.icustay_id is null or icud.hospital_admit_dt-fa.first_hadm_disch_dt > 90 then 'N' else 'Y' end as readmission_90d, case when icud.icustay_id is null or icud.hospital_admit_dt-fa.first_hadm_disch_dt > 365 then 'N' else 'Y' end as readmission_1yr, icud.hospital_admit_dt-fa.first_hadm_disch_dt as days_to_readmission, case when hosp_mort_first_admission='Y' or dp.dod-fa.first_hadm_disch_dt <= 0 then null when dp.dod-fa.first_hadm_disch_dt between 1 and 90 then 'Y' else 'N' end as mortality_90d, case when hosp_mort_first_admission='Y' or dp.dod-fa.first_hadm_disch_dt <= 0 then null when dp.dod-fa.first_hadm_disch_dt between 1 and 365 then 'Y' else 'N' end as mortality_1yr, case when dp.dod-fa.first_hadm_disch_dt < 0 then null when hosp_mort_first_admission='Y' then 0 when dp.dod is null or dp.dod-fa.first_hadm_disch_dt > 730 then 730 else dp.dod-fa.first_hadm_disch_dt end as survival_2yr_hadm_disch, case when extract(day from dp.dod-fa.first_icustay_outtime) < 0 then null when dp.dod is null or extract(day from dp.dod-fa.first_icustay_outtime) > 730 then 730 else extract(day from dp.dod-fa.first_icustay_outtime) end as survival_2yr_icu_disch, case when fa.hosp_mort_first_admission='Y' then extract(day from dp.dod-fa.first_icustay_outtime) else null end as days_icu_disch_to_hosp_mort from first_admissions fa left join mimic2v26.icustay_detail icud on fa.subject_id=icud.subject_id and icud.hospital_seq=2 and icud.icustay_seq=1 and icud.hadm_id is not null and icud.icustay_id is not null left join mimic2devel.d_patients dp on fa.subject_id=dp.subject_id ) --select * from readmissions; , raw_icu_admit_labs as (select distinct r.subject_id, case when l.itemid=50090 then 'serum_cr' when l.itemid=50159 then 'serum_sodium' when l.itemid=50655 then 'urine_protein' when l.itemid=50264 then 'urine_cr' when l.itemid=50277 then 'urine_sodium' when l.itemid=50276 then 'urine_protein_cr_ratio' when l.itemid=50177 then 'bun' when l.itemid=50149 then 'potassium' when l.itemid=50083 then 'chloride' when l.itemid=50172 then 'bicarb' when l.itemid=50383 then 'hematocrit' when l.itemid=50468 then 'wbc' when l.itemid=50140 then 'magnesium' when l.itemid=50148 then 'phosphate' when l.itemid=50079 then 'calcium' when l.itemid=50010 then 'lactate' when l.itemid=50018 then 'ph' when l.itemid=50428 then 'platelets' when l.itemid=50060 then 'albumin' when l.itemid=50112 then 'glucose' when l.itemid=50399 then 'inr' when l.itemid=50439 then 'pt' when l.itemid=50440 then 'ptt' when l.itemid=50115 then 'haptoglobin' when l.itemid=50134 then 'ldh' when l.itemid=50370 then 'd-dimer' end as lab_type, first_value(l.value) over (partition by l.hadm_id, l.itemid order by l.charttime) as lab_value, first_value(l.charttime) over (partition by l.hadm_id order by l.charttime) as icu_admit_lab_time from readmissions r join mimic2v26.labevents l on r.first_hadm_id=l.hadm_id and l.itemid in (50090,50159,50655,50264,50277,50276,50177,50149,50083,50172,50383,50468,50140,50148,50079,50010,50018,50428,50060,50112,50399,50439,50440,50115,50134,50370) and l.charttime between r.first_icustay_intime - interval '12' hour and r.first_icustay_intime + interval '12' hour ) --select * from raw_icu_admit_labs order by 1,2; , icu_admit_labs as (select * from (select * from raw_icu_admit_labs) pivot (max(lab_value) for lab_type in ('serum_cr' as icu_admit_serum_cr, 'serum_sodium' as icu_admit_serum_sodium, 'urine_protein' as icu_admit_urine_protein, 'urine_cr' as icu_admit_urine_cr, 'urine_sodium' as icu_admit_urine_sodium, 'urine_protein_cr_ratio' as icu_admit_urine_prot_cr_ratio, 'bun' as icu_admit_bun, 'potassium' as icu_admit_potassium, 'chloride' as icu_admit_chloride, 'bicarb' as icu_admit_bicarb, 'hematocrit' as icu_admit_hematocrit, 'wbc' as icu_admit_wbc, 'magnesium' as icu_admit_magnesium, 'phosphate' as icu_admit_phosphate, 'calcium' as icu_admit_calcium, 'lactate' as icu_admit_lactate, 'ph' as icu_admit_ph, 'platelets' as icu_admit_platelets, 'albumin' as icu_admit_albumin, 'glucose' as icu_admit_glucose, 'inr' as icu_admit_inr, 'pt' as icu_admit_pt, 'ptt' as icu_admit_ptt, 'haptoglobin' as icu_admit_haptoglobin, 'ldh' as icu_admit_ldh, 'd-dimer' as icu_admit_d_dimer ) ) ) --select * from icu_admit_labs order by 1; , raw_hosp_admit_labs as (select distinct r.subject_id, case when l.itemid=50090 then 'serum_cr' when l.itemid=50159 then 'serum_sodium' when l.itemid=50655 then 'urine_protein' when l.itemid=50264 then 'urine_cr' when l.itemid=50277 then 'urine_sodium' when l.itemid=50276 then 'urine_protein_cr_ratio' when l.itemid=50177 then 'bun' when l.itemid=50149 then 'potassium' when l.itemid=50083 then 'chloride' when l.itemid=50172 then 'bicarb' when l.itemid=50383 then 'hematocrit' when l.itemid=50468 then 'wbc' when l.itemid=50140 then 'magnesium' when l.itemid=50148 then 'phosphate' when l.itemid=50079 then 'calcium' when l.itemid=50010 then 'lactate' when l.itemid=50018 then 'ph' when l.itemid=50428 then 'platelets' when l.itemid=50060 then 'albumin' when l.itemid=50112 then 'glucose' end as lab_type, first_value(l.value) over (partition by l.hadm_id, l.itemid order by l.charttime) as lab_value, first_value(l.charttime) over (partition by l.hadm_id order by l.charttime) as hosp_admit_lab_time from readmissions r join mimic2v26.labevents l on r.first_hadm_id=l.hadm_id and l.itemid in (50090,50159,50655,50264,50277,50276,50177,50149,50083,50172,50383,50468,50140,50148,50079,50010,50018,50428,50060,50112) and extract(day from l.charttime-r.first_hadm_admit_dt) = 0 ) --select * from raw_hosp_admit_labs order by 1,2; , hosp_admit_labs as (select * from (select * from raw_hosp_admit_labs) pivot (max(lab_value) for lab_type in ('serum_cr' as hosp_admit_serum_cr, 'serum_sodium' as hosp_admit_serum_sodium, 'urine_protein' as hosp_admit_urine_protein, 'urine_cr' as hosp_admit_urine_cr, 'urine_sodium' as hosp_admit_urine_sodium, 'urine_protein_cr_ratio' as hosp_admit_urine_prot_cr_ratio, 'bun' as hosp_admit_bun, 'potassium' as hosp_admit_potassium, 'chloride' as hosp_admit_chloride, 'bicarb' as hosp_admit_bicarb, 'hematocrit' as hosp_admit_hematocrit, 'wbc' as hosp_admit_wbc, 'magnesium' as hosp_admit_magnesium, 'phosphate' as hosp_admit_phosphate, 'calcium' as hosp_admit_calcium, 'lactate' as hosp_admit_lactate, 'ph' as hosp_admit_ph, 'platelets' as hosp_admit_platelets, 'albumin' as hosp_admit_albumin, 'glucose' as hosp_admit_glucose ) ) ) --select * from hosp_admit_labs order by 1; , admit_labs_first_icustay as (select i.subject_id, extract(day from i.icu_admit_lab_time-r.first_hadm_admit_dt) as days_btw_icu_lab_hosp_admit, case when i.icu_admit_lab_time is null or h.hosp_admit_lab_time is null then null when abs(extract(minute from i.icu_admit_lab_time-h.hosp_admit_lab_time)) < 10 then 'Y' else 'N' end as same_hosp_icu_admit_labs, case when LENGTH(TRIM(TRANSLATE(i.icu_admit_serum_cr, ' +-.0123456789', ' '))) > 0 then null else to_number(i.icu_admit_serum_cr) end as icu_admit_serum_cr, case when LENGTH(TRIM(TRANSLATE(i.icu_admit_serum_sodium, ' +-.0123456789', ' '))) > 0 then null else to_number(i.icu_admit_serum_sodium) end as icu_admit_serum_sodium, case when i.icu_admit_urine_protein in ('N','NEG','NEGATIVE','Neg') then 0 when i.icu_admit_urine_protein in ('TR','Tr') then 1 when i.icu_admit_urine_protein in ('15','25','30') then 30 when i.icu_admit_urine_protein in ('75','100') then 100 when i.icu_admit_urine_protein in ('150','300') then 300 when i.icu_admit_urine_protein in ('>300','>600','500') then 500 else null end as icu_admit_urine_protein, case when LENGTH(TRIM(TRANSLATE(i.icu_admit_urine_cr, ' +-.0123456789', ' '))) > 0 then null else to_number(i.icu_admit_urine_cr) end as icu_admit_urine_cr, case when i.icu_admit_urine_sodium='<10' or (lower(i.icu_admit_urine_sodium) like '%less%' and i.icu_admit_urine_sodium like '%10%') then 0 when LENGTH(TRIM(TRANSLATE(i.icu_admit_urine_sodium, ' +-.0123456789', ' '))) > 0 then null else to_number(i.icu_admit_urine_sodium) end as icu_admit_urine_sodium, case when LENGTH(TRIM(TRANSLATE(i.icu_admit_urine_prot_cr_ratio, ' +-.0123456789', ' '))) > 0 then null else to_number(i.icu_admit_urine_prot_cr_ratio) end as icu_admit_urine_prot_cr_ratio, i.icu_admit_bun, i.icu_admit_potassium, i.icu_admit_chloride, i.icu_admit_bicarb, i.icu_admit_hematocrit, i.icu_admit_wbc, i.icu_admit_magnesium, i.icu_admit_phosphate, i.icu_admit_calcium, i.icu_admit_lactate, i.icu_admit_ph, i.icu_admit_platelets, i.icu_admit_albumin, i.icu_admit_glucose, i.icu_admit_inr, i.icu_admit_pt, i.icu_admit_ptt, i.icu_admit_haptoglobin, i.icu_admit_ldh, i.icu_admit_d_dimer, case when LENGTH(TRIM(TRANSLATE(h.hosp_admit_serum_cr, ' +-.0123456789', ' '))) > 0 then null else to_number(h.hosp_admit_serum_cr) end as hosp_admit_serum_cr, case when LENGTH(TRIM(TRANSLATE(h.hosp_admit_serum_sodium, ' +-.0123456789', ' '))) > 0 then null else to_number(h.hosp_admit_serum_sodium) end as hosp_admit_serum_sodium, case when h.hosp_admit_urine_protein in ('N','NEG','NEGATIVE','Neg') then 0 when h.hosp_admit_urine_protein in ('TR','Tr') then 1 when h.hosp_admit_urine_protein in ('15','25','30') then 30 when h.hosp_admit_urine_protein in ('75','100') then 100 when h.hosp_admit_urine_protein in ('150','300') then 300 when h.hosp_admit_urine_protein in ('>300','>600','500') then 500 else null end as hosp_admit_urine_protein, case when LENGTH(TRIM(TRANSLATE(h.hosp_admit_urine_cr, ' +-.0123456789', ' '))) > 0 then null else to_number(h.hosp_admit_urine_cr) end as hosp_admit_urine_cr, case when h.hosp_admit_urine_sodium='<10' or (lower(h.hosp_admit_urine_sodium) like '%less%' and h.hosp_admit_urine_sodium like '%10%') then 0 when LENGTH(TRIM(TRANSLATE(h.hosp_admit_urine_sodium, ' +-.0123456789', ' '))) > 0 then null else to_number(h.hosp_admit_urine_sodium) end as hosp_admit_urine_sodium, case when LENGTH(TRIM(TRANSLATE(h.hosp_admit_urine_prot_cr_ratio, ' +-.0123456789', ' '))) > 0 then null else to_number(h.hosp_admit_urine_prot_cr_ratio) end as hosp_admit_urine_prot_cr_ratio, h.hosp_admit_bun, h.hosp_admit_potassium, h.hosp_admit_chloride, h.hosp_admit_bicarb, h.hosp_admit_hematocrit, h.hosp_admit_wbc, h.hosp_admit_magnesium, h.hosp_admit_phosphate, h.hosp_admit_calcium, h.hosp_admit_lactate, h.hosp_admit_ph, h.hosp_admit_platelets, h.hosp_admit_albumin, h.hosp_admit_glucose from readmissions r left join icu_admit_labs i on r.subject_id=i.subject_id left join hosp_admit_labs h on i.subject_id=h.subject_id ) --select * from admit_labs_first_icustay; -- Get peak creatinine values from first ICU stays , peak_creat_first_icustay as (select distinct r.subject_id, count(*) as num_cr_first_icustay, max(l.valuenum) as cr_peak_first_icustay from readmissions r join mimic2v26.labevents l on r.first_icustay_id=l.icustay_id and l.itemid=50090 group by r.subject_id ) --select * from peak_creat_first_icustay; -- Get discharge creatinine values from first ICU stays , disch_creat_first_icustay as (select distinct r.subject_id, first_value(l.valuenum) over (partition by l.icustay_id order by l.charttime desc) as cr_disch_first_icustay from readmissions r join mimic2v26.labevents l on r.first_icustay_id=l.icustay_id and l.itemid=50090 and l.charttime between r.first_icustay_outtime - interval '48' hour and r.first_icustay_outtime ) --select * from disch_creat_first_icustay; -- Get number of days with at least one creatinine measurement during the first ICU stay , days_with_cr_first_icustay as (select distinct r.subject_id, icud.seq from readmissions r join mimic2v26.icustay_days icud on r.first_icustay_id=icud.icustay_id join mimic2v26.labevents l on r.first_icustay_id=l.icustay_id and l.itemid=50090 and l.charttime between icud.begintime and icud.endtime ) --select * from days_with_cr_first_icustay; , num_daily_cr_first_icustay as (select subject_id, count(*) as num_daily_cr_first_icustay from days_with_cr_first_icustay group by subject_id ) --select * from num_daily_cr_first_icustay; -- Get admit creatinine values from second ICU stays , admit_labs_second_icustay as (select distinct r.subject_id, first_value(l.valuenum) over (partition by l.icustay_id order by l.charttime) as admit_serum_cr_second_icustay from readmissions r join mimic2v26.labevents l on r.second_icustay_id=l.icustay_id and l.itemid=50090 and l.charttime between r.second_icustay_intime - interval '12' hour and r.second_icustay_intime + interval '12' hour ) --select * from admit_labs_second_icustay; -- Combine all labs together , all_labs as (select alf.*, pcf.cr_peak_first_icustay, dcf.cr_disch_first_icustay, pcf.num_cr_first_icustay, ncf.num_daily_cr_first_icustay, als.admit_serum_cr_second_icustay from admit_labs_first_icustay alf left join peak_creat_first_icustay pcf on alf.subject_id=pcf.subject_id left join disch_creat_first_icustay dcf on alf.subject_id=dcf.subject_id left join num_daily_cr_first_icustay ncf on alf.subject_id=ncf.subject_id left join admit_labs_second_icustay als on alf.subject_id=als.subject_id ) --select * from all_labs; -- Narrow down Chartevents table , small_chartevents as (select subject_id, icustay_id, itemid, charttime, value1num, value2num from mimic2v26.chartevents where itemid in (580,581,763,762,920,211,51,52,455,456,678,679,646,834,20001) and subject_id in (select subject_id from readmissions) ) --select * from small_chartevents; -- Get admit weight from first ICU stays , admit_weight_first_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as weight_admit_first_icustay from readmissions r join small_chartevents l on r.first_icustay_id=l.icustay_id and l.itemid=762 and l.charttime between r.first_icustay_intime and r.first_icustay_intime + interval '24' hour ) --select * from admit_weight_first_icustay; -- Get admit height from first ICU stays , admit_height_first_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as height_admit_first_icustay from readmissions r join small_chartevents l on r.first_icustay_id=l.icustay_id and l.itemid=920 and l.charttime between r.first_icustay_intime and r.first_icustay_intime + interval '24' hour ) --select * from admit_height_first_icustay; -- Get discharge weight from first ICU stays , disch_weight_first_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime desc) as weight_disch_first_icustay from readmissions r join small_chartevents l on r.first_icustay_id=l.icustay_id and l.itemid in (580,581,763) and l.charttime between r.first_icustay_outtime - interval '48' hour and r.first_icustay_outtime ) --select * from disch_weight_first_icustay; -- Get admit weight from second ICU stays , admit_weight_second_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as weight_admit_second_icustay from readmissions r join small_chartevents l on r.second_icustay_id=l.icustay_id and l.itemid=762 and l.charttime between r.second_icustay_intime and r.second_icustay_intime + interval '24' hour ) --select * from admit_weight_second_icustay; -- Combine all weight and height together , all_weight_height as (select r.subject_id, awf.weight_admit_first_icustay, ahf.height_admit_first_icustay, case when ahf.height_admit_first_icustay > 0 then round(awf.weight_admit_first_icustay/power(ahf.height_admit_first_icustay*0.0254,2),2) else null end as bmi_admit_first_icustay, dwf.weight_disch_first_icustay, aws.weight_admit_second_icustay from readmissions r left join admit_weight_first_icustay awf on r.subject_id=awf.subject_id left join admit_height_first_icustay ahf on r.subject_id=ahf.subject_id left join disch_weight_first_icustay dwf on r.subject_id=dwf.subject_id left join admit_weight_second_icustay aws on r.subject_id=aws.subject_id ) --select * from all_weight_height; -- Get admit heart rate from first ICU stays , admit_hr_first_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as hr_admit_first_icustay from readmissions r join small_chartevents l on r.first_icustay_id=l.icustay_id and l.itemid in (211) and l.charttime between r.first_icustay_intime and r.first_icustay_intime + interval '24' hour ) --select * from admit_hr_first_icustay; -- Get admit heart rate from second ICU stays , admit_hr_second_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as hr_admit_second_icustay from readmissions r join small_chartevents l on r.second_icustay_id=l.icustay_id and l.itemid in (211) and l.charttime between r.second_icustay_intime and r.second_icustay_intime + interval '24' hour ) --select * from admit_hr_second_icustay; -- Get admit mean arterial pressure from first ICU stays , admit_map_first_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as map_admit_first_icustay, first_value(l.itemid) over (partition by l.icustay_id order by l.charttime) as map_type_first_icustay from readmissions r join small_chartevents l on r.first_icustay_id=l.icustay_id and l.itemid in (52,456) and l.charttime between r.first_icustay_intime and r.first_icustay_intime + interval '24' hour ) --select * from admit_map_first_icustay; -- Get admit mean arterial pressure from second ICU stays , admit_map_second_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as map_admit_second_icustay, first_value(l.itemid) over (partition by l.icustay_id order by l.charttime) as map_type_second_icustay from readmissions r join small_chartevents l on r.second_icustay_id=l.icustay_id and l.itemid in (52,456) and l.charttime between r.second_icustay_intime and r.second_icustay_intime + interval '24' hour ) --select * from admit_map_second_icustay; -- Get admit systolic and diastolic arterial pressure from first ICU stays , admit_bp_first_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as sbp_admit_first_icustay, first_value(l.value2num) over (partition by l.icustay_id order by l.charttime) as dbp_admit_first_icustay, first_value(l.itemid) over (partition by l.icustay_id order by l.charttime) as sbp_dbp_type_first_icustay from readmissions r join small_chartevents l on r.first_icustay_id=l.icustay_id and l.itemid in (51,455) and l.charttime between r.first_icustay_intime and r.first_icustay_intime + interval '24' hour ) --select * from admit_bp_first_icustay; -- Get admit systolic and diastolic arterial pressure from second ICU stays , admit_bp_second_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as sbp_admit_second_icustay, first_value(l.value2num) over (partition by l.icustay_id order by l.charttime) as dbp_admit_second_icustay, first_value(l.itemid) over (partition by l.icustay_id order by l.charttime) as sbp_dbp_type_second_icustay from readmissions r join small_chartevents l on r.second_icustay_id=l.icustay_id and l.itemid in (51,455) and l.charttime between r.second_icustay_intime and r.second_icustay_intime + interval '24' hour ) --select * from admit_bp_second_icustay; -- Get admit temperature from first ICU stays , admit_temp_first_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as temp_admit_first_icustay from readmissions r join small_chartevents l on r.first_icustay_id=l.icustay_id and l.itemid in (678, 679) and l.charttime between r.first_icustay_intime and r.first_icustay_intime + interval '24' hour ) --select * from admit_temp_first_icustay; -- Get admit temperature from second ICU stays , admit_temp_second_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as temp_admit_second_icustay from readmissions r join small_chartevents l on r.second_icustay_id=l.icustay_id and l.itemid in (678, 679) and l.charttime between r.second_icustay_intime and r.second_icustay_intime + interval '24' hour ) --select * from admit_temp_second_icustay; -- Get admit o2sat from first ICU stays , admit_o2sat_first_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as o2sat_admit_first_icustay from readmissions r join small_chartevents l on r.first_icustay_id=l.icustay_id and l.itemid in (646, 834) and l.charttime between r.first_icustay_intime and r.first_icustay_intime + interval '24' hour ) --select * from admit_o2sat_first_icustay; -- Get admit o2sat from second ICU stays , admit_o2sat_second_icustay as (select distinct r.subject_id, first_value(l.value1num) over (partition by l.icustay_id order by l.charttime) as o2sat_admit_second_icustay from readmissions r join small_chartevents l on r.second_icustay_id=l.icustay_id and l.itemid in (646, 834) and l.charttime between r.second_icustay_intime and r.second_icustay_intime + interval '24' hour ) --select * from admit_o2sat_second_icustay; -- Total urine output during the first ICU stay , uo_first_icustay as (select r.subject_id, sum(ie.volume) as urine_first_icustay from readmissions r join mimic2v26.ioevents ie on r.first_icustay_id=ie.icustay_id where ie.itemid in ( 651, 715, 55, 56, 57, 61, 65, 69, 85, 94, 96, 288, 405, 428, 473, 2042, 2068, 2111, 2119, 2130, 1922, 2810, 2859, 3053, 3462, 3519, 3175, 2366, 2463, 2507, 2510, 2592, 2676, 3966, 3987, 4132, 4253, 5927 ) group by r.subject_id ) --select * from uo_first_icustay; , uo_first_icustay_24h as (select r.subject_id, sum(ie.volume) as urine_first_icustay_24h from readmissions r join mimic2v26.ioevents ie on r.first_icustay_id=ie.icustay_id and ie.charttime between r.first_icustay_intime and r.first_icustay_intime + interval '24' hour where ie.itemid in ( 651, 715, 55, 56, 57, 61, 65, 69, 85, 94, 96, 288, 405, 428, 473, 2042, 2068, 2111, 2119, 2130, 1922, 2810, 2859, 3053, 3462, 3519, 3175, 2366, 2463, 2507, 2510, 2592, 2676, 3966, 3987, 4132, 4253, 5927 ) group by r.subject_id ) --select * from uo_first_icustay_24h; -- Total 1/2 NS during the first ICU stay , half_ns_first_icustay as (select r.subject_id, sum(ie.volume) as half_ns_first_icustay from readmissions r join mimic2v26.ioevents ie on r.first_icustay_id=ie.icustay_id where ie.itemid not in (select itemid from rishi_kothari.d_fluiditems) and ie.itemid in (select itemid from mimic2v26.d_ioitems where (lower(label) like '%normal saline%' or lower(label) like '%ns%') and (lower(label) not like '%d%ns%') and (label like '%1/2%' or label like '%.45%')) group by r.subject_id ) --select * from half_ns_first_icustay; -- Total 1/4 NS during the first ICU stay , quarter_ns_first_icustay as (select r.subject_id, sum(ie.volume) as quarter_ns_first_icustay from readmissions r join mimic2v26.ioevents ie on r.first_icustay_id=ie.icustay_id where ie.itemid not in (select itemid from rishi_kothari.d_fluiditems) and ie.itemid in (select itemid from mimic2v26.d_ioitems where (lower(label) like '%normal saline%' or lower(label) like '%ns%') and (lower(label) not like '%d%ns%') and (label like '%1/4%' or label like '%.22%')) group by r.subject_id ) --select * from quarter_ns_first_icustay; -- Total D5W during the first ICU stay , d5w_first_icustay as (select r.subject_id, sum(ie.volume) as d5w_first_icustay from readmissions r join mimic2v26.ioevents ie on r.first_icustay_id=ie.icustay_id where ie.itemid not in (select itemid from rishi_kothari.d_fluiditems) and ie.itemid in (select itemid from mimic2v26.d_ioitems where lower(label) like '%d5w%' and lower(label) not like '%d5%ns%' and lower(label) not like '%d5%lr%' and lower(label) not like '%d5%rl%') group by r.subject_id ) --select * from d5w_first_icustay; -- Total crystalloid volume during the first ICU stay , cryst_first_icustay as (select r.subject_id, sum(ie.volume) as cryst_first_icustay from readmissions r join mimic2v26.ioevents ie on r.first_icustay_id=ie.icustay_id where ie.itemid in (select itemid from rishi_kothari.d_fluiditems) group by r.subject_id ) --select * from cryst_first_icustay; -- Total colloid volume during the first ICU stay , colloid_first_icustay as (select r.subject_id, sum(ie.volume) as colloid_first_icustay from readmissions r join mimic2v26.ioevents ie on r.first_icustay_id=ie.icustay_id where ie.itemid in (select itemid from rishi_kothari.d_colloids) group by r.subject_id ) --select * from colloid_first_icustay; -- Total PO intake during the first ICU stay , pointake_first_icustay as (select r.subject_id, sum(t.cumvolume) as po_intake_first_icustay from readmissions r join mimic2v26.totalbalevents t on r.first_icustay_id=t.icustay_id where itemid=20 group by r.subject_id ) --select * from pointake_first_icustay; -- Total stool loss during the first ICU stay , stool_first_icustay as (select r.subject_id, sum(t.cumvolume) as stool_first_icustay from readmissions r join mimic2v26.totalbalevents t on r.first_icustay_id=t.icustay_id where itemid=22 group by r.subject_id ) --select * from pointake_first_icustay; -- Total input during the first ICU stay , totalin_first_icustay as (select r.subject_id, sum(t.cumvolume) as total_in_first_icustay from readmissions r join mimic2v26.totalbalevents t on r.first_icustay_id=t.icustay_id where itemid=1 group by r.subject_id ) --select * from totalin_first_icustay; -- Total output during the first ICU stay , totalout_first_icustay as (select r.subject_id, sum(t.cumvolume) as total_out_first_icustay from readmissions r join mimic2v26.totalbalevents t on r.first_icustay_id=t.icustay_id where itemid=2 group by r.subject_id ) --select * from totalout_first_icustay; -- Total fluid balance for the first ICU stay , fluidbal_first_icustay as (select distinct r.subject_id, first_value(t.cumvolume) over (partition by t.icustay_id order by t.charttime desc) as fluid_balance_first_icustay from readmissions r join mimic2v26.totalbalevents t on r.first_icustay_id=t.icustay_id where itemid=28 ) --select * from fluidbal_first_icustay; -- ICD9 from first hospital admission , icd9_first_admission as (select r.subject_id, i.code, i.description from readmissions r join mimic2v26.icd9 i on r.first_hadm_id=i.hadm_id where i.sequence = 1 ) --select * from icd9_first_admission; -- ICD9 from second hospital admission , icd9_second_admission as (select r.subject_id, i.code, i.description from readmissions r join mimic2v26.icd9 i on r.second_hadm_id=i.hadm_id where i.sequence = 1 ) --select * from icd9_second_admission; ------------------------------------ --- Start of dialysis-related data ------------------------------------ , first_dialysis as (select distinct r.subject_id, r.first_hadm_id, r.first_icustay_id, first_value(p.proc_dt) over (partition by p.hadm_id order by p.proc_dt) as first_dialysis_dt from readmissions r join mimic2v26.procedureevents p on r.first_hadm_id=p.hadm_id where p.itemid in (100977,100622) ) --select * from first_dialysis; -- Hemodialysis during the first hospital admission , hd as (select distinct r.subject_id from readmissions r join mimic2v26.procedureevents p on r.first_hadm_id=p.hadm_id where p.itemid=100622 ) --select * from hd; -- Peritoneal dialysis during the first hospital admission , pd as (select distinct r.subject_id from readmissions r join mimic2v26.procedureevents p on r.first_hadm_id=p.hadm_id where p.itemid=100977 ) --select * from pd; , labs_proximal_to_dialysis as (select fd.subject_id, extract(day from fd.first_dialysis_dt-r.first_icustay_intime) as icu_day_first_dialysis, fd.first_dialysis_dt-r.first_hadm_admit_dt as hosp_day_first_dialysis, fd.first_dialysis_dt, l.itemid, l.charttime, first_value(l.valuenum) over (partition by fd.subject_id,l.itemid order by fd.first_dialysis_dt-l.charttime) as proximal_lab from first_dialysis fd join readmissions r on fd.subject_id=r.subject_id join mimic2v26.labevents l on r.first_hadm_id=l.hadm_id and l.itemid in (50090,50177) and l.charttime < fd.first_dialysis_dt ) --select * from labs_proximal_to_dialysis; , labs_prior_to_dialysis as (select subject_id, icu_day_first_dialysis, hosp_day_first_dialysis, first_dialysis_dt, cr_prior_to_dialysis, bun_prior_to_dialysis from (select distinct subject_id, icu_day_first_dialysis, hosp_day_first_dialysis, first_dialysis_dt, itemid, proximal_lab from labs_proximal_to_dialysis) pivot (avg(proximal_lab) for itemid in ('50090' as cr_prior_to_dialysis, '50177' as bun_prior_to_dialysis ) ) ) --select * from labs_prior_to_dialysis; , cr_and_dialysis as (select subject_id, extract(day from min(first_dialysis_dt-charttime)) as days_btw_cr_and_dialysis from labs_proximal_to_dialysis where itemid=50090 group by subject_id ) --select * from cr_and_dialysis; , fluidbal_dialysis as (select distinct f.subject_id, first_value(t.cumvolume) over (partition by t.icustay_id order by t.charttime desc) as fluidbal_prior_to_dialysis from first_dialysis f join mimic2v26.totalbalevents t on f.first_icustay_id=t.icustay_id where t.itemid=28 and t.charttime < f.first_dialysis_dt ) --select * from fluidbal_dialysis; , uo_dialysis as (select f.subject_id, sum(ie.volume) as urine_prior_to_dialysis from first_dialysis f join mimic2v26.ioevents ie on f.first_icustay_id=ie.icustay_id and ie.charttime < f.first_dialysis_dt where ie.itemid in ( 651, 715, 55, 56, 57, 61, 65, 69, 85, 94, 96, 288, 405, 428, 473, 2042, 2068, 2111, 2119, 2130, 1922, 2810, 2859, 3053, 3462, 3519, 3175, 2366, 2463, 2507, 2510, 2592, 2676, 3966, 3987, 4132, 4253, 5927 ) and ie.volume > 0 group by f.subject_id ) --select * from uo_dialysis; , ivf_dialysis as (select f.subject_id, sum(ie.volume) as ivf_prior_to_dialysis from first_dialysis f join mimic2v26.ioevents ie on f.first_icustay_id=ie.icustay_id and ie.charttime < f.first_dialysis_dt where (ie.itemid in (select itemid from rishi_kothari.d_fluiditems) or ie.itemid in (select itemid from rishi_kothari.d_colloids)) and ie.volume > 0 group by f.subject_id ) --select * from ivf_dialysis; , saps_dialysis as (select distinct f.subject_id, first_value(ce.value1num) over (partition by f.subject_id order by ce.charttime desc) as saps_day_of_dialysis from first_dialysis f join small_chartevents ce on f.first_icustay_id=ce.icustay_id and ce.itemid=20001 and ce.charttime>=f.first_dialysis_dt and extract(day from ce.charttime-f.first_dialysis_dt)=0 ) --select * from saps_dialysis; , all_dialysis_data as (select f.*, case when hd.subject_id is null then 'N' else 'Y' end as hd_first_hadm, case when pd.subject_id is null then 'N' else 'Y' end as pd_first_hadm, l.icu_day_first_dialysis, l.hosp_day_first_dialysis, l.cr_prior_to_dialysis, cd.days_btw_cr_and_dialysis, l.bun_prior_to_dialysis, fd.fluidbal_prior_to_dialysis, ud.urine_prior_to_dialysis, ivfd.ivf_prior_to_dialysis, s.saps_day_of_dialysis from first_dialysis f left join hd on f.subject_id=hd.subject_id left join pd on f.subject_id=pd.subject_id left join labs_prior_to_dialysis l on f.subject_id=l.subject_id left join cr_and_dialysis cd on f.subject_id=cd.subject_id left join fluidbal_dialysis fd on f.subject_id=fd.subject_id left join uo_dialysis ud on f.subject_id=ud.subject_id left join ivf_dialysis ivfd on f.subject_id=ivfd.subject_id left join saps_dialysis s on f.subject_id=s.subject_id ) --select * from all_dialysis_data; --------------------------------- --- End of dialysis-related data --------------------------------- -- daily SAPS scores , daily_saps as (select r.subject_id, sum(ce.value1num) as total_saps_first_icustay, count(*) as num_saps_scores_first_icustay, max(ce.value1num) as peak_saps_first_icustay from readmissions r join small_chartevents ce on r.first_icustay_id=ce.icustay_id and ce.itemid=20001 group by r.subject_id ) --select * from daily_saps; -- mechanical ventilation , mech_vent as (select distinct icustay_id from mimic2devel.ventilation ) --select * from mech_vent -- Get home diuretics , count_home_diuretics as (select r.subject_id, case when hm.hadm_id is null then null when pm.name is not null then 1 else 0 end diuretic_flg from readmissions r left join lilehman.pt_with_home_meds hm on r.first_hadm_id=hm.hadm_id left join lilehman.ppi_admission_drugs2 p on r.first_hadm_id=p.hadm_id left join djscott.ppi_med_groups pm on instr(pm.name,p.medication)>0 and pm.med_category='DIURETIC' ) --select * from count_home_diuretics; -- Tally the number of home diuretics , home_diuretics as (select subject_id, sum(diuretic_flg) as num_home_diuretics from count_home_diuretics group by subject_id ) --select * from home_diuretics; -- Vasopressors during the first 24 hours in the ICU , icu_admit_pressors as (SELECT DISTINCT r.subject_id FROM readmissions r JOIN mimic2v26.medevents m on r.first_icustay_id=m.icustay_id WHERE m.itemid in (42, 43, 44, 46, 47, 51, 119, 120, 125, 127, 128, 306, 307, 309) and m.dose > 0 and m.charttime between r.first_icustay_intime and r.first_icustay_intime + interval '24' hour ) --select * from icu_admit_pressors; -- Assemble final data , final_data as (select r.subject_id, r.first_hadm_id, r.first_icustay_id, r.days_btw_hosp_icu_admit, r.days_btw_hosp_icu_disch, r.icu_mort_first_admission, r.hosp_mort_first_admission, r.first_hadm_source, r.ED_admission, r.age_first_icustay, r.gender, r.race, r.first_icustay_los, r.icustay_first_service, r.first_icustay_admit_saps, r.first_hadm_sepsis, r.second_hadm_id, r.second_icustay_id, r.readmission_90d, r.readmission_1yr, r.days_to_readmission, r.mortality_90d, r.mortality_1yr, r.survival_2yr_hadm_disch, r.survival_2yr_icu_disch, r.days_icu_disch_to_hosp_mort, al.days_btw_icu_lab_hosp_admit, al.same_hosp_icu_admit_labs, al.icu_admit_serum_cr, al.icu_admit_serum_sodium, al.icu_admit_urine_protein, al.icu_admit_urine_cr, al.icu_admit_urine_sodium, al.icu_admit_urine_prot_cr_ratio, al.icu_admit_bun, al.icu_admit_potassium, al.icu_admit_chloride, al.icu_admit_bicarb, al.icu_admit_hematocrit, al.icu_admit_wbc, al.icu_admit_magnesium, al.icu_admit_phosphate, al.icu_admit_calcium, al.icu_admit_lactate, al.icu_admit_ph, al.icu_admit_platelets, al.icu_admit_albumin, al.icu_admit_glucose, al.icu_admit_inr, al.icu_admit_pt, al.icu_admit_ptt, al.icu_admit_haptoglobin, al.icu_admit_ldh, al.icu_admit_d_dimer, al.hosp_admit_serum_cr, al.hosp_admit_serum_sodium, al.hosp_admit_urine_protein, al.hosp_admit_urine_cr, al.hosp_admit_urine_sodium, al.hosp_admit_urine_prot_cr_ratio, al.hosp_admit_bun, al.hosp_admit_potassium, al.hosp_admit_chloride, al.hosp_admit_bicarb, al.hosp_admit_hematocrit, al.hosp_admit_wbc, al.hosp_admit_magnesium, al.hosp_admit_phosphate, al.hosp_admit_calcium, al.hosp_admit_lactate, al.hosp_admit_ph, al.hosp_admit_platelets, al.hosp_admit_albumin, al.hosp_admit_glucose, al.cr_peak_first_icustay, al.cr_disch_first_icustay, al.num_cr_first_icustay, al.num_daily_cr_first_icustay, al.admit_serum_cr_second_icustay, CASE WHEN r.gender='F' AND (r.race LIKE '%AFRICAN%' OR r.race LIKE '%BLACK%') THEN ROUND(186 *POWER(al.cr_disch_first_icustay,-1.154)*POWER(r.age_first_icustay,-0.203) * 1.212 * 0.742 ,2) WHEN r.gender='M' AND (r.race LIKE '%AFRICAN%' OR r.race LIKE '%BLACK%') THEN ROUND(186 *POWER(al.cr_disch_first_icustay,-1.154)*POWER(r.age_first_icustay,-0.203) * 1.212 ,2) WHEN r.gender='F' AND (r.race NOT LIKE '%AFRICAN%' AND r.race NOT LIKE '%BLACK%') THEN ROUND(186 *POWER(al.cr_disch_first_icustay,-1.154)*POWER(r.age_first_icustay,-0.203) * 0.742 ,2) WHEN r.gender='M' AND (r.race NOT LIKE '%AFRICAN%' AND r.race NOT LIKE '%BLACK%') THEN ROUND(186 *POWER(al.cr_disch_first_icustay,-1.154)*POWER(r.age_first_icustay,-0.203) ,2) END as mdrd_disch_first_icustay, awh.weight_admit_first_icustay, awh.height_admit_first_icustay, awh.bmi_admit_first_icustay, awh.weight_disch_first_icustay, awh.weight_admit_second_icustay, ahf.hr_admit_first_icustay, ahs.hr_admit_second_icustay, round(amf.map_admit_first_icustay,2) as map_admit_first_icustay, case when amf.map_type_first_icustay=52 then 'invasive' when amf.map_type_first_icustay=456 then 'non-invasive' else null end as map_type_first_icustay, round(ams.map_admit_second_icustay,2) as map_admit_second_icustay, case when ams.map_type_second_icustay=52 then 'invasive' when ams.map_type_second_icustay=456 then 'non-invasive' else null end as map_type_second_icustay, abf.sbp_admit_first_icustay, abs.sbp_admit_second_icustay, abf.dbp_admit_first_icustay, abs.dbp_admit_second_icustay, case when abf.sbp_dbp_type_first_icustay=51 then 'invasive' when abf.sbp_dbp_type_first_icustay=455 then 'non-invasive' else null end as sbp_dbp_type_first_icustay, case when abs.sbp_dbp_type_second_icustay=51 then 'invasive' when abs.sbp_dbp_type_second_icustay=455 then 'non-invasive' else null end as sbp_dbp_type_second_icustay, round(atf.temp_admit_first_icustay,2) as temp_admit_first_icustay, round(ats.temp_admit_second_icustay,2) as temp_admit_second_icustay, aof.o2sat_admit_first_icustay, aos.o2sat_admit_second_icustay, ufi.urine_first_icustay, ufi24.urine_first_icustay_24h, case when hnf.half_ns_first_icustay is null then 0 else hnf.half_ns_first_icustay end as half_ns_first_icustay, case when qnf.quarter_ns_first_icustay is null then 0 else qnf.quarter_ns_first_icustay end as quarter_ns_first_icustay, case when dwf.d5w_first_icustay is null then 0 else dwf.d5w_first_icustay end as d5w_first_icustay, case when crf.cryst_first_icustay is null then 0 else crf.cryst_first_icustay end as iso_cryst_first_icustay, case when cof.colloid_first_icustay is null then 0 else cof.colloid_first_icustay end as colloid_first_icustay, case when crf.cryst_first_icustay is null and cof.colloid_first_icustay is null then 0 when crf.cryst_first_icustay is null and cof.colloid_first_icustay is not null then cof.colloid_first_icustay when crf.cryst_first_icustay is not null and cof.colloid_first_icustay is null then crf.cryst_first_icustay else crf.cryst_first_icustay+cof.colloid_first_icustay end as ivf_first_icustay, case when pif.po_intake_first_icustay is null then 0 else pif.po_intake_first_icustay end as po_intake_first_icustay, case when sf.stool_first_icustay is null then 0 else sf.stool_first_icustay end as stool_first_icustay, round(tif.total_in_first_icustay,1) as total_in_first_icustay, round(tof.total_out_first_icustay,1) as total_out_first_icustay, round(ff.fluid_balance_first_icustay,1) as fluid_balance_first_icustay, ad.first_dialysis_dt, ad.hd_first_hadm, ad.pd_first_hadm, ad.icu_day_first_dialysis, ad.hosp_day_first_dialysis, ad.cr_prior_to_dialysis, ad.days_btw_cr_and_dialysis, ad.bun_prior_to_dialysis, ad.fluidbal_prior_to_dialysis, ad.urine_prior_to_dialysis, ad.ivf_prior_to_dialysis, ad.saps_day_of_dialysis, d.esrd, d.preadmit_ckd, d.preadmit_base_cr, case when iap.subject_id is null then 'N' else 'Y' end as first_icu_day_vasopressor, case when vc.icustay_id is null then 'N' else 'Y' end as vasopressor_first_icustay, case when mv.icustay_id is null then 'N' else 'Y' end as mech_vent_first_icustay, ds.total_saps_first_icustay, ds.num_saps_scores_first_icustay, ds.peak_saps_first_icustay, ifa.code as icd9_code_first_icustay, ifa.description as icd9_descr_first_icustay, isa.code as icd9_code_second_icustay, isa.description as icd9_descr_second_icustay, case when hdr.num_home_diuretics is null then 'N' else 'Y' end as preadmit_med_section, case when hdr.num_home_diuretics is null then null when hdr.num_home_diuretics>0 then 'Y' else 'N' end as preadmit_diuretics, er.CONGESTIVE_HEART_FAILURE, er.CARDIAC_ARRHYTHMIAS, er.VALVULAR_DISEASE, er.PULMONARY_CIRCULATION, er.PERIPHERAL_VASCULAR, er.HYPERTENSION, er.PARALYSIS, er.OTHER_NEUROLOGICAL, er.CHRONIC_PULMONARY, er.DIABETES_UNCOMPLICATED, er.DIABETES_COMPLICATED, er.HYPOTHYROIDISM, er.RENAL_FAILURE, er.LIVER_DISEASE, er.PEPTIC_ULCER, er.AIDS, er.LYMPHOMA, er.METASTATIC_CANCER, er.SOLID_TUMOR, er.RHEUMATOID_ARTHRITIS, er.COAGULOPATHY, er.OBESITY, er.WEIGHT_LOSS, er.FLUID_ELECTROLYTE, er.BLOOD_LOSS_ANEMIA, er.DEFICIENCY_ANEMIAS, er.ALCOHOL_ABUSE, er.DRUG_ABUSE, er.PSYCHOSES, er.DEPRESSION from readmissions r left join all_labs al on r.subject_id=al.subject_id left join all_weight_height awh on r.subject_id=awh.subject_id left join admit_hr_first_icustay ahf on r.subject_id=ahf.subject_id left join admit_hr_second_icustay ahs on r.subject_id=ahs.subject_id left join admit_map_first_icustay amf on r.subject_id=amf.subject_id left join admit_map_second_icustay ams on r.subject_id=ams.subject_id left join admit_bp_first_icustay abf on r.subject_id=abf.subject_id left join admit_bp_second_icustay abs on r.subject_id=abs.subject_id left join admit_temp_first_icustay atf on r.subject_id=atf.subject_id left join admit_temp_second_icustay ats on r.subject_id=ats.subject_id left join admit_o2sat_first_icustay aof on r.subject_id=aof.subject_id left join admit_o2sat_second_icustay aos on r.subject_id=aos.subject_id left join uo_first_icustay ufi on r.subject_id=ufi.subject_id left join uo_first_icustay_24h ufi24 on r.subject_id=ufi24.subject_id left join half_ns_first_icustay hnf on r.subject_id=hnf.subject_id left join quarter_ns_first_icustay qnf on r.subject_id=qnf.subject_id left join d5w_first_icustay dwf on r.subject_id=dwf.subject_id left join cryst_first_icustay crf on r.subject_id=crf.subject_id left join colloid_first_icustay cof on r.subject_id=cof.subject_id left join pointake_first_icustay pif on r.subject_id=pif.subject_id left join stool_first_icustay sf on r.subject_id=sf.subject_id left join totalin_first_icustay tif on r.subject_id=tif.subject_id left join totalout_first_icustay tof on r.subject_id=tof.subject_id left join fluidbal_first_icustay ff on r.subject_id=ff.subject_id left join icd9_first_admission ifa on r.subject_id=ifa.subject_id left join icd9_second_admission isa on r.subject_id=isa.subject_id left join mimic2devel.elixhauser_revised er on r.first_hadm_id=er.hadm_id left join all_dialysis_data ad on r.subject_id=ad.subject_id left join daily_saps ds on r.subject_id=ds.subject_id left join joonlee.vasopressor_use_cohort vc on r.first_icustay_id=vc.icustay_id left join mech_vent mv on r.first_icustay_id=mv.icustay_id left join home_diuretics hdr on r.subject_id=hdr.subject_id left join num_daily_cr_first_icustay ndc on r.subject_id=ndc.subject_id left join joonlee.dialysis_manual_review_john d on r.first_hadm_id=d.hadm_id left join icu_admit_pressors iap on r.subject_id=iap.subject_id ) select * from final_data; -- should be 23,455 rows -- extract discharge summaries of those who received dialysis (either HD or PD) in order to manually determine acute/chronic renal failure select r.first_hadm_id, n.text from JOONLEE.renal_readmission_study_cohort r join mimic2v26.noteevents n on r.first_hadm_id=n.hadm_id where (r.hd_first_hadm='Y' or r.pd_first_hadm='Y') and n.category='DISCHARGE_SUMMARY' order by r.first_hadm_id;
the_stack
; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; # Dump of table mock_mockserver # ------------------------------------------------------------ DROP TABLE IF EXISTS `mock_mockserver`; CREATE TABLE `mock_mockserver` ( `mockid` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '接口ID,自动生成', `project_id` varchar(20) NOT NULL DEFAULT '' COMMENT '关联的项目ID', `api_name` varchar(2000) NOT NULL DEFAULT '' COMMENT '接口名称', `api_url` varchar(2000) NOT NULL DEFAULT '' COMMENT '接口地址', `api_url_regexp` varchar(2000) DEFAULT NULL COMMENT '接口地址正则', `api_content` longtext NOT NULL COMMENT '接口响应数据', `api_content_desc` longtext COMMENT '接口响应数据的参数描述', `is_proxy` int(1) DEFAULT '0' COMMENT '是否开启二次代理,0为不开启,1为开启', `proxy_prefix` varchar(2000) DEFAULT NULL COMMENT '代理前缀', `api_header` longtext COMMENT '接口请求HEADER参数', `api_header_desc` longtext COMMENT '接口请求HEADER参数说明', `api_parms` longtext COMMENT '接口请求POST等表单请求参数', `api_parms_desc` longtext COMMENT '接口请求POST等表单请求参数说明', `api_type` varchar(11) DEFAULT 'get' COMMENT '接口请求类型,HTTP请求类型,GET,PUT,POST等', `api_state_code` int(11) DEFAULT '200' COMMENT '接口响应状态码,200,404等', `exact_match` int(1) DEFAULT '1' COMMENT '接口匹配类型,1为全局匹配,0为只匹配【?】前面部分', `is_mockjs` int(1) DEFAULT '0' COMMENT '接口响应数据是否使用mockjs', `api_lazy_time` int(10) DEFAULT '0' COMMENT '接口响应延迟时间,单位为毫秒,默认0', `api_querys_desc` longtext COMMENT '接口请求url中?后参数说明', `api_req_header` longtext COMMENT '接口响应HEADER参数', `api_req_header_desc` longtext COMMENT '接口响应HEADER参数说明', `swagger_url` varchar(2000) DEFAULT NULL COMMENT '接口对应的swagger 接口路径,用于在swagger tab中,显示指定接口', PRIMARY KEY (`mockid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `mock_mockserver` WRITE; /*!40000 ALTER TABLE `mock_mockserver` DISABLE KEYS */; INSERT INTO `mock_mockserver` (`mockid`, `project_id`, `api_name`, `api_url`, `api_url_regexp`, `api_content`, `api_content_desc`, `is_proxy`, `proxy_prefix`, `api_header`, `api_header_desc`, `api_parms`, `api_parms_desc`, `api_type`, `api_state_code`, `exact_match`, `is_mockjs`, `api_lazy_time`, `api_querys_desc`, `api_req_header`, `api_req_header_desc`, `swagger_url`) VALUES (85,'8a15fbb94471050bb46f','mockjs-demo-打开接口-刷新页面数据会随机变化','demo1',NULL,'{\r\n \"array|1-10\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"null\": null,\r\n \"number\": 123,\r\n \"object\": {\r\n \"a\": \"b\",\r\n \"c\": \"d\",\r\n \"e\": \"f\"\r\n },\r\n \"string\": \"Hello World\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}',1,'','{\r\n \"headere1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}','{\r\n \"username\": \"参数说明\",\r\n \"password\": \"参数说明\"\r\n}','get',200,0,1,0,'{\r\n \"query1\": \"参数说明\",\r\n \"query2\": \"参数说明\"\r\n}','{\r\n \"header1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}',NULL), (86,'8a15fbb94471050bb46f','404-code-status-demo-请求返回状态为:404','demo2',NULL,'{\r\n \"array|1-10\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"null\": null,\r\n \"number\": 123,\r\n \"object\": {\r\n \"a\": \"b\",\r\n \"c\": \"d\",\r\n \"e\": \"f\"\r\n },\r\n \"string\": \"Hello World\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}',0,'','{\r\n \"headere1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}','{\r\n \"username\": \"参数说明\",\r\n \"password\": \"参数说明\"\r\n}','get',404,0,1,0,'{\r\n \"query1\": \"参数说明\",\r\n \"query2\": \"参数说明\"\r\n}','{\r\n \"header1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}',NULL), (88,'8a15fbb94471050bb46f','dealy-3-second-demo-延迟3秒返回数据','dealy-3-second-demo',NULL,'{\r\n \"array|1-10\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"null\": null,\r\n \"number\": 123,\r\n \"object\": {\r\n \"a\": \"b\",\r\n \"c\": \"d\",\r\n \"e\": \"f\"\r\n },\r\n \"string\": \"Hello World\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}',0,'','{\r\n \"headere1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}','{\r\n \"username\": \"参数说明\",\r\n \"password\": \"参数说明\"\r\n}','get',404,0,1,3000,'{\r\n \"query1\": \"参数说明\",\r\n \"query2\": \"参数说明\"\r\n}','{\r\n \"header1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}',NULL), (89,'8a15fbb94471050bb46f','switch-to-real-data-点击关闭二次代理,将访问模拟数据,开启二次代理-访问真实服务的数据','demo/switch-to-real-data',NULL,'{\r\n \"array|1-10\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"null\": null,\r\n \"number\": 123,\r\n \"object\": {\r\n \"a\": \"b\",\r\n \"c\": \"d\",\r\n \"e\": \"f\"\r\n },\r\n \"string\": \"Hello World\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}',1,'http://127.0.0.1:8034','{\r\n \"headere1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}','{\r\n \"username\": \"参数说明\",\r\n \"password\": \"参数说明\"\r\n}','get',404,0,1,0,'{\r\n \"query1\": \"参数说明\",\r\n \"query2\": \"参数说明\"\r\n}','{\r\n \"header1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}',NULL), (98,'8a15fbb94471050bb46f','RESTful格式示例-修改 :id,:user试试,如 search/4/tom','search/:id/:name','%5Esearch%5C/((?:%5B%5E%5C/%5D+?))%5C/((?:%5B%5E%5C/%5D+?))(?:%5C/(?=$))?$','{\r\n \"array\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"null\": null,\r\n \"number\": 123,\r\n \"object\": {\r\n \"a\": \"b\",\r\n \"c\": \"d\",\r\n \"e\": \"f\"\r\n },\r\n \"string\": \"Hello World\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}',0,'','{\r\n \"headere1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}','{\r\n \"username\": \"参数说明\",\r\n \"password\": \"参数说明\"\r\n}','get',200,0,0,0,'{\r\n \"query1\": \"参数说明\",\r\n \"query2\": \"参数说明\"\r\n}','{\r\n \"header1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}',NULL), (104,'8a15fbb94471050bb46f','method为post RESTful格式示例-修改 :id,:user试试,如 search/4/tom','search/:id/:name','%5Esearch%5C/((?:%5B%5E%5C/%5D+?))%5C/((?:%5B%5E%5C/%5D+?))(?:%5C/(?=$))?$','{\r\n \"array\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"null\": null,\r\n \"number\": 123,\r\n \"object\": {\r\n \"a\": \"b\",\r\n \"c\": \"d\",\r\n \"e\": \"f\"\r\n },\r\n \"string\": \"POST\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}',1,'','{\r\n \"headere1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}','{\r\n \"username\": \"参数说明\",\r\n \"password\": \"参数说明\"\r\n}','post',200,0,0,0,'{\r\n \"query1\": \"参数说明\",\r\n \"query2\": \"参数说明\"\r\n}','{\r\n \"header1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}',NULL), (105,'8a15fbb94471050bb46f','method为 put :RESTful格式示例-修改 :id,:user试试,如 search/4/tom','search/:id/:name','%5Esearch%5C/((?:%5B%5E%5C/%5D+?))%5C/((?:%5B%5E%5C/%5D+?))(?:%5C/(?=$))?$','{\r\n \"array\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"null\": null,\r\n \"number\": 123,\r\n \"object\": {\r\n \"a\": \"b\",\r\n \"c\": \"d\",\r\n \"e\": \"f\"\r\n },\r\n \"string\": \"PUT\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}',1,'','{\r\n \"headere1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}','{\r\n \"username\": \"参数说明\",\r\n \"password\": \"参数说明\"\r\n}','put',200,0,0,0,'{\r\n \"query1\": \"参数说明\",\r\n \"query2\": \"参数说明\"\r\n}','{\r\n \"header1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}',NULL), (106,'8a15fbb94471050bb46f','method为 delete','search/:id/:name/ss','%5Esearch%5C/((?:%5B%5E%5C/%5D+?))%5C/((?:%5B%5E%5C/%5D+?))%5C/ss(?:%5C/(?=$))?$','{\r\n \"array\": [\r\n 1,\r\n 2,\r\n 3\r\n ],\r\n \"boolean\": true,\r\n \"null\": null,\r\n \"number\": 123,\r\n \"object\": {\r\n \"a\": \"b\",\r\n \"c\": \"d\",\r\n \"e\": \"f\"\r\n },\r\n \"string\": \"PUT\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}',1,'','{\r\n \"headere1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}','{\r\n \"username\": \"参数值\",\r\n \"password\": \"参数值\"\r\n}','{\r\n \"username\": \"参数说明\",\r\n \"password\": \"参数说明\"\r\n}','delete',200,0,1,0,'{\r\n \"query1\": \"参数说明\",\r\n \"query2\": \"参数说明\"\r\n}','{\r\n \"header1\": \"参数值\",\r\n \"header2\": \"参数值\"\r\n}','{\r\n \"headere1\": \"参数说明\",\r\n \"header2\": \"参数说明\"\r\n}',NULL); /*!40000 ALTER TABLE `mock_mockserver` ENABLE KEYS */; UNLOCK TABLES; # Dump of table mock_project # ------------------------------------------------------------ DROP TABLE IF EXISTS `mock_project`; CREATE TABLE `mock_project` ( `project_id` varchar(20) NOT NULL DEFAULT '', `project_name` varchar(2000) NOT NULL DEFAULT '', `project_prefix` varchar(200) DEFAULT '/', `proxy_url` varchar(2000) DEFAULT '', `open_proxy` int(1) NOT NULL DEFAULT '1', `swagger_url` varchar(2000) DEFAULT NULL COMMENT 'swagger获取接口信息路径', PRIMARY KEY (`project_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `mock_project` WRITE; /*!40000 ALTER TABLE `mock_project` DISABLE KEYS */; INSERT INTO `mock_project` (`project_id`, `project_name`, `project_prefix`, `proxy_url`, `open_proxy`, `swagger_url`) VALUES ('8a15fbb94471050bb46f','demo','/','http://192.168.1.2/',1,''); /*!40000 ALTER TABLE `mock_project` ENABLE KEYS */; UNLOCK TABLES; # Dump of table mock_swagger # ------------------------------------------------------------ DROP TABLE IF EXISTS `mock_swagger`; CREATE TABLE `mock_swagger` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `header_name` varchar(2000) DEFAULT NULL COMMENT '需要在请求中添中的header字段名,如cookie', `header_val` varchar(2000) DEFAULT NULL COMMENT '需要在请求中添中的header字段值', `type` int(2) DEFAULT NULL COMMENT 'swagger类型,1为全局,2为单个', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `mock_swagger` WRITE; /*!40000 ALTER TABLE `mock_swagger` DISABLE KEYS */; INSERT INTO `mock_swagger` (`id`, `header_name`, `header_val`, `type`) VALUES (1,'cookie','ggg',1), (2,'cookie','ggg',1); /*!40000 ALTER TABLE `mock_swagger` ENABLE KEYS */; UNLOCK TABLES; # Dump of table mock_system # ------------------------------------------------------------ DROP TABLE IF EXISTS `mock_system`; CREATE TABLE `mock_system` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `proxy_url` varchar(200) DEFAULT '', `headers_white_list` varchar(2000) DEFAULT '', `headers_black_list` varchar(2000) DEFAULT 'host\r\naccept-encoding', `headers_proxy_state` tinyint(2) DEFAULT '0', `language_type` varchar(100) DEFAULT 'cn' COMMENT 'language type:cn|en', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOCK TABLES `mock_system` WRITE; /*!40000 ALTER TABLE `mock_system` DISABLE KEYS */; INSERT INTO `mock_system` (`id`, `proxy_url`, `headers_white_list`, `headers_black_list`, `headers_proxy_state`, `language_type`) VALUES (4,'http://47.93.62.181:8034/','cookie','accept-encoding\r\nhost',0,'cn'); /*!40000 ALTER TABLE `mock_system` ENABLE KEYS */; UNLOCK TABLES; # Dump of table mock_template # ------------------------------------------------------------ DROP TABLE IF EXISTS `mock_template`; CREATE TABLE `mock_template` ( `template_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `template_name` varchar(2000) NOT NULL DEFAULT '', PRIMARY KEY (`template_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
the_stack
CREATE OR REPLACE FUNCTION db4ai.create_snapshot_internal( IN s_id BIGINT, -- snapshot id IN i_schema NAME, -- snapshot namespace IN i_name NAME, -- snapshot name IN i_commands TEXT[], -- commands defining snapshot data and layout IN i_comment TEXT, -- snapshot description IN i_owner NAME -- snapshot owner ) RETURNS VOID LANGUAGE plpgsql SECURITY DEFINER SET search_path = pg_catalog, pg_temp AS $$ DECLARE e_stack_act TEXT; -- current stack for validation dist_cmd TEXT; -- DISTRIBUTE BY translation for backing table row_count BIGINT; -- number of rows in this snapshot BEGIN BEGIN RAISE EXCEPTION 'SECURITY_STACK_CHECK'; EXCEPTION WHEN OTHERS THEN GET STACKED DIAGNOSTICS e_stack_act = PG_EXCEPTION_CONTEXT; IF CURRENT_SCHEMA = 'db4ai' THEN e_stack_act := replace(e_stack_act, 'ion cre', 'ion db4ai.cre'); END IF; IF e_stack_act NOT LIKE E'referenced column: create_snapshot_internal\n' 'SQL statement "SELECT db4ai.create_snapshot_internal(s_id, i_schema, i_name, i_commands, i_comment, CURRENT_USER)"\n' 'PL/pgSQL function db4ai.create_snapshot(name,name,text[],name,text) line 269 at PERFORM%' THEN RAISE EXCEPTION 'direct call to db4ai.create_snapshot_internal(bigint,name,name,text[],text,name) is not allowed' USING HINT = 'call public interface db4ai.create_snapshot instead'; END IF; END; IF length(i_commands[3]) > 0 THEN <<translate_dist_by_hash>> DECLARE pattern TEXT; -- current user column name mapping NAME[]; -- mapping user column names to internal backing columns quoted BOOLEAN := FALSE; -- inside quoted identifier cur_ch VARCHAR; -- current character in tokenizer idx INTEGER := 0; -- loop counter, cannot use FOR .. iterator tokens TEXT; -- user's column name list in DISTRIBUTE BY HASH() BEGIN -- extract mapping from projection list for view definition mapping := array(SELECT unnest(ARRAY[ m[1], coalesce(m[2], replace(m[3],'""','"'))]) FROM regexp_matches( i_commands[5], 't[0-9]+\.(f[0-9]+) AS (?:([^\s",]+)|"((?:[^"]*"")*[^"]*)")', 'g') m); -- extract field list from DISTRIBUTE BY clause tokens :=(regexp_matches(i_commands[3], '^\s*DISTRIBUTE\s+BY\s+HASH\s*\((.*)\)\s*$', 'i'))[1]; IF tokens IS NULL OR tokens SIMILAR TO '\s*' THEN tokens := (regexp_matches(i_commands[3], '^\s*DISTRIBUTE\s+BY\s+REPLICATION\s*$', 'i'))[1]; IF tokens IS NULL OR tokens SIMILAR TO '\s*' THEN RAISE EXCEPTION 'cannot match DISTRIBUTE BY clause' USING HINT = 'currently only DISTRIBUTE BY REPLICATION and DISTRIBUTE BY HASH(column_name [, ...]) supported'; END IF; -- no translation required, bail out dist_cmd := ' ' || i_commands[3]; EXIT translate_dist_by_hash; END IF; tokens := tokens || ' '; -- prepare the translated command dist_cmd = ' DISTRIBUTE BY HASH('; -- BEGIN tokenizer code for testing pattern := ''; LOOP idx := idx + 1; cur_ch := substr(tokens, idx, 1); EXIT WHEN cur_ch IS NULL OR cur_ch = ''; CASE cur_ch WHEN '"' THEN IF quoted AND substr(tokens, idx + 1, 1) = '"' THEN pattern := pattern || '"'; idx := idx + 1; ELSE quoted := NOT quoted; END IF; IF quoted THEN CONTINUE; END IF; WHEN ',' THEN IF quoted THEN pattern := pattern || cur_ch; CONTINUE; ELSIF pattern IS NULL OR length(pattern) = 0 THEN pattern := ','; ELSE idx := idx - 1; -- reset on comma for next loop END IF; WHEN ' ', E'\n', E'\t' THEN IF quoted THEN pattern := pattern || cur_ch; CONTINUE; ELSIF pattern IS NULL OR length(pattern) = 0 THEN CONTINUE; END IF; ELSE pattern := pattern || CASE WHEN quoted THEN cur_ch ELSE lower(cur_ch) END; CONTINUE; END CASE; -- END tokenizer code for testing -- attempt to map the pattern FOR idx IN 2 .. array_length(mapping, 1) BY 2 LOOP IF pattern = mapping[idx] THEN -- apply the mapping dist_cmd := dist_cmd || mapping[idx-1] || ','; pattern := NULL; EXIT; END IF; END LOOP; -- check if pattern was mapped IF pattern IS NOT NULL THEN RAISE EXCEPTION 'unable to map field "%" to backing table', pattern; END IF; END LOOP; IF quoted THEN RAISE EXCEPTION 'unterminated quoted identifier ''%'' at or near: ''%''', substr(pattern, 1, char_length(pattern)-1), i_commands[3]; END IF; dist_cmd := rtrim(dist_cmd, ',') || ')'; END; END IF; dist_cmd := ''; -- we silently drop DISTRIBUTE_BY EXECUTE 'CREATE TABLE db4ai.t' || s_id || ' WITH (orientation = column, compression = low)' || dist_cmd || ' AS SELECT ' || i_commands[4] || ' FROM _db4ai_tmp_x' || s_id; EXECUTE 'COMMENT ON TABLE db4ai.t' || s_id || ' IS ''snapshot backing table, root is ' || quote_ident(i_schema) || '.' || quote_ident(i_name) || ''''; EXECUTE 'CREATE VIEW db4ai.v' || s_id || ' WITH(security_barrier) AS SELECT ' || i_commands[5] || ', xc_node_id, ctid FROM db4ai.t' || s_id; EXECUTE 'COMMENT ON VIEW db4ai.v' || s_id || ' IS ''snapshot ' || quote_ident(i_schema) || '.' || quote_ident(i_name) || ' backed by db4ai.t' || s_id || CASE WHEN length(i_comment) > 0 THEN ' comment is "' || i_comment || '"' ELSE '' END || ''''; EXECUTE 'GRANT SELECT ON db4ai.v' || s_id || ' TO ' || i_owner || ' WITH GRANT OPTION'; EXECUTE 'SELECT COUNT(*) FROM db4ai.v' || s_id INTO STRICT row_count; -- store only original commands supplied by user i_commands := ARRAY[i_commands[1], i_commands[2], i_commands[3]]; INSERT INTO db4ai.snapshot (id, root_id, schema, name, owner, commands, comment, published, row_count) VALUES (s_id, s_id, i_schema, i_name, i_owner, i_commands, i_comment, TRUE, row_count); END; $$; CREATE OR REPLACE FUNCTION db4ai.create_snapshot( IN i_schema NAME, -- snapshot namespace, default is CURRENT_USER or PUBLIC IN i_name NAME, -- snapshot name IN i_commands TEXT[], -- commands defining snapshot data and layout IN i_vers NAME DEFAULT NULL, -- override version postfix IN i_comment TEXT DEFAULT NULL -- snapshot description ) RETURNS db4ai.snapshot_name LANGUAGE plpgsql SECURITY INVOKER SET client_min_messages TO ERROR AS $$ DECLARE s_id BIGINT; -- snapshot id s_mode VARCHAR(3); -- current snapshot mode s_vers_del CHAR; -- snapshot version delimiter, default '@' s_vers_sep CHAR; -- snapshot version separator, default '.' separation_of_powers TEXT; --current separation of rights qual_name TEXT; -- qualified snapshot name command_str TEXT; -- command string pattern TEXT; -- command pattern for matching proj_cmd TEXT; -- SELECT clause for create user view command (may be NULL if from_cmd is not NULL) from_cmd TEXT; -- FROM clause for command (may be NULL if proj_cmd is not NULL) dist_cmd TEXT; -- DISTRIBUTE BY clause for command (may be NULL) res db4ai.snapshot_name; -- composite result BEGIN -- obtain active message level BEGIN EXECUTE 'SET LOCAL client_min_messages TO ' || current_setting('db4ai.message_level'); RAISE INFO 'effective client_min_messages is ''%''', upper(current_setting('db4ai.message_level')); EXCEPTION WHEN OTHERS THEN END; -- obtain database state of separation of rights BEGIN separation_of_powers := upper(current_setting('enableSeparationOfDuty')); EXCEPTION WHEN OTHERS THEN separation_of_powers := 'OFF'; END; IF separation_of_powers NOT IN ('ON', 'OFF') THEN RAISE EXCEPTION 'Uncertain state of separation of rights.'; ELSIF separation_of_powers = 'ON' THEN RAISE EXCEPTION 'Snapshot is not supported in separation of rights'; END IF; -- obtain active snapshot mode BEGIN s_mode := upper(current_setting('db4ai_snapshot_mode')); EXCEPTION WHEN OTHERS THEN s_mode := 'MSS'; END; IF s_mode NOT IN ('CSS', 'MSS') THEN RAISE EXCEPTION 'invalid snapshot mode: ''%''', s_mode; END IF; -- obtain relevant configuration parameters BEGIN s_vers_del := current_setting('db4ai_snapshot_version_delimiter'); EXCEPTION WHEN OTHERS THEN s_vers_del := '@'; END; BEGIN s_vers_sep := current_setting('db4ai_snapshot_version_separator'); EXCEPTION WHEN OTHERS THEN s_vers_sep := '.'; END; -- check all input parameters IF i_schema IS NULL OR i_schema = '' THEN i_schema := CASE WHEN (SELECT 0=COUNT(*) FROM pg_catalog.pg_namespace WHERE nspname = CURRENT_USER) THEN 'public' ELSE CURRENT_USER END; END IF; IF i_name IS NULL OR i_name = '' THEN RAISE EXCEPTION 'i_name cannot be NULL or empty'; ELSIF strpos(i_name, s_vers_del) > 0 THEN RAISE EXCEPTION 'i_name must not contain ''%'' characters', s_vers_del; END IF; -- PG BUG: array_ndims('{}') or array_dims(ARRAY[]::INT[]) returns NULL IF i_commands IS NULL OR array_length(i_commands, 1) IS NULL OR array_length(i_commands, 2) IS NOT NULL THEN RAISE EXCEPTION 'i_commands array malformed' USING HINT = 'pass SQL commands as TEXT[] literal, e.g. ''{SELECT *, FROM public.t, DISTRIBUTE BY HASH(id)'''; END IF; FOREACH command_str IN ARRAY i_commands LOOP IF command_str IS NULL THEN RAISE EXCEPTION 'i_commands array contains NULL values'; END IF; END LOOP; FOREACH command_str IN ARRAY i_commands LOOP command_str := btrim(command_str); pattern := upper(regexp_replace(left(command_str, 30), '\s+', ' ', 'g')); IF left(pattern, 7) = 'SELECT ' THEN IF proj_cmd IS NULL THEN proj_cmd := command_str; DECLARE nested INT := 0; -- level of nesting quoted BOOLEAN := FALSE; -- inside quoted identifier cur_ch VARCHAR; -- current character in tokenizer idx INTEGER := 0; -- loop counter, cannot use FOR .. iterator start INTEGER := 1; stmt TEXT := command_str; BEGIN -- BEGIN splitter code for testing pattern := ''; LOOP idx := idx + 1; cur_ch := substr(stmt, idx, 1); EXIT WHEN cur_ch IS NULL OR cur_ch = ''; CASE cur_ch WHEN '"' THEN IF quoted AND substr(stmt, idx + 1, 1) = '"' THEN idx := idx + 1; ELSE quoted := NOT quoted; END IF; IF quoted THEN CONTINUE; END IF; WHEN '(' THEN nested := nested + 1; CONTINUE; WHEN ')' THEN nested := nested - 1; IF nested < 0 THEN RAISE EXCEPTION 'syntax error at or near '')'' in ''%'' at position ''%''', stmt, idx; END IF; CONTINUE; WHEN ' ' THEN IF quoted OR nested > 0 THEN CONTINUE; ELSIF pattern IS NULL OR length(pattern) = 0 THEN start := idx; CONTINUE; END IF; WHEN ';' THEN RAISE EXCEPTION 'syntax error at or near '';'' in ''%'' at position ''%''', stmt, idx; CONTINUE; ELSE pattern := pattern || upper(cur_ch); CONTINUE; END CASE; -- END splitter code for testing IF pattern = 'FROM' THEN from_cmd := substr(stmt, start + 1); proj_cmd := left(stmt, start - 1); stmt := from_cmd; nested := 0; quoted := FALSE; idx := idx - start; start := 1; RAISE NOTICE E'SELECT SPLITTING1\n%\n%\n%', stmt, proj_cmd, from_cmd; ELSIF pattern = 'DISTRIBUTE' THEN RAISE NOTICE E'SELECT SPLITTING2\n%\n%\n%', stmt, proj_cmd, from_cmd; CONTINUE; ELSIF pattern = 'DISTRIBUTEBY' THEN dist_cmd := substr(stmt, start + 1); from_cmd := left(stmt, start - 1); RAISE NOTICE E'SELECT SPLITTING3\n%\n%\n%\n%', stmt, proj_cmd, from_cmd, dist_cmd; EXIT; END IF; pattern := ''; start := idx; END LOOP; END; ELSE RAISE EXCEPTION 'multiple SELECT clauses in i_commands: ''%'' ''%''', proj_cmd, command_str; END IF; ELSIF left(pattern, 5) = 'FROM ' THEN IF from_cmd IS NULL THEN from_cmd := command_str; ELSE RAISE EXCEPTION 'multiple FROM clauses in i_commands: ''%'' ''%''', from_cmd, command_str; END IF; ELSIF left(pattern, 14) = 'DISTRIBUTE BY ' THEN IF dist_cmd IS NULL THEN dist_cmd := command_str; ELSE RAISE EXCEPTION 'multiple DISTRIBUTE BY clauses in i_commands: ''%'' ''%''', dist_cmd, command_str; END IF; ELSE RAISE EXCEPTION 'unrecognized command in i_commands: ''%''', command_str; END IF; END LOOP; IF proj_cmd IS NULL THEN -- minimum required input IF from_cmd IS NULL THEN RAISE EXCEPTION 'SELECT and FROM clauses are missing in i_commands'; END IF; -- supply default projection proj_cmd := 'SELECT *'; ELSE IF from_cmd IS NULL AND strpos(upper(proj_cmd), 'FROM ') = 0 THEN RAISE EXCEPTION 'FROM clause is missing in i_commands'; END IF; END IF; IF dist_cmd IS NULL THEN dist_cmd := ''; END IF; IF i_vers IS NULL OR i_vers = '' THEN i_vers := s_vers_del || '1' || s_vers_sep || '0' || s_vers_sep || '0'; ELSE i_vers := replace(i_vers, chr(2), s_vers_sep); IF LEFT(i_vers, 1) <> s_vers_del THEN i_vers := s_vers_del || i_vers; ELSIF char_length(i_vers ) < 2 THEN RAISE EXCEPTION 'illegal i_vers: ''%''', s_vers_del; END IF; IF strpos(substr(i_vers, 2), s_vers_del) > 0 THEN RAISE EXCEPTION 'i_vers may contain only one single, leading ''%'' character', s_vers_del USING HINT = 'specify snapshot version as [' || s_vers_del || ']x' || s_vers_sep || 'y' || s_vers_sep || 'z or [' || s_vers_del || ']label with optional, leading ''' || s_vers_del || ''''; END IF; END IF; IF char_length(i_name || i_vers) > 63 THEN RAISE EXCEPTION 'snapshot name too long: ''%''', i_name || i_vers; ELSE i_name := i_name || i_vers; END IF; -- the final name of the snapshot qual_name := quote_ident(i_schema) || '.' || quote_ident(i_name); -- check for duplicate snapshot IF 0 < (SELECT COUNT(*) FROM db4ai.snapshot WHERE schema = i_schema AND name = i_name) THEN RAISE EXCEPTION 'snapshot % already exists' , qual_name; END IF; --SELECT nextval('db4ai.snapshot_sequence') INTO STRICT s_id; SELECT COALESCE(MAX(id)+1,0) FROM db4ai.snapshot INTO STRICT s_id; -- openGauss BUG: cannot create sequences in initdb -- execute using current user privileges DECLARE e_message TEXT; -- exception message BEGIN EXECUTE 'CREATE TEMPORARY TABLE _db4ai_tmp_x' || s_id || ' AS ' || proj_cmd || CASE WHEN from_cmd IS NULL THEN '' ELSE ' ' || from_cmd END; EXCEPTION WHEN undefined_table THEN GET STACKED DIAGNOSTICS e_message = MESSAGE_TEXT; -- during function invocation, search path is redirected to {pg_temp, pg_catalog, function_schema} and becomes immutable RAISE INFO 'could not resolve relation % using system-defined "search_path" setting during function invocation: ''%''', substr(e_message, 10, 1 + strpos(substr(e_message,11), '" does not exist')), array_to_string(current_schemas(TRUE),', ') USING HINT = 'snapshots require schema-qualified table references, e.g. schema_name.table_name'; RAISE; END; -- extract normalized projection list i_commands := ARRAY[proj_cmd, from_cmd, dist_cmd, '', '']; SELECT string_agg(ident, ', '), string_agg(ident || ' AS f' || ordinal_position, ', '), string_agg('t' || s_id || '.f' || ordinal_position || ' AS ' || ident, ', ') FROM ( SELECT ordinal_position, quote_ident(column_name) AS ident FROM information_schema.columns WHERE table_schema = (SELECT nspname FROM pg_namespace WHERE oid=pg_my_temp_schema()) AND table_name = '_db4ai_tmp_x' || s_id ORDER BY ordinal_position ) INTO STRICT proj_cmd, i_commands[4], i_commands[5]; IF proj_cmd IS NULL THEN RAISE EXCEPTION 'create snapshot internal error1: %', s_id; END IF; -- finalize the snapshot using elevated privileges PERFORM db4ai.create_snapshot_internal(s_id, i_schema, i_name, i_commands, i_comment, CURRENT_USER); -- drop temporary view used for privilege transfer EXECUTE 'DROP TABLE _db4ai_tmp_x' || s_id; -- create custom view, owned by current user EXECUTE 'CREATE VIEW ' || qual_name || ' WITH(security_barrier) AS SELECT ' || proj_cmd || ' FROM db4ai.v' || s_id; EXECUTE 'COMMENT ON VIEW ' || qual_name || ' IS ''snapshot view backed by db4ai.v' || s_id || CASE WHEN length(i_comment) > 0 THEN ' comment is "' || i_comment || '"' ELSE '' END || ''''; EXECUTE 'ALTER VIEW ' || qual_name || ' OWNER TO ' || CURRENT_USER; -- return final snapshot name res := ROW(i_schema, i_name); -- PG BUG: PG 9.2 cannot return composite type, only a reference to a variable of composite type return res; END; $$; COMMENT ON FUNCTION db4ai.create_snapshot() IS 'Create a new snapshot';
the_stack
-- -- Test citext datatype -- CREATE EXTENSION citext; -- Test the operators and indexing functions -- Test = and <>. SELECT 'a'::citext = 'a'::citext AS t; SELECT 'a'::citext = 'A'::citext AS t; SELECT 'a'::citext = 'A'::text AS f; -- text wins the discussion SELECT 'a'::citext = 'b'::citext AS f; SELECT 'a'::citext = 'ab'::citext AS f; SELECT 'a'::citext <> 'ab'::citext AS t; -- Multibyte sanity tests. Uncomment to run. -- SELECT 'À'::citext = 'À'::citext AS t; -- SELECT 'À'::citext = 'à'::citext AS t; -- SELECT 'À'::text = 'à'::text AS f; -- text wins. -- SELECT 'À'::citext <> 'B'::citext AS t; -- Test combining characters making up canonically equivalent strings. -- SELECT 'Ä'::text <> 'Ä'::text AS t; -- SELECT 'Ä'::citext <> 'Ä'::citext AS t; -- Test the Turkish dotted I. The lowercase is a single byte while the -- uppercase is multibyte. This is why the comparison code can't be optimized -- to compare string lengths. -- SELECT 'i'::citext = 'İ'::citext AS t; -- Regression. -- SELECT 'láska'::citext <> 'laská'::citext AS t; -- SELECT 'Ask Bjørn Hansen'::citext = 'Ask Bjørn Hansen'::citext AS t; -- SELECT 'Ask Bjørn Hansen'::citext = 'ASK BJØRN HANSEN'::citext AS t; -- SELECT 'Ask Bjørn Hansen'::citext <> 'Ask Bjorn Hansen'::citext AS t; -- SELECT 'Ask Bjørn Hansen'::citext <> 'ASK BJORN HANSEN'::citext AS t; -- SELECT citext_cmp('Ask Bjørn Hansen'::citext, 'Ask Bjørn Hansen'::citext) AS zero; -- SELECT citext_cmp('Ask Bjørn Hansen'::citext, 'ask bjørn hansen'::citext) AS zero; -- SELECT citext_cmp('Ask Bjørn Hansen'::citext, 'ASK BJØRN HANSEN'::citext) AS zero; -- SELECT citext_cmp('Ask Bjørn Hansen'::citext, 'Ask Bjorn Hansen'::citext) AS positive; -- SELECT citext_cmp('Ask Bjorn Hansen'::citext, 'Ask Bjørn Hansen'::citext) AS negative; -- Test > and >= SELECT 'B'::citext > 'a'::citext AS t; SELECT 'b'::citext > 'A'::citext AS t; SELECT 'B'::citext > 'b'::citext AS f; SELECT 'B'::citext >= 'b'::citext AS t; -- Test < and <= SELECT 'a'::citext < 'B'::citext AS t; SELECT 'a'::citext <= 'B'::citext AS t; -- Test implicit casting. citext casts to text, but not vice-versa. SELECT 'a'::citext = 'a'::text AS t; SELECT 'A'::text <> 'a'::citext AS t; SELECT 'B'::citext < 'a'::text AS t; -- text wins. SELECT 'B'::citext <= 'a'::text AS t; -- text wins. SELECT 'a'::citext > 'B'::text AS t; -- text wins. SELECT 'a'::citext >= 'B'::text AS t; -- text wins. -- Test implicit casting. citext casts to varchar, but not vice-versa. SELECT 'a'::citext = 'a'::varchar AS t; SELECT 'A'::varchar <> 'a'::citext AS t; SELECT 'B'::citext < 'a'::varchar AS t; -- varchar wins. SELECT 'B'::citext <= 'a'::varchar AS t; -- varchar wins. SELECT 'a'::citext > 'B'::varchar AS t; -- varchar wins. SELECT 'a'::citext >= 'B'::varchar AS t; -- varchar wins. -- A couple of longer examlpes to ensure that we don't get any issues with bad -- conversions to char[] in the c code. Yes, I did do this. SELECT 'aardvark'::citext = 'aardvark'::citext AS t; SELECT 'aardvark'::citext = 'aardVark'::citext AS t; -- Check the citext_cmp() function explicitly. SELECT citext_cmp('aardvark'::citext, 'aardvark'::citext) AS zero; SELECT citext_cmp('aardvark'::citext, 'aardVark'::citext) AS zero; SELECT citext_cmp('AARDVARK'::citext, 'AARDVARK'::citext) AS zero; SELECT citext_cmp('B'::citext, 'a'::citext) > 0 AS true; -- Do some tests using a table and index. CREATE TEMP TABLE try ( name citext PRIMARY KEY ); INSERT INTO try (name) VALUES ('a'), ('ab'), ('â'), ('aba'), ('b'), ('ba'), ('bab'), ('AZ'); SELECT name, 'a' = name AS eq_a FROM try WHERE name <> 'â'; SELECT name, 'a' = name AS t FROM try where name = 'a'; SELECT name, 'A' = name AS "eq_A" FROM try WHERE name <> 'â'; SELECT name, 'A' = name AS t FROM try where name = 'A'; SELECT name, 'A' = name AS t FROM try where name = 'A'; -- expected failures on duplicate key INSERT INTO try (name) VALUES ('a'); INSERT INTO try (name) VALUES ('A'); INSERT INTO try (name) VALUES ('aB'); -- Make sure that citext_smaller() and citext_lager() work properly. SELECT citext_smaller( 'aa'::citext, 'ab'::citext ) = 'aa' AS t; SELECT citext_smaller( 'AAAA'::citext, 'bbbb'::citext ) = 'AAAA' AS t; SELECT citext_smaller( 'aardvark'::citext, 'Aaba'::citext ) = 'Aaba' AS t; SELECT citext_smaller( 'aardvark'::citext, 'AARDVARK'::citext ) = 'AARDVARK' AS t; SELECT citext_larger( 'aa'::citext, 'ab'::citext ) = 'ab' AS t; SELECT citext_larger( 'AAAA'::citext, 'bbbb'::citext ) = 'bbbb' AS t; SELECT citext_larger( 'aardvark'::citext, 'Aaba'::citext ) = 'aardvark' AS t; -- Test aggregate functions and sort ordering CREATE TEMP TABLE srt ( name CITEXT ); INSERT INTO srt (name) VALUES ('aardvark'), ('AAA'), ('aba'), ('ABC'), ('abd'); CREATE INDEX srt_name ON srt (name); -- Check the min() and max() aggregates, with and without index. set enable_seqscan = off; SELECT MIN(name) AS "AAA" FROM srt; SELECT MAX(name) AS abd FROM srt; reset enable_seqscan; set enable_indexscan = off; SELECT MIN(name) AS "AAA" FROM srt; SELECT MAX(name) AS abd FROM srt; reset enable_indexscan; -- Check sorting likewise set enable_seqscan = off; SELECT name FROM srt ORDER BY name; reset enable_seqscan; set enable_indexscan = off; SELECT name FROM srt ORDER BY name; reset enable_indexscan; -- Test assignment casts. SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::text; SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::varchar; SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::bpchar; SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'; SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::citext; -- LIKE should be case-insensitive SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name; SELECT name FROM srt WHERE name NOT LIKE '%b%' ORDER BY name; SELECT name FROM srt WHERE name LIKE '%A%' ORDER BY name; SELECT name FROM srt WHERE name NOT LIKE '%B%' ORDER BY name; -- ~~ should be case-insensitive SELECT name FROM srt WHERE name ~~ '%a%' ORDER BY name; SELECT name FROM srt WHERE name !~~ '%b%' ORDER BY name; SELECT name FROM srt WHERE name ~~ '%A%' ORDER BY name; SELECT name FROM srt WHERE name !~~ '%B%' ORDER BY name; -- ~ should be case-insensitive SELECT name FROM srt WHERE name ~ '^a' ORDER BY name; SELECT name FROM srt WHERE name !~ 'a$' ORDER BY name; SELECT name FROM srt WHERE name ~ '^A' ORDER BY name; SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name; -- SIMILAR TO should be case-insensitive. SELECT name FROM srt WHERE name SIMILAR TO '%a.*'; SELECT name FROM srt WHERE name SIMILAR TO '%A.*'; -- Explicit casts. SELECT true::citext = 'true' AS t; SELECT 'true'::citext::boolean = true AS t; SELECT 4::citext = '4' AS t; SELECT 4::int4::citext = '4' AS t; SELECT '4'::citext::int4 = 4 AS t; SELECT 4::integer::citext = '4' AS t; SELECT '4'::citext::integer = 4 AS t; SELECT 4::int8::citext = '4' AS t; SELECT '4'::citext::int8 = 4 AS t; SELECT 4::bigint::citext = '4' AS t; SELECT '4'::citext::bigint = 4 AS t; SELECT 4::int2::citext = '4' AS t; SELECT '4'::citext::int2 = 4 AS t; SELECT 4::smallint::citext = '4' AS t; SELECT '4'::citext::smallint = 4 AS t; SELECT 4.0::numeric = '4.0' AS t; SELECT '4.0'::citext::numeric = 4.0 AS t; SELECT 4.0::decimal = '4.0' AS t; SELECT '4.0'::citext::decimal = 4.0 AS t; SELECT 4.0::real = '4.0' AS t; SELECT '4.0'::citext::real = 4.0 AS t; SELECT 4.0::float4 = '4.0' AS t; SELECT '4.0'::citext::float4 = 4.0 AS t; SELECT 4.0::double precision = '4.0' AS t; SELECT '4.0'::citext::double precision = 4.0 AS t; SELECT 4.0::float8 = '4.0' AS t; SELECT '4.0'::citext::float8 = 4.0 AS t; SELECT 'foo'::name::citext = 'foo' AS t; SELECT 'foo'::citext::name = 'foo'::name AS t; SELECT 'f'::char::citext = 'f' AS t; SELECT 'f'::citext::char = 'f'::char AS t; SELECT 'f'::"char"::citext = 'f' AS t; SELECT 'f'::citext::"char" = 'f'::"char" AS t; SELECT '100'::money::citext = '$100.00' AS t; SELECT '100'::citext::money = '100'::money AS t; SELECT 'a'::char::citext = 'a' AS t; SELECT 'a'::citext::char = 'a'::char AS t; SELECT 'foo'::varchar::citext = 'foo' AS t; SELECT 'foo'::citext::varchar = 'foo'::varchar AS t; SELECT 'foo'::text::citext = 'foo' AS t; SELECT 'foo'::citext::text = 'foo'::text AS t; SELECT '192.168.100.128/25'::cidr::citext = '192.168.100.128/25' AS t; SELECT '192.168.100.128/25'::citext::cidr = '192.168.100.128/25'::cidr AS t; SELECT '192.168.100.128'::inet::citext = '192.168.100.128/32' AS t; SELECT '192.168.100.128'::citext::inet = '192.168.100.128'::inet AS t; SELECT '08:00:2b:01:02:03'::macaddr::citext = '08:00:2b:01:02:03' AS t; SELECT '08:00:2b:01:02:03'::citext::macaddr = '08:00:2b:01:02:03'::macaddr AS t; SELECT '1999-01-08 04:05:06'::timestamp::citext = '1999-01-08 04:05:06'::timestamp::text AS t; SELECT '1999-01-08 04:05:06'::citext::timestamp = '1999-01-08 04:05:06'::timestamp AS t; SELECT '1999-01-08 04:05:06'::timestamptz::citext = '1999-01-08 04:05:06'::timestamptz::text AS t; SELECT '1999-01-08 04:05:06'::citext::timestamptz = '1999-01-08 04:05:06'::timestamptz AS t; SELECT '1 hour'::interval::citext = '1 hour'::interval::text AS t; SELECT '1 hour'::citext::interval = '1 hour'::interval AS t; SELECT '1999-01-08'::date::citext = '1999-01-08'::date::text AS t; SELECT '1999-01-08'::citext::date = '1999-01-08'::date AS t; SELECT '04:05:06'::time::citext = '04:05:06' AS t; SELECT '04:05:06'::citext::time = '04:05:06'::time AS t; SELECT '04:05:06'::timetz::citext = '04:05:06'::timetz::text AS t; SELECT '04:05:06'::citext::timetz = '04:05:06'::timetz AS t; SELECT '( 1 , 1)'::point::citext = '(1,1)' AS t; SELECT '( 1 , 1)'::citext::point ~= '(1,1)'::point AS t; SELECT '( 1 , 1 ) , ( 2 , 2 )'::lseg::citext = '[(1,1),(2,2)]' AS t; SELECT '( 1 , 1 ) , ( 2 , 2 )'::citext::lseg = '[(1,1),(2,2)]'::lseg AS t; SELECT '( 0 , 0 ) , ( 1 , 1 )'::box::citext = '(0,0),(1,1)'::box::text AS t; SELECT '( 0 , 0 ) , ( 1 , 1 )'::citext::box ~= '(0,0),(1,1)'::text::box AS t; SELECT '((0,0),(1,1),(2,0))'::path::citext = '((0,0),(1,1),(2,0))' AS t; SELECT '((0,0),(1,1),(2,0))'::citext::path = '((0,0),(1,1),(2,0))'::path AS t; SELECT '((0,0),(1,1))'::polygon::citext = '((0,0),(1,1))' AS t; SELECT '((0,0),(1,1))'::citext::polygon ~= '((0,0),(1,1))'::polygon AS t; SELECT '((0,0),2)'::circle::citext = '((0,0),2)'::circle::text AS t; SELECT '((0,0),2)'::citext::circle ~= '((0,0),2)'::text::circle AS t; SELECT '101'::bit::citext = '101'::bit::text AS t; SELECT '101'::citext::bit = '101'::text::bit AS t; SELECT '101'::bit varying::citext = '101'::bit varying::text AS t; SELECT '101'::citext::bit varying = '101'::text::bit varying AS t; SELECT 'a fat cat'::tsvector::citext = '''a'' ''cat'' ''fat''' AS t; SELECT 'a fat cat'::citext::tsvector = 'a fat cat'::tsvector AS t; SELECT 'fat & rat'::tsquery::citext = '''fat'' & ''rat''' AS t; SELECT 'fat & rat'::citext::tsquery = 'fat & rat'::tsquery AS t; SELECT 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid::citext = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11' AS t; SELECT 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::citext::uuid = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid AS t; CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy'); SELECT 'sad'::mood::citext = 'sad' AS t; SELECT 'sad'::citext::mood = 'sad'::mood AS t; -- Assignment casts. CREATE TABLE caster ( citext citext, text text, varchar varchar, bpchar bpchar, char char, chr "char", name name, bytea bytea, boolean boolean, float4 float4, float8 float8, numeric numeric, int8 int8, int4 int4, int2 int2, cidr cidr, inet inet, macaddr macaddr, money money, timestamp timestamp, timestamptz timestamptz, interval interval, date date, time time, timetz timetz, point point, lseg lseg, box box, path path, polygon polygon, circle circle, bit bit, bitv bit varying, tsvector tsvector, tsquery tsquery, uuid uuid ); INSERT INTO caster (text) VALUES ('foo'::citext); INSERT INTO caster (citext) VALUES ('foo'::text); INSERT INTO caster (varchar) VALUES ('foo'::text); INSERT INTO caster (text) VALUES ('foo'::varchar); INSERT INTO caster (varchar) VALUES ('foo'::citext); INSERT INTO caster (citext) VALUES ('foo'::varchar); INSERT INTO caster (bpchar) VALUES ('foo'::text); INSERT INTO caster (text) VALUES ('foo'::bpchar); INSERT INTO caster (bpchar) VALUES ('foo'::citext); INSERT INTO caster (citext) VALUES ('foo'::bpchar); INSERT INTO caster (char) VALUES ('f'::text); INSERT INTO caster (text) VALUES ('f'::char); INSERT INTO caster (char) VALUES ('f'::citext); INSERT INTO caster (citext) VALUES ('f'::char); INSERT INTO caster (chr) VALUES ('f'::text); INSERT INTO caster (text) VALUES ('f'::"char"); INSERT INTO caster (chr) VALUES ('f'::citext); INSERT INTO caster (citext) VALUES ('f'::"char"); INSERT INTO caster (name) VALUES ('foo'::text); INSERT INTO caster (text) VALUES ('foo'::name); INSERT INTO caster (name) VALUES ('foo'::citext); INSERT INTO caster (citext) VALUES ('foo'::name); -- Cannot cast to bytea on assignment. INSERT INTO caster (bytea) VALUES ('foo'::text); INSERT INTO caster (text) VALUES ('foo'::bytea); INSERT INTO caster (bytea) VALUES ('foo'::citext); INSERT INTO caster (citext) VALUES ('foo'::bytea); -- Cannot cast to boolean on assignment. INSERT INTO caster (boolean) VALUES ('t'::text); INSERT INTO caster (text) VALUES ('t'::boolean); INSERT INTO caster (boolean) VALUES ('t'::citext); INSERT INTO caster (citext) VALUES ('t'::boolean); -- Cannot cast to float8 on assignment. INSERT INTO caster (float8) VALUES ('12.42'::text); INSERT INTO caster (text) VALUES ('12.42'::float8); INSERT INTO caster (float8) VALUES ('12.42'::citext); INSERT INTO caster (citext) VALUES ('12.42'::float8); -- Cannot cast to float4 on assignment. INSERT INTO caster (float4) VALUES ('12.42'::text); INSERT INTO caster (text) VALUES ('12.42'::float4); INSERT INTO caster (float4) VALUES ('12.42'::citext); INSERT INTO caster (citext) VALUES ('12.42'::float4); -- Cannot cast to numeric on assignment. INSERT INTO caster (numeric) VALUES ('12.42'::text); INSERT INTO caster (text) VALUES ('12.42'::numeric); INSERT INTO caster (numeric) VALUES ('12.42'::citext); INSERT INTO caster (citext) VALUES ('12.42'::numeric); -- Cannot cast to int8 on assignment. INSERT INTO caster (int8) VALUES ('12'::text); INSERT INTO caster (text) VALUES ('12'::int8); INSERT INTO caster (int8) VALUES ('12'::citext); INSERT INTO caster (citext) VALUES ('12'::int8); -- Cannot cast to int4 on assignment. INSERT INTO caster (int4) VALUES ('12'::text); INSERT INTO caster (text) VALUES ('12'::int4); INSERT INTO caster (int4) VALUES ('12'::citext); INSERT INTO caster (citext) VALUES ('12'::int4); -- Cannot cast to int2 on assignment. INSERT INTO caster (int2) VALUES ('12'::text); INSERT INTO caster (text) VALUES ('12'::int2); INSERT INTO caster (int2) VALUES ('12'::citext); INSERT INTO caster (citext) VALUES ('12'::int2); -- Cannot cast to cidr on assignment. INSERT INTO caster (cidr) VALUES ('192.168.100.128/25'::text); INSERT INTO caster (text) VALUES ('192.168.100.128/25'::cidr); INSERT INTO caster (cidr) VALUES ('192.168.100.128/25'::citext); INSERT INTO caster (citext) VALUES ('192.168.100.128/25'::cidr); -- Cannot cast to inet on assignment. INSERT INTO caster (inet) VALUES ('192.168.100.128'::text); INSERT INTO caster (text) VALUES ('192.168.100.128'::inet); INSERT INTO caster (inet) VALUES ('192.168.100.128'::citext); INSERT INTO caster (citext) VALUES ('192.168.100.128'::inet); -- Cannot cast to macaddr on assignment. INSERT INTO caster (macaddr) VALUES ('08:00:2b:01:02:03'::text); INSERT INTO caster (text) VALUES ('08:00:2b:01:02:03'::macaddr); INSERT INTO caster (macaddr) VALUES ('08:00:2b:01:02:03'::citext); INSERT INTO caster (citext) VALUES ('08:00:2b:01:02:03'::macaddr); -- Cannot cast to money on assignment. INSERT INTO caster (money) VALUES ('12'::text); INSERT INTO caster (text) VALUES ('12'::money); INSERT INTO caster (money) VALUES ('12'::citext); INSERT INTO caster (citext) VALUES ('12'::money); -- Cannot cast to timestamp on assignment. INSERT INTO caster (timestamp) VALUES ('1999-01-08 04:05:06'::text); INSERT INTO caster (text) VALUES ('1999-01-08 04:05:06'::timestamp); INSERT INTO caster (timestamp) VALUES ('1999-01-08 04:05:06'::citext); INSERT INTO caster (citext) VALUES ('1999-01-08 04:05:06'::timestamp); -- Cannot cast to timestamptz on assignment. INSERT INTO caster (timestamptz) VALUES ('1999-01-08 04:05:06'::text); INSERT INTO caster (text) VALUES ('1999-01-08 04:05:06'::timestamptz); INSERT INTO caster (timestamptz) VALUES ('1999-01-08 04:05:06'::citext); INSERT INTO caster (citext) VALUES ('1999-01-08 04:05:06'::timestamptz); -- Cannot cast to interval on assignment. INSERT INTO caster (interval) VALUES ('1 hour'::text); INSERT INTO caster (text) VALUES ('1 hour'::interval); INSERT INTO caster (interval) VALUES ('1 hour'::citext); INSERT INTO caster (citext) VALUES ('1 hour'::interval); -- Cannot cast to date on assignment. INSERT INTO caster (date) VALUES ('1999-01-08'::text); INSERT INTO caster (text) VALUES ('1999-01-08'::date); INSERT INTO caster (date) VALUES ('1999-01-08'::citext); INSERT INTO caster (citext) VALUES ('1999-01-08'::date); -- Cannot cast to time on assignment. INSERT INTO caster (time) VALUES ('04:05:06'::text); INSERT INTO caster (text) VALUES ('04:05:06'::time); INSERT INTO caster (time) VALUES ('04:05:06'::citext); INSERT INTO caster (citext) VALUES ('04:05:06'::time); -- Cannot cast to timetz on assignment. INSERT INTO caster (timetz) VALUES ('04:05:06'::text); INSERT INTO caster (text) VALUES ('04:05:06'::timetz); INSERT INTO caster (timetz) VALUES ('04:05:06'::citext); INSERT INTO caster (citext) VALUES ('04:05:06'::timetz); -- Cannot cast to point on assignment. INSERT INTO caster (point) VALUES ('( 1 , 1)'::text); INSERT INTO caster (text) VALUES ('( 1 , 1)'::point); INSERT INTO caster (point) VALUES ('( 1 , 1)'::citext); INSERT INTO caster (citext) VALUES ('( 1 , 1)'::point); -- Cannot cast to lseg on assignment. INSERT INTO caster (lseg) VALUES ('( 1 , 1 ) , ( 2 , 2 )'::text); INSERT INTO caster (text) VALUES ('( 1 , 1 ) , ( 2 , 2 )'::lseg); INSERT INTO caster (lseg) VALUES ('( 1 , 1 ) , ( 2 , 2 )'::citext); INSERT INTO caster (citext) VALUES ('( 1 , 1 ) , ( 2 , 2 )'::lseg); -- Cannot cast to box on assignment. INSERT INTO caster (box) VALUES ('(0,0),(1,1)'::text); INSERT INTO caster (text) VALUES ('(0,0),(1,1)'::box); INSERT INTO caster (box) VALUES ('(0,0),(1,1)'::citext); INSERT INTO caster (citext) VALUES ('(0,0),(1,1)'::box); -- Cannot cast to path on assignment. INSERT INTO caster (path) VALUES ('((0,0),(1,1),(2,0))'::text); INSERT INTO caster (text) VALUES ('((0,0),(1,1),(2,0))'::path); INSERT INTO caster (path) VALUES ('((0,0),(1,1),(2,0))'::citext); INSERT INTO caster (citext) VALUES ('((0,0),(1,1),(2,0))'::path); -- Cannot cast to polygon on assignment. INSERT INTO caster (polygon) VALUES ('((0,0),(1,1))'::text); INSERT INTO caster (text) VALUES ('((0,0),(1,1))'::polygon); INSERT INTO caster (polygon) VALUES ('((0,0),(1,1))'::citext); INSERT INTO caster (citext) VALUES ('((0,0),(1,1))'::polygon); -- Cannot cast to circle on assignment. INSERT INTO caster (circle) VALUES ('((0,0),2)'::text); INSERT INTO caster (text) VALUES ('((0,0),2)'::circle); INSERT INTO caster (circle) VALUES ('((0,0),2)'::citext); INSERT INTO caster (citext) VALUES ('((0,0),2)'::circle); -- Cannot cast to bit on assignment. INSERT INTO caster (bit) VALUES ('101'::text); INSERT INTO caster (text) VALUES ('101'::bit); INSERT INTO caster (bit) VALUES ('101'::citext); INSERT INTO caster (citext) VALUES ('101'::bit); -- Cannot cast to bit varying on assignment. INSERT INTO caster (bitv) VALUES ('101'::text); INSERT INTO caster (text) VALUES ('101'::bit varying); INSERT INTO caster (bitv) VALUES ('101'::citext); INSERT INTO caster (citext) VALUES ('101'::bit varying); -- Cannot cast to tsvector on assignment. INSERT INTO caster (tsvector) VALUES ('the fat cat'::text); INSERT INTO caster (text) VALUES ('the fat cat'::tsvector); INSERT INTO caster (tsvector) VALUES ('the fat cat'::citext); INSERT INTO caster (citext) VALUES ('the fat cat'::tsvector); -- Cannot cast to tsquery on assignment. INSERT INTO caster (tsquery) VALUES ('fat & rat'::text); INSERT INTO caster (text) VALUES ('fat & rat'::tsquery); INSERT INTO caster (tsquery) VALUES ('fat & rat'::citext); INSERT INTO caster (citext) VALUES ('fat & rat'::tsquery); -- Cannot cast to uuid on assignment. INSERT INTO caster (uuid) VALUES ('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::text); INSERT INTO caster (text) VALUES ('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid); INSERT INTO caster (uuid) VALUES ('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::citext); INSERT INTO caster (citext) VALUES ('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid); -- Table 9-5. SQL String Functions and Operators SELECT 'D'::citext || 'avid'::citext = 'David'::citext AS citext_concat; SELECT 'Value: '::citext || 42 = 'Value: 42' AS text_concat; SELECT 42 || ': value'::citext ='42: value' AS int_concat; SELECT bit_length('jose'::citext) = 32 AS t; SELECT bit_length( name ) = bit_length( name::text ) AS t FROM srt; SELECT textlen( name ) = textlen( name::text ) AS t FROM srt; SELECT char_length( name ) = char_length( name::text ) AS t FROM srt; SELECT lower( name ) = lower( name::text ) AS t FROM srt; SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt; SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing 'hom' from 2 for 4) AS t FROM srt; SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt; SELECT substr('alphabet'::citext, 3) = 'phabet' AS t; SELECT substr('alphabet'::citext, 3, 2) = 'ph' AS t; SELECT substring('alphabet'::citext, 3) = 'phabet' AS t; SELECT substring('alphabet'::citext, 3, 2) = 'ph' AS t; SELECT substring('Thomas'::citext from 2 for 3) = 'hom' AS t; SELECT substring('Thomas'::citext from 2) = 'homas' AS t; SELECT substring('Thomas'::citext from '...$') = 'mas' AS t; SELECT substring('Thomas'::citext from '%#"o_a#"_' for '#') = 'oma' AS t; SELECT trim(' trim '::citext) = 'trim' AS t; SELECT trim('xxxxxtrimxxxx'::citext, 'x'::citext) = 'trim' AS t; SELECT trim('xxxxxxtrimxxxx'::text, 'x'::citext) = 'trim' AS t; SELECT trim('xxxxxtrimxxxx'::text, 'x'::citext) = 'trim' AS t; SELECT upper( name ) = upper( name::text ) AS t FROM srt; -- Table 9-6. Other String Functions. SELECT ascii( name ) = ascii( name::text ) AS t FROM srt; SELECT btrim(' trim'::citext ) = 'trim' AS t; SELECT btrim('xxxxxtrimxxxx'::citext, 'x'::citext ) = 'trim' AS t; SELECT btrim('xyxtrimyyx'::citext, 'xy'::citext) = 'trim' AS t; SELECT btrim('xyxtrimyyx'::text, 'xy'::citext) = 'trim' AS t; SELECT btrim('xyxtrimyyx'::citext, 'xy'::text ) = 'trim' AS t; -- chr() takes an int and returns text. -- convert() and convert_from take bytea and return text. SELECT convert_from( name::bytea, 'SQL_ASCII' ) = convert_from( name::text::bytea, 'SQL_ASCII' ) AS t FROM srt; SELECT decode('MTIzAAE='::citext, 'base64') = decode('MTIzAAE='::text, 'base64') AS t; -- encode() takes bytea and returns text. SELECT initcap('hi THOMAS'::citext) = initcap('hi THOMAS'::text) AS t; SELECT length( name ) = length( name::text ) AS t FROM srt; SELECT lpad('hi'::citext, 5 ) = ' hi' AS t; SELECT lpad('hi'::citext, 5, 'xy'::citext) = 'xyxhi' AS t; SELECT lpad('hi'::text, 5, 'xy'::citext) = 'xyxhi' AS t; SELECT lpad('hi'::citext, 5, 'xy'::text ) = 'xyxhi' AS t; SELECT ltrim(' trim'::citext ) = 'trim' AS t; SELECT ltrim('zzzytrim'::citext, 'xyz'::citext) = 'trim' AS t; SELECT ltrim('zzzytrim'::text, 'xyz'::citext) = 'trim' AS t; SELECT ltrim('zzzytrim'::citext, 'xyz'::text ) = 'trim' AS t; SELECT md5( name ) = md5( name::text ) AS t FROM srt; -- pg_client_encoding() takes no args and returns name. SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt; SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt; SELECT regexp_matches('foobarbequebaz'::citext, '(bar)(beque)') = ARRAY[ 'bar', 'beque' ] AS t; SELECT regexp_matches('foobarbequebaz'::citext, '(BAR)(BEQUE)') = ARRAY[ 'bar', 'beque' ] AS t; SELECT regexp_matches('foobarbequebaz'::citext, '(BAR)(BEQUE)'::citext) = ARRAY[ 'bar', 'beque' ] AS t; SELECT regexp_matches('foobarbequebaz'::citext, '(BAR)(BEQUE)'::citext, '') = ARRAY[ 'bar', 'beque' ] AS t; SELECT regexp_matches('foobarbequebaz'::citext, '(BAR)(BEQUE)', '') = ARRAY[ 'bar', 'beque' ] AS t; SELECT regexp_matches('foobarbequebaz', '(BAR)(BEQUE)'::citext, '') = ARRAY[ 'bar', 'beque' ] AS t; SELECT regexp_matches('foobarbequebaz'::citext, '(BAR)(BEQUE)'::citext, ''::citext) = ARRAY[ 'bar', 'beque' ] AS t; -- c forces case-sensitive SELECT regexp_matches('foobarbequebaz'::citext, '(BAR)(BEQUE)'::citext, 'c'::citext) = ARRAY[ 'bar', 'beque' ] AS "null"; SELECT regexp_replace('Thomas'::citext, '.[mN]a.', 'M') = 'ThM' AS t; SELECT regexp_replace('Thomas'::citext, '.[MN]A.', 'M') = 'ThM' AS t; SELECT regexp_replace('Thomas', '.[MN]A.'::citext, 'M') = 'ThM' AS t; SELECT regexp_replace('Thomas'::citext, '.[MN]A.'::citext, 'M') = 'ThM' AS t; -- c forces case-sensitive SELECT regexp_replace('Thomas'::citext, '.[MN]A.'::citext, 'M', 'c') = 'Thomas' AS t; SELECT regexp_split_to_array('hello world'::citext, E'\\s+') = ARRAY[ 'hello', 'world' ] AS t; SELECT regexp_split_to_array('helloTworld'::citext, 't') = ARRAY[ 'hello', 'world' ] AS t; SELECT regexp_split_to_array('helloTworld', 't'::citext) = ARRAY[ 'hello', 'world' ] AS t; SELECT regexp_split_to_array('helloTworld'::citext, 't'::citext) = ARRAY[ 'hello', 'world' ] AS t; SELECT regexp_split_to_array('helloTworld'::citext, 't', 's') = ARRAY[ 'hello', 'world' ] AS t; SELECT regexp_split_to_array('helloTworld', 't'::citext, 's') = ARRAY[ 'hello', 'world' ] AS t; SELECT regexp_split_to_array('helloTworld'::citext, 't'::citext, 's') = ARRAY[ 'hello', 'world' ] AS t; -- c forces case-sensitive SELECT regexp_split_to_array('helloTworld'::citext, 't'::citext, 'c') = ARRAY[ 'helloTworld' ] AS t; SELECT regexp_split_to_table('hello world'::citext, E'\\s+') AS words; SELECT regexp_split_to_table('helloTworld'::citext, 't') AS words; SELECT regexp_split_to_table('helloTworld', 't'::citext) AS words; SELECT regexp_split_to_table('helloTworld'::citext, 't'::citext) AS words; -- c forces case-sensitive SELECT regexp_split_to_table('helloTworld'::citext, 't'::citext, 'c') AS word; SELECT repeat('Pg'::citext, 4) = 'PgPgPgPg' AS t; SELECT replace('abcdefabcdef'::citext, 'cd', 'XX') = 'abXXefabXXef' AS t; SELECT replace('abcdefabcdef'::citext, 'CD', 'XX') = 'abXXefabXXef' AS t; SELECT replace('ab^is$abcdef'::citext, '^is$', 'XX') = 'abXXabcdef' AS t; SELECT replace('abcdefabcdef', 'cd'::citext, 'XX') = 'abXXefabXXef' AS t; SELECT replace('abcdefabcdef', 'CD'::citext, 'XX') = 'abXXefabXXef' AS t; SELECT replace('ab^is$abcdef', '^is$'::citext, 'XX') = 'abXXabcdef' AS t; SELECT replace('abcdefabcdef'::citext, 'cd'::citext, 'XX') = 'abXXefabXXef' AS t; SELECT replace('abcdefabcdef'::citext, 'CD'::citext, 'XX') = 'abXXefabXXef' AS t; SELECT replace('ab^is$abcdef'::citext, '^is$'::citext, 'XX') = 'abXXabcdef' AS t; SELECT rpad('hi'::citext, 5 ) = 'hi ' AS t; SELECT rpad('hi'::citext, 5, 'xy'::citext) = 'hixyx' AS t; SELECT rpad('hi'::text, 5, 'xy'::citext) = 'hixyx' AS t; SELECT rpad('hi'::citext, 5, 'xy'::text ) = 'hixyx' AS t; SELECT rtrim('trim '::citext ) = 'trim' AS t; SELECT rtrim('trimxxxx'::citext, 'x'::citext) = 'trim' AS t; SELECT rtrim('trimxxxx'::text, 'x'::citext) = 'trim' AS t; SELECT rtrim('trimxxxx'::text, 'x'::text ) = 'trim' AS t; SELECT split_part('abc~@~def~@~ghi'::citext, '~@~', 2) = 'def' AS t; SELECT split_part('abcTdefTghi'::citext, 't', 2) = 'def' AS t; SELECT split_part('abcTdefTghi'::citext, 't'::citext, 2) = 'def' AS t; SELECT split_part('abcTdefTghi', 't'::citext, 2) = 'def' AS t; SELECT strpos('high'::citext, 'ig' ) = 2 AS t; SELECT strpos('high', 'ig'::citext) = 2 AS t; SELECT strpos('high'::citext, 'ig'::citext) = 2 AS t; SELECT strpos('high'::citext, 'IG' ) = 2 AS t; SELECT strpos('high', 'IG'::citext) = 2 AS t; SELECT strpos('high'::citext, 'IG'::citext) = 2 AS t; -- to_ascii() does not support UTF-8. -- to_hex() takes a numeric argument. SELECT substr('alphabet', 3, 2) = 'ph' AS t; SELECT translate('abcdefabcdef'::citext, 'cd', 'XX') = 'abXXefabXXef' AS t; SELECT translate('abcdefabcdef'::citext, 'CD', 'XX') = 'abXXefabXXef' AS t; SELECT translate('abcdefabcdef'::citext, 'CD'::citext, 'XX') = 'abXXefabXXef' AS t; SELECT translate('abcdefabcdef', 'CD'::citext, 'XX') = 'abXXefabXXef' AS t; -- Table 9-20. Formatting Functions SELECT to_date('05 Dec 2000'::citext, 'DD Mon YYYY'::citext) = to_date('05 Dec 2000', 'DD Mon YYYY') AS t; SELECT to_date('05 Dec 2000'::citext, 'DD Mon YYYY') = to_date('05 Dec 2000', 'DD Mon YYYY') AS t; SELECT to_date('05 Dec 2000', 'DD Mon YYYY'::citext) = to_date('05 Dec 2000', 'DD Mon YYYY') AS t; SELECT to_number('12,454.8-'::citext, '99G999D9S'::citext) = to_number('12,454.8-', '99G999D9S') AS t; SELECT to_number('12,454.8-'::citext, '99G999D9S') = to_number('12,454.8-', '99G999D9S') AS t; SELECT to_number('12,454.8-', '99G999D9S'::citext) = to_number('12,454.8-', '99G999D9S') AS t; SELECT to_timestamp('05 Dec 2000'::citext, 'DD Mon YYYY'::citext) = to_timestamp('05 Dec 2000', 'DD Mon YYYY') AS t; SELECT to_timestamp('05 Dec 2000'::citext, 'DD Mon YYYY') = to_timestamp('05 Dec 2000', 'DD Mon YYYY') AS t; SELECT to_timestamp('05 Dec 2000', 'DD Mon YYYY'::citext) = to_timestamp('05 Dec 2000', 'DD Mon YYYY') AS t; -- Try assigning function results to a column. SELECT COUNT(*) = 8::bigint AS t FROM try; INSERT INTO try VALUES ( to_char( now()::timestamp, 'HH12:MI:SS') ), ( to_char( now() + '1 sec'::interval, 'HH12:MI:SS') ), -- timetamptz ( to_char( '15h 2m 12s'::interval, 'HH24:MI:SS') ), ( to_char( current_date, '999') ), ( to_char( 125::int, '999') ), ( to_char( 127::int4, '999') ), ( to_char( 126::int8, '999') ), ( to_char( 128.8::real, '999D9') ), ( to_char( 125.7::float4, '999D9') ), ( to_char( 125.9::float8, '999D9') ), ( to_char( -125.8::numeric, '999D99S') ); SELECT COUNT(*) = 19::bigint AS t FROM try; SELECT like_escape( name, '' ) = like_escape( name::text, '' ) AS t FROM srt; SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS t FROM srt; -- Ensure correct behavior for citext with materialized views. CREATE TABLE citext_table ( id serial primary key, name citext ); INSERT INTO citext_table (name) VALUES ('one'), ('two'), ('three'), (NULL), (NULL); CREATE MATERIALIZED VIEW citext_matview AS SELECT * FROM citext_table; CREATE UNIQUE INDEX citext_matview_id ON citext_matview (id); SELECT * FROM citext_matview m FULL JOIN citext_table t ON (t.id = m.id AND t *= m) WHERE t.id IS NULL OR m.id IS NULL; UPDATE citext_table SET name = 'Two' WHERE name = 'TWO'; SELECT * FROM citext_matview m FULL JOIN citext_table t ON (t.id = m.id AND t *= m) WHERE t.id IS NULL OR m.id IS NULL; REFRESH MATERIALIZED VIEW CONCURRENTLY citext_matview; SELECT * FROM citext_matview ORDER BY id;
the_stack
DO $$ BEGIN IF NOT EXISTS(select 1 from C_Year where FiscalYear='2018' and C_Calendar_ID=1000000) THEN -- 2018-01-02T19:53:45.484 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Year (AD_Client_ID,AD_Org_ID,C_Calendar_ID,Created,CreatedBy,C_Year_ID,FiscalYear,IsActive,Processing,Updated,UpdatedBy) VALUES (1000000,0,1000000,TO_TIMESTAMP('2018-01-02 19:53:45','YYYY-MM-DD HH24:MI:SS'),100,540005,'2018','Y','N',TO_TIMESTAMP('2018-01-02 19:53:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:50.968 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540026,TO_TIMESTAMP('2018-01-02 19:53:50','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-01-31','YYYY-MM-DD'),'Y','Jan-18',1,'S','N',TO_TIMESTAMP('2018-01-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:53:50','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:50.969 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540026 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:53:51.017 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540794,540026,TO_TIMESTAMP('2018-01-02 19:53:50','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:50','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.043 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540795,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.072 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540796,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.098 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540797,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.124 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540798,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.151 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540799,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.182 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540800,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.215 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540801,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.250 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540802,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.283 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540803,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.316 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540804,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.348 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540805,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.382 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540806,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.416 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540807,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.447 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540808,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.480 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540809,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.514 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540810,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.542 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540811,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.574 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540812,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.605 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540813,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.637 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540814,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.672 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540815,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.707 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540816,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.740 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540817,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.767 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540818,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.794 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540819,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.826 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540820,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.859 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540821,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.890 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540822,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.922 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540823,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.955 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540824,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:51.987 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540825,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.024 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540826,540026,TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.065 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-02-28','YYYY-MM-DD'),'Y','Feb-18',2,'S','N',TO_TIMESTAMP('2018-02-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.067 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540027 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:53:52.108 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540827,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.137 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540828,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.169 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540829,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.426 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540830,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.457 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540831,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.492 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540832,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.521 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540833,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.550 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540834,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.583 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540835,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.615 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540836,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.647 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540837,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.678 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540838,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.710 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540839,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.740 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540840,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.767 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540841,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.793 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540842,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.819 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540843,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.847 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540844,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.883 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540845,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.916 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540846,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.948 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540847,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:52.983 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540848,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.014 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540849,540027,TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:52','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.045 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540850,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.078 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540851,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.112 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540852,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.144 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540853,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.173 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540854,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.198 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540855,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.222 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540856,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.247 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540857,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.273 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540858,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.296 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540859,540027,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.322 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-03-31','YYYY-MM-DD'),'Y','Mär-18',3,'S','N',TO_TIMESTAMP('2018-03-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.322 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540028 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:53:53.348 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540860,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.372 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540861,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.396 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540862,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.423 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540863,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.449 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540864,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.479 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540865,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.511 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540866,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.545 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540867,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.580 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540868,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.620 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540869,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.645 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540870,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.672 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540871,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.699 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540872,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.729 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540873,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.759 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540874,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.787 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540875,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.816 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540876,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.847 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540877,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.880 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540878,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.913 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540879,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.945 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540880,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:53.981 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540881,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.008 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540882,540028,TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.033 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540883,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.063 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540884,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.097 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540885,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.130 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540886,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.162 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540887,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.195 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540888,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.228 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540889,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.258 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540890,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.288 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540891,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.320 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540892,540028,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.358 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-04-30','YYYY-MM-DD'),'Y','Apr-18',4,'S','N',TO_TIMESTAMP('2018-04-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.359 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540029 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:53:54.393 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540893,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.419 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540894,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.445 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540895,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.472 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540896,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.504 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540897,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.534 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540898,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.561 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540899,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.593 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540900,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.623 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540901,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.655 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540902,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.685 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540903,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.716 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540904,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.756 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540905,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.794 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540906,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.823 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540907,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.853 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540908,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.884 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540909,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.916 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540910,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.948 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540911,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:54.981 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540912,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.013 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540913,540029,TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.045 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540914,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.085 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540915,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.114 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540916,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.145 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540917,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.179 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540918,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.213 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540919,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.248 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540920,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.279 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540921,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.311 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540922,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.342 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540923,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.374 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540924,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.407 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540925,540029,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.449 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-05-31','YYYY-MM-DD'),'Y','Mai-18',5,'S','N',TO_TIMESTAMP('2018-05-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.451 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540030 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:53:55.495 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540926,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.519 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540927,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.542 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540928,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.569 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540929,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.595 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540930,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.619 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540931,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.649 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540932,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.674 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540933,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.699 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540934,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.724 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540935,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.747 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540936,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.771 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540937,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.795 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540938,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.819 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540939,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.843 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540940,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.871 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540941,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.898 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540942,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.925 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540943,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.952 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540944,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:55.980 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540945,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.007 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540946,540030,TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:55','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.034 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540947,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.067 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540948,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.100 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540949,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.134 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540950,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.164 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540951,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.195 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540952,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.225 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540953,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.255 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540954,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.285 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540955,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.316 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540956,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.347 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540957,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.387 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540958,540030,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.651 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-06-30','YYYY-MM-DD'),'Y','Jun-18',6,'S','N',TO_TIMESTAMP('2018-06-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.653 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540031 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:53:56.693 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540959,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.731 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540960,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.758 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540961,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.782 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540962,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.807 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540963,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.832 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540964,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.856 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540965,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.880 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540966,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.905 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540967,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.932 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540968,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.965 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540969,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:56.998 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540970,540031,TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.027 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540971,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.055 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540972,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.083 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540973,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.339 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540974,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.370 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540975,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.401 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540976,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.431 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540977,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.459 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540978,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.488 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540979,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.520 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540980,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.551 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540981,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.586 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540982,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.613 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540983,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.640 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540984,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.671 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540985,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.704 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540986,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:57.736 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540987,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:58.768 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540988,540031,TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:57','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:58.797 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540989,540031,TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:58.825 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540990,540031,TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:58.855 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540991,540031,TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:58.894 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540032,TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-07-31','YYYY-MM-DD'),'Y','Jul-18',7,'S','N',TO_TIMESTAMP('2018-07-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:58.895 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540032 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:53:58.921 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540992,540032,TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:58.951 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540993,540032,TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:58.978 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540994,540032,TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.009 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540995,540032,TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.047 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540996,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.077 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540997,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.109 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540998,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.139 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,540999,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.171 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541000,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.204 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541001,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.236 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541002,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.268 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541003,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.300 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541004,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.331 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541005,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.363 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541006,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.395 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541007,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.427 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541008,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.463 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541009,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.490 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541010,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.519 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541011,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.550 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541012,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.583 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541013,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.618 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541014,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.649 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541015,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.681 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541016,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.712 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541017,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.742 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541018,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.770 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541019,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.800 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541020,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.838 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541021,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.869 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541022,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.900 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541023,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.932 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541024,540032,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.973 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540033,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-08-31','YYYY-MM-DD'),'Y','Aug-18',8,'S','N',TO_TIMESTAMP('2018-08-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:53:59.975 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540033 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:54:00.013 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541025,540033,TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:53:59','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.049 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541026,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.085 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541027,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.127 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541028,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.153 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541029,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.179 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541030,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.207 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541031,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.231 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541032,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.255 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541033,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.280 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541034,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.305 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541035,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.328 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541036,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.352 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541037,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.379 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541038,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.411 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541039,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.441 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541040,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.471 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541041,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.502 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541042,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.538 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541043,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.566 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541044,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.592 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541045,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.619 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541046,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.647 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541047,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.678 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541048,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.936 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541049,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:00.969 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541050,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.005 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541051,540033,TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:00','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.036 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541052,540033,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.068 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541053,540033,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.109 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541054,540033,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.149 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541055,540033,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.189 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541056,540033,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.230 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541057,540033,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.277 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-09-30','YYYY-MM-DD'),'Y','Sep-18',9,'S','N',TO_TIMESTAMP('2018-09-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.278 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540034 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:54:01.320 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541058,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.364 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541059,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.395 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541060,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.427 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541061,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.458 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541062,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.488 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541063,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.531 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541064,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.559 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541065,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.586 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541066,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.615 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541067,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.644 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541068,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.676 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541069,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.707 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541070,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.743 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541071,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.773 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541072,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.801 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541073,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.831 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541074,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.861 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541075,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.887 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541076,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.916 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541077,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.948 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541078,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:01.978 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541079,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.005 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541080,540034,TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:01','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.033 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541081,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.063 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541082,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.096 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541083,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.128 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541084,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.163 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541085,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.197 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541086,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.229 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541087,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.263 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541088,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.296 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541089,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.330 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541090,540034,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.367 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-10-31','YYYY-MM-DD'),'Y','Okt-18',10,'S','N',TO_TIMESTAMP('2018-10-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.369 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540035 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:54:02.407 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541091,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.652 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541092,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.679 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541093,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.712 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541094,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.747 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541095,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.778 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541096,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.809 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541097,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.839 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541098,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.872 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541099,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.904 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541100,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.941 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541101,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:02.970 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541102,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541103,540035,TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:02','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.028 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541104,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.059 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541105,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.094 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541106,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.125 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541107,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.155 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541108,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.185 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541109,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.219 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541110,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.250 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541111,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.281 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541112,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.314 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541113,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.347 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541114,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.379 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541115,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.412 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541116,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.444 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541117,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.476 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541118,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.508 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541119,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.540 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541120,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.573 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541121,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.606 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541122,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.639 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541123,540035,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.685 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-11-30','YYYY-MM-DD'),'Y','Nov-18',11,'S','N',TO_TIMESTAMP('2018-11-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.686 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540036 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:54:03.717 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541124,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.744 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541125,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.773 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541126,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.802 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541127,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.835 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541128,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.867 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541129,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.900 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541130,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.931 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541131,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.963 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541132,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:03.995 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541133,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.025 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541134,540036,TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:03','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.054 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541135,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.085 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541136,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.117 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541137,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.149 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541138,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.181 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541139,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.214 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541140,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.245 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541141,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.276 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541142,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.309 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541143,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.340 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541144,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.371 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541145,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.402 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541146,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.432 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541147,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.463 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541148,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.489 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541149,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.515 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541150,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.541 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541151,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.571 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541152,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.600 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541153,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.631 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541154,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.661 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541155,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.690 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541156,540036,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.716 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period (AD_Client_ID,AD_Org_ID,C_Period_ID,Created,CreatedBy,C_Year_ID,EndDate,IsActive,Name,PeriodNo,PeriodType,Processing,StartDate,Updated,UpdatedBy) VALUES (1000000,0,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,540005,TO_TIMESTAMP('2018-12-31','YYYY-MM-DD'),'Y','Dez-18',12,'S','N',TO_TIMESTAMP('2018-12-01','YYYY-MM-DD'),TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.717 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_Period_Trl (AD_Language,C_Period_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.C_Period_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_Period t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Period_ID=540037 AND NOT EXISTS (SELECT 1 FROM C_Period_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Period_ID=t.C_Period_ID) ; -- 2018-01-02T19:54:04.742 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541157,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'AVI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.768 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541158,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'API','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.792 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541159,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'HRP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.817 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541160,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'DOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.840 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541161,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MCC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.867 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541162,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'AEI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.891 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541163,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'GLJ','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.916 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541164,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'ARC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.940 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541165,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MXI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.964 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541166,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'MXP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:04.990 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541167,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'POR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.018 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541168,540037,TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100,'CMB','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.276 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541169,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'CMC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.309 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541170,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'MMM','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.343 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541171,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'MMI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.376 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541172,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'MMP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.411 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541173,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'PJI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.443 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541174,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'GLD','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.475 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541175,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'ARF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.511 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541176,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'APC','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.542 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541177,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'CMA','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.574 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541178,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'MMS','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.609 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541179,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'POO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.641 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541180,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'SOO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.673 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541181,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'ARI','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.708 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541182,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'MMR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.750 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541183,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'CON','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.781 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541184,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'MST','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.810 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541185,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'ARR','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.840 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541186,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'APP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.867 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541187,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'MQO','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.892 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541188,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'MOP','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-01-02T19:54:05.918 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_PeriodControl (AD_Client_ID,AD_Org_ID,C_PeriodControl_ID,C_Period_ID,Created,CreatedBy,DocBaseType,IsActive,PeriodAction,PeriodStatus,Processing,Updated,UpdatedBy) VALUES (1000000,0,541189,540037,TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100,'MOF','Y','N','N','N',TO_TIMESTAMP('2018-01-02 19:54:05','YYYY-MM-DD HH24:MI:SS'),100) ; END IF; END; $$;
the_stack
----------------------------------------------------------------------- -- Oracle Machine Learning for SQL (OML4SQL) 21c -- -- Association Rules - Apriori Algorithm - dmardemo.sql -- -- Copyright (c) 2021 Oracle Corporation and/or its affilitiates. -- -- The Universal Permissive License (UPL), Version 1.0 -- -- https://oss.oracle.com/licenses/upl/ ----------------------------------------------------------------------- SET serveroutput ON SET trimspool ON SET pages 10000 SET linesize 140 SET echo ON -- ODM API accepts data both in relational (2D) form, and -- transactional form for Association Rules. -- Transactional data is the more common form of input for -- this type of problem, so the demo shows examples of -- processing transactional input. ----------------------------------------------------------------------- -- SET UP AND ANALYZE THE DATA ----------------------------------------------------------------------- -- Cleanup old dataset for repeat runs BEGIN EXECUTE IMMEDIATE 'DROP VIEW sales_trans_cust'; EXCEPTION WHEN OTHERS THEN NULL; END; / ------- -- DATA ------- -- The data for this sample is composed from a small subset of -- sales transactions in the SH schema - listing the (multiple) -- items bought by a set of customers with ids in the range -- 100001-104500. It also lists the dollar amount sold for -- each item. Note that this data is based on customer id, -- not "basket" id (as in the case of true market basket data). -- -- Market basket or sales datasets are transactional in nature, -- and form fact tables in a typical data warehouse. -- CREATE VIEW sales_trans_cust AS SELECT cust_id, prod_name, prod_category, amount_sold FROM (SELECT a.cust_id, b.prod_name, b.prod_category, a.amount_sold FROM sh.sales a, sh.products b WHERE a.prod_id = b.prod_id AND a.cust_id between 100001 AND 104500); ----------- -- ANALYSIS ----------- -- Association Rules in ODM works best on sparse data - i.e. data where -- the average number of attributes/items associated with a given case is -- a small percentage of the total number of possible attributes/items. -- This is true of most market basket datasets where an average customer -- purchases only a small subset of items from a fairly large inventory -- in the store. -- -- This section provides a rough outline of the analysis to be performed -- on data used for Association Rules model build. -- -- 1. Compute the cardinality of customer id and product (940, 14) SELECT COUNT(DISTINCT cust_id) cc, COUNT(DISTINCT prod_name) cp FROM sales_trans_cust; -- 2. Compute the density of data (21.31) column density format a18 SELECT TO_CHAR((100 * ct)/(cc * cp), 99.99) density FROM (SELECT COUNT(DISTINCT cust_id) cc, COUNT(DISTINCT prod_name) cp, COUNT(*) ct FROM sales_trans_cust); -- 3. Common items are candidates for removal during model build, because -- if a majority of customers have bought those items, the resulting -- rules do not have much value. Find out most common items. For example, -- the query shown below determines that Mouse_Pad is most common (303). -- -- Since the dataset is small, we will skip common item removal. -- column prod_name format a40 SELECT prod_name, count(prod_name) cnt FROM sales_trans_cust GROUP BY prod_name ORDER BY cnt DESC, prod_name DESC; -- 4. Compute the average number of products purchased per customer (2.98) -- 3 out of 11 corresponds to the density we computed earlier. -- column avg_num_prod format a16 SELECT TO_CHAR(AVG(cp), 999.99) avg_num_prod FROM (SELECT COUNT(prod_name) cp FROM sales_trans_cust GROUP BY cust_id); -- 5. Compute the minimum and maximum dollar amount sold -- for each item (7.99, 1299.99). SELECT MIN(amount_sold), MAX(amount_sold) FROM sales_trans_cust; -------------------------------------------------------------------------------- -- -- Create view sales_trans_cust_parallel with a parallel hint -- -------------------------------------------------------------------------------- CREATE or REPLACE VIEW sales_trans_cust_parallel AS SELECT /*+ parallel (4)*/ * FROM sales_trans_cust; ----------------------------------------------------------------------- -- SAMPLE PROBLEM USING TRANSACTIONAL (pair/triple) INPUT ----------------------------------------------------------------------- -- ODM API accepts data both in relational (2D) form and -- transactional form for Association Rules. -- -- The transactional input is a two column table of the form: -- (transaction_id, item_id) -- or a three column table of the form: -- (transaction_id, item_id, item_value) -- where we use the case_id to represent a transaction_id. -- -- Example of a two column transactional table is: -- (transaction_id, item_id) -- (1, 1) -- (1, 4) -- (2, 2) -- or -- (1, 'apple') -- (1, 'pear') -- (2, 'banana') -- -- Example of a three column transactional table is: -- (transaction_id, item_id, item_value) -- (1, 'apple', 2) -- (1, 'banana', 4) -- (2, 'apple', 1) -- (2, 'banana', 2) -- or -- (1, 'wine', 'red') -- (1, 'wine', 'white') -- (1, 'cheese', 'swiss') -- (2, 'cheese', 'provolone') -- which allows you to treat different (item_id, item_val) pairings -- for a given transaction essentially as different, unique items. -- -------------------------------- -- PREPARE BUILD (TRAINING) DATA -- -- Data for AR modeling may need binning if it contains numerical data. ------------------- -- SPECIFY SETTINGS -- -- Cleanup old settings table for repeat runs BEGIN EXECUTE IMMEDIATE 'DROP TABLE ar_sh_sample_settings'; EXCEPTION WHEN OTHERS THEN NULL; END; / -- The default (and only) algorithm for association rules is -- Apriori AR. However, we need a settings table -- to override the default Min Support, Min Confidence, -- and Max items settings. -- Add settings for Transaction Input - the presence -- of an Item Id column specification indicates to the -- API that the input is transactional -- set echo off CREATE TABLE ar_sh_sample_settings ( setting_name VARCHAR2(30), setting_value VARCHAR2(4000)); set echo on BEGIN INSERT INTO ar_sh_sample_settings VALUES (dbms_data_mining.asso_min_support,0.1); INSERT INTO ar_sh_sample_settings VALUES (dbms_data_mining.asso_min_confidence,0.1); INSERT INTO ar_sh_sample_settings VALUES (dbms_data_mining.asso_max_rule_length,3); INSERT INTO ar_sh_sample_settings VALUES (dbms_data_mining.odms_item_id_column_name, 'PROD_NAME'); INSERT INTO ar_sh_sample_settings VALUES (dbms_data_mining.asso_aggregates, 'AMOUNT_SOLD'); COMMIT; END; / BEGIN DBMS_DATA_MINING.DROP_MODEL('AR_SH_SAMPLE'); EXCEPTION WHEN OTHERS THEN NULL; END; / ---------------------------------------------- -- Build AR model with transactional input -- BEGIN DBMS_DATA_MINING.CREATE_MODEL( model_name => 'AR_SH_SAMPLE', mining_function => DBMS_DATA_MINING.ASSOCIATION, data_table_name => 'sales_trans_cust_parallel', case_id_column_name => 'cust_id', settings_table_name => 'ar_sh_sample_settings' ); END; / ------------------------- -- DISPLAY MODEL SETTINGS -- column setting_name format a30 column setting_value format a30 SELECT setting_name, setting_value FROM user_mining_model_settings WHERE model_name = 'AR_SH_SAMPLE' ORDER BY setting_name; ----------------------------------------------------------------------- -- TEST THE MODEL ----------------------------------------------------------------------- -- Association rules do not have a predefined test metric. -- -- Two indirect measures of modeling success are: -- -- 1. Number of Rules generated: The optimal number of rules is -- application dependent. In general, an overwhelming number of -- rules is undesirable for user interpretation. More rules take -- longer to compute, and also consume storage and CPU cycles. -- You avoid too many rules by increasing the value for support. -- -- 2. Relevance of rules -- This can be determined only by user inspection of rules, since -- it is application dependent. Ideally, we want to find rules with -- high confidence and with non-obvious patterns. The value for -- confidence is an indicator of the strength of the rule - so -- you could set the confidence value high in conjunction with -- support and see if you get high quality rules. -- -- 3. Frequent itemsets provide an insight into co-occurrence of items. ----------------------------------------------------------------------- -- DISPLAY MODEL CONTENT ----------------------------------------------------------------------- ------------------------------------------------------------- -- Display Top-10 Frequent Itemsets -- break on itemset_id skip 1; column item format a40 SELECT item, support, number_of_items FROM (SELECT I.attribute_subname AS item, F.support, F.number_of_items FROM TABLE(DBMS_DATA_MINING.GET_FREQUENT_ITEMSETS( 'AR_SH_SAMPLE', 10)) F, TABLE(F.items) I ORDER BY number_of_items, support, item); ---------------------------------------------------------- -- Display Top-10 Association Rules -- SET line 300 column antecedent format a30 column consequent format a20 column supp format 9.999 column conf format 9.999 SELECT a.attribute_subname antecedent, c.attribute_subname consequent, rule_support supp, rule_confidence conf, row_number() over (partition by rule_id order by a.attribute_subname) piece FROM TABLE(DBMS_DATA_MINING.GET_ASSOCIATION_RULES('AR_SH_SAMPLE', 10)) T, TABLE(T.consequent) C, TABLE(T.antecedent) A ORDER BY conf DESC, supp DESC, piece; ----------------------------------------------------------------------- -- DISPLAY MODEL CONTENT USING VIEWS ----------------------------------------------------------------------- -- In 12.2, aggregation functionality is added to Association Rules -- model. The model views, DM$VI<ModelName> and DM$VR<ModelName>, are -- provided as the new output interface. -- Get a list of model views col view_name format a30 col view_type format a50 SELECT view_name, view_type FROM user_mining_model_views WHERE model_name='AR_SH_SAMPLE' ORDER BY view_name; ---------------------------------------------------------- -- Using DM$VI<ModelName> to display Top-10 Frequent Itemsets. -- The dollar amount sold of each item is displayed. -- column item format a40 column amount_sold format 999999.99 column support format 9.999 column number_of_items format 99 set echo off SELECT items.item, items.amount_sold, support, number_of_items FROM (SELECT * FROM( SELECT itemset, number_of_items, support FROM DM$VIAR_SH_SAMPLE ORDER BY number_of_items, support) WHERE ROWNUM <=10) fis, XMLTABLE ('/itemset/item' PASSING fis.itemset COLUMNS item varchar2(40) PATH 'item_name', amount_sold number PATH 'ASSO_AGG0' ) items ORDER BY number_of_items, support, item; set echo on ---------------------------------------------------------- -- Using DM$VR<ModelName> to display Top-10 Association Rules. -- For each rule, the dollar amount sold of the consequent item -- is displayed. -- SET line 300 column antecedent format a30 column consequent format a20 column supp format 9.999 column conf format 9.999 column con_amount format 99999.99 column piece format 99 set echo off SELECT ant_items.item antecedent, consequent_name consequent, con_rule_amount_sold con_amount, rule_support supp, rule_confidence conf, ant_items.piece FROM (SELECT * FROM (SELECT antecedent, consequent_name, rule_support, rule_confidence, con_rule_amount_sold FROM DM$VRAR_SH_SAMPLE ORDER BY rule_confidence DESC, rule_support DESC) WHERE ROWNUM <=10) r, XMLTABLE ('/itemset/item' PASSING r.ANTECEDENT COLUMNS item varchar2(30) PATH 'item_name', piece for ordinality ) ant_items ORDER BY conf DESC, supp DESC, piece; set echo on --- ------------------------------------------------------------------ --- Now we shall build the model with a 2 column transactional input table --- We choose only cust_id and prod_name from the sales_trans_cust view --- Clear the settings table and specify the settings for this model build. --- Use dbms_data_mining.odms_item_id_column_name to indicate transactional --- input CREATE OR REPLACE VIEW sales_trans_cust_2col AS SELECT cust_id, prod_name from sales_trans_cust; -------------------------------------------------------------------------------- -- -- Create view sales_trans_2col_parallel with a parallel hint -- -------------------------------------------------------------------------------- CREATE or REPLACE VIEW sales_trans_2col_parallel AS SELECT /*+ parallel (4)*/ * FROM sales_trans_cust_2col; truncate table ar_sh_sample_settings; BEGIN INSERT INTO ar_sh_sample_settings VALUES (dbms_data_mining.asso_min_support,0.1); INSERT INTO ar_sh_sample_settings VALUES (dbms_data_mining.asso_min_confidence,0.1); INSERT INTO ar_sh_sample_settings VALUES (dbms_data_mining.asso_max_rule_length,3); INSERT INTO ar_sh_sample_settings VALUES (dbms_data_mining.odms_item_id_column_name, 'PROD_NAME'); COMMIT; END; / BEGIN DBMS_DATA_MINING.DROP_MODEL('AR_SH_SAMPLE_2COL'); EXCEPTION WHEN OTHERS THEN NULL; END; / BEGIN DBMS_DATA_MINING.CREATE_MODEL( model_name => 'AR_SH_SAMPLE_2COL', mining_function => DBMS_DATA_MINING.ASSOCIATION, data_table_name => 'sales_trans_2col_parallel', case_id_column_name => 'cust_id', settings_table_name => 'ar_sh_sample_settings' ); END; / ---- Lets display the model content using views. ---- There are 2 additional views for transactional data ---- i.e DM$VTAR_SH_SAMPLE_2COL and DM$VAAR_SH_SAMPLE_2COL that give ---- information about the frequent item sets and rules. ---- in addition to DM$VIAR_SH_SAMPLE_2COL and DM$VRAR_SH_SAMPLE_2COL. ---- We shall use DM$VT and DM$VA to display the Top-10 frequent itemsets ---- and Top-10 association rules SELECT view_name, view_type FROM user_mining_model_views WHERE model_name='AR_SH_SAMPLE_2COL' ORDER BY view_name; set echo off column item_name format a40 select * from ( select item_name, support, number_of_items from DM$VTAR_SH_SAMPLE_2COL ORDER BY number_of_items, support ) where rownum <=10 ORDER BY number_of_items, support, item_name; select * from ( SELECT antecedent_predicate antecedent, consequent_predicate consequent, rule_support supp, rule_confidence conf, number_of_items num from DM$VAAR_SH_SAMPLE_2COL ORDER BY rule_confidence DESC, rule_support DESC) WHERE ROWNUM <=10 order by antecedent, consequent; set echo on
the_stack
-- -- Selected TOC Entries: -- -- -- TOC Entry ID 1 (OID 0) -- -- Name: booktown Type: DATABASE Owner: postgres -- Create Database "booktown"; \connect booktown jharris BEGIN; -- -- TOC Entry ID 2 (OID 2991542) -- -- Name: DATABASE "booktown" Type: COMMENT Owner: -- COMMENT ON DATABASE "booktown" IS 'The Book Town Database.'; -- -- TOC Entry ID 33 (OID 3629264) -- -- Name: books Type: TABLE Owner: manager -- CREATE TABLE "books" ( "id" integer NOT NULL, "title" text NOT NULL, "author_id" integer, "subject_id" integer, Constraint "books_id_pkey" Primary Key ("id") ); CREATE TABLE "publishers" ( "id" integer NOT NULL, "name" text, "address" text, Constraint "publishers_pkey" Primary Key ("id") ); CREATE TABLE "authors" ( "id" integer NOT NULL, "last_name" text, "first_name" text, Constraint "authors_pkey" Primary Key ("id") ); CREATE TABLE "numeric_values" ( "num" numeric(30,6) ); -- -- TOC Entry ID 20 (OID 3390866) -- -- Name: daily_inventory Type: TABLE Owner: postgres -- CREATE TABLE "daily_inventory" ( "isbn" text, "is_stocked" boolean ); -- -- TOC Entry ID 21 (OID 3391084) -- -- Name: money_example Type: TABLE Owner: postgres -- CREATE TABLE "money_example" ( "money_cash" money, "numeric_cash" numeric(6,2) ); -- -- TOC Entry ID 22 (OID 3391184) -- -- Name: shipments Type: TABLE Owner: postgres -- CREATE TABLE "shipments" ( "id" integer DEFAULT nextval('"shipments_ship_id_seq"'::text) NOT NULL, "customer_id" integer, "isbn" text, "ship_date" timestamp with time zone ); -- -- TOC Entry ID 24 (OID 3391454) -- -- Name: customers Type: TABLE Owner: manager -- CREATE TABLE "customers" ( "id" integer NOT NULL, "last_name" text, "first_name" text, Constraint "customers_pkey" Primary Key ("id") ); -- -- TOC Entry ID 15 (OID 3389632) -- -- Name: states Type: TABLE Owner: postgres -- CREATE TABLE "states" ( "id" integer NOT NULL, "name" text, "abbreviation" character(2), Constraint "state_pkey" Primary Key ("id") ); -- -- TOC Entry ID 16 (OID 3389702) -- -- Name: my_list Type: TABLE Owner: postgres -- CREATE TABLE "my_list" ( "todos" text ); -- -- TOC Entry ID 17 (OID 3390348) -- -- Name: stock Type: TABLE Owner: postgres -- CREATE TABLE "stock" ( "isbn" text NOT NULL, "cost" numeric(5,2), "retail" numeric(5,2), "stock" integer, Constraint "stock_pkey" Primary Key ("isbn") ); CREATE TABLE "book_queue" ( "title" text NOT NULL, "author_id" integer, "subject_id" integer, "approved" boolean ); CREATE TABLE "stock_backup" ( "isbn" text, "cost" numeric(5,2), "retail" numeric(5,2), "stock" integer ); CREATE TABLE "favorite_books" ( "employee_id" integer, "books" text[] ); CREATE TABLE "employees" ( "id" integer NOT NULL, "last_name" text NOT NULL, "first_name" text, CONSTRAINT "employees_id" CHECK ((id > 100)), Constraint "employees_pkey" Primary Key ("id") ); CREATE TABLE "editions" ( "isbn" text NOT NULL, "book_id" integer, "edition" integer, "publisher_id" integer, "publication" date, "type" character(1), CONSTRAINT "integrity" CHECK (((book_id NOTNULL) AND (edition NOTNULL))), Constraint "pkey" Primary Key ("isbn") ); CREATE TABLE "distinguished_authors" ( "award" text ) INHERITS ("authors"); CREATE TABLE "favorite_authors" ( "employee_id" integer, "authors_and_titles" text[] ); CREATE TABLE "text_sorting" ( "letter" character(1) ); CREATE TABLE "subjects" ( "id" integer NOT NULL, "subject" text, "location" text, Constraint "subjects_pkey" Primary Key ("id") ); CREATE TABLE "alternate_stock" ( "isbn" text, "cost" numeric(5,2), "retail" numeric(5,2), "stock" integer ); -- -- TOC Entry ID 40 (OID 3752020) -- -- Name: book_backup Type: TABLE Owner: postgres -- CREATE TABLE "book_backup" ( "id" integer, "title" text, "author_id" integer, "subject_id" integer ); CREATE TABLE "schedules" ( "employee_id" integer NOT NULL, "schedule" text, Constraint "schedules_pkey" Primary Key ("employee_id") ); COPY "publishers" FROM stdin; 150 Kids Can Press Kids Can Press, 29 Birch Ave. Toronto,ONM4V 1E2 91 Henry Holt & Company, Inc. Henry Holt & Company, Inc. 115 West 18th Street New York, NY 10011 113 O'Reilly & Associates O'Reilly & Associates, Inc. 101 Morris St, Sebastopol, CA 95472 62 Watson-Guptill Publications 1515 Boradway, New York, NY 10036 105 Noonday Press Farrar Straus & Giroux Inc, 19 Union Square W, New York, NY 10003 99 Ace Books The Berkley Publishing Group, Penguin Putnam Inc, 375 Hudson St, New York, NY 10014 101 Roc Penguin Putnam Inc, 375 Hudson St, New York, NY 10014 163 Mojo Press Mojo Press, PO Box 1215, Dripping Springs, TX 78720 171 Books of Wonder Books of Wonder, 16 W. 18th St. New York, NY, 10011 102 Penguin Penguin Putnam Inc, 375 Hudson St, New York, NY 10014 75 Doubleday Random House, Inc, 1540 Broadway, New York, NY 10036 65 HarperCollins HarperCollins Publishers, 10 E 53rd St, New York, NY 10022 59 Random House Random House, Inc, 1540 Broadway, New York, NY 10036 \. -- -- Data for TOC Entry ID 113 (OID 3389594) -- -- Name: authors Type: TABLE DATA Owner: manager -- COPY "authors" FROM stdin; 1111 Denham Ariel 1212 Worsley John 15990 Bourgeois Paulette 25041 Bianco Margery Williams 16 Alcott Louisa May 4156 King Stephen 1866 Herbert Frank 1644 Hogarth Burne 2031 Brown Margaret Wise 115 Poe Edgar Allen 7805 Lutz Mark 7806 Christiansen Tom 1533 Brautigan Richard 1717 Brite Poppy Z. 2112 Gorey Edward 2001 Clarke Arthur C. 1213 Brookins Andrew \. -- -- Data for TOC Entry ID 114 (OID 3389632) -- -- Name: states Type: TABLE DATA Owner: postgres -- COPY "states" FROM stdin; 42 Washington WA 51 Oregon OR \. -- -- Data for TOC Entry ID 115 (OID 3389702) -- -- Name: my_list Type: TABLE DATA Owner: postgres -- COPY "my_list" FROM stdin; Pick up laundry. Send out bills. Wrap up Grand Unifying Theory for publication. \. -- -- Data for TOC Entry ID 116 (OID 3390348) -- -- Name: stock Type: TABLE DATA Owner: postgres -- COPY "stock" FROM stdin; 0385121679 29.00 36.95 65 039480001X 30.00 32.95 31 0394900014 23.00 23.95 0 044100590X 36.00 45.95 89 0441172717 17.00 21.95 77 0451160916 24.00 28.95 22 0451198492 36.00 46.95 0 0451457994 17.00 22.95 0 0590445065 23.00 23.95 10 0679803335 20.00 24.95 18 0694003611 25.00 28.95 50 0760720002 18.00 23.95 28 0823015505 26.00 28.95 16 0929605942 19.00 21.95 25 1885418035 23.00 24.95 77 0394800753 16.00 16.95 4 \. -- -- Data for TOC Entry ID 117 (OID 3390653) -- -- Name: numeric_values Type: TABLE DATA Owner: postgres -- COPY "numeric_values" FROM stdin; 68719476736.000000 68719476737.000000 6871947673778.000000 999999999999999999999999.999900 999999999999999999999999.999999 -999999999999999999999999.999999 -100000000000000000000000.999999 1.999999 2.000000 2.000000 999999999999999999999999.999999 999999999999999999999999.000000 \. -- -- Data for TOC Entry ID 118 (OID 3390866) -- -- Name: daily_inventory Type: TABLE DATA Owner: postgres -- COPY "daily_inventory" FROM stdin; 039480001X t 044100590X t 0451198492 f 0394900014 f 0441172717 t 0451160916 f 0385121679 \N \. -- -- Data for TOC Entry ID 119 (OID 3391084) -- -- Name: money_example Type: TABLE DATA Owner: postgres -- COPY "money_example" FROM stdin; $12.24 12.24 \. -- -- Data for TOC Entry ID 120 (OID 3391184) -- -- Name: shipments Type: TABLE DATA Owner: postgres -- COPY "shipments" FROM stdin; 375 142 039480001X 2001-08-06 09:29:21-07 323 671 0451160916 2001-08-14 10:36:41-07 998 1045 0590445065 2001-08-12 12:09:47-07 749 172 0694003611 2001-08-11 10:52:34-07 662 655 0679803335 2001-08-09 07:30:07-07 806 1125 0760720002 2001-08-05 09:34:04-07 102 146 0394900014 2001-08-11 13:34:08-07 813 112 0385121679 2001-08-08 09:53:46-07 652 724 1885418035 2001-08-14 13:41:39-07 599 430 0929605942 2001-08-10 08:29:42-07 969 488 0441172717 2001-08-14 08:42:58-07 433 898 044100590X 2001-08-12 08:46:35-07 660 409 0451457994 2001-08-07 11:56:42-07 310 738 0451198492 2001-08-15 14:02:01-07 510 860 0823015505 2001-08-14 07:33:47-07 997 185 039480001X 2001-08-10 13:47:52-07 999 221 0451160916 2001-08-14 13:45:51-07 56 880 0590445065 2001-08-14 13:49:00-07 72 574 0694003611 2001-08-06 07:49:44-07 146 270 039480001X 2001-08-13 09:42:10-07 981 652 0451160916 2001-08-08 08:36:44-07 95 480 0590445065 2001-08-10 07:29:52-07 593 476 0694003611 2001-08-15 11:57:40-07 977 853 0679803335 2001-08-09 09:30:46-07 117 185 0760720002 2001-08-07 13:00:48-07 406 1123 0394900014 2001-08-13 09:47:04-07 340 1149 0385121679 2001-08-12 13:39:22-07 871 388 1885418035 2001-08-07 11:31:57-07 1000 221 039480001X 2001-09-14 16:46:32-07 1001 107 039480001X 2001-09-14 17:42:22-07 754 107 0394800753 2001-08-11 09:55:05-07 458 107 0394800753 2001-08-07 10:58:36-07 189 107 0394800753 2001-08-06 11:46:36-07 720 107 0394800753 2001-08-08 10:46:13-07 1002 107 0394800753 2001-09-22 11:23:28-07 2 107 0394800753 2001-09-22 20:58:56-07 \. -- -- Data for TOC Entry ID 121 (OID 3391454) -- -- Name: customers Type: TABLE DATA Owner: manager -- COPY "customers" FROM stdin; 107 Jackson Annie 112 Gould Ed 142 Allen Chad 146 Williams James 172 Brown Richard 185 Morrill Eric 221 King Jenny 270 Bollman Julie 388 Morrill Royce 409 Holloway Christine 430 Black Jean 476 Clark James 480 Thomas Rich 488 Young Trevor 574 Bennett Laura 652 Anderson Jonathan 655 Olson Dave 671 Brown Chuck 723 Eisele Don 724 Holloway Adam 738 Gould Shirley 830 Robertson Royce 853 Black Wendy 860 Owens Tim 880 Robinson Tammy 898 Gerdes Kate 964 Gould Ramon 1045 Owens Jean 1125 Bollman Owen 1149 Becker Owen 1123 Corner Kathy \. -- -- Data for TOC Entry ID 122 (OID 3574043) -- -- Name: book_queue Type: TABLE DATA Owner: postgres -- COPY "book_queue" FROM stdin; Learning Python 7805 4 t Perl Cookbook 7806 4 t \. -- -- Data for TOC Entry ID 123 (OID 3574983) -- -- Name: stock_backup Type: TABLE DATA Owner: postgres -- COPY "stock_backup" FROM stdin; 0385121679 29.00 36.95 65 039480001X 30.00 32.95 31 0394800753 16.00 16.95 0 0394900014 23.00 23.95 0 044100590X 36.00 45.95 89 0441172717 17.00 21.95 77 0451160916 24.00 28.95 22 0451198492 36.00 46.95 0 0451457994 17.00 22.95 0 0590445065 23.00 23.95 10 0679803335 20.00 24.95 18 0694003611 25.00 28.95 50 0760720002 18.00 23.95 28 0823015505 26.00 28.95 16 0929605942 19.00 21.95 25 1885418035 23.00 24.95 77 \. -- -- Data for TOC Entry ID 124 (OID 3628247) -- -- Name: favorite_books Type: TABLE DATA Owner: manager -- COPY "favorite_books" FROM stdin; 102 {"The Hitchhiker's Guide to the Galaxy","The Restauraunt at the End of the Universe"} 103 {"There and Back Again: A Hobbit's Holiday","Kittens Squared"} \. -- -- Data for TOC Entry ID 125 (OID 3628899) -- -- Name: employees Type: TABLE DATA Owner: postgres -- COPY "employees" FROM stdin; 101 Appel Vincent 102 Holloway Michael 105 Connoly Sarah 104 Noble Ben 103 Joble David 106 Hall Timothy 1008 Williams \N \. -- -- Data for TOC Entry ID 126 (OID 3629174) -- -- Name: editions Type: TABLE DATA Owner: manager -- COPY "editions" FROM stdin; 039480001X 1608 1 59 1957-03-01 h 0451160916 7808 1 75 1981-08-01 p 0394800753 1590 1 59 1949-03-01 p 0590445065 25908 1 150 1987-03-01 p 0694003611 1501 1 65 1947-03-04 p 0679803335 1234 1 102 1922-01-01 p 0760720002 190 1 91 1868-01-01 p 0394900014 1608 1 59 1957-01-01 p 0385121679 7808 2 75 1993-10-01 h 1885418035 156 1 163 1995-03-28 p 0929605942 156 2 171 1998-12-01 p 0441172717 4513 2 99 1998-09-01 p 044100590X 4513 3 99 1999-10-01 h 0451457994 4267 3 101 2000-09-12 p 0451198492 4267 3 101 1999-10-01 h 0823015505 2038 1 62 1958-01-01 p 0596000855 41473 2 113 2001-03-01 p \. -- -- Data for TOC Entry ID 127 (OID 3629264) -- -- Name: books Type: TABLE DATA Owner: manager -- COPY "books" FROM stdin; 7808 The Shining 4156 9 4513 Dune 1866 15 4267 2001: A Space Odyssey 2001 15 1608 The Cat in the Hat 1809 2 1590 Bartholomew and the Oobleck 1809 2 25908 Franklin in the Dark 15990 2 1501 Goodnight Moon 2031 2 190 Little Women 16 6 1234 The Velveteen Rabbit 25041 3 2038 Dynamic Anatomy 1644 0 156 The Tell-Tale Heart 115 9 41473 Programming Python 7805 4 41477 Learning Python 7805 4 41478 Perl Cookbook 7806 4 41472 Practical PostgreSQL 1212 4 \. -- -- Data for TOC Entry ID 128 (OID 3629424) -- -- Name: distinguished_authors Type: TABLE DATA Owner: manager -- COPY "distinguished_authors" FROM stdin; 25043 Simon Neil Pulitzer Prize 1809 Geisel Theodor Seuss Pulitzer Prize \. -- -- Data for TOC Entry ID 129 (OID 3727889) -- -- Name: favorite_authors Type: TABLE DATA Owner: manager -- COPY "favorite_authors" FROM stdin; 102 {{"J.R.R. Tolkien","The Silmarillion"},{"Charles Dickens","Great Expectations"},{"Ariel Denham","Attic Lives"}} \. -- -- Data for TOC Entry ID 130 (OID 3751599) -- -- Name: text_sorting Type: TABLE DATA Owner: postgres -- COPY "text_sorting" FROM stdin; 0 1 2 3 A B C D a b c d \. -- -- Data for TOC Entry ID 131 (OID 3751882) -- -- Name: subjects Type: TABLE DATA Owner: postgres -- COPY "subjects" FROM stdin; 0 Arts Creativity St 1 Business Productivity Ave 2 Children's Books Kids Ct 3 Classics Academic Rd 4 Computers Productivity Ave 5 Cooking Creativity St 6 Drama Main St 7 Entertainment Main St 8 History Academic Rd 9 Horror Black Raven Dr 10 Mystery Black Raven Dr 11 Poetry Sunset Dr 12 Religion \N 13 Romance Main St 14 Science Productivity Ave 15 Science Fiction Main St \. -- -- Data for TOC Entry ID 132 (OID 3751975) -- -- Name: alternate_stock Type: TABLE DATA Owner: postgres -- COPY "alternate_stock" FROM stdin; 0385121679 29.00 36.95 65 039480001X 30.00 32.95 31 0394900014 23.00 23.95 0 044100590X 36.00 45.95 89 0441172717 17.00 21.95 77 0451160916 24.00 28.95 22 0451198492 36.00 46.95 0 0451457994 17.00 22.95 0 0590445065 23.00 23.95 10 0679803335 20.00 24.95 18 0694003611 25.00 28.95 50 0760720002 18.00 23.95 28 0823015505 26.00 28.95 16 0929605942 19.00 21.95 25 1885418035 23.00 24.95 77 0394800753 16.00 16.95 4 \. -- -- Data for TOC Entry ID 133 (OID 3752020) -- -- Name: book_backup Type: TABLE DATA Owner: postgres -- COPY "book_backup" FROM stdin; 7808 The Shining 4156 9 4513 Dune 1866 15 4267 2001: A Space Odyssey 2001 15 1608 The Cat in the Hat 1809 2 1590 Bartholomew and the Oobleck 1809 2 25908 Franklin in the Dark 15990 2 1501 Goodnight Moon 2031 2 190 Little Women 16 6 1234 The Velveteen Rabbit 25041 3 2038 Dynamic Anatomy 1644 0 156 The Tell-Tale Heart 115 9 41472 Practical PostgreSQL 1212 4 41473 Programming Python 7805 4 41477 Learning Python 7805 4 41478 Perl Cookbook 7806 4 7808 The Shining 4156 9 4513 Dune 1866 15 4267 2001: A Space Odyssey 2001 15 1608 The Cat in the Hat 1809 2 1590 Bartholomew and the Oobleck 1809 2 25908 Franklin in the Dark 15990 2 1501 Goodnight Moon 2031 2 190 Little Women 16 6 1234 The Velveteen Rabbit 25041 3 2038 Dynamic Anatomy 1644 0 156 The Tell-Tale Heart 115 9 41473 Programming Python 7805 4 41477 Learning Python 7805 4 41478 Perl Cookbook 7806 4 41472 Practical PostgreSQL 1212 4 \. -- -- Data for TOC Entry ID 134 (OID 4063343) -- -- Name: schedules Type: TABLE DATA Owner: postgres -- COPY "schedules" FROM stdin; 102 Mon - Fri, 9am - 5pm \. COMMIT;
the_stack
/*========================================================== 1. 创建数据库 ===========================================================*/ USE [master] GO --删除数据库 EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'Log' GO IF EXISTS (SELECT name FROM sys.databases WHERE name = N'Log') Begin DROP DATABASE [Log] End GO --创建数据库 CREATE DATABASE [Log] GO /*========================================================== 2. 创建架构 ===========================================================*/ USE [Log] GO /* 1. 日志模块[Logs] */ IF EXISTS (SELECT * FROM sys.schemas WHERE name = N'Logs') DROP SCHEMA [Logs] GO CREATE SCHEMA [Logs] AUTHORIZATION [dbo] GO /*========================================================== 3. 创建表及索引 ===========================================================*/ if exists (select 1 from sysobjects where id = object_id('Logs.Log') and type = 'U') drop table Logs.Log go /*==============================================================*/ /* Table: Log */ /*==============================================================*/ create table Logs.Log ( Id bigint identity, TraceId nvarchar(50) not null, BusinessId nvarchar(50) null, LogName nvarchar(100) not null, Level nvarchar(20) not null, OperationTime nvarchar(30) not null, Duration nvarchar(50) null, Url nvarchar(500) null, Tenant nvarchar(100) null, Application nvarchar(200) null, Module nvarchar(500) null, Class nvarchar(500) null, Method nvarchar(200) null, Params nvarchar(max) null, Caption nvarchar(500) null, Content nvarchar(max) null, Sql nvarchar(max) null, SqlParams nvarchar(max) null, ErrorCode nvarchar(30) null, ErrorMessage nvarchar(2000) null, StackTrace nvarchar(max) null, UserId nvarchar(50) null, Operator nvarchar(50) null, Role nvarchar(500) null, Ip nvarchar(50) null, Host nvarchar(200) null, ThreadId nvarchar(20) null, Browser nvarchar(2000) null, constraint PK_LOG primary key (Id) ) go if exists (select 1 from sys.extended_properties where major_id = object_id('Logs.Log') and minor_id = 0) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log' end execute sp_addextendedproperty 'MS_Description', '日志', 'schema', 'Logs', 'table', 'Log' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Id' end execute sp_addextendedproperty 'MS_Description', '日志编号', 'schema', 'Logs', 'table', 'Log', 'column', 'Id' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'TraceId') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'TraceId' end execute sp_addextendedproperty 'MS_Description', '跟踪号', 'schema', 'Logs', 'table', 'Log', 'column', 'TraceId' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'BusinessId') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'BusinessId' end execute sp_addextendedproperty 'MS_Description', '业务标识', 'schema', 'Logs', 'table', 'Log', 'column', 'BusinessId' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'LogName') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'LogName' end execute sp_addextendedproperty 'MS_Description', '日志名称', 'schema', 'Logs', 'table', 'Log', 'column', 'LogName' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Level') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Level' end execute sp_addextendedproperty 'MS_Description', '日志级别', 'schema', 'Logs', 'table', 'Log', 'column', 'Level' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OperationTime') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'OperationTime' end execute sp_addextendedproperty 'MS_Description', '操作时间', 'schema', 'Logs', 'table', 'Log', 'column', 'OperationTime' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Duration') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Duration' end execute sp_addextendedproperty 'MS_Description', '执行时间', 'schema', 'Logs', 'table', 'Log', 'column', 'Duration' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Url') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Url' end execute sp_addextendedproperty 'MS_Description', '请求地址', 'schema', 'Logs', 'table', 'Log', 'column', 'Url' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Tenant') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Tenant' end execute sp_addextendedproperty 'MS_Description', '租户', 'schema', 'Logs', 'table', 'Log', 'column', 'Tenant' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Application') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Application' end execute sp_addextendedproperty 'MS_Description', '应用程序', 'schema', 'Logs', 'table', 'Log', 'column', 'Application' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Module') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Module' end execute sp_addextendedproperty 'MS_Description', '模块', 'schema', 'Logs', 'table', 'Log', 'column', 'Module' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Class') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Class' end execute sp_addextendedproperty 'MS_Description', '类名', 'schema', 'Logs', 'table', 'Log', 'column', 'Class' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Method') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Method' end execute sp_addextendedproperty 'MS_Description', '方法', 'schema', 'Logs', 'table', 'Log', 'column', 'Method' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Params') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Params' end execute sp_addextendedproperty 'MS_Description', '参数', 'schema', 'Logs', 'table', 'Log', 'column', 'Params' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Caption') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Caption' end execute sp_addextendedproperty 'MS_Description', '标题', 'schema', 'Logs', 'table', 'Log', 'column', 'Caption' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Content') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Content' end execute sp_addextendedproperty 'MS_Description', '内容', 'schema', 'Logs', 'table', 'Log', 'column', 'Content' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Sql') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Sql' end execute sp_addextendedproperty 'MS_Description', 'Sql语句', 'schema', 'Logs', 'table', 'Log', 'column', 'Sql' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'SqlParams') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'SqlParams' end execute sp_addextendedproperty 'MS_Description', 'Sql参数', 'schema', 'Logs', 'table', 'Log', 'column', 'SqlParams' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ErrorCode') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'ErrorCode' end execute sp_addextendedproperty 'MS_Description', '错误码', 'schema', 'Logs', 'table', 'Log', 'column', 'ErrorCode' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ErrorMessage') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'ErrorMessage' end execute sp_addextendedproperty 'MS_Description', '错误消息', 'schema', 'Logs', 'table', 'Log', 'column', 'ErrorMessage' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'StackTrace') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'StackTrace' end execute sp_addextendedproperty 'MS_Description', '堆栈跟踪', 'schema', 'Logs', 'table', 'Log', 'column', 'StackTrace' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'UserId') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'UserId' end execute sp_addextendedproperty 'MS_Description', '操作人标识', 'schema', 'Logs', 'table', 'Log', 'column', 'UserId' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Operator') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Operator' end execute sp_addextendedproperty 'MS_Description', '操作人', 'schema', 'Logs', 'table', 'Log', 'column', 'Operator' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Role') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Role' end execute sp_addextendedproperty 'MS_Description', '操作人角色', 'schema', 'Logs', 'table', 'Log', 'column', 'Role' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Ip') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Ip' end execute sp_addextendedproperty 'MS_Description', 'IP地址', 'schema', 'Logs', 'table', 'Log', 'column', 'Ip' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Host') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Host' end execute sp_addextendedproperty 'MS_Description', '主机', 'schema', 'Logs', 'table', 'Log', 'column', 'Host' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ThreadId') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'ThreadId' end execute sp_addextendedproperty 'MS_Description', '线程号', 'schema', 'Logs', 'table', 'Log', 'column', 'ThreadId' go if exists(select 1 from sys.extended_properties p where p.major_id = object_id('Logs.Log') and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Browser') ) begin execute sp_dropextendedproperty 'MS_Description', 'schema', 'Logs', 'table', 'Log', 'column', 'Browser' end execute sp_addextendedproperty 'MS_Description', '浏览器', 'schema', 'Logs', 'table', 'Log', 'column', 'Browser' go
the_stack
USE [DB_DBA] GO IF SCHEMA_ID('Perfmon') IS NULL BEGIN DECLARE @SQL NVARCHAR(MAX) = N'CREATE SCHEMA [Perfmon]' EXEC (@SQL) END GO IF OBJECT_ID('Perfmon.CounterCollector') IS NOT NULL DROP TABLE [Perfmon].[CounterCollector] IF OBJECT_ID('Perfmon.CounterCollectorProcesses') IS NOT NULL DROP TABLE [Perfmon].[CounterCollectorProcesses] IF OBJECT_ID('Perfmon.Counters') IS NOT NULL DROP TABLE [Perfmon].[Counters] IF OBJECT_ID('Perfmon.CountersType') IS NOT NULL DROP TABLE [Perfmon].[CountersType] CREATE TABLE [Perfmon].[CounterCollectorProcesses] ( Id BIGINT NOT NULL IDENTITY CONSTRAINT [PK_CounterCollectorProcesses] PRIMARY KEY CLUSTERED, StartDateTime DATETIME2 NOT NULL CONSTRAINT [DF_CounterCollectorProcesses_StartDateTime] DEFAULT (SYSDATETIME()) , EndDateTime DATETIME2 NULL, DurationSec AS DATEDIFF(second,StartDateTime,EndDateTime) ) CREATE TABLE [Perfmon].[CountersType] ( Id INT NOT NULL IDENTITY CONSTRAINT [PK_CountersType] PRIMARY KEY CLUSTERED, Origin NVARCHAR(4000) ) SET IDENTITY_INSERT [Perfmon].[CountersType] ON INSERT INTO [Perfmon].[CountersType] (Id,Origin) VALUES (1,N'sys.dm_os_performance_counters') SET IDENTITY_INSERT [Perfmon].[CountersType] OFF CREATE TABLE [Perfmon].[Counters] ( Id BIGINT NOT NULL IDENTITY CONSTRAINT [PK_CounterList] PRIMARY KEY CLUSTERED, TypeId INT NOT NULL CONSTRAINT [FK_Counters_CountersType_TypeId_Id] FOREIGN KEY REFERENCES [Perfmon].[CountersType](Id), CounterName NVARCHAR(4000) NOT NULL, InstanceName NVARCHAR(4000) NULL, ObjectName NVARCHAR(4000) NULL ) SET IDENTITY_INSERT [Perfmon].[Counters] ON INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (1, 1, N'Average Wait Time (ms)', N'_Total', N'MSSQL$INSTANCE1:Locks') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (2, 1, N'Buffer cache hit ratio', N'', N'MSSQL$INSTANCE1:Buffer Manager') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (3, 1, N'CPU usage %', N'default', N'MSSQL$INSTANCE1:Workload Group Stats') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (4, 1, N'Data File(s) Size (KB)', N'_Total', N'MSSQL$INSTANCE1:Databases') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (5, 1, N'Free Memory (KB)', N'', N'MSSQL$INSTANCE1:Memory Manager') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (6, 1, N'Log File(s) Size (KB)', N'_Total', N'MSSQL$INSTANCE1:Databases') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (7, 1, N'Log Send Queue', N'_Total', N'MSSQL$INSTANCE1:Database Replica') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (8, 1, N'Memory Grants Pending', N'', N'MSSQL$INSTANCE1:Memory Manager') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (9, 1, N'Open Connection Count', N'', N'MSSQL$INSTANCE1:Broker/DBM Transport') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (10, 1, N'Page life expectancy', N'', N'MSSQL$INSTANCE1:Buffer Manager') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (11, 1, N'Processes blocked', N'', N'MSSQL$INSTANCE1:General Statistics') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (12, 1, N'Queued requests', N'default', N'MSSQL$INSTANCE1:Workload Group Stats') INSERT [Perfmon].[Counters] ([Id], [TypeId], [CounterName], [InstanceName], [ObjectName]) VALUES (13, 1, N'Transactions/sec', N'_Total', N'MSSQL$INSTANCE1:Databases') SET IDENTITY_INSERT [Perfmon].[Counters] OFF CREATE TABLE [Perfmon].[CounterCollector] ( Id BIGINT NOT NULL IDENTITY CONSTRAINT [PK_CounterCollector] PRIMARY KEY CLUSTERED, ProcesseId BIGINT NOT NULL CONSTRAINT [FK_CounterCollector_CounterCollectorProcesses_ProcesseId_Id] FOREIGN KEY REFERENCES [Perfmon].[CounterCollectorProcesses](Id), CounterId BIGINT NOT NULL CONSTRAINT [FK_CounterCollector_Counter_CounterId_Id] FOREIGN KEY REFERENCES [Perfmon].[Counters](Id), CounterValue BIGINT NOT NULL ) GO --------------------------------------------- -----------Capture Snapshot script----------- --------------------------------------------- IF EXISTS(SELECT TOP 1 1 FROM SYS.procedures WHERE object_id = OBJECT_ID('Perfmon.usp_CounterCollector')) DROP PROCEDURE [Perfmon].[usp_CounterCollector] GO CREATE PROCEDURE [Perfmon].[usp_CounterCollector] AS BEGIN BEGIN TRY BEGIN TRAN DECLARE @ProcesseId BIGINT INSERT INTO [Perfmon].[CounterCollectorProcesses] (StartDateTime) VALUES (DEFAULT) SELECT @ProcesseId = SCOPE_IDENTITY() INSERT INTO [Perfmon].[CounterCollector](ProcesseId,CounterId,CounterValue) SELECT @ProcesseId,[Counters].[Id],OPC.[cntr_value] FROM sys.dm_os_performance_counters OPC JOIN [Perfmon].[Counters] ON [Counters].[CounterName] = [OPC].[counter_name] AND [Counters].[InstanceName] = [OPC].[instance_name] AND [Counters].[ObjectName] = [OPC].[object_name] AND [Counters].[TypeId] = 1 UPDATE [Perfmon].[CounterCollectorProcesses] SET EndDateTime = SYSDATETIME() WHERE Id = @ProcesseId COMMIT END TRY BEGIN CATCH IF @@TRANCOUNT > 0 ROLLBACK; THROW; END CATCH; END GO USE [msdb] GO DECLARE @jobId BINARY(16) EXEC msdb.dbo.sp_add_job @job_name=N'StatisticsCollector', @enabled=1, @notify_level_eventlog=0, @notify_level_email=2, @notify_level_netsend=2, @notify_level_page=2, @delete_level=0, @category_name=N'Data Collector', @owner_login_name=N'sa', @job_id = @jobId OUTPUT select @jobId GO EXEC msdb.dbo.sp_add_jobserver @job_name=N'StatisticsCollector', @server_name = N'WIN-4N0UG99QPHC\INSTANCE1' GO USE [msdb] GO EXEC msdb.dbo.sp_add_jobstep @job_name=N'StatisticsCollector', @step_name=N'PerfmonCollector', @step_id=1, @cmdexec_success_code=0, @on_success_action=1, @on_fail_action=2, @retry_attempts=0, @retry_interval=0, @os_run_priority=0, @subsystem=N'TSQL', @command=N'EXEC [Perfmon].[usp_CounterCollector]', @database_name=N'DB_DBA', @flags=0 GO USE [msdb] GO EXEC msdb.dbo.sp_update_job @job_name=N'StatisticsCollector', @enabled=1, @start_step_id=1, @notify_level_eventlog=0, @notify_level_email=2, @notify_level_netsend=2, @notify_level_page=2, @delete_level=0, @description=N'', @category_name=N'Data Collector', @owner_login_name=N'WIN-4N0UG99QPHC\MADEIRA', @notify_email_operator_name=N'', @notify_netsend_operator_name=N'', @notify_page_operator_name=N'' GO USE [msdb] GO DECLARE @schedule_id int EXEC msdb.dbo.sp_add_jobschedule @job_name=N'StatisticsCollector', @name=N'Daily-5Min', @enabled=1, @freq_type=4, @freq_interval=1, @freq_subday_type=4, @freq_subday_interval=5, @freq_relative_interval=0, @freq_recurrence_factor=1, @active_start_date=20141110, @active_end_date=99991231, @active_start_time=0, @active_end_time=235959, @schedule_id = @schedule_id OUTPUT select @schedule_id GO --------------------------------------------- -----------Generate report script------------ --------------------------------------------- USE DB_DBA GO CREATE PROCEDURE [Perfmon].[usp_SendReport] AS BEGIN DECLARE @html NVARCHAR(MAX) WITH T AS ( SELECT DatesRangeId = DatesRange.Id, DatesRange = DatesRange.Name, [CounterCollector].[CounterId], A.[CounterFullName], MaxCounterValue = CAST(MAX([CounterValue]) AS DECIMAL(23,2)), MinCounterValue = CAST(MIN([CounterValue]) AS DECIMAL(23,2)), AVGCounterValue = CAST(AVG([CounterValue]) AS DECIMAL(23,2)) FROM [Perfmon].[CounterCollector] JOIN [Perfmon].[CounterCollectorProcesses] ON [CounterCollectorProcesses].[Id] = [CounterCollector].[ProcesseId] JOIN [Perfmon].[Counters] ON [Counters].[Id] = [CounterCollector].[CounterId] JOIN ( VALUES (1,N'Last 24 Hours',DATEADD(DAY,-1,SYSDATETIME()),SYSDATETIME()), (2,N'One Week Ago',DATEADD(DAY,-8,SYSDATETIME()),DATEADD(DAY,-7,SYSDATETIME())), (3,N'One Month Ago',DATEADD(DAY,-29,SYSDATETIME()),DATEADD(DAY,-28,SYSDATETIME())), (4,N'One Year Ago',DATEADD(DAY,-365,SYSDATETIME()),DATEADD(DAY,-364,SYSDATETIME())) )DatesRange(Id,Name,StartDateTime,EndDateTime) ON [CounterCollectorProcesses].StartDateTime >= DatesRange.StartDateTime AND [CounterCollectorProcesses].StartDateTime <= DatesRange.EndDateTime CROSS APPLY (SELECT [CounterFullName] = [Counters].[CounterName]+CASE WHEN [Counters].[InstanceName] = N'' OR [Counters].[InstanceName] IS NULL THEN N'' ELSE N'('+[Counters].[InstanceName]+N')' END) A GROUP BY [CounterCollector].[CounterId],A.[CounterFullName],DatesRange.Name,DatesRange.Id) SELECT @html = CONVERT (VARCHAR(MAX),( SELECT 'td'= a,'td'= b,'td'= c,'td'= d,'td'= e,'td'= f,'td'= g,'td'= h, 'td'= i,'td'= j,'td'= k,'td'= l,'td'= m,'td'= n FROM ( SELECT a= CAST('<b>Counter Id</b>' AS XML) , b= CAST('<b>Counter Name</b>' AS XML) , c= CAST('<b>AVG Counter Value</b>' AS XML) , d= CAST('<b>Max Counter Value</b>' AS XML) , e= CAST('<b>Min Counter Value</b>' AS XML) , f= CAST('<b>AVG Week Ago</b>' AS XML) , g= CAST('<b>AVG Month Ago</b>' AS XML) , h= CAST('<b>AVG Year Ago</b>' AS XML) , i= CAST('<b>MAX Week Ago</b>' AS XML) , j= CAST('<b>MAX Month Ago</b>' AS XML) , k= CAST('<b>MAX Year Ago</b>' AS XML) , l= CAST('<b>MIN Week Ago</b>' AS XML) , m= CAST('<b>MIN Month Ago</b>' AS XML) , n= CAST('<b>MIN Year Ago</b>' AS XML) UNION ALL SELECT ISNULL(CAST(Last24Hours.CounterId AS NVARCHAR(MAX)) ,''), --[Counter Id] ISNULL(CAST(Last24Hours.CounterFullName AS NVARCHAR(MAX)) ,''), --[Counter Name] ISNULL(CAST(Last24Hours.AVGCounterValue AS NVARCHAR(MAX)) ,''), --[AVG Counter Value] ISNULL(CAST(Last24Hours.MaxCounterValue AS NVARCHAR(MAX)) ,''), --[Max Counter Value] ISNULL(CAST(Last24Hours.MinCounterValue AS NVARCHAR(MAX)) ,''), --[Min Counter Value] ISNULL(CAST(Change.[AVGComparedToAWeekAgo] AS NVARCHAR(MAX)) ,''), ISNULL(CAST(Change.[AVGComparedToAMonthAgo] AS NVARCHAR(MAX)) ,''), ISNULL(CAST(Change.[AVGComparedToAYearAgo] AS NVARCHAR(MAX)) ,''), ISNULL(CAST(Change.[MAXComparedToAWeekAgo] AS NVARCHAR(MAX)) ,''), ISNULL(CAST(Change.[MAXComparedToAMonthAgo] AS NVARCHAR(MAX)) ,''), ISNULL(CAST(Change.[MAXComparedToAYearAgo] AS NVARCHAR(MAX)) ,''), ISNULL(CAST(Change.[MINComparedToAWeekAgo] AS NVARCHAR(MAX)) ,''), ISNULL(CAST(Change.[MINComparedToAMonthAgo] AS NVARCHAR(MAX)) ,''), ISNULL(CAST(Change.[MINComparedToAYearAgo] AS NVARCHAR(MAX)) ,'') FROM T AS Last24Hours LEFT JOIN T AS OneWeekAgo ON Last24Hours.CounterId = OneWeekAgo.CounterId AND OneWeekAgo.DatesRangeId = 2 LEFT JOIN T AS OneMonthAgo ON Last24Hours.CounterId = OneMonthAgo.CounterId AND OneMonthAgo.DatesRangeId = 3 LEFT JOIN T AS OneYearAgo ON Last24Hours.CounterId = OneYearAgo.CounterId AND OneYearAgo.DatesRangeId = 4 CROSS APPLY (SELECT [AVGComparedToAWeekAgo] = FORMAT(CASE WHEN OneWeekAgo.AVGCounterValue = 0 THEN NULL ELSE (Last24Hours.AVGCounterValue-OneWeekAgo.AVGCounterValue)/OneWeekAgo.AVGCounterValue/100 END ,'p'), [AVGComparedToAMonthAgo] = FORMAT(CASE WHEN OneMonthAgo.AVGCounterValue = 0 THEN NULL ELSE (Last24Hours.AVGCounterValue-OneMonthAgo.AVGCounterValue)/OneMonthAgo.AVGCounterValue/100 END ,'p'), [AVGComparedToAYearAgo] = FORMAT(CASE WHEN OneYearAgo.AVGCounterValue = 0 THEN NULL ELSE (Last24Hours.AVGCounterValue-OneYearAgo.AVGCounterValue)/OneYearAgo.AVGCounterValue/100 END ,'p'), [MAXComparedToAWeekAgo] = FORMAT(CASE WHEN OneWeekAgo.MaxCounterValue = 0 THEN NULL ELSE (Last24Hours.MaxCounterValue-OneWeekAgo.MaxCounterValue)/OneWeekAgo.MaxCounterValue/100 END ,'p'), [MAXComparedToAMonthAgo] = FORMAT(CASE WHEN OneMonthAgo.MaxCounterValue = 0 THEN NULL ELSE (Last24Hours.MaxCounterValue-OneMonthAgo.MaxCounterValue)/OneMonthAgo.MaxCounterValue/100 END ,'p'), [MAXComparedToAYearAgo] = FORMAT(CASE WHEN OneYearAgo.MaxCounterValue = 0 THEN NULL ELSE (Last24Hours.MaxCounterValue-OneYearAgo.MaxCounterValue)/OneYearAgo.MaxCounterValue/100 END ,'p'), [MINComparedToAWeekAgo] = FORMAT(CASE WHEN OneWeekAgo.MinCounterValue = 0 THEN NULL ELSE (Last24Hours.MinCounterValue-OneWeekAgo.MinCounterValue)/OneWeekAgo.MinCounterValue/100 END ,'p'), [MINComparedToAMonthAgo] = FORMAT(CASE WHEN OneMonthAgo.MinCounterValue = 0 THEN NULL ELSE (Last24Hours.MinCounterValue-OneMonthAgo.MinCounterValue)/OneMonthAgo.MinCounterValue/100 END,'p'), [MINComparedToAYearAgo] = FORMAT(CASE WHEN OneYearAgo.MinCounterValue = 0 THEN NULL ELSE (Last24Hours.MinCounterValue-OneYearAgo.MinCounterValue)/OneYearAgo.MinCounterValue/100 END,'p') )Change WHERE Last24Hours.DatesRangeId = 1 ) a FOR XML RAW ('tr'),TYPE ,ELEMENTS ) ,1) SET @html = '<html><header></header><body><table align="center" border=1 width="100%">'+@html+'</table></body></html>' select @html EXEC msdb.dbo.sp_send_dbmail @body = @html , @recipients = 'dudu@madeira.co.il' , @subject = 'Performance Report' , @profile_name = 'sales.neworder gmail' , @body_format = 'HTML'; END
the_stack
-- -- Name: planet_osm_line_index; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_line_index ON planet_osm_line USING gist (way) WITH (fillfactor='100'); -- -- Name: planet_osm_point_aeroway_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_aeroway_idx ON planet_osm_point USING hash (aeroway); -- -- Name: planet_osm_point_amenity_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_amenity_idx ON planet_osm_point USING hash (amenity); -- -- Name: planet_osm_point_geography_aeroway_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_geography_aeroway_idx ON planet_osm_point_geography USING hash (aeroway); -- -- Name: planet_osm_point_geography_amenity_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_geography_amenity_idx ON planet_osm_point_geography USING hash (amenity); -- -- Name: planet_osm_point_geography_gway_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_geography_gway_idx ON planet_osm_point_geography USING gist (gway); -- -- Name: planet_osm_point_geography_railway_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_geography_railway_idx ON planet_osm_point_geography USING hash (railway); -- -- Name: planet_osm_point_geography_shop_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_geography_shop_idx ON planet_osm_point_geography USING btree (shop); -- -- Name: planet_osm_point_geography_way_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_geography_way_idx ON planet_osm_point_geography USING gist (way); -- -- Name: planet_osm_point_index; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_index ON planet_osm_point USING gist (way) WITH (fillfactor='100'); -- -- Name: planet_osm_point_railway_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_railway_idx ON planet_osm_point USING hash (railway); -- -- Name: planet_osm_point_shop_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_shop_idx ON planet_osm_point USING btree (shop); -- -- Name: planet_osm_point_station_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_station_idx ON planet_osm_point USING hash (station); -- -- Name: planet_osm_point_station_idx1; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_station_idx1 ON planet_osm_point USING btree (station) WHERE (station = 'subway'::text); -- -- Name: planet_osm_point_tourism_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_point_tourism_idx ON planet_osm_point USING hash (tourism); -- -- Name: planet_osm_polygon_amenity_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_polygon_amenity_idx ON planet_osm_polygon USING hash (amenity); -- -- Name: planet_osm_polygon_building_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_polygon_building_idx ON planet_osm_polygon USING btree (building); -- -- Name: planet_osm_polygon_building_landuse_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_polygon_building_landuse_idx ON planet_osm_polygon USING btree (building, landuse) WHERE ((landuse = 'industrial'::text) AND (building = 'industrial'::text)); -- -- Name: planet_osm_polygon_building_landuse_idx1; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_polygon_building_landuse_idx1 ON planet_osm_polygon USING btree (building, landuse); -- -- Name: planet_osm_polygon_index; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_polygon_index ON planet_osm_polygon USING gist (way) WITH (fillfactor='100'); -- -- Name: planet_osm_polygon_landuse_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_polygon_landuse_idx ON planet_osm_polygon USING hash (landuse); -- -- Name: planet_osm_polygon_leisure_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_polygon_leisure_idx ON planet_osm_polygon USING hash (leisure); -- -- Name: planet_osm_roads_index; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX planet_osm_roads_index ON planet_osm_roads USING gist (way) WITH (fillfactor='100'); CREATE MATERIALIZED VIEW osm_walkability_nbus_stops AS SELECT c.geoid, COUNT(p.osm_id) as c FROM census_areas_onfocus c LEFT JOIN planet_osm_point p ON ST_DWithin(c.geom, p.way, 0.005) AND (highway='bus_stop' OR public_transport='stop_position') GROUP BY geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_airport AS SELECT c.geoid, near_point.dist FROM census_areas_onfocus c, LATERAL (SELECT ROUND(ST_Distance(c.geom::geography, p.way::geography)) as dist FROM planet_osm_point p WHERE aeroway='terminal' ORDER BY c.geom <-> p.way LIMIT 1) near_point; CREATE MATERIALIZED VIEW osm_walkability_prox_cache_industrial AS SELECT p.way, p.way::geography as gway FROM planet_osm_polygon p WHERE landuse='industrial'; CREATE INDEX ON osm_walkability_prox_cache_industrial using gist(way); CREATE MATERIALIZED VIEW osm_walkability_prox_industrial_area AS SELECT c.geoid, near_point.dist FROM census_areas_onfocus c, LATERAL (SELECT ROUND(ST_Distance(c.geom::geography, p.gway)) as dist FROM osm_walkability_prox_cache_industrial p ORDER BY c.geom <-> p.way LIMIT 1) near_point; CREATE MATERIALIZED VIEW osm_walkability_prox_grocery AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest FROM planet_osm_point p WHERE shop IN ('supermarket', 'convenience', 'grocery', 'greengrocer', 'bakery', 'butcher', 'beverages', 'cheese', 'deli', 'dairy', 'health_food', 'pasta', 'seafood', 'spices') ORDER BY c.geom <-> p.way LIMIT 1) near_point group by geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_restaurants AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest FROM planet_osm_point p WHERE amenity='restaurant' OR amenity IN('fast_food', 'bar', 'pub') ORDER BY c.geom <-> p.way LIMIT 10) near_point group by geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_cache_shops AS SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest, p.way FROM planet_osm_point p WHERE shop IS NOT NULL AND shop NOT IN ('supermarket', 'convenience', 'grocery', 'greengrocer', 'bakery', 'butcher', 'beverages', 'cheese', 'deli', 'dairy', 'health_food', 'pasta', 'seafood', 'spices'); CREATE INDEX ON osm_walkability_prox_cache_shops using gist(way); CREATE MATERIALIZED VIEW osm_walkability_prox_shops AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT p.dest FROM osm_walkability_prox_cache_shops p ORDER BY c.geom <-> p.way LIMIT 5) near_point group by geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_school AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest FROM planet_osm_point p WHERE amenity IN ('school', 'university', 'college', 'kindergarten') ORDER BY c.geom <-> p.way LIMIT 1) near_point group by geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_enter AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest FROM planet_osm_point p WHERE amenity IN('cinema', 'theatre', 'arts_centre') ORDER BY c.geom <-> p.way LIMIT 1) near_point group by geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_coffee AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest FROM planet_osm_point p WHERE amenity='cafe' ORDER BY c.geom <-> p.way LIMIT 1) near_point group by geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_cache_metro AS SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest, p.way FROM planet_osm_point p WHERE station='subway'; CREATE INDEX ON osm_walkability_prox_cache_metro using gist(way); CREATE MATERIALIZED VIEW osm_walkability_prox_metro AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest FROM osm_walkability_prox_cache_metro p ORDER BY c.geom <-> p.way LIMIT 1) near_point group by geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_library AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest FROM planet_osm_point p WHERE amenity = 'library' OR tourism='museum' ORDER BY c.geom <-> p.way LIMIT 1) near_point group by geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_railway AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT ST_X(p.way)::text||','||ST_Y(p.way)::text as dest FROM planet_osm_point p WHERE railway='station' AND (station <> 'subway' OR station IS NULL) ORDER BY c.geom <-> p.way LIMIT 1) near_point group by geoid; CREATE MATERIALIZED VIEW osm_walkability_prox_parks AS SELECT c.geoid, array_agg(dest) as dests FROM census_areas_onfocus c, LATERAL (SELECT ST_X(ST_Centroid(p.way))::text||','||ST_Y(ST_Centroid(p.way))::text as dest FROM planet_osm_polygon p WHERE amenity='park' OR landuse='park' OR leisure='park' ORDER BY c.geom <-> p.way LIMIT 2) near_point group by geoid; CREATE TABLE placepulse (dir text, filename text,lat float, lon float, label float,prediction float); CREATE MATERIALIZED VIEW placepulse_geom AS SELECT prediction, ST_Buffer(ST_setsrid(ST_Makepoint(lon, lat), 4326), 0.0005) as geom FROM placepulse; CREATE INDEX ON placepulse_geom using GIST (geom); CREATE MATERIALIZED VIEW placepulse_census AS SELECT geoid, AVG(prediction) as score FROM census_areas as c INNER JOIN placepulse_geom p ON ST_Intersects(p.geom, c.geom) GROUP BY geoid;
the_stack
-- 2018-11-06T18:29:02.506 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2018-11-06 18:29:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=541365 ; -- 2018-11-07T11:19:02.627 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsIdentifier='Y', IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2018-11-07 11:19:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=563572 ; -- 2018-11-07T11:24:45.324 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Ref_Table SET AD_Window_ID=102,Updated=TO_TIMESTAMP('2018-11-07 11:24:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Reference_ID=284 ; -- 2018-11-07T11:35:21.336 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET IsIdentifier='Y', SeqNo=2,Updated=TO_TIMESTAMP('2018-11-07 11:35:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=563548 ; -- 2018-11-07T11:43:59.518 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=554196 ; -- 2018-11-07T11:45:46.489 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET AD_Column_ID=563571, Parent_Column_ID=2637,Updated=TO_TIMESTAMP('2018-11-07 11:45:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=541366 ; -- 2018-11-07T11:46:19.781 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Org_ID,AD_Tab_ID,AD_UI_Element_ID,AD_UI_ElementGroup_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayed_SideList,IsDisplayedGrid,IsMultiLine,Labels_Selector_Field_ID,Labels_Tab_ID,MultiLine_LinesCount,Name,SeqNo,SeqNo_SideList,SeqNoGrid,Updated,UpdatedBy) VALUES (0,0,541365,554223,541928,'L',TO_TIMESTAMP('2018-11-07 11:46:19','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','N','Y','N','N','N',570216,541366,0,'AD_Element_Link',170,0,0,TO_TIMESTAMP('2018-11-07 11:46:19','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-11-07T11:47:40.154 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsAllowFiltering='Y',Updated=TO_TIMESTAMP('2018-11-07 11:47:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554223 ; -- 2018-11-07T11:47:46.185 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET Labels_Selector_Field_ID=570218,Updated=TO_TIMESTAMP('2018-11-07 11:47:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554223 ; -- 2018-11-07T11:53:06.922 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554181 ; -- 2018-11-07T11:53:06.925 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554182 ; -- 2018-11-07T11:53:06.927 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554183 ; -- 2018-11-07T11:53:06.929 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554184 ; -- 2018-11-07T11:53:06.931 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554185 ; -- 2018-11-07T11:53:06.933 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554186 ; -- 2018-11-07T11:53:06.935 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554187 ; -- 2018-11-07T11:53:06.937 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554188 ; -- 2018-11-07T11:53:06.938 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554189 ; -- 2018-11-07T11:53:06.939 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554190 ; -- 2018-11-07T11:53:06.941 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554191 ; -- 2018-11-07T11:53:06.943 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554192 ; -- 2018-11-07T11:53:06.944 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554193 ; -- 2018-11-07T11:53:06.945 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554194 ; -- 2018-11-07T11:53:06.947 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554195 ; -- 2018-11-07T11:53:06.948 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2018-11-07 11:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554223 ; -- 2018-11-07T11:53:17.091 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554180 ; -- 2018-11-07T11:53:17.097 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554181 ; -- 2018-11-07T11:53:17.102 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=30,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554182 ; -- 2018-11-07T11:53:17.107 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554183 ; -- 2018-11-07T11:53:17.113 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554184 ; -- 2018-11-07T11:53:17.118 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554185 ; -- 2018-11-07T11:53:17.121 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554186 ; -- 2018-11-07T11:53:17.123 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554187 ; -- 2018-11-07T11:53:17.126 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=90,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554188 ; -- 2018-11-07T11:53:17.128 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554189 ; -- 2018-11-07T11:53:17.129 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554190 ; -- 2018-11-07T11:53:17.131 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=120,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554191 ; -- 2018-11-07T11:53:17.133 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=130,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554192 ; -- 2018-11-07T11:53:17.135 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=140,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554193 ; -- 2018-11-07T11:53:17.137 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=150,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554194 ; -- 2018-11-07T11:53:17.138 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=160,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554195 ; -- 2018-11-07T11:53:17.140 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=170,Updated=TO_TIMESTAMP('2018-11-07 11:53:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=554223 ; -- 2018-11-07T11:54:27.164 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET AD_Reference_ID=30, IsUpdateable='N', AD_Reference_Value_ID=540779,Updated=TO_TIMESTAMP('2018-11-07 11:54:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2637 ; -- 2018-11-07T11:55:19.764 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET AD_Reference_ID=19, IsUpdateable='N',Updated=TO_TIMESTAMP('2018-11-07 11:55:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2637 ; -- 2018-11-07T12:04:22.008 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET IsTranslationTab='Y',Updated=TO_TIMESTAMP('2018-11-07 12:04:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=541365 ;
the_stack
-- 31.03.2016 11:24 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,Classname,Created,CreatedBy,EntityType,IsActive,IsBetaFunctionality,IsDirectPrint,IsOneInstanceOnly,IsReport,IsServerProcess,JasperReport,Name,RefreshAllAfterExecution,ShowHelp,Statistic_Count,Statistic_Seconds,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,540676,'Y','org.compiere.report.ReportStarter',TO_TIMESTAMP('2016-03-31 11:24:52','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.procurement','Y','N','Y','N','Y','N','@PREFIX@de/metas/reports/all_procurements_conditions_excel/report.xls','Anbauplanung Auswertung Excel','N','Y',0,0,'Java',TO_TIMESTAMP('2016-03-31 11:24:52','YYYY-MM-DD HH24:MI:SS'),100,'Anbauplanung Auswertung Excel (Jasper)') ; -- 31.03.2016 11:24 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=540676 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 31.03.2016 11:48 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM de_metas_procurement.docs_flatrate_term_all_procurements_conditions_report(@C_BPartner_ID@,@M_Product_ID@);',Updated=TO_TIMESTAMP('2016-03-31 11:48:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540676 ; -- 31.03.2016 11:49 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,454,0,540676,540930,30,'M_Product_ID',TO_TIMESTAMP('2016-03-31 11:49:28','YYYY-MM-DD HH24:MI:SS'),100,'Produkt, Leistung, Artikel','de.metas.procurement',0,'Bezeichnet eine Einheit, die in dieser Organisation gekauft oder verkauft wird.','Y','N','Y','N','N','N','Produkt',10,TO_TIMESTAMP('2016-03-31 11:49:28','YYYY-MM-DD HH24:MI:SS'),100) ; -- 31.03.2016 11:49 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540930 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 31.03.2016 11:49 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET SeqNo=20,Updated=TO_TIMESTAMP('2016-03-31 11:49:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540930 ; -- 31.03.2016 11:49 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,187,0,540676,540931,30,'C_BPartner_ID',TO_TIMESTAMP('2016-03-31 11:49:51','YYYY-MM-DD HH24:MI:SS'),100,'Bezeichnet einen Geschäftspartner','de.metas.procurement',0,'Ein Geschäftspartner ist jemand, mit dem Sie interagieren. Dies kann Lieferanten, Kunden, Mitarbeiter oder Handelsvertreter umfassen.','Y','Y','Y','N','N','N','Geschäftspartner',10,TO_TIMESTAMP('2016-03-31 11:49:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 31.03.2016 11:49 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540931 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 31.03.2016 11:49 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET IsAutocomplete='Y',Updated=TO_TIMESTAMP('2016-03-31 11:49:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540930 ; -- 31.03.2016 12:39 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT * FROM de_metas_procurement.docs_flatrate_term_all_procurements_conditions_report(@C_BPartner_ID/NULL@,@M_Product_ID/NULL@);',Updated=TO_TIMESTAMP('2016-03-31 12:39:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540676 ; /* -- 31.03.2016 12:58 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Process_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES ('R',0,540704,0,540676,TO_TIMESTAMP('2016-03-31 12:58:53','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.procurement','Anbauplanung Auswertung Excel (Jasper)','Y','N','N','N','Anbauplanung Auswertung Excel',TO_TIMESTAMP('2016-03-31 12:58:53','YYYY-MM-DD HH24:MI:SS'),100) ; -- 31.03.2016 13:00 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Process_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES ('R',0,540705,0,540676,TO_TIMESTAMP('2016-03-31 13:00:02','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.procurement','Anbauplanung Auswertung Excel (Jasper)','Y','N','N','N','Anbauplanung Auswertung Excel',TO_TIMESTAMP('2016-03-31 13:00:02','YYYY-MM-DD HH24:MI:SS'),100) ; */ -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu (Action,AD_Client_ID,AD_Menu_ID,AD_Org_ID,AD_Process_ID,Created,CreatedBy,EntityType,InternalName,IsActive,IsReadOnly,IsSOTrx,IsSummary,Name,Updated,UpdatedBy) VALUES ('R',0,540706,0,540676,TO_TIMESTAMP('2016-03-31 13:02:54','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.procurement','Anbauplanung Auswertung Excel (Jasper)','Y','N','N','N','Anbauplanung Auswertung Excel',TO_TIMESTAMP('2016-03-31 13:02:54','YYYY-MM-DD HH24:MI:SS'),100) ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Menu_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=540706 AND NOT EXISTS (SELECT * FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID) ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo) SELECT t.AD_Client_ID,0, 'Y', now(), 100, now(), 100,t.AD_Tree_ID, 540706, 0, 999 FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.AD_Table_ID=116 AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=540706) ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=0, Updated=now(), UpdatedBy=100 WHERE Node_ID=540614 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=1, Updated=now(), UpdatedBy=100 WHERE Node_ID=540616 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=2, Updated=now(), UpdatedBy=100 WHERE Node_ID=540681 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=3, Updated=now(), UpdatedBy=100 WHERE Node_ID=540617 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=4, Updated=now(), UpdatedBy=100 WHERE Node_ID=540618 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=5, Updated=now(), UpdatedBy=100 WHERE Node_ID=540619 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=6, Updated=now(), UpdatedBy=100 WHERE Node_ID=540632 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=7, Updated=now(), UpdatedBy=100 WHERE Node_ID=540635 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=8, Updated=now(), UpdatedBy=100 WHERE Node_ID=540698 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=9, Updated=now(), UpdatedBy=100 WHERE Node_ID=540637 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=10, Updated=now(), UpdatedBy=100 WHERE Node_ID=540638 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=11, Updated=now(), UpdatedBy=100 WHERE Node_ID=540648 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=12, Updated=now(), UpdatedBy=100 WHERE Node_ID=540674 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=13, Updated=now(), UpdatedBy=100 WHERE Node_ID=540676 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=14, Updated=now(), UpdatedBy=100 WHERE Node_ID=540679 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=15, Updated=now(), UpdatedBy=100 WHERE Node_ID=540678 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=16, Updated=now(), UpdatedBy=100 WHERE Node_ID=540684 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=17, Updated=now(), UpdatedBy=100 WHERE Node_ID=540686 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=18, Updated=now(), UpdatedBy=100 WHERE Node_ID=540701 AND AD_Tree_ID=10 ; -- 31.03.2016 13:02 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_TreeNodeMM SET Parent_ID=540613, SeqNo=19, Updated=now(), UpdatedBy=100 WHERE Node_ID=540706 AND AD_Tree_ID=10 ;
the_stack
IF (OBJECT_ID('dbo.usp_LoadTableBlobs') IS NULL) EXEC('CREATE PROCEDURE dbo.usp_LoadTableBlobs AS --') GO /* Copyright Daniel Hutmacher under Creative Commons 4.0 license with attribution. http://creativecommons.org/licenses/by/4.0/ Source: http://sqlsunday.com/downloads/ DISCLAIMER: This script may not be suitable to run in a production environment. I cannot assume any responsibility regarding the accuracy of the output information, performance impacts on your server, or any other consequence. If your juristiction does not allow for this kind of waiver/disclaimer, or if you do not accept these terms, you are NOT allowed to store, distribute or use this code in any way. VERSION: 2016-06-16 DESCRIPTION: This procedure will insert a blob of table rows, generated with SELECT ... FOR XML AUTO into all of the respective tables referenced. If possible, it will figure out the insert order, based on foreign key constraints between those tables, and it also gives you the option of first deleting any existing rows and/or using IDENTITY_INSERT. Typical use case: scripting and copying meta-data from multiple related tables from a production database to a test/dev database. USAGE: --- 1. Collect one or more tables' contents as an XML AUTO blob: DECLARE @xml xml=( SELECT (SELECT * FROM dbo.A FOR XML AUTO, TYPE), (SELECT * FROM dbo.B FOR XML AUTO, TYPE), (SELECT * FROM dbo.C FOR XML AUTO, TYPE) FOR XML PATH('')); --- 2. Then, on the target database (with identical, existing tables), --- run the procedure, passing the XML blob as argument: EXECUTE dbo.usp_LoadTableBlobs @blob=@xml, @use_identity_insert=0, --- If you need IDENTITY_INSERT ON @truncate_table=0, --- If you want to empty the target table(s) before inserting @print_only=0 --- If you want a "dry run" that only prints the T-SQL code */ ALTER PROCEDURE dbo.usp_LoadTableBlobs @blob xml=NULL, @use_identity_insert bit=0, @truncate_table bit=0, @print_only bit=0 AS SET NOCOUNT, XACT_ABORT ON; IF (@blob IS NULL) BEGIN; PRINT N'How to use this procedure: --- 1. Collect one or more tables'' contents as a XML AUTO blob: DECLARE @xml xml=( SELECT (SELECT * FROM dbo.A FOR XML AUTO, TYPE), (SELECT * FROM dbo.B FOR XML AUTO, TYPE), (SELECT * FROM dbo.C FOR XML AUTO, TYPE) FOR XML PATH('''')); RETURN; --- 2. Then, on the target database (with identical, existing tables), --- run the procedure, passing the XML blob as argument: EXECUTE '+OBJECT_SCHEMA_NAME(@@PROCID)+'.'+OBJECT_NAME(@@PROCID)+' @blob=@xml, @use_identity_insert=0, --- If you need IDENTITY_INSERT ON @truncate_table=0, --- If you want to empty the target table(s) before inserting @print_only=0 --- If you want a "dry run" that only prints the T-SQL code '; RETURN; END; DECLARE @table_order TABLE ( ord int NOT NULL, [object_id] int NOT NULL, PRIMARY KEY CLUSTERED (ord) ); DECLARE @updates TABLE ( parent_object_id int NOT NULL, referenced_object_id int NOT NULL, [sql] nvarchar(max) NOT NULL, [index] nvarchar(max) NOT NULL, PRIMARY KEY CLUSTERED (referenced_object_id, parent_object_id) ); DECLARE @msg nvarchar(max), @offset int, @sql nvarchar(max)=N'', @print nvarchar(max); --- Check input data for tables that don't exist: SELECT TOP 1 @msg=N'Could not find a table or view named '+sub.name+N'.'+ (CASE WHEN sub.name NOT LIKE '%.%' THEN N' All table names in @blob need to include schema.' ELSE N'' END) FROM ( SELECT DISTINCT x.n.value('fn:local-name(.)', 'sysname') AS name FROM @blob.nodes('//*') AS x(n) ) AS sub WHERE sub.name NOT IN (SELECT s.name+N'.'+o.name FROM sys.objects AS o INNER JOIN sys.schemas AS s ON o.[schema_id]=s.[schema_id] WHERE o.[type] IN ('U', 'V')); IF (@msg IS NOT NULL) BEGIN; RAISERROR(@msg, 16, 1); RETURN; END; --- All tables: WITH tbl AS ( SELECT o.[object_id], s.name+'.'+o.name AS name FROM sys.tables AS o INNER JOIN sys.schemas AS s ON o.[schema_id]=s.[schema_id]), --- All foreign key constraints: refs AS ( SELECT DISTINCT fk.parent_object_id, fk.referenced_object_id FROM sys.foreign_key_columns AS fk WHERE fk.parent_object_id!=fk.referenced_object_id), --- Recurse from referenced tables up to their parents rcte AS ( SELECT 1 AS lvl, tbl.[object_id], tbl.name FROM tbl WHERE tbl.[object_id] NOT IN (SELECT parent_object_id FROM refs) AND tbl.[object_id] IN (SELECT referenced_object_id FROM refs) UNION ALL SELECT 10000 AS lvl, tbl.[object_id], tbl.name FROM tbl WHERE tbl.[object_id] NOT IN (SELECT parent_object_id FROM refs) AND tbl.[object_id] NOT IN (SELECT referenced_object_id FROM refs) UNION ALL --- Recursion happens here: SELECT rcte.lvl+1, tbl.[object_id], tbl.name FROM rcte INNER JOIN refs ON refs.referenced_object_id=rcte.[object_id] INNER JOIN tbl ON refs.parent_object_id=tbl.[object_id]) INSERT INTO @table_order (ord, [object_id]) SELECT ROW_NUMBER() OVER (ORDER BY MAX(lvl)) AS ord, [object_id] FROM rcte WHERE name IN ( --- These are the distinct element names in the blob, i.e. --- a list of all the table names: SELECT DISTINCT x.n.value('fn:local-name(.)', 'sysname') FROM @blob.nodes('//*') AS x(n)) GROUP BY [object_id]; --- Generate dynamic T-SQL code to create the temp tables: ------------------------------------------------------------------------------- SELECT @sql=@sql+ (CASE WHEN LAG(c.column_id, 1, 0) OVER (PARTITION BY x.ord ORDER BY c.column_id)=0 THEN N' --- Worker table for '+s.name+N'.'+o.name+N' SELECT' ELSE ',' END)+' t.r.value(''@'+REPLACE(c.name, ' ', '_')+N''', '''+t.name+(CASE WHEN t.name LIKE 'n%char' OR t.name LIKE 'n%binary' THEN N'('+ISNULL(CAST(NULLIF(c.max_length, -1)/2 AS varchar(10)), N'max')+N')' WHEN t.name LIKE '%char' OR t.name LIKE '%binary' THEN N'('+ISNULL(CAST(NULLIF(c.max_length, -1) AS varchar(10)), N'max')+N')' WHEN t.name IN ('datetime2' ,'time', 'datetimeoffset') THEN N'('+CAST(c.scale AS varchar(10))+N')' WHEN t.name IN ('decimal', 'numeric') THEN N'('+CAST(c.[precision] AS varchar(10))+N', '+CAST(c.scale AS varchar(10))+N')' ELSE N'' END)+N''') AS ['+c.name+']' +(CASE WHEN LEAD(c.column_id, 1, 0) OVER (PARTITION BY x.ord ORDER BY c.column_id)=0 THEN N' INTO [#'+s.name+N'.'+o.name+'] FROM @xml.nodes(''/'+s.name+N'.'+o.name+N''') AS t(r); ' ELSE '' END) FROM sys.schemas AS s INNER JOIN sys.objects AS o ON s.[schema_id]=o.[schema_id] LEFT JOIN sys.identity_columns AS id ON o.[object_id]=id.[object_id] INNER JOIN sys.columns AS c ON o.[object_id]=c.[object_id] INNER JOIN sys.types AS t ON c.system_type_id=t.user_type_id INNER JOIN @table_order AS x ON o.[object_id]=x.[object_id] ORDER BY x.ord, c.column_id; --- Build dynamic T-SQL to map inserted identity values to any --- dependent (referencing) target tables: ------------------------------------------------------------------------------- IF (@use_identity_insert=0) BEGIN; WITH cols AS ( SELECT fk.parent_object_id, pc.name AS parent_column, fk.referenced_object_id, rc.name AS referenced_identity_column FROM @table_order AS p INNER JOIN sys.columns AS pc ON p.[object_id]=pc.[object_id] INNER JOIN sys.foreign_key_columns AS fk ON pc.[object_id]=fk.parent_object_id AND pc.column_id=fk.parent_column_id INNER JOIN @table_order AS r ON fk.referenced_object_id=r.[object_id] INNER JOIN sys.identity_columns AS rc ON fk.referenced_object_id=rc.[object_id] AND fk.referenced_column_id=rc.column_id), natural_keys AS ( SELECT x.[object_id], SUBSTRING(CAST( (SELECT (CASE is_nullable WHEN 1 THEN N' AND (old.['+name+N']=new.['+name+N'] OR old.['+name+N'] IS NULL AND new.['+name+N'] IS NULL)' WHEN 0 THEN N' AND old.['+name+N']=new.['+name+N']' END) FROM ( SELECT [object_id], index_id, name, is_nullable, DENSE_RANK() OVER (PARTITION BY [object_id] ORDER BY column_count, index_id) AS prio FROM ( SELECT i.[object_id], i.index_id, c.name, c.is_nullable, SIGN(MAX(ISNULL(id.column_id, 0)) OVER (PARTITION BY i.[object_id], i.index_id)) AS includes_identity, COUNT(*) OVER (PARTITION BY i.[object_id], i.index_id) AS column_count FROM @table_order AS x INNER JOIN sys.indexes AS i ON x.[object_id]=i.[object_id] INNER JOIN sys.index_columns AS ic ON i.[object_id]=ic.[object_id] AND i.index_id=ic.index_id AND ic.is_included_column=0 INNER JOIN sys.columns AS c ON ic.[object_id]=c.[object_id] AND ic.column_id=c.column_id LEFT JOIN sys.identity_columns AS id ON i.[object_id]=id.[object_id] AND ic.column_id=id.column_id WHERE i.is_unique=1 AND i.has_filter=0 AND i.is_disabled=0 ) AS sub WHERE includes_identity=0 ) AS sub WHERE prio=1 AND [object_id]=x.[object_id] FOR XML PATH(''), TYPE) AS nvarchar(max)), 6, 10000) AS [join], SUBSTRING(CAST( (SELECT N', ['+name+N']' FROM ( SELECT [object_id], index_id, name, is_nullable, DENSE_RANK() OVER (PARTITION BY [object_id] ORDER BY column_count, index_id) AS prio FROM ( SELECT i.[object_id], i.index_id, c.name, c.is_nullable, SIGN(MAX(ISNULL(id.column_id, 0)) OVER (PARTITION BY i.[object_id], i.index_id)) AS includes_identity, COUNT(*) OVER (PARTITION BY i.[object_id], i.index_id) AS column_count FROM @table_order AS x INNER JOIN sys.indexes AS i ON x.[object_id]=i.[object_id] INNER JOIN sys.index_columns AS ic ON i.[object_id]=ic.[object_id] AND i.index_id=ic.index_id AND ic.is_included_column=0 INNER JOIN sys.columns AS c ON ic.[object_id]=c.[object_id] AND ic.column_id=c.column_id LEFT JOIN sys.identity_columns AS id ON i.[object_id]=id.[object_id] AND ic.column_id=id.column_id WHERE i.is_unique=1 AND i.has_filter=0 AND i.is_disabled=0 ) AS sub WHERE includes_identity=0 ) AS sub WHERE prio=1 AND [object_id]=x.[object_id] FOR XML PATH(''), TYPE) AS nvarchar(max)), 3, 10000) AS index_cols FROM @table_order AS x) INSERT INTO @updates (parent_object_id, referenced_object_id, [sql], [index]) SELECT cols.parent_object_id, cols.referenced_object_id, N' UPDATE t SET t.['+cols.parent_column+N']=new.['+cols.referenced_identity_column+N'] FROM [#'+ps.name+N'.'+p.name+N'] AS t INNER JOIN [#'+rs.name+N'.'+r.name+N'] AS old ON t.['+cols.parent_column+N']=old.['+cols.referenced_identity_column+N'] INNER JOIN '+rs.name+N'.'+r.name+N' AS new ON '+nk.[join]+N'; ' AS [sql], N'CREATE UNIQUE CLUSTERED INDEX NK ON [#'+rs.name+N'.'+r.name+N'] ('+nk.index_cols+N');' FROM natural_keys AS nk INNER JOIN cols AS cols ON cols.referenced_object_id=nk.[object_id] INNER JOIN sys.objects AS p ON cols.parent_object_id=p.[object_id] INNER JOIN sys.schemas AS ps ON p.[schema_id]=ps.[schema_id] INNER JOIN sys.objects AS r ON cols.referenced_object_id=r.[object_id] INNER JOIN sys.schemas AS rs ON r.[schema_id]=rs.[schema_id] WHERE nk.[join] IS NOT NULL; --- Sanity check: SELECT TOP 1 @msg='Error: There is no unique index on non-identity column(s) in table '+s.name+'.'+o.name+'. The table has an identity column as a primary key, which is referenced by one or more foreign key constraints. The procedure needs this information to map the inserted IDENTITY column ids. Add a unique index on a natural key in '+s.name+'.'+o.name+' OR set @use_identity_insert=1.' FROM @table_order AS p INNER JOIN sys.columns AS pc ON p.[object_id]=pc.[object_id] INNER JOIN sys.foreign_key_columns AS fk ON pc.[object_id]=fk.parent_object_id AND pc.column_id=fk.parent_column_id INNER JOIN @table_order AS r ON fk.referenced_object_id=r.[object_id] INNER JOIN sys.identity_columns AS rc ON fk.referenced_object_id=rc.[object_id] AND fk.referenced_column_id=rc.column_id INNER JOIN sys.objects AS o ON r.[object_id]=o.[object_id] INNER JOIN sys.schemas AS s ON o.[schema_id]=s.[schema_id] LEFT JOIN @updates AS u ON u.parent_object_id=fk.parent_object_id AND u.referenced_object_id=fk.referenced_object_id WHERE u.parent_object_id IS NULL; IF (@msg IS NOT NULL) BEGIN; RAISERROR(@msg, 16, 1); RETURN; END; END; --- Create indexes on the temp tables: ------------------------------------------------------------------------------- SELECT @sql=@sql+N' --- Unique index on natural key, used to look up IDENTITY values. '+[index]+N' ' FROM ( SELECT DISTINCT [index] FROM @updates ) AS sub; --- Begin transaction: ------------------------------------------------------------------------------- SET @sql=@sql+N' BEGIN TRANSACTION; '; --- T-SQL code to delete existing rows from target tables: ------------------------------------------------------------------------------- IF (@truncate_table=1) SELECT @sql=@sql+N' --- Delete any rows in '+s.name+N'.'+o.name+N' DELETE FROM '+s.name+N'.'+o.name+'; PRINT ''Deleted ''+CAST(@@ROWCOUNT AS varchar(10))+'' row(s) from table '+s.name+N'.'+o.name+N'.''; ' FROM sys.schemas AS s INNER JOIN sys.objects AS o ON s.[schema_id]=o.[schema_id] INNER JOIN @table_order AS x ON o.[object_id]=x.[object_id] ORDER BY x.ord DESC; --- T-SQL code to a) insert rows into target tables, then b) map inserted --- identity values to referencing target tables: ------------------------------------------------------------------------------- SELECT @sql=@sql+ (CASE WHEN p.pass=1 AND LAG(c.column_id, 1, 0) OVER (PARTITION BY x.ord, p.pass ORDER BY c.column_id)=0 THEN N' --- '+s.name+N'.'+o.name+N':'+(CASE WHEN @use_identity_insert=1 AND id.[object_id] IS NOT NULL THEN N' SET IDENTITY_INSERT '+s.name+N'.'+o.name+N' ON; ' ELSE N'' END)+N' INSERT INTO '+s.name+N'.'+o.name+N' (' WHEN p.pass=2 AND LAG(c.column_id, 1, 0) OVER (PARTITION BY x.ord, p.pass ORDER BY c.column_id)=0 THEN N' SELECT ' WHEN p.pass=3 AND LAG(c.column_id, 1, 0) OVER (PARTITION BY x.ord, p.pass ORDER BY c.column_id)=0 THEN ISNULL(N' --- Target tables that directly reference '+s.name+N'.'+o.name+N':'+REPLACE(CAST(( SELECT [sql]+N'' FROM @updates AS upd_sql WHERE upd_sql.referenced_object_id=o.[object_id] FOR XML PATH(''), TYPE) AS varchar(max)), N'&#x0D;', N''), N'') WHEN p.pass=3 THEN N'' ELSE ', ' END)+ (CASE WHEN p.pass IN (1, 2) THEN N'['+c.name+N']' ELSE N'' END)+ (CASE WHEN p.pass=1 AND LEAD(c.column_id, 1, 0) OVER (PARTITION BY x.ord, p.pass ORDER BY c.column_id)=0 THEN N')' WHEN p.pass=2 AND LEAD(c.column_id, 1, 0) OVER (PARTITION BY x.ord, p.pass ORDER BY c.column_id)=0 THEN N' FROM [#'+s.name+N'.'+o.name+N']; PRINT ''Inserted ''+CAST(@@ROWCOUNT AS varchar(10))+'' row(s) in table '+s.name+N'.'+o.name+N'.'';'+ (CASE WHEN @use_identity_insert=1 AND id.[object_id] IS NOT NULL THEN N' SET IDENTITY_INSERT '+s.name+N'.'+o.name+N' OFF; ' ELSE N'' END)+N' ' ELSE '' END) FROM sys.schemas AS s INNER JOIN sys.objects AS o ON s.[schema_id]=o.[schema_id] INNER JOIN sys.columns AS c ON o.[object_id]=c.[object_id] LEFT JOIN sys.identity_columns AS id ON c.[object_id]=id.[object_id] INNER JOIN @table_order AS x ON o.[object_id]=x.[object_id] CROSS APPLY (VALUES (1), (2), (3)) AS p(pass) WHERE @use_identity_insert=1 AND p.pass IN (1, 2) OR @use_identity_insert=0 AND c.column_id!=ISNULL(id.column_id, 0) ORDER BY x.ord, p.pass; --- Ready to run: ------------------------------------------------------------------------------- SET @sql=@sql+N' COMMIT TRANSACTION;'; --- Sharing is caring: here's the T-SQL code: SET @print=@sql; WHILE (@print!='') BEGIN; SET @offset=4000-CHARINDEX(' ', REVERSE(LEFT(@print, 4000))); PRINT LEFT(@print, @offset); SET @print=SUBSTRING(@print, @offset+1, LEN(@print)); END; --- The big-time: IF (@print_only=0) EXECUTE sys.sp_executesql @sql, N'@xml xml', @xml=@blob; GO
the_stack
SET NAMES utf8mb4; SET foreign_key_checks = 0; DROP TABLE IF EXISTS `catalog_category_entity`; CREATE TABLE `catalog_category_entity` ( `entity_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Entity Id', `attribute_set_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Attribute Set ID', `parent_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Parent Category ID', `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Creation Time', `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Update Time', `path` varchar(255) NOT NULL COMMENT 'Tree Path', `position` int(11) NOT NULL COMMENT 'Position', `level` int(11) NOT NULL DEFAULT 0 COMMENT 'Tree Level', `children_count` int(11) NOT NULL COMMENT 'Child Count', PRIMARY KEY (`entity_id`), KEY `CATALOG_CATEGORY_ENTITY_LEVEL` (`level`), KEY `CATALOG_CATEGORY_ENTITY_PATH` (`path`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Category Table'; LOCK TABLES `catalog_category_entity` WRITE; /*!40000 ALTER TABLE `catalog_category_entity` DISABLE KEYS */; INSERT INTO `catalog_category_entity` (`entity_id`, `attribute_set_id`, `parent_id`, `created_at`, `updated_at`, `path`, `position`, `level`, `children_count`) VALUES (1,3,0,'2018-04-17 21:33:50','2018-04-17 21:44:22','1',0,0,39), (2,3,1,'2018-04-17 21:33:50','2018-04-17 21:44:22','1/2',1,1,38), (3,3,2,'2018-04-17 21:41:51','2018-04-17 21:41:51','1/2/3',4,2,3), (4,3,3,'2018-04-17 21:41:51','2018-04-17 21:41:51','1/2/3/4',1,3,0), (5,3,3,'2018-04-17 21:41:51','2018-04-17 21:41:51','1/2/3/5',2,3,0), (6,3,3,'2018-04-17 21:41:51','2018-04-18 07:40:23','1/2/3/6',3,3,0), (7,3,2,'2018-04-17 21:41:51','2018-04-17 21:44:22','1/2/7',5,2,6), (8,3,7,'2018-04-17 21:41:51','2018-04-17 21:41:51','1/2/7/8',1,3,0), (9,3,2,'2018-04-17 21:42:02','2018-04-17 21:42:02','1/2/9',5,2,1), (10,3,9,'2018-04-17 21:42:02','2018-04-17 21:42:03','1/2/9/10',1,3,0), (11,3,2,'2018-04-17 21:42:07','2018-04-17 21:42:08','1/2/11',3,2,8), (12,3,11,'2018-04-17 21:42:07','2018-04-17 21:42:08','1/2/11/12',1,3,4), (13,3,11,'2018-04-17 21:42:07','2018-04-17 21:42:08','1/2/11/13',2,3,2), (14,3,12,'2018-04-17 21:42:07','2018-04-17 21:42:07','1/2/11/12/14',1,4,0), (15,3,12,'2018-04-17 21:42:08','2018-04-17 21:42:08','1/2/11/12/15',2,4,0), (16,3,12,'2018-04-17 21:42:08','2018-04-17 21:42:08','1/2/11/12/16',3,4,0), (17,3,12,'2018-04-17 21:42:08','2018-04-17 21:42:08','1/2/11/12/17',4,4,0), (18,3,13,'2018-04-17 21:42:08','2018-04-17 21:42:08','1/2/11/13/18',1,4,0), (19,3,13,'2018-04-17 21:42:08','2018-04-17 21:42:08','1/2/11/13/19',2,4,0), (20,3,2,'2018-04-17 21:42:08','2018-04-17 21:42:09','1/2/20',2,2,8), (21,3,20,'2018-04-17 21:42:09','2018-04-17 21:42:09','1/2/20/21',1,3,4), (22,3,20,'2018-04-17 21:42:09','2018-04-17 21:42:09','1/2/20/22',2,3,2), (23,3,21,'2018-04-17 21:42:09','2018-04-17 21:42:09','1/2/20/21/23',1,4,0), (24,3,21,'2018-04-17 21:42:09','2018-04-17 21:42:09','1/2/20/21/24',2,4,0), (25,3,21,'2018-04-17 21:42:09','2018-04-17 21:42:09','1/2/20/21/25',3,4,0), (26,3,21,'2018-04-17 21:42:09','2018-04-17 21:42:09','1/2/20/21/26',4,4,0), (27,3,22,'2018-04-17 21:42:09','2018-04-17 21:42:09','1/2/20/22/27',1,4,0), (28,3,22,'2018-04-17 21:42:09','2018-04-17 21:42:10','1/2/20/22/28',2,4,0), (29,3,2,'2018-04-17 21:42:10','2018-04-17 21:42:10','1/2/29',6,2,4), (30,3,29,'2018-04-17 21:42:10','2018-04-17 21:42:10','1/2/29/30',1,3,0), (31,3,29,'2018-04-17 21:42:10','2018-04-17 21:42:10','1/2/29/31',2,3,0), (32,3,29,'2018-04-17 21:42:10','2018-04-17 21:42:10','1/2/29/32',3,3,0), (33,3,29,'2018-04-17 21:42:10','2018-04-17 21:42:10','1/2/29/33',4,3,0), (34,3,7,'2018-04-17 21:42:10','2018-04-17 21:42:10','1/2/7/34',2,3,0), (35,3,7,'2018-04-17 21:42:10','2018-04-17 21:42:10','1/2/7/35',3,3,0), (36,3,7,'2018-04-17 21:42:11','2018-04-17 21:42:11','1/2/7/36',4,3,0), (37,3,2,'2018-04-17 21:44:22','2018-04-17 21:44:22','1/2/37',6,2,0), (38,3,2,'2018-04-17 21:44:22','2018-04-17 21:44:22','1/2/38',1,2,0), (39,3,7,'2018-04-17 21:44:22','2018-04-17 21:44:22','1/2/7/39',5,3,0), (40,3,7,'2018-04-17 21:44:22','2018-04-17 21:44:22','1/2/7/40',6,3,0); /*!40000 ALTER TABLE `catalog_category_entity` ENABLE KEYS */; UNLOCK TABLES; # Dump of table catalog_category_entity_datetime # ------------------------------------------------------------ DROP TABLE IF EXISTS `catalog_category_entity_datetime`; CREATE TABLE `catalog_category_entity_datetime` ( `value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID', `attribute_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Attribute ID', `store_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Store ID', `entity_id` int(10) unsigned NOT NULL DEFAULT 0, `value` datetime DEFAULT NULL COMMENT 'Value', PRIMARY KEY (`value_id`), UNIQUE KEY `CATALOG_CATEGORY_ENTITY_DATETIME_ENTITY_ID_ATTRIBUTE_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`), KEY `CATALOG_CATEGORY_ENTITY_DATETIME_ENTITY_ID` (`entity_id`), KEY `CATALOG_CATEGORY_ENTITY_DATETIME_ATTRIBUTE_ID` (`attribute_id`), KEY `CATALOG_CATEGORY_ENTITY_DATETIME_STORE_ID` (`store_id`), CONSTRAINT `CAT_CTGR_ENTT_DTIME_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Category Datetime Attribute Backend Table'; LOCK TABLES `catalog_category_entity_datetime` WRITE; /*!40000 ALTER TABLE `catalog_category_entity_datetime` DISABLE KEYS */; INSERT INTO `catalog_category_entity_datetime` (`value_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES (1,61,2,6,NULL), (2,62,2,6,NULL); /*!40000 ALTER TABLE `catalog_category_entity_datetime` ENABLE KEYS */; UNLOCK TABLES; # Dump of table catalog_category_entity_decimal # ------------------------------------------------------------ DROP TABLE IF EXISTS `catalog_category_entity_decimal`; CREATE TABLE `catalog_category_entity_decimal` ( `value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID', `attribute_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Attribute ID', `store_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Store ID', `entity_id` int(10) unsigned NOT NULL DEFAULT 0, `value` decimal(12,4) DEFAULT NULL COMMENT 'Value', PRIMARY KEY (`value_id`), UNIQUE KEY `CATALOG_CATEGORY_ENTITY_DECIMAL_ENTITY_ID_ATTRIBUTE_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`), KEY `CATALOG_CATEGORY_ENTITY_DECIMAL_ENTITY_ID` (`entity_id`), KEY `CATALOG_CATEGORY_ENTITY_DECIMAL_ATTRIBUTE_ID` (`attribute_id`), KEY `CATALOG_CATEGORY_ENTITY_DECIMAL_STORE_ID` (`store_id`), CONSTRAINT `CAT_CTGR_ENTT_DEC_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Category Decimal Attribute Backend Table'; # Dump of table catalog_category_entity_int # ------------------------------------------------------------ DROP TABLE IF EXISTS `catalog_category_entity_int`; CREATE TABLE `catalog_category_entity_int` ( `value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID', `attribute_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Attribute ID', `store_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Store ID', `entity_id` int(10) unsigned NOT NULL DEFAULT 0, `value` int(11) DEFAULT NULL COMMENT 'Value', PRIMARY KEY (`value_id`), UNIQUE KEY `CATALOG_CATEGORY_ENTITY_INT_ENTITY_ID_ATTRIBUTE_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`), KEY `CATALOG_CATEGORY_ENTITY_INT_ENTITY_ID` (`entity_id`), KEY `CATALOG_CATEGORY_ENTITY_INT_ATTRIBUTE_ID` (`attribute_id`), KEY `CATALOG_CATEGORY_ENTITY_INT_STORE_ID` (`store_id`), CONSTRAINT `CAT_CTGR_ENTT_INT_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Category Integer Attribute Backend Table'; LOCK TABLES `catalog_category_entity_int` WRITE; /*!40000 ALTER TABLE `catalog_category_entity_int` DISABLE KEYS */; INSERT INTO `catalog_category_entity_int` (`value_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES (1,69,0,1,1), (2,46,0,2,1), (3,69,0,2,1), (4,46,0,3,1), (5,54,0,3,0), (6,69,0,3,1), (7,46,0,4,1), (8,54,0,4,1), (9,69,0,4,1), (10,46,0,5,1), (11,54,0,5,1), (12,69,0,5,1), (13,46,0,6,1), (14,54,0,6,1), (15,69,0,6,1), (16,46,0,7,0), (17,54,0,7,0), (18,69,0,7,0), (19,46,0,8,1), (20,54,0,8,1), (21,69,0,8,0), (22,46,0,9,1), (23,54,0,9,0), (24,69,0,9,1), (25,46,0,10,1), (26,54,0,10,1), (27,69,0,10,1), (28,46,0,11,1), (29,54,0,11,0), (30,69,0,11,1), (31,46,0,12,1), (32,54,0,12,1), (33,69,0,12,1), (34,46,0,13,1), (35,54,0,13,1), (36,69,0,13,1), (37,46,0,14,1), (38,54,0,14,1), (39,69,0,14,1), (40,46,0,15,1), (41,54,0,15,1), (42,69,0,15,1), (43,46,0,16,1), (44,54,0,16,1), (45,69,0,16,1), (46,46,0,17,1), (47,54,0,17,1), (48,69,0,17,1), (49,46,0,18,1), (50,54,0,18,1), (51,69,0,18,1), (52,46,0,19,1), (53,54,0,19,1), (54,69,0,19,1), (55,46,0,20,1), (56,54,0,20,0), (57,69,0,20,1), (58,46,0,21,1), (59,54,0,21,1), (60,69,0,21,1), (61,46,0,22,1), (62,54,0,22,1), (63,69,0,22,1), (64,46,0,23,1), (65,54,0,23,1), (66,69,0,23,1), (67,46,0,24,1), (68,54,0,24,1), (69,69,0,24,1), (70,46,0,25,1), (71,54,0,25,1), (72,69,0,25,1), (73,46,0,26,1), (74,54,0,26,1), (75,69,0,26,1), (76,46,0,27,1), (77,54,0,27,1), (78,69,0,27,1), (79,46,0,28,1), (80,54,0,28,1), (81,69,0,28,1), (82,46,0,29,0), (83,54,0,29,0), (84,69,0,29,0), (85,46,0,30,1), (86,54,0,30,1), (87,69,0,30,0), (88,46,0,31,1), (89,54,0,31,1), (90,69,0,31,0), (91,46,0,32,1), (92,54,0,32,1), (93,69,0,32,0), (94,46,0,33,1), (95,54,0,33,1), (96,69,0,33,0), (97,46,0,34,1), (98,54,0,34,1), (99,69,0,34,0), (100,46,0,35,1), (101,54,0,35,1), (102,69,0,35,0), (103,46,0,36,1), (104,54,0,36,1), (105,69,0,36,0), (106,46,0,37,1), (107,54,0,37,0), (108,69,0,37,1), (109,46,0,38,1), (110,54,0,38,0), (111,69,0,38,1), (112,46,0,39,1), (113,54,0,39,0), (114,69,0,39,0), (115,46,0,40,1), (116,54,0,40,0), (117,69,0,40,0), (118,71,2,6,0); /*!40000 ALTER TABLE `catalog_category_entity_int` ENABLE KEYS */; UNLOCK TABLES; # Dump of table catalog_category_entity_text # ------------------------------------------------------------ DROP TABLE IF EXISTS `catalog_category_entity_text`; CREATE TABLE `catalog_category_entity_text` ( `value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID', `attribute_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Attribute ID', `store_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Store ID', `entity_id` int(10) unsigned NOT NULL DEFAULT 0, `value` text DEFAULT NULL COMMENT 'Value', PRIMARY KEY (`value_id`), UNIQUE KEY `CATALOG_CATEGORY_ENTITY_TEXT_ENTITY_ID_ATTRIBUTE_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`), KEY `CATALOG_CATEGORY_ENTITY_TEXT_ENTITY_ID` (`entity_id`), KEY `CATALOG_CATEGORY_ENTITY_TEXT_ATTRIBUTE_ID` (`attribute_id`), KEY `CATALOG_CATEGORY_ENTITY_TEXT_STORE_ID` (`store_id`), CONSTRAINT `CAT_CTGR_ENTT_TEXT_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Category Text Attribute Backend Table'; LOCK TABLES `catalog_category_entity_text` WRITE; /*!40000 ALTER TABLE `catalog_category_entity_text` DISABLE KEYS */; INSERT INTO `catalog_category_entity_text` (`value_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES (1,64,0,3,'<ref name=\"catalog.leftnav\" remove=\"true\"/>'), (2,64,0,9,'<ref name=\"catalog.leftnav\" remove=\"true\"/>'), (3,64,0,11,'<ref name=\"catalog.leftnav\" remove=\"true\"/>'), (4,64,0,20,'<ref name=\"catalog.leftnav\" remove=\"true\"/>'), (5,64,2,6,NULL); /*!40000 ALTER TABLE `catalog_category_entity_text` ENABLE KEYS */; UNLOCK TABLES; # Dump of table catalog_category_entity_varchar # ------------------------------------------------------------ DROP TABLE IF EXISTS `catalog_category_entity_varchar`; CREATE TABLE `catalog_category_entity_varchar` ( `value_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID', `attribute_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Attribute ID', `store_id` smallint(5) unsigned NOT NULL DEFAULT 0 COMMENT 'Store ID', `entity_id` int(10) unsigned NOT NULL DEFAULT 0, `value` varchar(255) DEFAULT NULL COMMENT 'Value', PRIMARY KEY (`value_id`), UNIQUE KEY `CATALOG_CATEGORY_ENTITY_VARCHAR_ENTITY_ID_ATTRIBUTE_ID_STORE_ID` (`entity_id`,`attribute_id`,`store_id`), KEY `CATALOG_CATEGORY_ENTITY_VARCHAR_ENTITY_ID` (`entity_id`), KEY `CATALOG_CATEGORY_ENTITY_VARCHAR_ATTRIBUTE_ID` (`attribute_id`), KEY `CATALOG_CATEGORY_ENTITY_VARCHAR_STORE_ID` (`store_id`), CONSTRAINT `CAT_CTGR_ENTT_VCHR_ENTT_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Category Varchar Attribute Backend Table'; LOCK TABLES `catalog_category_entity_varchar` WRITE; /*!40000 ALTER TABLE `catalog_category_entity_varchar` DISABLE KEYS */; INSERT INTO `catalog_category_entity_varchar` (`value_id`, `attribute_id`, `store_id`, `entity_id`, `value`) VALUES (1,45,0,1,'Root Catalog'), (2,45,0,2,'Default Category'), (3,52,0,2,'PRODUCTS'), (4,45,0,3,'Gear'), (5,52,0,3,'PAGE'), (6,117,0,3,'gear'), (7,118,0,3,'gear'), (8,45,0,4,'Bags'), (9,117,0,4,'bags'), (10,118,0,4,'gear/bags'), (11,45,0,5,'Fitness Equipment'), (12,117,0,5,'fitness-equipment'), (13,118,0,5,'gear/fitness-equipment'), (14,45,0,6,'Watches'), (15,117,0,6,'watches'), (16,118,0,6,'gear/watches'), (17,45,0,7,'Collections'), (18,52,0,7,'PAGE'), (19,117,0,7,'collections'), (20,118,0,7,'collections'), (21,45,0,8,'New Luma Yoga Collection'), (22,117,0,8,'yoga-new'), (23,118,0,8,'collections/yoga-new'), (24,45,0,9,'Training'), (25,52,0,9,'PAGE'), (26,117,0,9,'training'), (27,118,0,9,'training'), (28,45,0,10,'Video Download'), (29,117,0,10,'training-video'), (30,118,0,10,'training/training-video'), (31,45,0,11,'Men'), (32,52,0,11,'PAGE'), (33,117,0,11,'men'), (34,118,0,11,'men'), (35,45,0,12,'Tops'), (36,117,0,12,'tops-men'), (37,118,0,12,'men/tops-men'), (38,45,0,13,'Bottoms'), (39,117,0,13,'bottoms-men'), (40,118,0,13,'men/bottoms-men'), (41,45,0,14,'Jackets'), (42,117,0,14,'jackets-men'), (43,118,0,14,'men/tops-men/jackets-men'), (44,45,0,15,'Hoodies & Sweatshirts'), (45,117,0,15,'hoodies-and-sweatshirts-men'), (46,118,0,15,'men/tops-men/hoodies-and-sweatshirts-men'), (47,45,0,16,'Tees'), (48,117,0,16,'tees-men'), (49,118,0,16,'men/tops-men/tees-men'), (50,45,0,17,'Tanks'), (51,117,0,17,'tanks-men'), (52,118,0,17,'men/tops-men/tanks-men'), (53,45,0,18,'Pants'), (54,117,0,18,'pants-men'), (55,118,0,18,'men/bottoms-men/pants-men'), (56,45,0,19,'Shorts'), (57,117,0,19,'shorts-men'), (58,118,0,19,'men/bottoms-men/shorts-men'), (59,45,0,20,'Women'), (60,52,0,20,'PAGE'), (61,117,0,20,'women'), (62,118,0,20,'women'), (63,45,0,21,'Tops'), (64,117,0,21,'tops-women'), (65,118,0,21,'women/tops-women'), (66,45,0,22,'Bottoms'), (67,117,0,22,'bottoms-women'), (68,118,0,22,'women/bottoms-women'), (69,45,0,23,'Jackets'), (70,117,0,23,'jackets-women'), (71,118,0,23,'women/tops-women/jackets-women'), (72,45,0,24,'Hoodies & Sweatshirts'), (73,117,0,24,'hoodies-and-sweatshirts-women'), (74,118,0,24,'women/tops-women/hoodies-and-sweatshirts-women'), (75,45,0,25,'Tees'), (76,117,0,25,'tees-women'), (77,118,0,25,'women/tops-women/tees-women'), (78,45,0,26,'Bras & Tanks'), (79,117,0,26,'tanks-women'), (80,118,0,26,'women/tops-women/tanks-women'), (81,45,0,27,'Pants'), (82,117,0,27,'pants-women'), (83,118,0,27,'women/bottoms-women/pants-women'), (84,45,0,28,'Shorts'), (85,117,0,28,'shorts-women'), (86,118,0,28,'women/bottoms-women/shorts-women'), (87,45,0,29,'Promotions'), (88,52,0,29,'PAGE'), (89,117,0,29,'promotions'), (90,118,0,29,'promotions'), (91,45,0,30,'Women Sale'), (92,117,0,30,'women-sale'), (93,118,0,30,'promotions/women-sale'), (94,45,0,31,'Men Sale'), (95,117,0,31,'men-sale'), (96,118,0,31,'promotions/men-sale'), (97,45,0,32,'Pants'), (98,117,0,32,'pants-all'), (99,118,0,32,'promotions/pants-all'), (100,45,0,33,'Tees'), (101,117,0,33,'tees-all'), (102,118,0,33,'promotions/tees-all'), (103,45,0,34,'Erin Recommends'), (104,117,0,34,'erin-recommends'), (105,118,0,34,'collections/erin-recommends'), (106,45,0,35,'Performance Fabrics'), (107,117,0,35,'performance-fabrics'), (108,118,0,35,'collections/performance-fabrics'), (109,45,0,36,'Eco Friendly'), (110,117,0,36,'eco-friendly'), (111,118,0,36,'collections/eco-friendly'), (112,45,0,37,'Sale'), (113,52,0,37,'PAGE'), (114,117,0,37,'sale'), (115,118,0,37,'sale'), (116,45,0,38,'What\'s New'), (117,52,0,38,'PAGE'), (118,117,0,38,'what-is-new'), (119,118,0,38,'what-is-new'), (120,45,0,39,'Performance Sportswear New'), (121,52,0,39,'PAGE'), (122,63,0,39,'1column'), (123,117,0,39,'performance-new'), (124,118,0,39,'collections/performance-new'), (125,45,0,40,'Eco Collection New'), (126,52,0,40,'PAGE'), (127,63,0,40,'1column'), (128,117,0,40,'eco-new'), (129,118,0,40,'collections/eco-new'), (130,48,2,6,NULL), (131,60,2,6,NULL), (132,63,2,6,NULL), (133,118,2,6,'gear/watches'), (134,45,1,6,'Watches StoreID_1'); /*!40000 ALTER TABLE `catalog_category_entity_varchar` ENABLE KEYS */; UNLOCK TABLES; SET foreign_key_checks = 1;
the_stack
\set HIVE_SERVER `echo \'"$HIVE_SERVER"\'` \set HIVE_CLIENT_TYPE `echo \'"$CLIENT_TYPE"\'` \set HIVE_PORT `echo \'"$HIVE_PORT"\'` \set HIVE_USER `echo \'"$HIVE_USER"\'` \set HIVE_PASSWORD `echo \'"$HIVE_PASSWORD"\'` \set AUTH_TYPE `echo \'"$AUTH_TYPE"\'` \c contrib_regression CREATE EXTENSION IF NOT EXISTS hdfs_fdw; CREATE SERVER hdfs_server FOREIGN DATA WRAPPER hdfs_fdw OPTIONS(host :HIVE_SERVER, port :HIVE_PORT, client_type :HIVE_CLIENT_TYPE, auth_type :AUTH_TYPE); CREATE USER MAPPING FOR public SERVER hdfs_server OPTIONS (username :HIVE_USER, password :HIVE_PASSWORD); CREATE FOREIGN TABLE dept ( deptno INTEGER, dname VARCHAR(14), loc VARCHAR(13) ) SERVER hdfs_server OPTIONS (dbname 'fdw_db', table_name 'dept'); CREATE FOREIGN TABLE emp ( empno INTEGER, ename VARCHAR(10), job VARCHAR(9), mgr INTEGER, hiredate pg_catalog.DATE, sal INTEGER, comm INTEGER, deptno INTEGER ) SERVER hdfs_server OPTIONS (dbname 'fdw_db', table_name 'emp'); CREATE FOREIGN TABLE jobhist ( empno INTEGER, startdate pg_catalog.DATE, enddate pg_catalog.DATE, job VARCHAR(9), sal INTEGER, comm INTEGER, deptno INTEGER, chgdesc VARCHAR(80) ) SERVER hdfs_server OPTIONS (dbname 'fdw_db', table_name 'jobhist'); -- Retrieve Data from Foreign Table using SELECT Statement. SELECT * FROM DEPT ORDER BY 1, 2; -- Test whole row reference works correctly. EXPLAIN (VERBOSE, COSTS OFF) SELECT dept FROM dept ORDER BY dept; SELECT dept FROM dept ORDER BY dept; -- Make sure if whole row reference is requested and also any individual -- attributes of the same table are requested - we do not add the attribute -- more than once to remote query. EXPLAIN (VERBOSE, COSTS OFF) SELECT dept, deptno FROM dept ORDER BY deptno; SELECT dept, deptno FROM dept ORDER BY deptno; -- Test if all the columns in the relation are referenced we instead send -- 'SELECT *' in remote query(this will avoid map-reduce job). EXPLAIN (VERBOSE, COSTS OFF) SELECT deptno, dname, loc FROM DEPT ORDER BY deptno; SELECT deptno, dname, loc FROM DEPT ORDER BY deptno; SELECT * FROM emp ORDER BY deptno, empno; SELECT * FROM emp ORDER BY deptno DESC, empno; SELECT * FROM emp ORDER BY deptno DESC, empno DESC; SELECT * FROM dept ORDER BY dname DESC; SELECT DISTINCT deptno FROM emp ORDER BY deptno; SELECT DISTINCT mgr, deptno FROM emp ORDER BY mgr, deptno; SELECT DISTINCT empno, deptno FROM emp ORDER BY empno, deptno; SELECT deptno, dname, loc FROM dept ORDER BY 1; SELECT deptno, dname FROM dept ORDER BY 1; SELECT ename as "Employee Name" FROM emp ORDER BY 1; SELECT deptno, sal, comm FROM Emp ORDER BY deptno, sal, comm; SELECT COUNT(*) FROM jobhist; SELECT COUNT(DISTINCT deptno) FROM jobhist; SELECT COUNT(empno) FROM jobhist; SELECT * FROM emp ORDER BY empno LIMIT ALL; SELECT * FROM emp ORDER BY empno LIMIT NULL; SELECT * FROM emp ORDER BY empno OFFSET 13; SELECT * FROM emp ORDER BY empno LIMIT 5 OFFSET 1; -- Retrieve Data from Foreign Table using Group By Clause. SELECT deptno "Department", COUNT(emp) "Total Employees" FROM emp GROUP BY deptno ORDER BY deptno; SELECT deptno, SUM(sal) FROM emp GROUP BY deptno HAVING deptno IN (10, 30) ORDER BY deptno; SELECT deptno, SUM(sal) FROM emp GROUP BY deptno HAVING SUM(sal) > 9400 ORDER BY deptno; SELECT deptno, ROUND(AVG(sal)) FROM emp GROUP BY deptno HAVING deptno IN (10,20,40) ORDER BY deptno DESC; SELECT deptno, ROUND(AVG(sal)) FROM emp GROUP BY deptno HAVING deptno NOT IN (10,20,40) ORDER BY deptno DESC; SELECT deptno, ROUND(AVG(sal)) "Average Salary", SUM(sal) "Total Salary", MIN(sal) "Minimum Salary", MAX(sal) "Maximum Salary" FROM emp GROUP BY deptno HAVING deptno = 10 OR deptno = 20 OR deptno = 30 ORDER BY deptno; -- Retrieve Data from Foreign Table using Sub Queries. SELECT * FROM emp WHERE deptno <> ALL (SELECT deptno FROM dept WHERE deptno IN (10,30,40)) ORDER BY empno; SELECT * FROM dept WHERE EXISTS (SELECT * FROM emp WHERE dept.deptno = emp.deptno) ORDER BY deptno; SELECT * FROM emp WHERE deptno NOT IN (SELECT deptno FROM dept) ORDER BY empno; SELECT * FROM emp WHERE deptno = ANY (SELECT deptno FROM dept WHERE deptno IN (10,30,40)) ORDER BY empno; SELECT * FROM dept WHERE NOT EXISTS (SELECT * FROM emp WHERE dept.deptno = emp.deptno) ORDER BY deptno; SELECT * FROM emp WHERE empno IN (SELECT empno FROM emp WHERE sal BETWEEN 5000 AND 6000) ORDER BY empno; -- Retrieve Data from Foreign Table using UNION Operator. SELECT deptno, dname FROM dept UNION SELECT empno, ename FROM emp ORDER BY deptno; SELECT dname FROM dept UNION SELECT ename FROM emp ORDER BY dname; SELECT dname FROM dept UNION ALL SELECT ename FROM emp ORDER BY dname; -- Retrieve Data from Foreign Table using INTERSECT Operator. SELECT ename FROM emp WHERE empno >= 7788 INTERSECT SELECT ename FROM emp WHERE empno >= 7566 ORDER BY ename; SELECT ename FROM emp WHERE empno >= 7788 INTERSECT ALL SELECT ename FROM emp WHERE empno >= 7566 ORDER BY ename; -- Retrieve Data from Foreign Table using CROSS JOIN. SELECT dept.dname, emp.ename FROM dept CROSS JOIN emp ORDER BY 1, 2; -- Retrieve Data from Foreign Table using INNER JOIN. SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept d, emp e WHERE d.deptno=e.deptno ORDER BY 1, 2, 3, 4, 5, 6; SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept d INNER JOIN emp e ON d.deptno=e.deptno ORDER BY 1, 2, 3, 4, 5, 6; -- Retrieve Data from Foreign Table using EXCEPT. SELECT ename FROM emp EXCEPT SELECT ename FROM emp WHERE empno > 7839 ORDER BY ename; SELECT ename FROM emp EXCEPT ALL SELECT ename FROM emp WHERE empno > 7839 ORDER BY ename; -- Retrieve Data from Foreign Table using OUTER JOINS. SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept d LEFT OUTER JOIN emp e ON d.deptno=e.deptno ORDER BY 1, 2, 3, 4, 5, 6; SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept d RIGHT OUTER JOIN emp e ON d.deptno=e.deptno ORDER BY 1, 2, 3, 4, 5, 6; SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept d FULL OUTER JOIN emp e ON d.deptno=e.deptno ORDER BY 1, 2, 3, 4, 5, 6; -- Retrieve Data from Foreign Table using CTE (With Clause). WITH dept_count AS ( SELECT deptno, COUNT(*) AS dept_count FROM emp GROUP BY deptno ) SELECT e.ename AS Employee_Name, dc.dept_count AS "Employee in Same Dept" FROM emp e, dept_count dc WHERE e.deptno = dc.deptno ORDER BY 2, 1; WITH with_qry AS ( SELECT * FROM dept ) SELECT e.ename, e.sal, w.deptno, w.dname FROM emp e, with_qry w WHERE e.deptno = w.deptno ORDER BY e.deptno, e.ename; WITH dept_costs AS ( SELECT dname, SUM(sal) dept_total FROM emp e, dept d WHERE e.deptno = d.deptno GROUP BY dname ), avg_cost AS ( SELECT SUM(dept_total)/COUNT(*) avg FROM dept_costs ) SELECT * FROM dept_costs WHERE dept_total > (SELECT avg FROM avg_cost) ORDER BY dname; -- Retrieve Data from Foreign Table using Window Clause. SELECT deptno, empno, sal, AVG(sal) OVER (PARTITION BY deptno) FROM emp ORDER BY deptno, empno; SELECT deptno, empno, sal, COUNT(sal) OVER (PARTITION BY deptno) FROM emp WHERE deptno IN (10,30,40,50,60,70) ORDER BY deptno, empno; SELECT deptno, empno, sal, SUM(sal) OVER (PARTITION BY deptno) FROM emp ORDER BY deptno, empno; SELECT deptno, empno, sal, RANK() OVER (PARTITION BY deptno ORDER BY sal DESC) FROM emp ORDER BY 1, 2, 3, 4; SELECT deptno, empno, sal, DENSE_RANK() OVER (PARTITION BY deptno ORDER BY sal DESC) FROM emp WHERE deptno IN (10,30,40,50,60,70) ORDER BY 1, 2, 3, 4; SELECT deptno, empno, sal , MIN(sal) OVER (PARTITION BY deptno), MAX(sal) OVER (PARTITION BY deptno) FROM emp WHERE deptno IN (10,30,50,70) ORDER BY deptno, empno; SELECT deptno, empno, sal , MIN(sal) OVER win, MAX(sal) OVER win, SUM(sal) OVER win,AVG(sal) OVER win FROM emp WHERE deptno IN (10,30,50,70) WINDOW win AS (PARTITION BY deptno) ORDER BY deptno, empno; SELECT deptno, empno, sal, ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY sal DESC) FROM emp ORDER BY empno; SELECT deptno, empno, sal, FIRST_VALUE(sal) OVER (PARTITION BY deptno ORDER BY sal DESC), LAST_VALUE(sal) OVER (PARTITION BY deptno ORDER BY sal DESC) FROM emp ORDER BY empno; SELECT deptno, empno, sal, LEAD(sal, 1, 0) OVER (PARTITION BY deptno ORDER BY sal DESC) NEXT_LOWER_SAL, LAG(sal, 1, 0) OVER (PARTITION BY deptno ORDER BY sal DESC ) PREV_HIGHER_SAL FROM emp WHERE deptno IN (10, 20,30,40,50) ORDER BY deptno, sal DESC; SELECT deptno, empno, sal, PERCENT_RANK() OVER (PARTITION BY deptno ORDER BY sal DESC) FROM emp ORDER BY empno; SELECT deptno, empno, sal, NTH_VALUE(sal, 2) OVER (PARTITION BY deptno ORDER BY sal) FROM emp ORDER BY empno; -- Retrieve Data from Foreign Table using Query Optimizer. EXPLAIN (COSTS OFF) SELECT * FROM DEPT; EXPLAIN (COSTS OFF) SELECT deptno,dname,loc FROM DEPT; EXPLAIN (COSTS OFF) SELECT * FROM EMP ORDER BY deptno; EXPLAIN (COSTS OFF) SELECT empno,ename FROM EMP ORDER BY deptno; EXPLAIN (COSTS OFF) SELECT empno,ename FROM EMP; EXPLAIN (COSTS OFF) SELECT ename as "Employee Name" FROM emp; EXPLAIN (COSTS OFF) SELECT COUNT(*) FROM jobhist; EXPLAIN (COSTS OFF) SELECT * FROM jobhist LIMIT 2; EXPLAIN (COSTS OFF) SELECT * FROM emp ORDER BY emp LIMIT 5 OFFSET 1; EXPLAIN (COSTS OFF) SELECT * FROM emp WHERE deptno <> ALL (SELECT deptno FROM dept WHERE deptno IN (10,30,40)) ORDER BY empno; EXPLAIN (COSTS OFF) SELECT deptno, dname FROM dept UNION SELECT empno, ename FROM emp ORDER BY deptno; EXPLAIN (COSTS OFF) SELECT ename FROM emp WHERE empno >= 7788 INTERSECT SELECT ename FROM emp WHERE empno >= 7566 ORDER BY ename; EXPLAIN (COSTS OFF) SELECT dept.dname, emp.ename FROM dept CROSS JOIN emp ORDER BY dept.deptno; EXPLAIN (COSTS OFF) SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept d INNER JOIN emp e ON d.deptno=e.deptno ORDER BY d.deptno; EXPLAIN (COSTS OFF) SELECT ename FROM emp EXCEPT SELECT ename FROM emp WHERE empno > 7839 ORDER BY ename; EXPLAIN (COSTS OFF) SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept d LEFT OUTER JOIN emp e ON d.deptno = e.deptno ORDER BY d.deptno; -- Retrieve Data from Foreign Table using Query Optimizer. CREATE TABLE dept_lcl ( deptno INTEGER NOT NULL CONSTRAINT dept_pk PRIMARY KEY, dname VARCHAR(14) CONSTRAINT dept_dname_uq UNIQUE, loc VARCHAR(13) ); INSERT INTO dept_lcl VALUES (10,'ACCOUNTING','NEW YORK'); INSERT INTO dept_lcl VALUES (20,'RESEARCH','DALLAS'); INSERT INTO dept_lcl VALUES (30,'SALES','CHICAGO'); INSERT INTO dept_lcl VALUES (40,'OPERATIONS','BOSTON'); SELECT dept_lcl.dname, emp.ename FROM dept_lcl CROSS JOIN emp ORDER BY 1, 2; EXPLAIN (COSTS OFF) SELECT dept_lcl.dname, emp.ename FROM dept_lcl CROSS JOIN emp ORDER BY dept_lcl.deptno; SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept_lcl d, emp e WHERE d.deptno = e.deptno ORDER BY 1, 2, 3, 4, 5, 6; SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept_lcl d LEFT OUTER JOIN emp e ON d.deptno=e.deptno ORDER BY 1, 2, 3, 4, 5, 6; EXPLAIN (COSTS OFF) SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept_lcl d RIGHT OUTER JOIN emp e ON d.deptno=e.deptno ORDER BY d.deptno; SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept_lcl d FULL OUTER JOIN emp e ON d.deptno=e.deptno ORDER BY 1, 2, 3, 4, 5, 6; EXPLAIN (COSTS OFF) SELECT d.deptno, d.dname, e.empno, e.ename, e.sal, e.deptno FROM dept_lcl d FULL OUTER JOIN emp e ON d.deptno=e.deptno ORDER BY d.deptno; -- FDW-251 -- LEFT JOIN LATERAL case should not crash EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM dept t1 LEFT JOIN LATERAL ( SELECT t2.deptno, t1.deptno AS t1_a FROM dept t2) t3 ON t1.deptno = t3.deptno ORDER BY 1; SELECT * FROM dept t1 LEFT JOIN LATERAL ( SELECT t2.deptno, t1.deptno AS t1_a FROM dept t2) t3 ON t1.deptno = t3.deptno ORDER BY 1; -- LEFT JOIN LATERAL involving local and foreign table should not crash. SELECT * FROM dept_lcl t1 LEFT JOIN LATERAL ( SELECT empno, ename, t1.deptno FROM emp WHERE empno < 7400) t3 ON t1.deptno = t3.deptno ORDER BY 1; -- Test INNER JOIN LATERAL syntax works fine. SELECT t3.empno, t3.ename, t1.dname, t3.dno FROM dept t1 INNER JOIN LATERAL ( SELECT empno, ename, t1.deptno AS dno FROM emp t2) t3 ON t1.deptno = dno ORDER BY 1, 2, 3, 4 LIMIT 4; -- Test LATERAL works for inner query SELECT *, (SELECT r FROM (SELECT empno AS c1) x, LATERAL (SELECT empno AS r) y) FROM emp ORDER BY empno; -- RIGHT JOIN LATERAL should error out SELECT * FROM dept t1 RIGHT JOIN LATERAL ( SELECT t2.deptno, t1.deptno AS t1_a FROM dept t2) t3 ON t1.deptno = t3.deptno ORDER BY 1; --VACUUM, ANALYZE VACUUM emp; VACUUM FULL emp; VACUUM FREEZE emp; VACUUM; VACUUM ANALYZE emp; --Views CREATE VIEW smpl_vw AS SELECT * FROM emp ORDER BY empno; SELECT * FROM smpl_vw ORDER BY empno; CREATE VIEW comp_vw (empno, ename, job, sal, comm, deptno, dname) AS SELECT s.empno, s.ename, s.job, s.sal, s.comm, d.deptno, d.dname FROM dept d, emp s WHERE d.deptno=s.deptno AND d.deptno = 10 ORDER BY s.empno; SELECT * FROM comp_vw ORDER BY 1; CREATE OR REPLACE TEMPORARY VIEW temp_vw AS SELECT * FROM dept; SELECT * FROM temp_vw ORDER BY 1; SELECT * FROM (SELECT deptno, count(*) emp_count FROM emp GROUP BY deptno) emp, dept dept WHERE dept.deptno = emp.deptno ORDER BY dept.deptno; --Cleanup DROP VIEW smpl_vw; DROP VIEW comp_vw; DROP VIEW temp_vw; DROP FOREIGN TABLE emp; DROP FOREIGN TABLE dept; DROP FOREIGN TABLE jobhist; DROP TABLE dept_lcl; DROP USER MAPPING FOR public SERVER hdfs_server; DROP SERVER hdfs_server; DROP EXTENSION hdfs_fdw;
the_stack
CREATE OR REPLACE FUNCTION cw_instr4(source STRING, search STRING, position INT64, ocurrence INT64) RETURNS INT64 AS ( case when position > 0 then (SELECT length(string_agg(x, '')) + length(search) * (ocurrence - 1) + position FROM unnest(split(substr(source, position), search)) as x with offset occ WHERE occ < ocurrence) when position < 0 then (SELECT length(string_agg(x, '')) + length(search) * (count(occ)) - (length(search) - 1) FROM unnest(array_reverse(split(substr(source, 1, length(source) + position + length(search)), search))) as x with offset occ WHERE occ >= ocurrence) else 0 end ); CREATE OR REPLACE FUNCTION cw_initcap(s STRING) RETURNS STRING AS ( (SELECT STRING_AGG(CONCAT(UPPER(SUBSTR(part, 1, 1)), LOWER(SUBSTR(part, 2))), ' ') FROM UNNEST(SPLIT(s, ' ')) AS part) ); CREATE OR REPLACE FUNCTION cw_otranslate(s STRING, key STRING, value STRING) RETURNS STRING AS ( (SELECT STRING_AGG( IFNULL( (SELECT SPLIT(value, '')[SAFE_OFFSET(( SELECT o2 FROM UNNEST(SPLIT(key, '')) AS k WITH OFFSET o2 WHERE k = c ORDER BY o2 ASC LIMIT 1))] ), c), '' ORDER BY o1) FROM UNNEST(SPLIT(s, '')) AS c WITH OFFSET o1 ) ); /* Formats the interval as 'day hour:minute:second */ CREATE OR REPLACE FUNCTION cw_stringify_interval (x INT64) RETURNS STRING AS ( concat( CASE WHEN x >= 0 THEN '+' ELSE '-' END, format('%04d', div(abs(x), 24*60*60)), ' ', -- day format('%02d', div(mod(abs(x), 24*60*60), 60*60)), ':', -- hour format('%02d', div(mod(abs(x), 60*60), 60)), ':', -- minute format('%02d', mod(abs(x), 60)) -- second ) ); /* Internal function */ CREATE OR REPLACE FUNCTION cw_regex_mode (mode STRING) RETURNS STRING LANGUAGE js AS """ var m = ''; if (mode == 'i' || mode == 'm') m += mode; else if (mode == 'n') m += 's'; m += 'g'; return m; """; /* Implements regexp_substr/4 (haystack, needle, position, occurence) */ CREATE OR REPLACE FUNCTION cw_regexp_substr_4 (h STRING, n STRING, p INT64, o INT64) RETURNS STRING AS ( regexp_extract_all(substr(h, p), n)[safe_ordinal(o)] ); CREATE OR REPLACE FUNCTION cw_regexp_substr_generic (str STRING, regexp STRING, p INT64, o INT64, mode STRING, g INT64) RETURNS STRING LANGUAGE js AS """ if (str == null || regexp == null || p == null || o == null || mode == null) return null; var r = new RegExp(regexp, mode); var m = str.substring(p - 1).matchAll(r); if (m == null) return null; var co = 1; for(var cm of m) { if (co == o) { if (g < cm.length) { return cm[g]; } else { return null; } } co++; } return null; """; /* Implements regexp_substr/5 (haystack, needle, position, occurence, mode) */ CREATE OR REPLACE FUNCTION cw_regexp_substr_5 (h STRING, n STRING, p INT64, o INT64, mode STRING) RETURNS STRING AS ( cw_regexp_substr_generic(h, n, p, o, cw_regex_mode(mode), 0) ); /* Implements regexp_substr/6 (haystack, needle, position, occurence, mode, captured_subexp) */ CREATE OR REPLACE FUNCTION cw_regexp_substr_6 (h STRING, n STRING, p INT64, o INT64, mode STRING, g INT64) RETURNS STRING AS ( cw_regexp_substr_generic(h, n, p, o, cw_regex_mode(mode), g) ); CREATE OR REPLACE FUNCTION cw_regexp_instr_2(haystack STRING, needle STRING) RETURNS INT64 AS ( CASE WHEN REGEXP_CONTAINS(haystack, needle) THEN LENGTH(REGEXP_REPLACE(haystack, CONCAT('(.*?)', needle, '(.*)'), '\\1')) + 1 WHEN needle IS NULL OR haystack IS NULL THEN NULL ELSE 0 END ); CREATE OR REPLACE FUNCTION cw_regexp_instr_3(haystack STRING, needle STRING, start INT64) RETURNS INT64 AS ( CASE WHEN REGEXP_CONTAINS(substr(haystack, start), needle) THEN LENGTH(REGEXP_REPLACE(substr(haystack, start), CONCAT('(.*?)', needle, '(.*)'), '\\1')) + 1 + start WHEN needle IS NULL OR haystack IS NULL or start IS NULL THEN NULL ELSE 0 END ); /* Implements regexp_instr/4 (haystack, needle, position, occurence) */ CREATE OR REPLACE FUNCTION cw_regexp_instr_4 (haystack STRING, regexp STRING, p INT64, o INT64) RETURNS INT64 LANGUAGE js AS """ if (haystack == null || regexp == null || o == null) return null; p = p -1; o = o -1; var str = haystack.substring(p); var a; var r = new RegExp(regexp, 'g'); var count = 0; while ((a = r.exec(str)) !== null && count++ < o) { } if (a == null) return 0; return a.index+1+Number(p); """; /* Implements regexp_instr/6 (haystack, needle, position, occurence, returnopt) // else: // case 'c': default // case 'l': not supported // case 'x': not supported */ CREATE OR REPLACE FUNCTION cw_regexp_instr_generic (haystack STRING, regexp STRING, p INT64, o INT64, returnopt INT64, mode STRING) RETURNS INT64 LANGUAGE js AS """ if (haystack == null || regexp == null || p == null || o == null || returnopt == null || mode == null) return null; p = p -1; o = o -1; var str = haystack.substring(p); var a; var r = new RegExp(regexp, mode); var count = 0; while ((a = r.exec(str)) !== null && count++ < o) { } if (a == null) return 0; if (returnopt == 0) return a.index+1+Number(p); else return a.index+1+Number(p)+a[0].length; """; CREATE OR REPLACE FUNCTION cw_regexp_instr_6 (haystack STRING, regexp STRING, p INT64, o INT64, returnopt INT64, mode STRING) RETURNS INT64 AS ( cw_regexp_instr_generic(haystack, regexp, p, o, returnopt, cw_regex_mode(mode)) ); /* Generic regexp_replace, which is the 6-args version with regexp_mode already decoded */ CREATE OR REPLACE FUNCTION cw_regexp_replace_generic (haystack STRING, regexp STRING, replacement STRING, offset INT64, occurrence INT64, mode STRING) RETURNS STRING LANGUAGE js AS """ if (haystack == null || regexp == null || replacement == null || offset == null || occurrence == null || mode == null) return null; replacement = replacement.replace('\\\\', '$'); let regExp = new RegExp(regexp, mode); if (occurrence == 0) return haystack.replace(regExp, replacement); const start = offset - 1; const index = occurrence - 1; let relevantString = haystack.substring(start); let a, count = 0; while ((a = regExp.exec(relevantString)) !== null && count++ < index) { relevantString = relevantString.substr(regExp.lastIndex); regExp.lastIndex = 0; } if (a == null) return haystack; const prefix = haystack.substr(0, haystack.length - relevantString.length); if (mode.indexOf('g') >= 0) { mode = mode.replace('g', ''); regExp = new RegExp(regexp, mode); } return prefix + relevantString.replace(regExp, replacement); """; CREATE OR REPLACE FUNCTION cw_regexp_replace_4 (haystack STRING, regexp STRING, replacement STRING, offset INT64) RETURNS STRING AS ( cw_regexp_replace_generic(haystack, regexp, replacement, offset, 0, cw_regex_mode('')) ); CREATE OR REPLACE FUNCTION cw_regexp_replace_5 (haystack STRING, regexp STRING, replacement STRING, offset INT64, occurrence INT64) RETURNS STRING AS ( cw_regexp_replace_generic(haystack, regexp, replacement, offset, occurrence, cw_regex_mode('')) ); CREATE OR REPLACE FUNCTION cw_regexp_replace_6 (haystack STRING, regexp STRING, replacement STRING, p INT64, o INT64, mode STRING) RETURNS STRING AS ( cw_regexp_replace_generic(haystack, regexp, replacement, p, o, cw_regex_mode('')) ); /* Implements regexp_instr/5 (haystack, needle, position, occurence, returnopt) */ CREATE OR REPLACE FUNCTION cw_regexp_instr_5 (haystack STRING, regexp STRING, p INT64, o INT64, returnopt INT64) RETURNS INT64 AS ( cw_regexp_instr_generic(haystack, regexp, p, o, returnopt, cw_regex_mode('')) ); /* Like presto ARRAY_MIN */ CREATE OR REPLACE FUNCTION cw_array_min(arr ANY TYPE) AS ( ( SELECT MIN(x) FROM UNNEST(arr) AS x ) ); /* Similar to MEDIAN in Teradata */ CREATE OR REPLACE FUNCTION cw_array_median(arr ANY TYPE) RETURNS FLOAT64 AS ( ( SELECT PERCENTILE_CONT(x, 0.5) OVER() FROM UNNEST(arr) AS x LIMIT 1 ) ); /* Like presto ARRAY_MAX */ CREATE OR REPLACE FUNCTION cw_array_max(arr ANY TYPE) AS ( ( SELECT MAX(x) FROM UNNEST(arr) AS x ) ); /* Like presto ARRAY_DISTINCT */ CREATE OR REPLACE FUNCTION cw_array_distinct(arr ANY TYPE) AS ( ARRAY( SELECT DISTINCT x FROM UNNEST(arr) AS x ) ); /* Returns the date of the first weekday (second arugment) that is later than the date specified by the first argument */ CREATE OR REPLACE FUNCTION cw_next_day(date_value DATE, day_name STRING) RETURNS DATE AS ( (WITH t AS (SELECT CASE lower(substr(day_name, 1, 3)) WHEN 'sun' THEN 1 WHEN 'mon' THEN 2 WHEN 'tue' THEN 3 WHEN 'wed' THEN 4 WHEN 'thu' THEN 5 WHEN 'fri' THEN 6 WHEN 'sat' THEN 7 ELSE NULL END AS tgt, extract(dayofweek FROM date_value) AS src ) SELECT CASE WHEN src < tgt THEN date_add(date_value, INTERVAL (tgt - src) DAY) ELSE date_add(date_value, INTERVAL (tgt + 7 - src) DAY) END FROM t) ); /* Emulate teradata NVP function - extract a value from a key-value separated string */ CREATE OR REPLACE FUNCTION cw_td_nvp(haystack STRING, needle STRING, pairsep STRING, valuesep STRING, occurence INT64) RETURNS STRING AS ( NULLIF(ARRAY(SELECT kv[SAFE_OFFSET(1)] FROM ( SELECT SPLIT(pairs, valuesep) AS kv, o FROM UNNEST(SPLIT(haystack, pairsep)) AS pairs WITH OFFSET o ) t WHERE kv[SAFE_OFFSET(0)] = needle ORDER BY o ASC)[SAFE_ORDINAL(occurence)], '') ); /* Emulate Presto from_base function - convert string from given base to decimal */ CREATE OR REPLACE FUNCTION cw_from_base(number STRING, base INT64) RETURNS INT64 AS ( (WITH chars AS ( SELECT IF(ch >= 48 AND ch <= 57, ch - 48, IF(ch >= 65 AND ch <= 90, ch - 65 + 10, ch - 97 + 10)) pos, offset + 1 AS idx FROM UNNEST(TO_CODE_POINTS(number)) AS ch WITH OFFSET ) SELECT SAFE_CAST(SUM(pos*CAST(POW(base, CHAR_LENGTH(number) - idx) AS NUMERIC)) AS INT64) from_base FROM chars) ); /* Emulate Presto to_base function - convert decimal number to number with given base */ CREATE OR REPLACE FUNCTION cw_to_base(number INT64, base INT64) RETURNS STRING AS ( (WITH chars AS ( SELECT MOD(CAST(FLOOR(ABS(number)/POW(base, (FLOOR(LOG(ABS(number))/LOG(base)) + 1) - idx)) AS INT64), base) ch, idx from UNNEST(GENERATE_ARRAY(1, CAST(FLOOR(LOG(ABS(number))/LOG(base)) AS INT64) + 1)) idx ) SELECT CONCAT(CASE WHEN number < 0 THEN '-' ELSE '' END, CODE_POINTS_TO_STRING(ARRAY_AGG(if(ch >= 0 AND ch <= 9, ch + 48, ch + 97 - 10) ORDER BY idx))) to_base FROM chars) ); /* Implements Presto ARRAYS_OVERLAP */ CREATE OR REPLACE FUNCTION cw_array_overlap(x ANY TYPE, y ANY TYPE) RETURNS BOOL AS( CASE WHEN EXISTS(SELECT 1 FROM UNNEST(ARRAY_CONCAT(x,y)) as z WHERE z IS NULL) THEN NULL ELSE EXISTS(SELECT 1 FROM UNNEST(x) as u JOIN UNNEST(y) as v ON u=v) END ); /* Implements Snowflake ARRAY_COMPACT */ CREATE OR REPLACE FUNCTION cw_array_compact(a ANY TYPE) AS ( ARRAY(SELECT v FROM UNNEST(a) v WHERE v IS NOT NULL) ); /* Kludge for interval translation - for now day->sec only! */ CREATE OR REPLACE FUNCTION cw_runtime_parse_interval_seconds(ival STRING) RETURNS INT64 AS ( CASE WHEN ival IS NULL THEN NULL WHEN ARRAY_LENGTH(SPLIT(ival,' ')) <> 2 THEN NULL WHEN SPLIT(ival,' ')[OFFSET(1)] NOT IN ('day','DAY') THEN NULL ELSE 86400 * SAFE_CAST(SPLIT(ival,' ')[OFFSET(0)] AS INT64) END ); /* url encode a string */ CREATE OR REPLACE FUNCTION cw_url_encode(path STRING) RETURNS STRING LANGUAGE js AS """ if (path == null) return null; try { return encodeURIComponent(path); } catch (e) { return path; } """; /* url decode a string */ CREATE OR REPLACE FUNCTION cw_url_decode(path STRING) RETURNS STRING LANGUAGE js AS """ if (path == null) return null; try { return decodeURIComponent(path); } catch (e) { return path; } """; /* Extract the host from a url, return "" (empty string) if no host is found. */ CREATE OR REPLACE FUNCTION cw_url_extract_host(url STRING) RETURNS STRING AS ( NET.HOST(url) ); /* Extract the protocol from a url, return "" (empty string) if no protocol is found. */ CREATE OR REPLACE FUNCTION cw_url_extract_protocol(url STRING) RETURNS STRING AS ( (WITH a AS ( SELECT STRPOS(url, "://") AS v ) SELECT IF(a.v <= 0, "", SUBSTR(url,1,a.v-1)) FROM a) ); /* Extract the path from a url, returns "" (empty string) if no path is found. */ CREATE OR REPLACE FUNCTION cw_url_extract_path(url STRING) RETURNS STRING LANGUAGE js AS """ var queryPos = url.indexOf('?'); if (queryPos >= 0) url = url.slice(0,queryPos); else { var fragPos = url.indexOf('#'); if (fragPos >= 0) url = url.slice(0,fragPos); } var protPos = url.indexOf("//"); if (protPos >= 0) url = url.slice(protPos+2); var pathPos = url.indexOf("/"); if (pathPos < 0) return ""; url = url.slice(pathPos); return url; """; /* Extract the port from a url, returns null if no port is found. */ CREATE OR REPLACE FUNCTION cw_url_extract_port(url STRING) RETURNS INT64 LANGUAGE js AS """ var protPos = url.indexOf("//"); if (protPos >= 0) url = url.slice(protPos+2); var pathPos = url.indexOf("/"); if (pathPos > 0) url = url.slice(0,pathPos); var portPos = url.lastIndexOf(":"); if (portPos < 0) return null; url = url.slice(portPos+1); var port = parseInt(url); return isNaN(port) ? null : port; """; /* Extract the query from a url, returns "" (empty string) if no query is found. */ CREATE OR REPLACE FUNCTION cw_url_extract_query(url STRING) RETURNS STRING AS ( COALESCE(SUBSTR(SPLIT(REGEXP_EXTRACT(url, '[^\\?]+(\\?.*)?'),'#')[OFFSET(0)],2),'') ); /* Extract the fragment from a url, returns "" (empty string) if no fragment is found. */ CREATE OR REPLACE FUNCTION cw_url_extract_fragment(url STRING) RETURNS STRING AS ( COALESCE(REGEXP_EXTRACT(url,'#(.+)'),'') ); /* Extract the value of a query param from a url, returns null if the parameter isn't found. */ CREATE OR REPLACE FUNCTION cw_url_extract_parameter(url STRING, pname STRING) RETURNS STRING AS ( SPLIT(REGEXP_EXTRACT(url, CONCAT('[?&]',pname,'=([^&]+).*$')),'#')[OFFSET(0)] ); /* Returns the first substring matched by the regular expression `regexp` in `str`. */ CREATE OR REPLACE FUNCTION cw_regexp_extract(str STRING, regexp STRING) RETURNS STRING LANGUAGE js AS """ var r = new RegExp(regexp); var a = str.match(r); return a[0]; """; /* Finds the first occurrence of the regular expression `regexp` in `str` and returns the capturing group number `groupn` */ CREATE OR REPLACE FUNCTION cw_regexp_extract_n(str STRING, regexp STRING, groupn INT64) RETURNS STRING LANGUAGE js AS """ var r = new RegExp(regexp); var a = str.match(r); if (!a) return null; var groupn = groupn || 0; if (groupn >= a.length) { throw new Error("Pattern has " + (a.length-1) + " groups. Cannot access group "+groupn); } return a[groupn]; """; /* Returns the substring(s) matched by the regular expression `regexp` in `str`. */ CREATE OR REPLACE FUNCTION cw_regexp_extract_all(str STRING, regexp STRING) RETURNS ARRAY<STRING> LANGUAGE js AS """ var r = new RegExp(regexp, "g"); return str.match(r); """; /* Finds all occurrences of the regular expression `regexp` in `str` and returns the capturing group number `groupn`. */ CREATE OR REPLACE FUNCTION cw_regexp_extract_all_n(str STRING, regexp STRING, groupn INT64) RETURNS ARRAY<STRING> LANGUAGE js AS """ var r = new RegExp(regexp, 'g'); var o = []; while ((a = r.exec(str)) !== null) { if (groupn >= a.length) { throw new Error("Pattern has " + (a.length-1) + " groups. Cannot access group "+groupn); } o.push(a[groupn]); } return o; """; /* Determine if value exists in json (a string containing a JSON array). */ CREATE OR REPLACE FUNCTION cw_json_array_contains_str(json STRING, needle STRING) RETURNS BOOL LANGUAGE js AS """ if (json == null || needle == null) return null; var parsedJson = JSON.parse(json); return parsedJson.indexOf(needle) >= 0; """; /* Same as cw_json_array_contains_str(STRING, STRING) UDF but with needle = number */ CREATE OR REPLACE FUNCTION cw_json_array_contains_num(json STRING, needle FLOAT64) RETURNS BOOL LANGUAGE js AS """ if (json == null || needle == null) return null; var parsedJson = JSON.parse(json); return parsedJson.indexOf(needle) >= 0; """; /* Same as cw_json_array_contains_str(STRING, STRING) UDF but with needle = boolean */ CREATE OR REPLACE FUNCTION cw_json_array_contains_bool(json STRING, needle BOOL) RETURNS BOOL LANGUAGE js AS """ if (json == null || needle == null) return null; var parsedJson = JSON.parse(json); return parsedJson.indexOf(needle) >= 0; """; /* Returns the element at the specified index into the json_array. The index is zero-based */ CREATE OR REPLACE FUNCTION cw_json_array_get(json STRING, loc FLOAT64) RETURNS STRING LANGUAGE js AS """ if (json == null || loc == null) return null; var parsedJson = JSON.parse(json); if (loc < 0) loc = parsedJson.length + loc if (loc < 0 && loc >= parsedJson.length) return null return JSON.stringify(parsedJson[loc]); """; /* Returns the array length of json (a string containing a JSON array) */ CREATE OR REPLACE FUNCTION cw_json_array_length(json STRING) RETURNS INT64 LANGUAGE js AS """ if (json == null) return null; var parsedJson = JSON.parse(json); return parsedJson.length; """; /* Implements MySQL SUBSTRING_INDEX */ CREATE OR REPLACE FUNCTION cw_substring_index(str STRING, sep STRING, idx INT64) RETURNS STRING LANGUAGE js AS """ if (str === null || sep === null || idx === null) return null; if (sep == "") return ""; var arr = str.split(sep); var oth = arr.splice(idx, arr.length - idx); return (idx >= 0 ? arr : oth).join(sep); """; /* Implements teradata's editdistance without weightages */ CREATE OR REPLACE FUNCTION cw_editdistance( a STRING, b STRING ) RETURNS INT64 LANGUAGE js AS """ if ( a == null || b == null ) { return null; } var work = new Array( a.length + 1 ) for ( var i = 0 ; i <= a.length ; i ++ ) { work[i] = new Array ( b.length + 1 ) } for ( var i = 0 ; i < a.length + 1 ; i ++ ) work[i][0] = i; for ( var j = 0 ; j < b.length + 1 ; j ++ ) work[0][j] = j; for ( var i = 1 ; i < a.length + 1 ; i ++ ) { for ( var j = 1 ; j < b.length + 1 ; j ++ ) { var cost = a[i-1] == b[j-1] ? 0 : 1; work[i][j] = Math.min( work[i-1] [j] + 1, work[i] [j-1] + 1, work[i-1] [j-1] + cost ) if ( i > 1 && j > 1 && a[i-1] == b[j-2] && a[i-2] == b[j-1] ) { work[i][j] = Math.min( work[i] [j], work[i-2][j-2] + 1 ); } } } return work[a.length][b.length]; """; CREATE OR REPLACE FUNCTION cw_round_half_even(n BIGNUMERIC, d INT64) RETURNS NUMERIC AS ( CAST( POW(10, -d) * SIGN(n) * CASE WHEN CAST(TRUNC(n * POW(10, d)) AS INT64) & 1 = 0 -- even number THEN CEIL(ABS(n * POW(10, d)) - 0.5) -- round towards ELSE FLOOR(ABS(n * POW(10, d)) + 0.5) -- round away END AS NUMERIC) ); CREATE OR REPLACE FUNCTION cw_round_half_even_bignumeric(n BIGNUMERIC, d INT64) RETURNS BIGNUMERIC AS ( CAST( POW(10, -d) * SIGN(n) * CASE WHEN CAST(TRUNC(n * POW(10, d)) AS INT64) & 1 = 0 -- even number THEN CEIL(ABS(n * POW(10, d)) - 0.5) -- round towards ELSE FLOOR(ABS(n * POW(10, d)) + 0.5) -- round away END AS BIGNUMERIC) ); CREATE OR REPLACE FUNCTION cw_getbit(bits INT64, index INT64) RETURNS INT64 AS ( (bits & (1 << index)) >> index ); CREATE OR REPLACE FUNCTION cw_setbit(bits INT64, index INT64) RETURNS INT64 AS ( bits | (1 << index) ); /** Emulate Vertica LOWERB function, which lowercases only ASCII characters within a given string. */ CREATE OR REPLACE FUNCTION cw_lower_case_ascii_only(str STRING) RETURNS STRING AS ( (WITH chars AS ( SELECT ch FROM UNNEST(TO_CODE_POINTS(str)) AS ch ) SELECT CONCAT(CODE_POINTS_TO_STRING(ARRAY_AGG(if(ch >= 65 and ch <= 90, ch + 32, ch)))) from chars )); /** Emulate Vertica SUBSTRB function, which treats the multibyte character string as a string of octets (bytes). */ CREATE OR REPLACE FUNCTION cw_substrb(str STRING, startpos INT64 /* 1-based */, extent INT64 /* 1-based */) RETURNS STRING AS ( (WITH octets AS ( SELECT oct FROM UNNEST(TO_CODE_POINTS(CAST(str as bytes))) AS oct WITH OFFSET off WHERE (off+1) >= startpos and (off+1) < startpos+extent ORDER BY off ) SELECT SAFE_CONVERT_BYTES_TO_STRING(CODE_POINTS_TO_BYTES(ARRAY_AGG(oct))) FROM octets )); CREATE OR REPLACE FUNCTION cw_twograms(t STRING) RETURNS ARRAY<STRING> AS ( (WITH splt as (SELECT regexp_extract_all(t, r'(\S+)') as a) SELECT array_agg(concat(a[offset(i)], ' ', a[offset(i+1)])) from splt join unnest(generate_array(0, array_length(a) - 2, 1)) as i )); CREATE OR REPLACE FUNCTION cw_threegrams(t STRING) RETURNS ARRAY<STRING> AS ( (WITH splt as (SELECT regexp_extract_all(t, r'(\S+)') as a) SELECT array_agg(concat(a[offset(i)], ' ', a[offset(i+1)], ' ', a[offset(i+2)])) from splt join unnest(generate_array(0, array_length(a) - 3, 1)) as i )); CREATE OR REPLACE FUNCTION cw_nvp2json1 (nvp STRING) RETURNS STRING AS ( --concat('{"',replace(replace(nvp,'&','","'),'=','":"'),'"}') --JSON_EXTRACT(concat('{"',replace(replace(nvp,'&','","'),'=','":"'),'"}'),'$') JSON_EXTRACT(concat('{"',replace(replace(replace(replace(nvp,'\\','\\\\'),'"','\\"'),'&','","'),'=','":"'),'"}'),'$') ); CREATE OR REPLACE FUNCTION cw_nvp2json3 (nvp STRING,name_delim STRING, val_delim STRING) RETURNS STRING AS ( --concat('{"',replace(replace(nvp,name_delim,'","'),val_delim,'":"'),'"}') -- JSON_EXTRACT(concat('{"',replace(replace(nvp,name_delim,'","'),val_delim,'":"'),'"}'),'$') JSON_EXTRACT(concat('{"',replace(replace(replace(replace(nvp,'\\','\\\\'),'"','\\"'),name_delim,'","'),val_delim,'":"'),'"}'),'$') ); CREATE OR REPLACE FUNCTION cw_nvp2json4 (nvp STRING, name_delim STRING, val_delim STRING, ignore_char STRING) RETURNS STRING AS ( --concat('{"',replace(replace(translate(nvp,ignore_char,''),name_delim,'","'),val_delim,'":"'),'"}') --JSON_EXTRACT(concat('{"',replace(replace(translate(nvp,ignore_char,''),name_delim,'","'),val_delim,'":"'),'"}'),'$') JSON_EXTRACT(concat('{"',replace(replace(replace(replace(translate(nvp,ignore_char,''),'\\','\\\\'),'"','\\"') ,name_delim,'","'),val_delim,'":"'),'"}'),'$') ); CREATE OR REPLACE FUNCTION cw_strtok(text string, delim string) RETURNS array<struct<tokennumber int64, token string>> LANGUAGE js AS """ var ret = [ ] var token = "" var tokennumber = 1; if ( text === null || delim === null ) return ret; var isDelim = function ( ch ) { return delim.indexOf(ch) >= 0; }; var wrap_up = function( ) { if ( token != '' ) { ret.push({ tokennumber, token}); token = ""; tokennumber++; } }; for ( var j = 0 ; j < text.length ; j ++ ) { var c = text.charAt(j); if ( isDelim(c) ) { wrap_up(); } else { token += c; } } wrap_up(); return ret; """; CREATE OR REPLACE FUNCTION cw_regexp_split(text string, delim string, flags string) RETURNS array<struct<tokennumber int64, token string>> LANGUAGE js AS """ var idx = 0; var nxt = function() { idx ++; return idx; }; var fix_flags = function(mode) { var m = ''; if (mode == 'i' || mode == 'm') m += mode; else if (mode == 'n') m += 's'; m += 'g'; return m; }; return text. split( new RegExp(delim,fix_flags(flags))). filter( x => x != ''). map( x => ({ tokennumber : nxt(), token: x }) ); """; CREATE OR REPLACE FUNCTION cw_csvld(text string, comma string, quote string,len INT64) RETURNS array<string> LANGUAGE js AS """ var ret = [] var index = 0; /* Can't return NULL from ARRAY */ for( var j = 0 ; j < len ; j ++ ) ret.push(''); if ( text === null ) return ret; var state = 0; const STATE_TOP = 0; const STATE_QUOTE = 1; const STATE_ESCAPE = 2; var start_new = function () { index ++; }; var append = function(c) { ret[index] += c; }; for ( var j = 0 ; j < text.length ; j ++ ) { var c = text.charAt(j); switch ( state ) { case STATE_TOP: if ( c == quote ) state = STATE_QUOTE; else if ( c == comma ) start_new(); else append(c); break; case STATE_QUOTE: if ( c == quote ) state = STATE_ESCAPE; else append(c); break; case STATE_ESCAPE: if ( c == quote ) { state = STATE_QUOTE; append(quote) } else if ( c == comma ) { state = STATE_TOP; start_new(); } else { state = STATE_TOP; append(c); } break; default: /* impossible condition */ break; } } return ret; """; CREATE OR REPLACE FUNCTION cw_json_enumerate_array(text string) RETURNS array<struct<ordinal int64, jsonvalue string>> LANGUAGE js AS """ if ( text === null ) return []; var idx = 0; var nxt = function() { idx ++; return idx; }; return JSON.parse(text).map( x => ({ ordinal: nxt(), jsonvalue: JSON.stringify(x)})); """; -- ts_pattern_match is function that returns range of matched pattern -- in given UID, SID (user session) CREATE OR REPLACE FUNCTION cw_ts_pattern_match(evSeries ARRAY<STRING>, regexpParts ARRAY<STRING>) RETURNS ARRAY<STRUCT<pattern_id INT64, start INT64, stop INT64>> LANGUAGE js AS """ var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; var charIdx = 0; var name2char = {}; var eventRegExp = ''; for( nameWithQuantifierOrAlt of regexpParts ) { var match = nameWithQuantifierOrAlt.match(/([a-zA-Z0-9]*)([^a-zA-Z0-9]*)/) if( !match ) { throw new Error("Invalid Event name" + nameWithQuantifierOrAlt); } var name = match[1]; var quantifiers = match[2]; if ( name ) { var ch = name2char[name]; if ( ! ch ) { if( charIdx == 52) { throw new Error("More than 52 events are not supported") } ch = chars.charAt(charIdx++) name2char[name] = ch; } eventRegExp += ch + quantifiers; } else { // is Alt('|') eventRegExp += quantifiers; // quantifier match the PCRE, [*+?]/[*?], | } }; var eventHaystack = '' for ( ev of evSeries ) { var ch = name2char[ev]; if ( ch ) eventHaystack += ch; else if ( ev == '?' ) { eventHaystack += ev; } else { throw new Error("Unknown event in event stream : " + evSeries) } }; var out = []; var k = 1; for(var matchedEvent of eventHaystack.matchAll(new RegExp(eventRegExp, 'g'))) { out.push({ 'pattern_id' : k++ , 'start' : matchedEvent.index + 1, 'stop' : matchedEvent.index + matchedEvent[0].length}) } return out; """;
the_stack
-- 2019-11-19T11:42:01.893Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AD_Client_ID,IsActive,Created,CreatedBy,Updated,IsReport,AD_Org_ID,IsDirectPrint,AccessLevel,ShowHelp,IsBetaFunctionality,IsServerProcess,CopyFromProcess,UpdatedBy,AD_Process_ID,Value,AllowProcessReRun,IsUseBPartnerLanguage,IsApplySecuritySettings,RefreshAllAfterExecution,IsOneInstanceOnly,LockWaitTimeout,Type,IsTranslateExcelHeaders,Name,SQLStatement,Classname,EntityType) VALUES (0,'Y',TO_TIMESTAMP('2019-11-19 13:42:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-11-19 13:42:01','YYYY-MM-DD HH24:MI:SS'),'N',0,'N','7','N','N','N','N',100,541210,'ExportPriceListSchemaLine','Y','Y','N','N','N',0,'Excel','Y','ExportPriceListSchemaLine',' SELECT l.seqno "Sequence", (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) "Product", (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) "Product Category", (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) "Business Partner", (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) "Taxcategory", l.std_addamt "Standard Price Surcharge Amount", l.std_rounding "Standard Price Rounding", (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) "Target Taxcategory" FROM m_discountschemaline l where l.m_discountschema_id = @M_DiscountSchema_ID@','de.metas.impexp.excel.process.ExportToExcelProcess','D') ; -- 2019-11-19T11:42:01.898Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_ID=541210 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 2019-11-19T11:43:52.237Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table_Process (Created,CreatedBy,IsActive,AD_Table_ID,Updated,UpdatedBy,AD_Client_ID,WEBUI_ViewQuickAction,AD_Process_ID,AD_Window_ID,AD_Tab_ID,WEBUI_DocumentAction,WEBUI_ViewAction,WEBUI_IncludedTabTopAction,WEBUI_ViewQuickAction_Default,AD_Table_Process_ID,AD_Org_ID,EntityType) VALUES (TO_TIMESTAMP('2019-11-19 13:43:52','YYYY-MM-DD HH24:MI:SS'),100,'Y',475,TO_TIMESTAMP('2019-11-19 13:43:52','YYYY-MM-DD HH24:MI:SS'),100,0,'N',541210,337,405,'Y','Y','N','N',540755,0,'D') ; -- 2019-11-19T11:53:00.363Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET Name='Export Price List Schema Lines',Updated=TO_TIMESTAMP('2019-11-19 13:53:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 AND AD_Language='de_CH' ; -- 2019-11-19T11:53:04.521Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Name='Export Price List Schema Lines',Updated=TO_TIMESTAMP('2019-11-19 13:53:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-19T11:53:11.460Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Export Price List Schema Lines',Updated=TO_TIMESTAMP('2019-11-19 13:53:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 AND AD_Language='en_US' ; -- 2019-11-19T12:15:33.388Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Preisliste Schemalinien exportieren',Updated=TO_TIMESTAMP('2019-11-19 14:15:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 AND AD_Language='de_CH' ; -- 2019-11-19T12:16:46.421Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AD_Client_ID,IsActive,Created,CreatedBy,Updated,IsReport,AD_Org_ID,IsDirectPrint,AccessLevel,ShowHelp,IsBetaFunctionality,IsServerProcess,CopyFromProcess,UpdatedBy,AD_Process_ID,Value,AllowProcessReRun,IsUseBPartnerLanguage,IsApplySecuritySettings,RefreshAllAfterExecution,IsOneInstanceOnly,LockWaitTimeout,Type,IsTranslateExcelHeaders,Name,Classname,EntityType) VALUES (0,'Y',TO_TIMESTAMP('2019-11-19 14:16:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-11-19 14:16:46','YYYY-MM-DD HH24:MI:SS'),'N',0,'N','7','N','N','N','N',100,541211,'ImportPriceListSchemaLinesFromAttachment','Y','Y','N','N','N',0,'Java','Y','Import Price List Schema Lines From Attachment','de.metas.pricing.process.ImportPriceListSchemaLinesFromAttachment','D') ; -- 2019-11-19T12:16:46.423Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_ID=541211 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 2019-11-19T12:19:31.438Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,IsActive,Created,CreatedBy,AD_Process_ID,AD_Reference_ID,IsRange,AD_Process_Para_ID,FieldLength,AD_Org_ID,IsCentrallyMaintained,AD_Element_ID,IsEncrypted,Updated,UpdatedBy,ColumnName,IsMandatory,IsAutocomplete,SeqNo,Name,EntityType) VALUES (0,'Y',TO_TIMESTAMP('2019-11-19 14:19:31','YYYY-MM-DD HH24:MI:SS'),100,541211,19,'N',541636,0,0,'Y',543390,'N',TO_TIMESTAMP('2019-11-19 14:19:31','YYYY-MM-DD HH24:MI:SS'),100,'AD_AttachmentEntry_ID','Y','N',10,'Anhang','D') ; -- 2019-11-19T12:19:31.441Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_Para_ID=541636 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2019-11-19T12:21:49.723Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Val_Rule (Code,AD_Client_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Val_Rule_ID,Type,Name,AD_Org_ID,EntityType) VALUES ('AD_AttachmentEntry_ID IN ( select r.AD_AttachmentEntry_ID from AD_Attachment_MultiRef r where r.AD_Table_ID=get_Table_ID(''M_DiscountSchema'') and r.Record_ID=@M_DiscountSchema_ID@ )',0,'Y',TO_TIMESTAMP('2019-11-19 14:21:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-11-19 14:21:49','YYYY-MM-DD HH24:MI:SS'),100,540470,'S','AD_AttachmentEntry_for_PriceListSchema_ID',0,'D') ; -- 2019-11-19T12:22:22.862Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Val_Rule_ID=540470,Updated=TO_TIMESTAMP('2019-11-19 14:22:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541636 ; -- 2019-11-19T12:23:07.132Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table_Process (Created,CreatedBy,IsActive,AD_Table_ID,Updated,UpdatedBy,AD_Client_ID,WEBUI_ViewQuickAction,AD_Process_ID,AD_Window_ID,AD_Tab_ID,WEBUI_DocumentAction,WEBUI_ViewAction,WEBUI_IncludedTabTopAction,WEBUI_ViewQuickAction_Default,AD_Table_Process_ID,AD_Org_ID,EntityType) VALUES (TO_TIMESTAMP('2019-11-19 14:23:07','YYYY-MM-DD HH24:MI:SS'),100,'Y',475,TO_TIMESTAMP('2019-11-19 14:23:07','YYYY-MM-DD HH24:MI:SS'),100,0,'N',541211,337,405,'Y','Y','N','N',540756,0,'D') ; -- 2019-11-19T12:23:47.261Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Process SET AD_Tab_ID=675,Updated=TO_TIMESTAMP('2019-11-19 14:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_Process_ID=540756 ; -- 2019-11-19T12:32:48.835Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Value='ExportPriceListSchemaLines',Updated=TO_TIMESTAMP('2019-11-19 14:32:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-19T12:33:22.945Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Process SET AD_Tab_ID=NULL,Updated=TO_TIMESTAMP('2019-11-19 14:33:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_Process_ID=540756 ; -- 2019-11-19T12:33:24.901Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Process SET AD_Tab_ID=NULL,Updated=TO_TIMESTAMP('2019-11-19 14:33:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_Process_ID=540755 ; -- 2019-11-19T13:41:07.134Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET Name='Schema-position Exportpreisliste',Updated=TO_TIMESTAMP('2019-11-19 15:41:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 AND AD_Language='de_CH' ; -- 2019-11-19T13:41:13.502Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Schema-position Exportpreisliste',Updated=TO_TIMESTAMP('2019-11-19 15:41:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 AND AD_Language='de_DE' ; -- 2019-11-19T13:48:23.441Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Classname='de.metas.pricing.ImportPriceListSchemaLinesFromAttachment',Updated=TO_TIMESTAMP('2019-11-19 15:48:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541211 ; -- 2019-11-19T14:08:52.510Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Preislistenschemapositionen aus Anhang importieren',Updated=TO_TIMESTAMP('2019-11-19 16:08:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541211 AND AD_Language='de_CH' ; -- 2019-11-19T14:08:56.592Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Preislistenschemapositionen aus Anhang importieren',Updated=TO_TIMESTAMP('2019-11-19 16:08:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541211 AND AD_Language='de_DE' ; -- 2019-11-19T14:09:00.029Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2019-11-19 16:09:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541211 AND AD_Language='en_US' ; -- 2019-11-19T14:25:46.260Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT l.seqno "Sequence", (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) "Product", (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) "Product Category", (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) "Business Partner", (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) "Taxcategory", l.std_addamt "Standard Price Surcharge Amount", l.std_rounding "Standard Price Rounding", (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) "Target Taxcategory" -- , l.List_Base, l.C_ConversionType_ID, l.Limit_AddAmt, l.Limit_Base, l.Limit_Discount, l.Limit_MaxAmt, l.Limit_MinAmt, l.Limit_Rounding, l.List_AddAmt, l.List_Discount, l.List_MaxAmt, l.List_MinAmt, l.List_Rounding, l.Std_Base, l.Std_Discount, l.Std_MaxAmt, l.Std_MinAmt FROM m_discountschemaline l WHERE l.m_discountschema_id = @M_DiscountSchema_ID@',Updated=TO_TIMESTAMP('2019-11-19 16:25:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-19T14:28:32.633Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement=' SELECT l.seqno, (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) m_product_id, (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_id, (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_id, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) c_taxcategory_id, l.std_addamt, l.std_rounding, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) c_taxcategory_target_id, -- default values l.List_Base, l.C_ConversionType_ID, l.Limit_AddAmt, l.Limit_Base, l.Limit_Discount, l.Limit_MaxAmt, l.Limit_MinAmt, l.Limit_Rounding, l.List_AddAmt, l.List_Discount, l.List_MaxAmt, l.List_MinAmt, l.List_Rounding, l.Std_Base, l.Std_Discount, l.Std_MaxAmt, l.Std_MinAmt FROM m_discountschemaline l WHERE l.m_discountschema_id = @M_DiscountSchema_ID@',Updated=TO_TIMESTAMP('2019-11-19 16:28:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-20T08:08:24.620Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table_Process SET WEBUI_ViewAction='N',Updated=TO_TIMESTAMP('2019-11-20 10:08:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_Process_ID=540755 ; -- 2019-11-20T08:14:04.530Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET SQLStatement='SELECT l.seqno, (SELECT p.value FROM m_product p WHERE p.m_product_id = l.m_product_id) m_product_id, (SELECT pc.value FROM m_product_category pc WHERE pc.m_product_category_id = l.m_product_category_id) m_product_category_id, (SELECT bp.value FROM c_bpartner bp WHERE bp.c_bpartner_id = l.c_bpartner_id) c_bpartner_id, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_id) c_taxcategory_id, l.std_addamt, l.std_rounding, (SELECT tc.name FROM c_taxcategory tc WHERE tc.c_taxcategory_id = l.c_taxcategory_target_id) c_taxcategory_target_id, -- default values l.List_Base, l.C_ConversionType_ID, l.Limit_AddAmt, l.Limit_Base, l.Limit_Discount, l.Limit_MaxAmt, l.Limit_MinAmt, l.Limit_Rounding, l.List_AddAmt, l.List_Discount, l.List_MaxAmt, l.List_MinAmt, l.List_Rounding, l.Std_Base, l.Std_Discount, l.Std_MaxAmt, l.Std_MinAmt FROM m_discountschemaline l WHERE l.m_discountschema_id = @M_DiscountSchema_ID@',Updated=TO_TIMESTAMP('2019-11-20 10:14:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541210 ; -- 2019-11-20T09:09:43.543Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Classname='de.metas.pricing.process.ImportPriceListSchemaLinesFromAttachment',Updated=TO_TIMESTAMP('2019-11-20 11:09:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541211 ;
the_stack
CREATE TABLE IF NOT EXISTS `oc_address` ( `address_id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `firstname` varchar(32) NOT NULL, `lastname` varchar(32) NOT NULL, `company` varchar(40) NOT NULL, `address_1` varchar(128) NOT NULL, `address_2` varchar(128) NOT NULL, `city` varchar(128) NOT NULL, `postcode` varchar(10) NOT NULL, `country_id` int(11) NOT NULL DEFAULT '0', `zone_id` int(11) NOT NULL DEFAULT '0', `custom_field` text NOT NULL, PRIMARY KEY (`address_id`), KEY `customer_id` (`customer_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_affiliate` -- CREATE TABLE IF NOT EXISTS `oc_affiliate` ( `affiliate_id` int(11) NOT NULL AUTO_INCREMENT, `firstname` varchar(32) NOT NULL, `lastname` varchar(32) NOT NULL, `email` varchar(96) NOT NULL, `telephone` varchar(32) NOT NULL, `fax` varchar(32) NOT NULL, `password` varchar(40) NOT NULL, `salt` varchar(9) NOT NULL, `company` varchar(40) NOT NULL, `website` varchar(255) NOT NULL, `address_1` varchar(128) NOT NULL, `address_2` varchar(128) NOT NULL, `city` varchar(128) NOT NULL, `postcode` varchar(10) NOT NULL, `country_id` int(11) NOT NULL, `zone_id` int(11) NOT NULL, `code` varchar(64) NOT NULL, `commission` decimal(4,2) NOT NULL DEFAULT '0.00', `tax` varchar(64) NOT NULL, `payment` varchar(6) NOT NULL, `cheque` varchar(100) NOT NULL, `paypal` varchar(64) NOT NULL, `bank_name` varchar(64) NOT NULL, `bank_branch_number` varchar(64) NOT NULL, `bank_swift_code` varchar(64) NOT NULL, `bank_account_name` varchar(64) NOT NULL, `bank_account_number` varchar(64) NOT NULL, `ip` varchar(40) NOT NULL, `status` tinyint(1) NOT NULL, `approved` tinyint(1) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`affiliate_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_affiliate_activity` -- CREATE TABLE IF NOT EXISTS `oc_affiliate_activity` ( `activity_id` int(11) NOT NULL AUTO_INCREMENT, `affiliate_id` int(11) NOT NULL, `key` varchar(64) NOT NULL, `data` text NOT NULL, `ip` varchar(40) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`activity_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_affiliate_login` -- CREATE TABLE IF NOT EXISTS `oc_affiliate_login` ( `affiliate_login_id` int(11) NOT NULL AUTO_INCREMENT, `email` varchar(96) NOT NULL, `ip` varchar(40) NOT NULL, `total` int(4) NOT NULL, `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`affiliate_login_id`), KEY `email` (`email`), KEY `ip` (`ip`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_affiliate_transaction` -- CREATE TABLE IF NOT EXISTS `oc_affiliate_transaction` ( `affiliate_transaction_id` int(11) NOT NULL AUTO_INCREMENT, `affiliate_id` int(11) NOT NULL, `order_id` int(11) NOT NULL, `description` text NOT NULL, `amount` decimal(15,4) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`affiliate_transaction_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_api` -- CREATE TABLE IF NOT EXISTS `oc_api` ( `api_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, `key` text NOT NULL, `status` tinyint(1) NOT NULL, `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`api_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_api_ip` -- CREATE TABLE IF NOT EXISTS `oc_api_ip` ( `api_ip_id` int(11) NOT NULL AUTO_INCREMENT, `api_id` int(11) NOT NULL, `ip` varchar(40) NOT NULL, PRIMARY KEY (`api_ip_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_api_session` -- CREATE TABLE IF NOT EXISTS `oc_api_session` ( `api_session_id` int(11) NOT NULL AUTO_INCREMENT, `api_id` int(11) NOT NULL, `token` varchar(32) NOT NULL, `session_id` varchar(32) NOT NULL, `session_name` varchar(32) NOT NULL, `ip` varchar(40) NOT NULL, `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`api_session_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_attribute` -- CREATE TABLE IF NOT EXISTS `oc_attribute` ( `attribute_id` int(11) NOT NULL AUTO_INCREMENT, `attribute_group_id` int(11) NOT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`attribute_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_attribute_description` -- CREATE TABLE IF NOT EXISTS `oc_attribute_description` ( `attribute_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(64) NOT NULL, PRIMARY KEY (`attribute_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_attribute_group` -- DROP TABLE IF EXISTS `oc_attribute_group`; CREATE TABLE IF NOT EXISTS `oc_attribute_group` ( `attribute_group_id` int(11) NOT NULL AUTO_INCREMENT, `sort_order` int(3) NOT NULL, PRIMARY KEY (`attribute_group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_attribute_group_description` -- CREATE TABLE IF NOT EXISTS `oc_attribute_group_description` ( `attribute_group_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(64) NOT NULL, PRIMARY KEY (`attribute_group_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_banner` -- CREATE TABLE IF NOT EXISTS `oc_banner` ( `banner_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, `status` tinyint(1) NOT NULL, PRIMARY KEY (`banner_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_banner_image` -- CREATE TABLE IF NOT EXISTS `oc_banner_image` ( `banner_image_id` int(11) NOT NULL AUTO_INCREMENT, `banner_id` int(11) NOT NULL, `link` varchar(255) NOT NULL, `image` varchar(255) NOT NULL, `sort_order` int(3) NOT NULL DEFAULT '0', PRIMARY KEY (`banner_image_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_banner_image_description` -- CREATE TABLE IF NOT EXISTS `oc_banner_image_description` ( `banner_image_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `banner_id` int(11) NOT NULL, `title` varchar(64) NOT NULL, PRIMARY KEY (`banner_image_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_cart` -- CREATE TABLE IF NOT EXISTS `oc_cart` ( `cart_id` int(11) NOT NULL AUTO_INCREMENT, `store_id` int(11) NOT NULL, `customer_id` int(11) NOT NULL, `session_id` varchar(32) NOT NULL, `product_id` int(11) NOT NULL, `recurring_id` int(11) NOT NULL, `option` text NOT NULL, `quantity` int(5) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`cart_id`), KEY `cart_id` (`customer_id`,`session_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_category` -- CREATE TABLE IF NOT EXISTS `oc_category` ( `category_id` int(11) NOT NULL AUTO_INCREMENT, `image` varchar(255) DEFAULT NULL, `parent_id` int(11) NOT NULL DEFAULT '0', `top` tinyint(1) NOT NULL, `column` int(3) NOT NULL, `sort_order` int(3) NOT NULL DEFAULT '0', `status` tinyint(1) NOT NULL, `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`category_id`), KEY `parent_id` (`parent_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_category_description` -- CREATE TABLE IF NOT EXISTS `oc_category_description` ( `category_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `description` text NOT NULL, `meta_title` varchar(255) NOT NULL, `meta_description` varchar(255) NOT NULL, `meta_keyword` varchar(255) NOT NULL, PRIMARY KEY (`category_id`,`language_id`), KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_category_filter` -- CREATE TABLE IF NOT EXISTS `oc_category_filter` ( `category_id` int(11) NOT NULL, `filter_id` int(11) NOT NULL, PRIMARY KEY (`category_id`,`filter_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_category_path` -- CREATE TABLE IF NOT EXISTS `oc_category_path` ( `category_id` int(11) NOT NULL, `path_id` int(11) NOT NULL, `level` int(11) NOT NULL, PRIMARY KEY (`category_id`,`path_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_category_to_layout` -- CREATE TABLE IF NOT EXISTS `oc_category_to_layout` ( `category_id` int(11) NOT NULL, `store_id` int(11) NOT NULL, `layout_id` int(11) NOT NULL, PRIMARY KEY (`category_id`,`store_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_category_to_store` -- CREATE TABLE IF NOT EXISTS `oc_category_to_store` ( `category_id` int(11) NOT NULL, `store_id` int(11) NOT NULL, PRIMARY KEY (`category_id`,`store_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_country` -- CREATE TABLE IF NOT EXISTS `oc_country` ( `country_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, `iso_code_2` varchar(2) NOT NULL, `iso_code_3` varchar(3) NOT NULL, `address_format` text NOT NULL, `postcode_required` tinyint(1) NOT NULL, `status` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`country_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_coupon` -- CREATE TABLE IF NOT EXISTS `oc_coupon` ( `coupon_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, `code` varchar(10) NOT NULL, `type` char(1) NOT NULL, `discount` decimal(15,4) NOT NULL, `logged` tinyint(1) NOT NULL, `shipping` tinyint(1) NOT NULL, `total` decimal(15,4) NOT NULL, `date_start` date NOT NULL DEFAULT '0000-00-00', `date_end` date NOT NULL DEFAULT '0000-00-00', `uses_total` int(11) NOT NULL, `uses_customer` varchar(11) NOT NULL, `status` tinyint(1) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`coupon_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_coupon_category` -- CREATE TABLE IF NOT EXISTS `oc_coupon_category` ( `coupon_id` int(11) NOT NULL, `category_id` int(11) NOT NULL, PRIMARY KEY (`coupon_id`,`category_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_coupon_history` -- DROP TABLE IF EXISTS `oc_coupon_history`; CREATE TABLE IF NOT EXISTS `oc_coupon_history` ( `coupon_history_id` int(11) NOT NULL AUTO_INCREMENT, `coupon_id` int(11) NOT NULL, `order_id` int(11) NOT NULL, `customer_id` int(11) NOT NULL, `amount` decimal(15,4) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`coupon_history_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_coupon_product` -- CREATE TABLE IF NOT EXISTS `oc_coupon_product` ( `coupon_product_id` int(11) NOT NULL AUTO_INCREMENT, `coupon_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, PRIMARY KEY (`coupon_product_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_currency` -- CREATE TABLE IF NOT EXISTS `oc_currency` ( `currency_id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(32) NOT NULL, `code` varchar(3) NOT NULL, `symbol_left` varchar(12) NOT NULL, `symbol_right` varchar(12) NOT NULL, `decimal_place` char(1) NOT NULL, `value` float(15,8) NOT NULL, `status` tinyint(1) NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`currency_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_customer` -- CREATE TABLE IF NOT EXISTS `oc_customer` ( `customer_id` int(11) NOT NULL AUTO_INCREMENT, `customer_group_id` int(11) NOT NULL, `store_id` int(11) NOT NULL DEFAULT '0', `firstname` varchar(32) NOT NULL, `lastname` varchar(32) NOT NULL, `email` varchar(96) NOT NULL, `telephone` varchar(32) NOT NULL, `fax` varchar(32) NOT NULL, `password` varchar(40) NOT NULL, `salt` varchar(9) NOT NULL, `cart` text, `wishlist` text, `newsletter` tinyint(1) NOT NULL DEFAULT '0', `address_id` int(11) NOT NULL DEFAULT '0', `custom_field` text NOT NULL, `ip` varchar(40) NOT NULL, `status` tinyint(1) NOT NULL, `approved` tinyint(1) NOT NULL, `safe` tinyint(1) NOT NULL, `token` text NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`customer_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_customer_activity` -- CREATE TABLE IF NOT EXISTS `oc_customer_activity` ( `activity_id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `key` varchar(64) NOT NULL, `data` text NOT NULL, `ip` varchar(40) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`activity_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_customer_group` -- CREATE TABLE IF NOT EXISTS `oc_customer_group` ( `customer_group_id` int(11) NOT NULL AUTO_INCREMENT, `approval` int(1) NOT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`customer_group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -- Dumping data for table `oc_customer_group` -- INSERT INTO `oc_customer_group` (`customer_group_id`, `approval`, `sort_order`) VALUES (1, 0, 1); -- -------------------------------------------------------- -- -- Table structure for table `oc_customer_group_description` -- CREATE TABLE IF NOT EXISTS `oc_customer_group_description` ( `customer_group_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(32) NOT NULL, `description` text NOT NULL, PRIMARY KEY (`customer_group_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_customer_history` -- CREATE TABLE IF NOT EXISTS `oc_customer_history` ( `customer_history_id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `comment` text NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`customer_history_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_customer_login` -- CREATE TABLE IF NOT EXISTS `oc_customer_login` ( `customer_login_id` int(11) NOT NULL AUTO_INCREMENT, `email` varchar(96) NOT NULL, `ip` varchar(40) NOT NULL, `total` int(4) NOT NULL, `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`customer_login_id`), KEY `email` (`email`), KEY `ip` (`ip`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_customer_ip` -- CREATE TABLE IF NOT EXISTS `oc_customer_ip` ( `customer_ip_id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `ip` varchar(40) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`customer_ip_id`), KEY `ip` (`ip`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_customer_online` -- CREATE TABLE IF NOT EXISTS `oc_customer_online` ( `ip` varchar(40) NOT NULL, `customer_id` int(11) NOT NULL, `url` text NOT NULL, `referer` text NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`ip`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_customer_reward` -- DROP TABLE IF EXISTS `oc_customer_reward`; CREATE TABLE IF NOT EXISTS `oc_customer_reward` ( `customer_reward_id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL DEFAULT '0', `order_id` int(11) NOT NULL DEFAULT '0', `description` text NOT NULL, `points` int(8) NOT NULL DEFAULT '0', `date_added` datetime NOT NULL, PRIMARY KEY (`customer_reward_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_customer_transaction` -- CREATE TABLE IF NOT EXISTS `oc_customer_transaction` ( `customer_transaction_id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) NOT NULL, `order_id` int(11) NOT NULL, `description` text NOT NULL, `amount` decimal(15,4) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`customer_transaction_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_custom_field` -- CREATE TABLE IF NOT EXISTS `oc_custom_field` ( `custom_field_id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(32) NOT NULL, `value` text NOT NULL, `location` varchar(7) NOT NULL, `status` tinyint(1) NOT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`custom_field_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_custom_field_customer_group` -- CREATE TABLE IF NOT EXISTS `oc_custom_field_customer_group` ( `custom_field_id` int(11) NOT NULL, `customer_group_id` int(11) NOT NULL, `required` tinyint(1) NOT NULL, PRIMARY KEY (`custom_field_id`,`customer_group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_custom_field_description` -- CREATE TABLE IF NOT EXISTS `oc_custom_field_description` ( `custom_field_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(128) NOT NULL, PRIMARY KEY (`custom_field_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_custom_field_value` -- CREATE TABLE IF NOT EXISTS `oc_custom_field_value` ( `custom_field_value_id` int(11) NOT NULL AUTO_INCREMENT, `custom_field_id` int(11) NOT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`custom_field_value_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_custom_field_value_description` -- CREATE TABLE IF NOT EXISTS `oc_custom_field_value_description` ( `custom_field_value_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `custom_field_id` int(11) NOT NULL, `name` varchar(128) NOT NULL, PRIMARY KEY (`custom_field_value_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_download` -- CREATE TABLE IF NOT EXISTS `oc_download` ( `download_id` int(11) NOT NULL AUTO_INCREMENT, `filename` varchar(128) NOT NULL, `mask` varchar(128) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`download_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_download_description` -- CREATE TABLE IF NOT EXISTS `oc_download_description` ( `download_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(64) NOT NULL, PRIMARY KEY (`download_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_event` -- CREATE TABLE IF NOT EXISTS `oc_event` ( `event_id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(32) NOT NULL, `trigger` text NOT NULL, `action` text NOT NULL, PRIMARY KEY (`event_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_extension` -- CREATE TABLE IF NOT EXISTS `oc_extension` ( `extension_id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(32) NOT NULL, `code` varchar(32) NOT NULL, PRIMARY KEY (`extension_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_filter` -- CREATE TABLE IF NOT EXISTS `oc_filter` ( `filter_id` int(11) NOT NULL AUTO_INCREMENT, `filter_group_id` int(11) NOT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`filter_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_filter_description` -- CREATE TABLE IF NOT EXISTS `oc_filter_description` ( `filter_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `filter_group_id` int(11) NOT NULL, `name` varchar(64) NOT NULL, PRIMARY KEY (`filter_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_filter_group` -- CREATE TABLE IF NOT EXISTS `oc_filter_group` ( `filter_group_id` int(11) NOT NULL AUTO_INCREMENT, `sort_order` int(3) NOT NULL, PRIMARY KEY (`filter_group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_filter_group_description` -- CREATE TABLE IF NOT EXISTS `oc_filter_group_description` ( `filter_group_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(64) NOT NULL, PRIMARY KEY (`filter_group_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_geo_zone` -- CREATE TABLE IF NOT EXISTS `oc_geo_zone` ( `geo_zone_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `description` varchar(255) NOT NULL, `date_modified` datetime NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`geo_zone_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_information` -- CREATE TABLE IF NOT EXISTS `oc_information` ( `information_id` int(11) NOT NULL AUTO_INCREMENT, `bottom` int(1) NOT NULL DEFAULT '0', `sort_order` int(3) NOT NULL DEFAULT '0', `status` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`information_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_information_description` -- CREATE TABLE IF NOT EXISTS `oc_information_description` ( `information_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `title` varchar(64) NOT NULL, `description` text NOT NULL, `meta_title` varchar(255) NOT NULL, `meta_description` varchar(255) NOT NULL, `meta_keyword` varchar(255) NOT NULL, PRIMARY KEY (`information_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_information_to_layout` -- CREATE TABLE IF NOT EXISTS `oc_information_to_layout` ( `information_id` int(11) NOT NULL, `store_id` int(11) NOT NULL, `layout_id` int(11) NOT NULL, PRIMARY KEY (`information_id`,`store_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_information_to_store` -- CREATE TABLE IF NOT EXISTS `oc_information_to_store` ( `information_id` int(11) NOT NULL, `store_id` int(11) NOT NULL, PRIMARY KEY (`information_id`,`store_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_language` -- CREATE TABLE IF NOT EXISTS `oc_language` ( `language_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `code` varchar(5) NOT NULL, `locale` varchar(255) NOT NULL, `image` varchar(64) NOT NULL, `directory` varchar(32) NOT NULL, `sort_order` int(3) NOT NULL DEFAULT '0', `status` tinyint(1) NOT NULL, PRIMARY KEY (`language_id`), KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_layout` -- CREATE TABLE IF NOT EXISTS `oc_layout` ( `layout_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, PRIMARY KEY (`layout_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_layout_module` -- CREATE TABLE IF NOT EXISTS `oc_layout_module` ( `layout_module_id` int(11) NOT NULL AUTO_INCREMENT, `layout_id` int(11) NOT NULL, `code` varchar(64) NOT NULL, `position` varchar(14) NOT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`layout_module_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_layout_route` -- CREATE TABLE IF NOT EXISTS `oc_layout_route` ( `layout_route_id` int(11) NOT NULL AUTO_INCREMENT, `layout_id` int(11) NOT NULL, `store_id` int(11) NOT NULL, `route` varchar(255) NOT NULL, PRIMARY KEY (`layout_route_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_length_class` -- CREATE TABLE IF NOT EXISTS `oc_length_class` ( `length_class_id` int(11) NOT NULL AUTO_INCREMENT, `value` decimal(15,8) NOT NULL, PRIMARY KEY (`length_class_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_length_class_description` -- CREATE TABLE IF NOT EXISTS `oc_length_class_description` ( `length_class_id` int(11) NOT NULL AUTO_INCREMENT, `language_id` int(11) NOT NULL, `title` varchar(32) NOT NULL, `unit` varchar(4) NOT NULL, PRIMARY KEY (`length_class_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_location` -- CREATE TABLE IF NOT EXISTS `oc_location` ( `location_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `address` text NOT NULL, `telephone` varchar(32) NOT NULL, `fax` varchar(32) NOT NULL, `geocode` varchar(32) NOT NULL, `image` varchar(255) DEFAULT NULL, `open` text NOT NULL, `comment` text NOT NULL, PRIMARY KEY (`location_id`), KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_manufacturer` -- CREATE TABLE IF NOT EXISTS `oc_manufacturer` ( `manufacturer_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, `image` varchar(255) DEFAULT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`manufacturer_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_manufacturer_to_store` -- CREATE TABLE IF NOT EXISTS `oc_manufacturer_to_store` ( `manufacturer_id` int(11) NOT NULL, `store_id` int(11) NOT NULL, PRIMARY KEY (`manufacturer_id`,`store_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_marketing` -- CREATE TABLE IF NOT EXISTS `oc_marketing` ( `marketing_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `description` text NOT NULL, `code` varchar(64) NOT NULL, `clicks` int(5) NOT NULL DEFAULT '0', `date_added` datetime NOT NULL, PRIMARY KEY (`marketing_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_modification` -- CREATE TABLE IF NOT EXISTS `oc_modification` ( `modification_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, `code` varchar(64) NOT NULL, `author` varchar(64) NOT NULL, `version` varchar(32) NOT NULL, `link` varchar(255) NOT NULL, `xml` text NOT NULL, `status` tinyint(1) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`modification_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- ---------------------------------------------------------- -- Table structure for table `oc_module` -- CREATE TABLE IF NOT EXISTS `oc_module` ( `module_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, `code` varchar(32) NOT NULL, `setting` text NOT NULL, PRIMARY KEY (`module_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_option` -- CREATE TABLE IF NOT EXISTS `oc_option` ( `option_id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(32) NOT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`option_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_option_description` -- CREATE TABLE IF NOT EXISTS `oc_option_description` ( `option_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(128) NOT NULL, PRIMARY KEY (`option_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_option_value` -- CREATE TABLE IF NOT EXISTS `oc_option_value` ( `option_value_id` int(11) NOT NULL AUTO_INCREMENT, `option_id` int(11) NOT NULL, `image` varchar(255) NOT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`option_value_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_option_value_description` -- CREATE TABLE IF NOT EXISTS `oc_option_value_description` ( `option_value_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `option_id` int(11) NOT NULL, `name` varchar(128) NOT NULL, PRIMARY KEY (`option_value_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order` -- CREATE TABLE IF NOT EXISTS `oc_order` ( `order_id` int(11) NOT NULL AUTO_INCREMENT, `invoice_no` int(11) NOT NULL DEFAULT '0', `invoice_prefix` varchar(26) NOT NULL, `store_id` int(11) NOT NULL DEFAULT '0', `store_name` varchar(64) NOT NULL, `store_url` varchar(255) NOT NULL, `customer_id` int(11) NOT NULL DEFAULT '0', `customer_group_id` int(11) NOT NULL DEFAULT '0', `firstname` varchar(32) NOT NULL, `lastname` varchar(32) NOT NULL, `email` varchar(96) NOT NULL, `telephone` varchar(32) NOT NULL, `fax` varchar(32) NOT NULL, `custom_field` text NOT NULL, `payment_firstname` varchar(32) NOT NULL, `payment_lastname` varchar(32) NOT NULL, `payment_company` varchar(40) NOT NULL, `payment_address_1` varchar(128) NOT NULL, `payment_address_2` varchar(128) NOT NULL, `payment_city` varchar(128) NOT NULL, `payment_postcode` varchar(10) NOT NULL, `payment_country` varchar(128) NOT NULL, `payment_country_id` int(11) NOT NULL, `payment_zone` varchar(128) NOT NULL, `payment_zone_id` int(11) NOT NULL, `payment_address_format` text NOT NULL, `payment_custom_field` text NOT NULL, `payment_method` varchar(128) NOT NULL, `payment_code` varchar(128) NOT NULL, `shipping_firstname` varchar(32) NOT NULL, `shipping_lastname` varchar(32) NOT NULL, `shipping_company` varchar(40) NOT NULL, `shipping_address_1` varchar(128) NOT NULL, `shipping_address_2` varchar(128) NOT NULL, `shipping_city` varchar(128) NOT NULL, `shipping_postcode` varchar(10) NOT NULL, `shipping_country` varchar(128) NOT NULL, `shipping_country_id` int(11) NOT NULL, `shipping_zone` varchar(128) NOT NULL, `shipping_zone_id` int(11) NOT NULL, `shipping_address_format` text NOT NULL, `shipping_custom_field` text NOT NULL, `shipping_method` varchar(128) NOT NULL, `shipping_code` varchar(128) NOT NULL, `comment` text NOT NULL, `total` decimal(15,4) NOT NULL DEFAULT '0.0000', `order_status_id` int(11) NOT NULL DEFAULT '0', `affiliate_id` int(11) NOT NULL, `commission` decimal(15,4) NOT NULL, `marketing_id` int(11) NOT NULL, `tracking` varchar(64) NOT NULL, `language_id` int(11) NOT NULL, `currency_id` int(11) NOT NULL, `currency_code` varchar(3) NOT NULL, `currency_value` decimal(15,8) NOT NULL DEFAULT '1.00000000', `ip` varchar(40) NOT NULL, `forwarded_ip` varchar(40) NOT NULL, `user_agent` varchar(255) NOT NULL, `accept_language` varchar(255) NOT NULL, `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`order_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order_custom_field` -- CREATE TABLE IF NOT EXISTS `oc_order_custom_field` ( `order_custom_field_id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `custom_field_id` int(11) NOT NULL, `custom_field_value_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `value` text NOT NULL, `type` varchar(32) NOT NULL, `location` varchar(16) NOT NULL, PRIMARY KEY (`order_custom_field_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order_history` -- CREATE TABLE IF NOT EXISTS `oc_order_history` ( `order_history_id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `order_status_id` int(11) NOT NULL, `notify` tinyint(1) NOT NULL DEFAULT '0', `comment` text NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`order_history_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order_option` -- CREATE TABLE IF NOT EXISTS `oc_order_option` ( `order_option_id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `order_product_id` int(11) NOT NULL, `product_option_id` int(11) NOT NULL, `product_option_value_id` int(11) NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL, `value` text NOT NULL, `type` varchar(32) NOT NULL, PRIMARY KEY (`order_option_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order_product` -- CREATE TABLE IF NOT EXISTS `oc_order_product` ( `order_product_id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `model` varchar(64) NOT NULL, `quantity` int(4) NOT NULL, `price` decimal(15,4) NOT NULL DEFAULT '0.0000', `total` decimal(15,4) NOT NULL DEFAULT '0.0000', `tax` decimal(15,4) NOT NULL DEFAULT '0.0000', `reward` int(8) NOT NULL, PRIMARY KEY (`order_product_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order_recurring` -- CREATE TABLE IF NOT EXISTS `oc_order_recurring` ( `order_recurring_id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `reference` varchar(255) NOT NULL, `product_id` int(11) NOT NULL, `product_name` varchar(255) NOT NULL, `product_quantity` int(11) NOT NULL, `recurring_id` int(11) NOT NULL, `recurring_name` varchar(255) NOT NULL, `recurring_description` varchar(255) NOT NULL, `recurring_frequency` varchar(25) NOT NULL, `recurring_cycle` smallint(6) NOT NULL, `recurring_duration` smallint(6) NOT NULL, `recurring_price` decimal(10,4) NOT NULL, `trial` tinyint(1) NOT NULL, `trial_frequency` varchar(25) NOT NULL, `trial_cycle` smallint(6) NOT NULL, `trial_duration` smallint(6) NOT NULL, `trial_price` decimal(10,4) NOT NULL, `status` tinyint(4) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`order_recurring_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order_recurring_transaction` -- CREATE TABLE IF NOT EXISTS `oc_order_recurring_transaction` ( `order_recurring_transaction_id` int(11) NOT NULL AUTO_INCREMENT, `order_recurring_id` int(11) NOT NULL, `reference` varchar(255) NOT NULL, `type` varchar(255) NOT NULL, `amount` decimal(10,4) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`order_recurring_transaction_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order_status` -- CREATE TABLE IF NOT EXISTS `oc_order_status` ( `order_status_id` int(11) NOT NULL AUTO_INCREMENT, `language_id` int(11) NOT NULL, `name` varchar(32) NOT NULL, PRIMARY KEY (`order_status_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order_total` -- CREATE TABLE IF NOT EXISTS `oc_order_total` ( `order_total_id` int(10) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `code` varchar(32) NOT NULL, `title` varchar(255) NOT NULL, `value` decimal(15,4) NOT NULL DEFAULT '0.0000', `sort_order` int(3) NOT NULL, PRIMARY KEY (`order_total_id`), KEY `order_id` (`order_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_order_voucher` -- CREATE TABLE IF NOT EXISTS `oc_order_voucher` ( `order_voucher_id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `voucher_id` int(11) NOT NULL, `description` varchar(255) NOT NULL, `code` varchar(10) NOT NULL, `from_name` varchar(64) NOT NULL, `from_email` varchar(96) NOT NULL, `to_name` varchar(64) NOT NULL, `to_email` varchar(96) NOT NULL, `voucher_theme_id` int(11) NOT NULL, `message` text NOT NULL, `amount` decimal(15,4) NOT NULL, PRIMARY KEY (`order_voucher_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product` -- CREATE TABLE IF NOT EXISTS `oc_product` ( `product_id` int(11) NOT NULL AUTO_INCREMENT, `model` varchar(64) NOT NULL, `sku` varchar(64) NOT NULL, `upc` varchar(12) NOT NULL, `ean` varchar(14) NOT NULL, `jan` varchar(13) NOT NULL, `isbn` varchar(17) NOT NULL, `mpn` varchar(64) NOT NULL, `location` varchar(128) NOT NULL, `quantity` int(4) NOT NULL DEFAULT '0', `stock_status_id` int(11) NOT NULL, `image` varchar(255) DEFAULT NULL, `manufacturer_id` int(11) NOT NULL, `shipping` tinyint(1) NOT NULL DEFAULT '1', `price` decimal(15,4) NOT NULL DEFAULT '0.0000', `points` int(8) NOT NULL DEFAULT '0', `tax_class_id` int(11) NOT NULL, `date_available` date NOT NULL DEFAULT '0000-00-00', `weight` decimal(15,8) NOT NULL DEFAULT '0.00000000', `weight_class_id` int(11) NOT NULL DEFAULT '0', `length` decimal(15,8) NOT NULL DEFAULT '0.00000000', `width` decimal(15,8) NOT NULL DEFAULT '0.00000000', `height` decimal(15,8) NOT NULL DEFAULT '0.00000000', `length_class_id` int(11) NOT NULL DEFAULT '0', `subtract` tinyint(1) NOT NULL DEFAULT '1', `minimum` int(11) NOT NULL DEFAULT '1', `sort_order` int(11) NOT NULL DEFAULT '0', `status` tinyint(1) NOT NULL DEFAULT '0', `viewed` int(5) NOT NULL DEFAULT '0', `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`product_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_attribute` -- CREATE TABLE IF NOT EXISTS `oc_product_attribute` ( `product_id` int(11) NOT NULL, `attribute_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `text` text NOT NULL, PRIMARY KEY (`product_id`,`attribute_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_description` -- CREATE TABLE IF NOT EXISTS `oc_product_description` ( `product_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `description` text NOT NULL, `tag` text NOT NULL, `meta_title` varchar(255) NOT NULL, `meta_description` varchar(255) NOT NULL, `meta_keyword` varchar(255) NOT NULL, PRIMARY KEY (`product_id`,`language_id`), KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_discount` -- CREATE TABLE IF NOT EXISTS `oc_product_discount` ( `product_discount_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL, `customer_group_id` int(11) NOT NULL, `quantity` int(4) NOT NULL DEFAULT '0', `priority` int(5) NOT NULL DEFAULT '1', `price` decimal(15,4) NOT NULL DEFAULT '0.0000', `date_start` date NOT NULL DEFAULT '0000-00-00', `date_end` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`product_discount_id`), KEY `product_id` (`product_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_filter` -- CREATE TABLE IF NOT EXISTS `oc_product_filter` ( `product_id` int(11) NOT NULL, `filter_id` int(11) NOT NULL, PRIMARY KEY (`product_id`,`filter_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_image` -- CREATE TABLE IF NOT EXISTS `oc_product_image` ( `product_image_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL, `image` varchar(255) DEFAULT NULL, `sort_order` int(3) NOT NULL DEFAULT '0', PRIMARY KEY (`product_image_id`), KEY `product_id` (`product_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_option` -- CREATE TABLE IF NOT EXISTS `oc_product_option` ( `product_option_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL, `option_id` int(11) NOT NULL, `value` text NOT NULL, `required` tinyint(1) NOT NULL, PRIMARY KEY (`product_option_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_option_value` -- CREATE TABLE IF NOT EXISTS `oc_product_option_value` ( `product_option_value_id` int(11) NOT NULL AUTO_INCREMENT, `product_option_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `option_id` int(11) NOT NULL, `option_value_id` int(11) NOT NULL, `quantity` int(3) NOT NULL, `subtract` tinyint(1) NOT NULL, `price` decimal(15,4) NOT NULL, `price_prefix` varchar(1) NOT NULL, `points` int(8) NOT NULL, `points_prefix` varchar(1) NOT NULL, `weight` decimal(15,8) NOT NULL, `weight_prefix` varchar(1) NOT NULL, PRIMARY KEY (`product_option_value_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_recurring` -- CREATE TABLE IF NOT EXISTS `oc_product_recurring` ( `product_id` int(11) NOT NULL, `recurring_id` int(11) NOT NULL, `customer_group_id` int(11) NOT NULL, PRIMARY KEY (`product_id`,`recurring_id`,`customer_group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_related` -- CREATE TABLE IF NOT EXISTS `oc_product_related` ( `product_id` int(11) NOT NULL, `related_id` int(11) NOT NULL, PRIMARY KEY (`product_id`,`related_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_reward` -- CREATE TABLE IF NOT EXISTS `oc_product_reward` ( `product_reward_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL DEFAULT '0', `customer_group_id` int(11) NOT NULL DEFAULT '0', `points` int(8) NOT NULL DEFAULT '0', PRIMARY KEY (`product_reward_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_special` -- CREATE TABLE IF NOT EXISTS `oc_product_special` ( `product_special_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL, `customer_group_id` int(11) NOT NULL, `priority` int(5) NOT NULL DEFAULT '1', `price` decimal(15,4) NOT NULL DEFAULT '0.0000', `date_start` date NOT NULL DEFAULT '0000-00-00', `date_end` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`product_special_id`), KEY `product_id` (`product_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_to_category` -- CREATE TABLE IF NOT EXISTS `oc_product_to_category` ( `product_id` int(11) NOT NULL, `category_id` int(11) NOT NULL, PRIMARY KEY (`product_id`,`category_id`), KEY `category_id` (`category_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_to_download` -- CREATE TABLE IF NOT EXISTS `oc_product_to_download` ( `product_id` int(11) NOT NULL, `download_id` int(11) NOT NULL, PRIMARY KEY (`product_id`,`download_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_to_layout` -- CREATE TABLE IF NOT EXISTS `oc_product_to_layout` ( `product_id` int(11) NOT NULL, `store_id` int(11) NOT NULL, `layout_id` int(11) NOT NULL, PRIMARY KEY (`product_id`,`store_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_product_to_store` -- CREATE TABLE IF NOT EXISTS `oc_product_to_store` ( `product_id` int(11) NOT NULL, `store_id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`product_id`,`store_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_recurring` -- CREATE TABLE IF NOT EXISTS `oc_recurring` ( `recurring_id` int(11) NOT NULL AUTO_INCREMENT, `price` decimal(10,4) NOT NULL, `frequency` enum('day','week','semi_month','month','year') NOT NULL, `duration` int(10) unsigned NOT NULL, `cycle` int(10) unsigned NOT NULL, `trial_status` tinyint(4) NOT NULL, `trial_price` decimal(10,4) NOT NULL, `trial_frequency` enum('day','week','semi_month','month','year') NOT NULL, `trial_duration` int(10) unsigned NOT NULL, `trial_cycle` int(10) unsigned NOT NULL, `status` tinyint(4) NOT NULL, `sort_order` int(11) NOT NULL, PRIMARY KEY (`recurring_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_recurring_description` -- CREATE TABLE IF NOT EXISTS `oc_recurring_description` ( `recurring_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, PRIMARY KEY (`recurring_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_return` -- CREATE TABLE IF NOT EXISTS `oc_return` ( `return_id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `customer_id` int(11) NOT NULL, `firstname` varchar(32) NOT NULL, `lastname` varchar(32) NOT NULL, `email` varchar(96) NOT NULL, `telephone` varchar(32) NOT NULL, `product` varchar(255) NOT NULL, `model` varchar(64) NOT NULL, `quantity` int(4) NOT NULL, `opened` tinyint(1) NOT NULL, `return_reason_id` int(11) NOT NULL, `return_action_id` int(11) NOT NULL, `return_status_id` int(11) NOT NULL, `comment` text, `date_ordered` date NOT NULL DEFAULT '0000-00-00', `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`return_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_return_action` -- CREATE TABLE IF NOT EXISTS `oc_return_action` ( `return_action_id` int(11) NOT NULL AUTO_INCREMENT, `language_id` int(11) NOT NULL DEFAULT '0', `name` varchar(64) NOT NULL, PRIMARY KEY (`return_action_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_return_history` -- CREATE TABLE IF NOT EXISTS `oc_return_history` ( `return_history_id` int(11) NOT NULL AUTO_INCREMENT, `return_id` int(11) NOT NULL, `return_status_id` int(11) NOT NULL, `notify` tinyint(1) NOT NULL, `comment` text NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`return_history_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_return_reason` -- CREATE TABLE IF NOT EXISTS `oc_return_reason` ( `return_reason_id` int(11) NOT NULL AUTO_INCREMENT, `language_id` int(11) NOT NULL DEFAULT '0', `name` varchar(128) NOT NULL, PRIMARY KEY (`return_reason_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_return_status` -- CREATE TABLE IF NOT EXISTS `oc_return_status` ( `return_status_id` int(11) NOT NULL AUTO_INCREMENT, `language_id` int(11) NOT NULL DEFAULT '0', `name` varchar(32) NOT NULL, PRIMARY KEY (`return_status_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_review` -- CREATE TABLE IF NOT EXISTS `oc_review` ( `review_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL, `customer_id` int(11) NOT NULL, `author` varchar(64) NOT NULL, `text` text NOT NULL, `rating` int(1) NOT NULL, `status` tinyint(1) NOT NULL DEFAULT '0', `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`review_id`), KEY `product_id` (`product_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_setting` -- CREATE TABLE IF NOT EXISTS `oc_setting` ( `setting_id` int(11) NOT NULL AUTO_INCREMENT, `store_id` int(11) NOT NULL DEFAULT '0', `code` varchar(32) NOT NULL, `key` varchar(64) NOT NULL, `value` text NOT NULL, `serialized` tinyint(1) NOT NULL, PRIMARY KEY (`setting_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_stock_status` -- CREATE TABLE IF NOT EXISTS `oc_stock_status` ( `stock_status_id` int(11) NOT NULL AUTO_INCREMENT, `language_id` int(11) NOT NULL, `name` varchar(32) NOT NULL, PRIMARY KEY (`stock_status_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_store` -- CREATE TABLE IF NOT EXISTS `oc_store` ( `store_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, `url` varchar(255) NOT NULL, `ssl` varchar(255) NOT NULL, PRIMARY KEY (`store_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_tax_class` -- CREATE TABLE IF NOT EXISTS `oc_tax_class` ( `tax_class_id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(32) NOT NULL, `description` varchar(255) NOT NULL, `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`tax_class_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_tax_rate` -- CREATE TABLE IF NOT EXISTS `oc_tax_rate` ( `tax_rate_id` int(11) NOT NULL AUTO_INCREMENT, `geo_zone_id` int(11) NOT NULL DEFAULT '0', `name` varchar(32) NOT NULL, `rate` decimal(15,4) NOT NULL DEFAULT '0.0000', `type` char(1) NOT NULL, `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`tax_rate_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_tax_rate_to_customer_group` -- CREATE TABLE IF NOT EXISTS `oc_tax_rate_to_customer_group` ( `tax_rate_id` int(11) NOT NULL, `customer_group_id` int(11) NOT NULL, PRIMARY KEY (`tax_rate_id`,`customer_group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_tax_rule` -- CREATE TABLE IF NOT EXISTS `oc_tax_rule` ( `tax_rule_id` int(11) NOT NULL AUTO_INCREMENT, `tax_class_id` int(11) NOT NULL, `tax_rate_id` int(11) NOT NULL, `based` varchar(10) NOT NULL, `priority` int(5) NOT NULL DEFAULT '1', PRIMARY KEY (`tax_rule_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_upload` -- CREATE TABLE IF NOT EXISTS `oc_upload` ( `upload_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `filename` varchar(255) NOT NULL, `code` varchar(255) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`upload_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_url_alias` -- CREATE TABLE IF NOT EXISTS `oc_url_alias` ( `url_alias_id` int(11) NOT NULL AUTO_INCREMENT, `query` varchar(255) NOT NULL, `keyword` varchar(255) NOT NULL, PRIMARY KEY (`url_alias_id`), KEY `query` (`query`), KEY `keyword` (`keyword`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_user` -- CREATE TABLE IF NOT EXISTS `oc_user` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_group_id` int(11) NOT NULL, `username` varchar(20) NOT NULL, `password` varchar(40) NOT NULL, `salt` varchar(9) NOT NULL, `firstname` varchar(32) NOT NULL, `lastname` varchar(32) NOT NULL, `email` varchar(96) NOT NULL, `image` varchar(255) NOT NULL, `code` varchar(40) NOT NULL, `ip` varchar(40) NOT NULL, `status` tinyint(1) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_user_group` -- CREATE TABLE IF NOT EXISTS `oc_user_group` ( `user_group_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, `permission` text NOT NULL, PRIMARY KEY (`user_group_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_voucher` -- CREATE TABLE IF NOT EXISTS `oc_voucher` ( `voucher_id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `code` varchar(10) NOT NULL, `from_name` varchar(64) NOT NULL, `from_email` varchar(96) NOT NULL, `to_name` varchar(64) NOT NULL, `to_email` varchar(96) NOT NULL, `voucher_theme_id` int(11) NOT NULL, `message` text NOT NULL, `amount` decimal(15,4) NOT NULL, `status` tinyint(1) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`voucher_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_voucher_history` -- CREATE TABLE IF NOT EXISTS `oc_voucher_history` ( `voucher_history_id` int(11) NOT NULL AUTO_INCREMENT, `voucher_id` int(11) NOT NULL, `order_id` int(11) NOT NULL, `amount` decimal(15,4) NOT NULL, `date_added` datetime NOT NULL, PRIMARY KEY (`voucher_history_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_voucher_theme` -- CREATE TABLE IF NOT EXISTS `oc_voucher_theme` ( `voucher_theme_id` int(11) NOT NULL AUTO_INCREMENT, `image` varchar(255) NOT NULL, PRIMARY KEY (`voucher_theme_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_voucher_theme_description` -- CREATE TABLE IF NOT EXISTS `oc_voucher_theme_description` ( `voucher_theme_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `name` varchar(32) NOT NULL, PRIMARY KEY (`voucher_theme_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_weight_class` -- CREATE TABLE IF NOT EXISTS `oc_weight_class` ( `weight_class_id` int(11) NOT NULL AUTO_INCREMENT, `value` decimal(15,8) NOT NULL DEFAULT '0.00000000', PRIMARY KEY (`weight_class_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_weight_class_description` -- CREATE TABLE IF NOT EXISTS `oc_weight_class_description` ( `weight_class_id` int(11) NOT NULL AUTO_INCREMENT, `language_id` int(11) NOT NULL, `title` varchar(32) NOT NULL, `unit` varchar(4) NOT NULL, PRIMARY KEY (`weight_class_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_zone` -- CREATE TABLE IF NOT EXISTS `oc_zone` ( `zone_id` int(11) NOT NULL AUTO_INCREMENT, `country_id` int(11) NOT NULL, `name` varchar(128) NOT NULL, `code` varchar(32) NOT NULL, `status` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`zone_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; -- -------------------------------------------------------- -- -- Table structure for table `oc_zone_to_geo_zone` -- CREATE TABLE IF NOT EXISTS `oc_zone_to_geo_zone` ( `zone_to_geo_zone_id` int(11) NOT NULL AUTO_INCREMENT, `country_id` int(11) NOT NULL, `zone_id` int(11) NOT NULL DEFAULT '0', `geo_zone_id` int(11) NOT NULL, `date_added` datetime NOT NULL, `date_modified` datetime NOT NULL, PRIMARY KEY (`zone_to_geo_zone_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
the_stack
-- Change ownership on the TIGER tables ALTER TABLE tiger2019.cbsa OWNER TO census; ALTER TABLE tiger2019.cd OWNER TO census; ALTER TABLE tiger2019.county OWNER TO census; ALTER TABLE tiger2019.csa OWNER TO census; ALTER TABLE tiger2019.place OWNER TO census; ALTER TABLE tiger2019.state OWNER TO census; ALTER TABLE tiger2019.elsd OWNER TO census; ALTER TABLE tiger2019.scsd OWNER TO census; ALTER TABLE tiger2019.zcta5 OWNER TO census; ALTER TABLE tiger2019.cousub OWNER TO census; ALTER TABLE tiger2019.puma OWNER TO census; ALTER TABLE tiger2019.sldl OWNER TO census; ALTER TABLE tiger2019.sldu OWNER TO census; ALTER TABLE tiger2019.aiannh OWNER TO census; ALTER TABLE tiger2019.aitsn OWNER TO census; ALTER TABLE tiger2019.anrc OWNER TO census; ALTER TABLE tiger2019.bg OWNER TO census; ALTER TABLE tiger2019.cnecta OWNER TO census; ALTER TABLE tiger2019.concity OWNER TO census; ALTER TABLE tiger2019.metdiv OWNER TO census; ALTER TABLE tiger2019.necta OWNER TO census; ALTER TABLE tiger2019.nectadiv OWNER TO census; ALTER TABLE tiger2019.submcd OWNER TO census; ALTER TABLE tiger2019.tbg OWNER TO census; ALTER TABLE tiger2019.ttract OWNER TO census; ALTER TABLE tiger2019.tract OWNER TO census; ALTER TABLE tiger2019.uac OWNER TO census; ALTER TABLE tiger2019.unsd OWNER TO census; -- OGR needs select on geography_columns to do it's thing GRANT SELECT ON geography_columns TO census; -- Create a unified table for all census names -> geoid DROP TABLE IF EXISTS tiger2019.census_name_lookup; CREATE TABLE tiger2019.census_name_lookup ( display_name varchar, simple_name varchar, prefix_match_name varchar, sumlevel varchar(3), geoid varchar, full_geoid varchar(40), priority smallint, population int, aland decimal(15), awater decimal(15) ); SELECT AddGeometryColumn('tiger2019', 'census_name_lookup', 'geom', 4326, 'MULTIPOLYGON', 2); INSERT INTO tiger2019.census_name_lookup SELECT state.name, state.name, state.name, '040', state.geoid, '04000US' || state.geoid, 10, b01003.b01003001, state.aland, state.awater, state.geom FROM tiger2019.state LEFT OUTER JOIN acs2019_1yr.b01003 ON (('04000US' || state.geoid) = b01003.geoid) WHERE state.geoid NOT IN ('60', '66', '69', '78'); INSERT INTO tiger2019.census_name_lookup SELECT place.name || ', ' || state.stusps, place.name, place.name || ' ' || state.stusps, '160', place.geoid, '16000US' || place.geoid, 20, b01003.b01003001, place.aland, place.awater, place.geom FROM tiger2019.place LEFT OUTER JOIN acs2018_5yr.b01003 ON (('16000US' || place.geoid) = b01003.geoid) JOIN tiger2019.state USING (statefp) WHERE state.geoid NOT IN ('60', '66', '69', '78'); INSERT INTO tiger2019.census_name_lookup SELECT county.namelsad || ', ' || state.stusps, county.namelsad, county.namelsad || ' ' || state.stusps, '050', county.geoid, '05000US' || county.geoid, 30, b01003.b01003001, county.aland, county.awater, county.geom FROM tiger2019.county LEFT OUTER JOIN acs2018_5yr.b01003 ON (('05000US' || county.geoid) = b01003.geoid) JOIN tiger2019.state USING (statefp) WHERE state.geoid NOT IN ('60', '66', '69', '78'); INSERT INTO tiger2019.census_name_lookup SELECT cousub.namelsad || ', ' || county.namelsad || ', ' || state.stusps, cousub.name, cousub.name || ' ' || state.stusps, '060', cousub.geoid, '06000US' || cousub.geoid, 40, b01003.b01003001, cousub.aland, cousub.awater, cousub.geom FROM tiger2019.cousub LEFT OUTER JOIN acs2018_5yr.b01003 ON (('06000US' || cousub.geoid) = b01003.geoid) JOIN tiger2019.county USING (statefp, countyfp) JOIN tiger2019.state USING (statefp) WHERE state.geoid NOT IN ('60', '66', '69', '78'); INSERT INTO tiger2019.census_name_lookup SELECT zcta5.zcta5ce10, zcta5.zcta5ce10, zcta5.zcta5ce10, '860', zcta5.geoid10, '86000US' || zcta5.geoid10, 50, b01003.b01003001, zcta5.aland10, zcta5.awater10, zcta5.geom FROM tiger2019.zcta5 LEFT OUTER JOIN acs2018_5yr.b01003 ON (('86000US' || zcta5.geoid10) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT cbsa.namelsad, cbsa.name, cbsa.name, '310', cbsa.geoid, '31000US' || cbsa.geoid, 60, b01003.b01003001, cbsa.aland, cbsa.awater, cbsa.geom FROM tiger2019.cbsa LEFT OUTER JOIN acs2018_5yr.b01003 ON (('31000US' || cbsa.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT cd.namelsad || ', ' || state.stusps, cd.namelsad, cd.namelsad, '500', cd.geoid, '50000US' || cd.geoid, 70, b01003.b01003001, cd.aland, cd.awater, cd.geom FROM tiger2019.cd LEFT OUTER JOIN acs2018_5yr.b01003 ON (('50000US' || cd.geoid) = b01003.geoid) JOIN tiger2019.state USING (statefp) WHERE state.geoid NOT IN ('60', '66', '69', '78'); INSERT INTO tiger2019.census_name_lookup SELECT csa.namelsad, csa.name, csa.name, '330', csa.geoid, '33000US' || csa.geoid, 80, b01003.b01003001, csa.aland, csa.awater, csa.geom FROM tiger2019.csa LEFT OUTER JOIN acs2018_5yr.b01003 ON (('33000US' || csa.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT elsd.name || ', ' || state.stusps, elsd.name, elsd.name, '950', elsd.geoid, '95000US' || elsd.geoid, 90, b01003.b01003001, elsd.aland, elsd.awater, elsd.geom FROM tiger2019.elsd LEFT OUTER JOIN acs2018_5yr.b01003 ON (('95000US' || elsd.geoid) = b01003.geoid) JOIN tiger2019.state USING (statefp); INSERT INTO tiger2019.census_name_lookup SELECT scsd.name || ', ' || state.stusps, scsd.name, scsd.name, '960', scsd.geoid, '96000US' || scsd.geoid, 100, b01003.b01003001, scsd.aland, scsd.awater, scsd.geom FROM tiger2019.scsd LEFT OUTER JOIN acs2018_5yr.b01003 ON (('96000US' || scsd.geoid) = b01003.geoid) JOIN tiger2019.state USING (statefp); INSERT INTO tiger2019.census_name_lookup SELECT puma.namelsad10 || ', ' || state.stusps, puma.namelsad10, puma.namelsad10, '795', puma.geoid10, '79500US' || puma.geoid10, 110, b01003.b01003001, puma.aland10, puma.awater10, puma.geom FROM tiger2019.puma LEFT OUTER JOIN acs2018_5yr.b01003 ON (('79500US' || puma.geoid10) = b01003.geoid) JOIN tiger2019.state ON (puma.statefp10=state.statefp) WHERE statefp NOT IN ('60', '66', '69', '78'); INSERT INTO tiger2019.census_name_lookup SELECT sldl.namelsad || ', ' || state.stusps, sldl.namelsad, sldl.namelsad, '620', sldl.geoid, '62000US' || sldl.geoid, 120, b01003.b01003001, sldl.aland, sldl.awater, sldl.geom FROM tiger2019.sldl LEFT OUTER JOIN acs2018_5yr.b01003 ON (('62000US' || sldl.geoid) = b01003.geoid) JOIN tiger2019.state USING (statefp); INSERT INTO tiger2019.census_name_lookup SELECT sldu.namelsad || ', ' || state.stusps, sldu.namelsad, sldu.namelsad, '610', sldu.geoid, '61000US' || sldu.geoid, 130, b01003.b01003001, sldu.aland, sldu.awater, sldu.geom FROM tiger2019.sldu LEFT OUTER JOIN acs2018_5yr.b01003 ON (('61000US' || sldu.geoid) = b01003.geoid) JOIN tiger2019.state USING (statefp); INSERT INTO tiger2019.census_name_lookup SELECT aiannh.namelsad, aiannh.namelsad, aiannh.namelsad, '250', aiannh.geoid, '25000US' || aiannh.geoid, 140, b01003.b01003001, aiannh.aland, aiannh.awater, aiannh.geom FROM tiger2019.aiannh LEFT OUTER JOIN acs2018_5yr.b01003 ON (('25000US' || aiannh.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT aitsn.namelsad, aitsn.namelsad, aitsn.namelsad, '251', aitsn.geoid, '25100US' || aitsn.geoid, 150, b01003.b01003001, aitsn.aland, aitsn.awater, aitsn.geom FROM tiger2019.aitsn LEFT OUTER JOIN acs2018_5yr.b01003 ON (('25100US' || aitsn.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT anrc.namelsad, anrc.namelsad, anrc.namelsad, '230', anrc.geoid, '23000US' || anrc.geoid, 160, b01003.b01003001, anrc.aland, anrc.awater, anrc.geom FROM tiger2019.anrc LEFT OUTER JOIN acs2018_5yr.b01003 ON (('23000US' || anrc.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT bg.namelsad || ', ' || county.name || ', ' || state.stusps, bg.namelsad, null, '150', bg.geoid, '15000US' || bg.geoid, 190, b01003.b01003001, bg.aland, bg.awater, bg.geom FROM tiger2019.bg LEFT OUTER JOIN acs2018_5yr.b01003 ON (('15000US' || bg.geoid) = b01003.geoid) JOIN tiger2019.county USING (statefp, countyfp) JOIN tiger2019.state USING (statefp) WHERE statefp NOT IN ('60', '66', '69', '78'); INSERT INTO tiger2019.census_name_lookup SELECT cnecta.namelsad, cnecta.namelsad, cnecta.namelsad, '335', cnecta.geoid, '33500US' || cnecta.geoid, 190, b01003.b01003001, cnecta.aland, cnecta.awater, cnecta.geom FROM tiger2019.cnecta LEFT OUTER JOIN acs2018_5yr.b01003 ON (('33500US' || cnecta.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT concity.namelsad || ', ' || state.stusps, concity.namelsad, concity.name || ' ' || state.stusps, '170', concity.geoid, '17000US' || concity.geoid, 190, b01003.b01003001, concity.aland, concity.awater, concity.geom FROM tiger2019.concity LEFT OUTER JOIN acs2018_5yr.b01003 ON (('17000US' || concity.geoid) = b01003.geoid) JOIN tiger2019.state USING (statefp); INSERT INTO tiger2019.census_name_lookup SELECT metdiv.namelsad, metdiv.namelsad, metdiv.name, '314', metdiv.geoid, '31400US' || metdiv.geoid, 200, b01003.b01003001, metdiv.aland, metdiv.awater, metdiv.geom FROM tiger2019.metdiv LEFT OUTER JOIN acs2018_5yr.b01003 ON (('31400US' || metdiv.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT necta.namelsad, necta.namelsad, necta.name, '350', necta.geoid, '35000US' || necta.geoid, 210, b01003.b01003001, necta.aland, necta.awater, necta.geom FROM tiger2019.necta LEFT OUTER JOIN acs2018_5yr.b01003 ON (('35000US' || necta.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT nectadiv.namelsad, nectadiv.namelsad, nectadiv.name, '355', nectadiv.geoid, '35500US' || nectadiv.geoid, 220, b01003.b01003001, nectadiv.aland, nectadiv.awater, nectadiv.geom FROM tiger2019.nectadiv LEFT OUTER JOIN acs2018_5yr.b01003 ON (('35500US' || nectadiv.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT submcd.namelsad, submcd.namelsad, submcd.name, '067', submcd.geoid, '06700US' || submcd.geoid, 230, b01003.b01003001, submcd.aland, submcd.awater, submcd.geom FROM tiger2019.submcd LEFT OUTER JOIN acs2018_5yr.b01003 ON (('06700US' || submcd.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT tbg.namelsad, tbg.namelsad, null, '258', tbg.geoid, '25800US' || tbg.geoid, 240, b01003.b01003001, tbg.aland, tbg.awater, tbg.geom FROM tiger2019.tbg LEFT OUTER JOIN acs2018_5yr.b01003 ON (('25800US' || tbg.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT ttract.namelsad, ttract.namelsad, null, '256', ttract.geoid, '25600US' || ttract.geoid, 250, b01003.b01003001, ttract.aland, ttract.awater, ttract.geom FROM tiger2019.ttract LEFT OUTER JOIN acs2018_5yr.b01003 ON (('25600US' || ttract.geoid) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT tract.namelsad || ', ' || county.name || ', ' || state.stusps, tract.namelsad, null, '140', tract.geoid, '14000US' || tract.geoid, 270, b01003.b01003001, tract.aland, tract.awater, tract.geom FROM tiger2019.tract LEFT OUTER JOIN acs2018_5yr.b01003 ON (('14000US' || tract.geoid) = b01003.geoid) JOIN tiger2019.county USING (statefp, countyfp) JOIN tiger2019.state USING (statefp) WHERE statefp NOT IN ('60', '66', '69', '78'); INSERT INTO tiger2019.census_name_lookup SELECT uac.namelsad10, uac.name10, uac.name10, '400', uac.geoid10, '40000US' || uac.geoid10, 280, b01003.b01003001, uac.aland10, uac.awater10, uac.geom FROM tiger2019.uac LEFT OUTER JOIN acs2018_5yr.b01003 ON (('40000US' || uac.geoid10) = b01003.geoid); INSERT INTO tiger2019.census_name_lookup SELECT unsd.name || ', ' || state.stusps, unsd.name, unsd.name || ' ' || state.stusps, '970', unsd.geoid, '97000US' || unsd.geoid, 290, b01003.b01003001, unsd.aland, unsd.awater, unsd.geom FROM tiger2019.unsd LEFT OUTER JOIN acs2018_5yr.b01003 ON (('97000US' || unsd.geoid) = b01003.geoid) JOIN tiger2019.state USING (statefp) WHERE statefp NOT IN ('60', '66', '69', '78'); INSERT INTO tiger2019.census_name_lookup SELECT 'United States', 'United States', 'united states', '010', '', '01000US', 5, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid='01000US'), (SELECT SUM(aland) FROM tiger2019.state), (SELECT SUM(awater) FROM tiger2019.state), (SELECT ST_Simplify(ST_Union(geom), 0.01) FROM tiger2019.state); ---- Divisions -- Division 1 INSERT INTO tiger2019.census_name_lookup SELECT 'New England Division', 'New England Division', 'new england division', '030', '', '03000US1', 310, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '03000US1'), (SELECT SUM(aland) FROM tiger2019.state WHERE division='1'), (SELECT SUM(awater) FROM tiger2019.state WHERE division='1'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.division = '1' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Division 2 INSERT INTO tiger2019.census_name_lookup SELECT 'Middle Atlantic Division', 'Middle Atlantic Division', 'middle atlantic division', '030', '', '03000US2', 310, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '03000US2'), (SELECT SUM(aland) FROM tiger2019.state WHERE division='2'), (SELECT SUM(awater) FROM tiger2019.state WHERE division='2'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.division = '2' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Division 3 INSERT INTO tiger2019.census_name_lookup SELECT 'East North Central Division', 'East North Central Division', 'east north central division', '030', '', '03000US3', 310, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '03000US3'), (SELECT SUM(aland) FROM tiger2019.state WHERE division='3'), (SELECT SUM(awater) FROM tiger2019.state WHERE division='3'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.division = '3' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Division 4 INSERT INTO tiger2019.census_name_lookup SELECT 'West North Central Division', 'West North Central Division', 'west north central division', '030', '', '03000US4', 310, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '03000US4'), (SELECT SUM(aland) FROM tiger2019.state WHERE division='4'), (SELECT SUM(awater) FROM tiger2019.state WHERE division='4'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.division = '4' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Division 5 INSERT INTO tiger2019.census_name_lookup SELECT 'South Atlantic Division', 'South Atlantic Division', 'south atlantic division', '030', '', '03000US5', 310, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '03000US5'), (SELECT SUM(aland) FROM tiger2019.state WHERE division='5'), (SELECT SUM(awater) FROM tiger2019.state WHERE division='5'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.division = '5' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Division 6 INSERT INTO tiger2019.census_name_lookup SELECT 'East South Central Division', 'East South Central Division', 'east south central division', '030', '', '03000US6', 310, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '03000US6'), (SELECT SUM(aland) FROM tiger2019.state WHERE division='6'), (SELECT SUM(awater) FROM tiger2019.state WHERE division='6'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.division = '6' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Division 7 INSERT INTO tiger2019.census_name_lookup SELECT 'West South Central Division', 'West South Central Division', 'west south central division', '030', '', '03000US7', 310, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '03000US7'), (SELECT SUM(aland) FROM tiger2019.state WHERE division='7'), (SELECT SUM(awater) FROM tiger2019.state WHERE division='7'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.division = '7' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Division 8 INSERT INTO tiger2019.census_name_lookup SELECT 'Mountain Division', 'Mountain Division', 'mountain division', '030', '', '03000US8', 310, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '03000US8'), (SELECT SUM(aland) FROM tiger2019.state WHERE division='8'), (SELECT SUM(awater) FROM tiger2019.state WHERE division='8'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.division = '8' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Division 9 INSERT INTO tiger2019.census_name_lookup SELECT 'Pacific Division', 'Pacific Division', 'pacific division', '030', '', '03000US9', 310, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '03000US9'), (SELECT SUM(aland) FROM tiger2019.state WHERE division='9'), (SELECT SUM(awater) FROM tiger2019.state WHERE division='9'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.division = '9' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); ---- Regions -- Region 1 INSERT INTO tiger2019.census_name_lookup SELECT 'Northeast Region', 'Northeast Region', 'northeast region', '020', '', '02000US1', 320, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '02000US1'), (SELECT SUM(aland) FROM tiger2019.state WHERE region='1'), (SELECT SUM(awater) FROM tiger2019.state WHERE region='1'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.region = '1' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Region 2 INSERT INTO tiger2019.census_name_lookup SELECT 'Midwest Region', 'Midwest Region', 'midwest region', '020', '', '02000US2', 320, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '02000US2'), (SELECT SUM(aland) FROM tiger2019.state WHERE region='2'), (SELECT SUM(awater) FROM tiger2019.state WHERE region='2'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.region = '2' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Region 3 INSERT INTO tiger2019.census_name_lookup SELECT 'South Region', 'South Region', 'south region', '020', '', '02000US3', 320, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '02000US3'), (SELECT SUM(aland) FROM tiger2019.state WHERE region='3'), (SELECT SUM(awater) FROM tiger2019.state WHERE region='3'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.region = '3' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); -- Region 4 INSERT INTO tiger2019.census_name_lookup SELECT 'West Region', 'West Region', 'west region', '020', '', '02000US4', 320, (SELECT b01003.b01003001 FROM acs2018_5yr.b01003 WHERE geoid = '02000US4'), (SELECT SUM(aland) FROM tiger2019.state WHERE region='4'), (SELECT SUM(awater) FROM tiger2019.state WHERE region='4'), (SELECT ST_Multi(ST_Union(tiger2019.census_name_lookup.geom)) FROM tiger2019.census_name_lookup, tiger2019.state WHERE tiger2019.state.region = '4' AND tiger2019.census_name_lookup.sumlevel = '040' AND tiger2019.census_name_lookup.geoid = tiger2019.state.geoid); CREATE INDEX census_name_lookup_idx_lower ON tiger2019.census_name_lookup ((lower(prefix_match_name)) text_pattern_ops); CREATE INDEX census_name_lookup_idx_geom ON tiger2019.census_name_lookup USING GIST(geom); CREATE INDEX census_name_lookup_idx_geoid ON tiger2019.census_name_lookup (full_geoid); CREATE INDEX census_name_lookup_idx_sumlevel ON tiger2019.census_name_lookup(sumlevel); CREATE TABLE tiger2019.census_geo_containment ( child_geoid varchar(40), parent_geoid varchar(40), percent_covered real ); -- Places (160) in Counties (050) INSERT INTO tiger2019.census_geo_containment ( SELECT '16000US' || place.geoid AS child_geoid, '05000US' || county.geoid AS parent_geoid, ST_Area(ST_Intersection(place.geom,county.geom))/ST_Area(place.geom)*100 as percent_covered FROM tiger2019.place JOIN tiger2019.county ON ST_Intersects(place.geom, county.geom) WHERE ST_Area(ST_Intersection(place.geom,county.geom))/ST_Area(place.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(place.geom,county.geom)) DESC ); -- ZCTA5s (860) in Counties (050) INSERT INTO tiger2019.census_geo_containment ( SELECT '86000US' || zcta5.geoid10 AS child_geoid, '05000US' || county.geoid AS parent_geoid, ST_Area(ST_Intersection(zcta5.geom,county.geom))/ST_Area(zcta5.geom)*100 as percent_covered FROM tiger2019.zcta5 JOIN tiger2019.county ON ST_Intersects(zcta5.geom, county.geom) WHERE ST_IsValid(zcta5.geom) AND ST_Area(ST_Intersection(zcta5.geom,county.geom))/ST_Area(zcta5.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(zcta5.geom,county.geom)) DESC ); -- Elementary school districts (950) in Counties (050) INSERT INTO tiger2019.census_geo_containment ( SELECT '95000US' || elsd.geoid AS child_geoid, '05000US' || county.geoid AS parent_geoid, ST_Area(ST_Intersection(elsd.geom,county.geom))/ST_Area(elsd.geom)*100 as percent_covered FROM tiger2019.elsd JOIN tiger2019.county ON ST_Intersects(elsd.geom, county.geom) WHERE ST_IsValid(elsd.geom) AND ST_Area(ST_Intersection(elsd.geom,county.geom))/ST_Area(elsd.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(elsd.geom,county.geom)) DESC ); -- Secondary school districts (960) in Counties (050) INSERT INTO tiger2019.census_geo_containment ( SELECT '96000US' || scsd.geoid AS child_geoid, '05000US' || county.geoid AS parent_geoid, ST_Area(ST_Intersection(scsd.geom,county.geom))/ST_Area(scsd.geom)*100 as percent_covered FROM tiger2019.scsd JOIN tiger2019.county ON ST_Intersects(scsd.geom, county.geom) WHERE ST_IsValid(scsd.geom) AND ST_Area(ST_Intersection(scsd.geom,county.geom))/ST_Area(scsd.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(scsd.geom,county.geom)) DESC ); -- Unified school districts (970) in Counties (050) INSERT INTO tiger2019.census_geo_containment ( SELECT '97000US' || unsd.geoid AS child_geoid, '05000US' || county.geoid AS parent_geoid, ST_Area(ST_Intersection(unsd.geom,county.geom))/ST_Area(unsd.geom)*100 as percent_covered FROM tiger2019.unsd JOIN tiger2019.county ON ST_Intersects(unsd.geom, county.geom) WHERE ST_IsValid(unsd.geom) AND ST_Area(ST_Intersection(unsd.geom,county.geom))/ST_Area(unsd.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(unsd.geom,county.geom)) DESC ); -- Places (160) in CBSA (310) INSERT INTO tiger2019.census_geo_containment ( SELECT '16000US' || place.geoid AS child_geoid, '31000US' || cbsa.geoid AS parent_geoid, ST_Area(ST_Intersection(place.geom,cbsa.geom))/ST_Area(place.geom)*100 as percent_covered FROM tiger2019.place JOIN tiger2019.cbsa ON ST_Intersects(place.geom, cbsa.geom) WHERE ST_IsValid(place.geom) AND ST_Area(ST_Intersection(place.geom,cbsa.geom))/ST_Area(place.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(place.geom,cbsa.geom)) DESC ); -- ZCTA5s (860) in CBSA (310) INSERT INTO tiger2019.census_geo_containment ( SELECT '86000US' || zcta5.geoid10 AS child_geoid, '31000US' || cbsa.geoid AS parent_geoid, ST_Area(ST_Intersection(zcta5.geom,cbsa.geom))/ST_Area(zcta5.geom)*100 as percent_covered FROM tiger2019.zcta5 JOIN tiger2019.cbsa ON ST_Intersects(zcta5.geom, cbsa.geom) WHERE ST_IsValid(zcta5.geom) AND ST_Area(ST_Intersection(zcta5.geom,cbsa.geom))/ST_Area(zcta5.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(zcta5.geom,cbsa.geom)) DESC ); -- ZCTA5s (860) in States (040) INSERT INTO tiger2019.census_geo_containment ( SELECT '86000US' || zcta5.geoid10 AS child_geoid, '04000US' || state.geoid AS parent_geoid, ST_Area(ST_Intersection(zcta5.geom,state.geom))/ST_Area(zcta5.geom)*100 as percent_covered FROM tiger2019.zcta5 JOIN tiger2019.state ON ST_Intersects(zcta5.geom, state.geom) WHERE ST_IsValid(zcta5.geom) AND ST_Area(ST_Intersection(zcta5.geom,state.geom))/ST_Area(zcta5.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(zcta5.geom,state.geom)) DESC ); -- CBSAs (310) in States (040) INSERT INTO tiger2019.census_geo_containment ( SELECT '31000US' || cbsa.geoid AS child_geoid, '04000US' || state.geoid AS parent_geoid, ST_Area(ST_Intersection(cbsa.geom,state.geom))/ST_Area(cbsa.geom)*100 as percent_covered FROM tiger2019.cbsa JOIN tiger2019.state ON ST_Intersects(cbsa.geom, state.geom) WHERE ST_IsValid(cbsa.geom) AND ST_Area(ST_Intersection(cbsa.geom,state.geom))/ST_Area(cbsa.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(cbsa.geom,state.geom)) DESC ); -- CBSAs (310) in CSAs (330) INSERT INTO tiger2019.census_geo_containment ( SELECT '31000US' || cbsa.geoid AS child_geoid, '33000US' || csa.geoid AS parent_geoid, ST_Area(ST_Intersection(cbsa.geom,csa.geom))/ST_Area(cbsa.geom)*100 as percent_covered FROM tiger2019.cbsa JOIN tiger2019.csa ON ST_Intersects(cbsa.geom, csa.geom) WHERE ST_IsValid(cbsa.geom) AND ST_Area(ST_Intersection(cbsa.geom,csa.geom))/ST_Area(cbsa.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(cbsa.geom,csa.geom)) DESC ); -- CSAs (330) in States (040) INSERT INTO tiger2019.census_geo_containment ( SELECT '33000US' || csa.geoid AS child_geoid, '04000US' || state.geoid AS parent_geoid, ST_Area(ST_Intersection(csa.geom,state.geom))/ST_Area(csa.geom)*100 as percent_covered FROM tiger2019.csa JOIN tiger2019.state ON ST_Intersects(csa.geom, state.geom) WHERE ST_IsValid(csa.geom) AND ST_Area(ST_Intersection(csa.geom,state.geom))/ST_Area(csa.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(csa.geom,state.geom)) DESC ); -- Tracts (140) in Places (160) INSERT INTO tiger2019.census_geo_containment ( SELECT '14000US' || tract.geoid AS child_geoid, '16000US' || place.geoid AS parent_geoid, ST_Area(ST_Intersection(tract.geom,place.geom))/ST_Area(tract.geom)*100 as percent_covered FROM tiger2019.tract JOIN tiger2019.place ON ST_Intersects(tract.geom, place.geom) WHERE ST_IsValid(tract.geom) AND ST_Area(ST_Intersection(tract.geom,place.geom))/ST_Area(tract.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(tract.geom,place.geom)) DESC ); -- Block Groups (150) in Places (160) INSERT INTO tiger2019.census_geo_containment ( SELECT '15000US' || bg.geoid AS child_geoid, '16000US' || place.geoid AS parent_geoid, ST_Area(ST_Intersection(bg.geom,place.geom))/ST_Area(bg.geom)*100 as percent_covered FROM tiger2019.bg JOIN tiger2019.place ON ST_Intersects(bg.geom, place.geom) WHERE ST_IsValid(bg.geom) AND ST_Area(ST_Intersection(bg.geom,place.geom))/ST_Area(bg.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(bg.geom,place.geom)) DESC ); -- NECTAs (350) in States (040) INSERT INTO tiger2019.census_geo_containment ( SELECT '35000US' || necta.geoid AS child_geoid, '04000US' || state.geoid AS parent_geoid, ST_Area(ST_Intersection(necta.geom,state.geom))/ST_Area(necta.geom)*100 as percent_covered FROM tiger2019.necta JOIN tiger2019.state ON ST_Intersects(necta.geom, state.geom) WHERE ST_IsValid(necta.geom) AND ST_Area(ST_Intersection(necta.geom,state.geom))/ST_Area(necta.geom) > 0 ORDER BY child_geoid ASC, ST_Area(ST_Intersection(necta.geom,state.geom)) DESC ); CREATE INDEX census_geo_containment_idx_child_geoid ON tiger2019.census_geo_containment (child_geoid); CREATE INDEX census_geo_containment_idx_parent_geoid ON tiger2019.census_geo_containment (parent_geoid);
the_stack
-- -- PostgreSQL database dump -- -- Dumped from database version 9.6.2 -- Dumped by pg_dump version 9.6.2 SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; SET row_security = off; -- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - -- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; -- -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - -- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; -- -- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - -- CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA public; -- -- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: - -- COMMENT ON EXTENSION pg_stat_statements IS 'track execution statistics of all SQL statements executed'; -- -- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: - -- CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public; -- -- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: - -- COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams'; SET search_path = public, pg_catalog; -- -- Name: context_type; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE context_type AS ENUM ( 'tip', 'take', 'final-gift', 'take-over', 'one-off' ); -- -- Name: status_of_1_0_payout; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE status_of_1_0_payout AS ENUM ( 'too-little', 'pending-application', 'pending-review', 'rejected', 'pending-payout', 'completed' ); SET default_tablespace = ''; SET default_with_oids = false; -- -- Name: participants; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE participants ( username text NOT NULL, session_token text, session_expires timestamp with time zone DEFAULT (now() + '06:00:00'::interval), ctime timestamp with time zone DEFAULT now() NOT NULL, claimed_time timestamp with time zone, is_admin boolean DEFAULT false NOT NULL, balance numeric(35,2) DEFAULT 0.0 NOT NULL, anonymous_giving boolean DEFAULT false NOT NULL, balanced_customer_href text, is_suspicious boolean, id bigint NOT NULL, username_lower text NOT NULL, api_key text, avatar_url text, is_closed boolean DEFAULT false NOT NULL, giving numeric(35,2) DEFAULT 0 NOT NULL, taking numeric(35,2) DEFAULT 0 NOT NULL, is_free_rider boolean, email_address text, email_lang text, is_searchable boolean DEFAULT true NOT NULL, old_auth_usage date, notifications text[] DEFAULT '{}'::text[] NOT NULL, notify_charge integer DEFAULT 3, braintree_customer_id text, ngiving_to integer DEFAULT 0 NOT NULL, ntaking_from integer DEFAULT 0 NOT NULL, status_of_1_0_payout status_of_1_0_payout DEFAULT 'completed'::status_of_1_0_payout NOT NULL, has_verified_identity boolean DEFAULT false NOT NULL, is_owner boolean DEFAULT false NOT NULL ); -- -- Name: elsewhere_with_participant; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE elsewhere_with_participant AS ( id integer, platform text, user_id text, user_name text, display_name text, email text, avatar_url text, is_team boolean, extra_info json, token json, connect_token text, connect_expires timestamp with time zone, participant participants ); -- -- Name: exchange_status; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE exchange_status AS ENUM ( 'pre', 'pending', 'failed', 'succeeded', 'unknown' ); -- -- Name: follow_up; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE follow_up AS ENUM ( 'monthly', 'quarterly', 'yearly', 'never' ); -- -- Name: participant_number; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE participant_number AS ENUM ( 'singular', 'plural' ); -- -- Name: payment_direction; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE payment_direction AS ENUM ( 'to-team', 'to-participant' ); -- -- Name: payment_net; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE payment_net AS ENUM ( 'balanced-ba', 'balanced-cc', 'paypal', 'bitcoin', 'braintree-cc', 'cash', 'transferwise', 'dwolla', 'unknown' ); -- -- Name: status_of_1_0_balance; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE status_of_1_0_balance AS ENUM ( 'unresolved', 'pending-payout', 'resolved' ); -- -- Name: supported_image_types; Type: TYPE; Schema: public; Owner: - -- CREATE TYPE supported_image_types AS ENUM ( 'image/png', 'image/jpeg' ); -- -- Name: complete_1_0_payout(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION complete_1_0_payout() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN UPDATE participants SET status_of_1_0_payout='completed' WHERE id = NEW.id; RETURN NULL; END; $$; -- -- Name: paydays; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE paydays ( id integer NOT NULL, ts_start timestamp with time zone DEFAULT now() NOT NULL, ts_end timestamp with time zone DEFAULT '1970-01-01 00:00:00+00'::timestamp with time zone NOT NULL, volume numeric(35,2) DEFAULT 0.00 NOT NULL, nusers bigint DEFAULT 0 NOT NULL, stage integer DEFAULT 0, nteams integer DEFAULT 0 NOT NULL ); -- -- Name: current_payday(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION current_payday() RETURNS paydays LANGUAGE sql AS $$ SELECT * FROM paydays WHERE ts_end='1970-01-01T00:00:00+00'::timestamptz; $$; -- -- Name: current_payday_id(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION current_payday_id() RETURNS integer LANGUAGE sql AS $$ -- This is a function so we can use it in DEFAULTS for a column. SELECT id FROM current_payday(); $$; -- -- Name: enumerate(anyarray); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION enumerate(anyarray) RETURNS TABLE(rank bigint, value anyelement) LANGUAGE sql STABLE AS $_$ SELECT row_number() over() as rank, value FROM unnest($1) value; $_$; -- -- Name: fail_if_no_email(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION fail_if_no_email() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF (SELECT email_address FROM participants WHERE id=NEW.participant_id) IS NULL THEN RAISE EXCEPTION USING ERRCODE=23100 , MESSAGE='This operation requires a verified participant email address.'; END IF; RETURN NEW; END; $$; -- -- Name: elsewhere; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE elsewhere ( id integer NOT NULL, platform text NOT NULL, user_id text NOT NULL, participant text NOT NULL, user_name text, display_name text, email text, avatar_url text, is_team boolean DEFAULT false NOT NULL, extra_info json, token json, connect_token text, connect_expires timestamp with time zone ); -- -- Name: load_participant_for_elsewhere(elsewhere); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION load_participant_for_elsewhere(elsewhere) RETURNS elsewhere_with_participant LANGUAGE sql AS $_$ SELECT $1.id , $1.platform , $1.user_id , $1.user_name , $1.display_name , $1.email , $1.avatar_url , $1.is_team , $1.extra_info , $1.token , $1.connect_token , $1.connect_expires , participants.*::participants FROM participants WHERE participants.username = $1.participant; $_$; -- -- Name: park(bigint, bigint, numeric); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION park(bigint, bigint, numeric) RETURNS void LANGUAGE plpgsql AS $_$ DECLARE payload json; BEGIN IF ($3 = 0) THEN RETURN; END IF; UPDATE current_payment_instructions SET due = $3 WHERE participant_id = $1 AND team_id = $2; payload = '{"action":"due","participant_id":"' || $1 || '", "team_id":"' || $2 || '", "due":' || $3 || '}'; INSERT INTO events(type, payload) VALUES ('payday',payload); END; $_$; -- -- Name: pay(bigint, bigint, numeric, payment_direction); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION pay(bigint, bigint, numeric, payment_direction) RETURNS void LANGUAGE plpgsql AS $_$ DECLARE participant_delta numeric; team_delta numeric; payload json; BEGIN IF ($3 = 0) THEN RETURN; END IF; IF ($4 = 'to-team') THEN participant_delta := -$3; team_delta := $3; ELSE participant_delta := $3; team_delta := -$3; END IF; UPDATE payday_participants SET new_balance = (new_balance + participant_delta) WHERE id = $1; UPDATE payday_teams SET balance = (balance + team_delta) WHERE id = $2; UPDATE current_payment_instructions SET due = 0 WHERE participant_id = $1 AND team_id = $2 AND due > 0; IF ($4 = 'to-team') THEN payload = '{"action":"pay","participant_id":"' || $1 || '", "team_id":"' || $2 || '", "amount":' || $3 || '}'; INSERT INTO events(type, payload) VALUES ('payday',payload); END IF; INSERT INTO payday_payments (participant, team, amount, direction) VALUES ( ( SELECT p.username FROM participants p JOIN payday_participants p2 ON p.id = p2.id WHERE p2.id = $1 ) , ( SELECT t.slug FROM teams t JOIN payday_teams t2 ON t.id = t2.id WHERE t2.id = $2 ) , $3 , $4 ); END; $_$; -- -- Name: process_draw(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION process_draw() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN EXECUTE pay( (SELECT id FROM participants WHERE username=NEW.owner) , NEW.id , NEW.balance , 'to-participant' ); RETURN NULL; END; $$; -- -- Name: process_payment_instruction(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION process_payment_instruction() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE participant payday_participants; BEGIN participant := ( SELECT p.*::payday_participants FROM payday_participants p WHERE id = NEW.participant_id ); IF (NEW.amount + NEW.due <= participant.new_balance OR participant.card_hold_ok) THEN EXECUTE pay(NEW.participant_id, NEW.team_id, NEW.amount + NEW.due, 'to-team'); RETURN NEW; ELSIF participant.has_credit_card THEN EXECUTE park(NEW.participant_id, NEW.team_id, NEW.amount + NEW.due); RETURN NULL; END IF; RETURN NULL; END; $$; -- -- Name: process_take(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION process_take() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE amount numeric(35,2); available_today_ numeric(35,2); BEGIN amount := NEW.amount; available_today_ := (SELECT available_today FROM payday_teams WHERE id = NEW.team_id); IF amount > available_today_ THEN amount := available_today_; END IF; IF amount > 0 THEN UPDATE payday_teams SET available_today = (available_today - amount) WHERE id = NEW.team_id; EXECUTE pay(NEW.participant_id, NEW.team_id, amount, 'to-participant'); END IF; RETURN NULL; END; $$; -- -- Name: update_payment_instruction(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION update_payment_instruction() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN UPDATE payment_instructions SET is_funded = NEW.is_funded , due = NEW.due WHERE id = NEW.id; RETURN NULL; END; $$; -- -- Name: update_tip(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION update_tip() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN UPDATE tips SET is_funded = NEW.is_funded WHERE id = NEW.id; RETURN NULL; END; $$; -- -- Name: upsert_community(); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION upsert_community() RETURNS trigger LANGUAGE plpgsql AS $$ DECLARE is_member boolean; delta int = CASE WHEN NEW.is_member THEN 1 ELSE -1 END; BEGIN IF (SELECT is_suspicious FROM participants WHERE id = NEW.participant) THEN RETURN NULL; END IF; is_member := ( SELECT cur.is_member FROM community_members cur WHERE slug = NEW.slug AND participant = NEW.participant ORDER BY mtime DESC LIMIT 1 ); IF (is_member IS NULL AND NEW.is_member IS false OR NEW.is_member = is_member) THEN RETURN NULL; END IF; LOOP UPDATE communities SET nmembers = nmembers + delta WHERE slug = NEW.slug AND nmembers + delta > 0; EXIT WHEN FOUND; IF (NEW.is_member) THEN BEGIN INSERT INTO communities VALUES (NEW.slug, NEW.name, 1, NEW.ctime); EXCEPTION WHEN unique_violation THEN IF (CONSTRAINT_NAME = 'communities_slug_pkey') THEN CONTINUE; -- Try again ELSE RAISE; END IF; END; EXIT; ELSE DELETE FROM communities WHERE slug = NEW.slug AND nmembers = 1; EXIT WHEN FOUND; END IF; END LOOP; RETURN NEW; END; $$; -- -- Name: exchange_routes; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE exchange_routes ( id integer NOT NULL, participant bigint NOT NULL, network payment_net NOT NULL, address text NOT NULL, error text NOT NULL, fee_cap numeric(35,2), is_deleted boolean DEFAULT false NOT NULL, CONSTRAINT exchange_routes_address_check CHECK ((address <> ''::text)) ); -- -- Name: current_exchange_routes; Type: VIEW; Schema: public; Owner: - -- CREATE VIEW current_exchange_routes AS SELECT DISTINCT ON (exchange_routes.participant, exchange_routes.network) exchange_routes.id, exchange_routes.participant, exchange_routes.network, exchange_routes.address, exchange_routes.error, exchange_routes.fee_cap, exchange_routes.is_deleted FROM exchange_routes WHERE (NOT exchange_routes.is_deleted) ORDER BY exchange_routes.participant, exchange_routes.network, exchange_routes.id DESC; SET search_path = pg_catalog; -- -- Name: CAST (public.current_exchange_routes AS public.exchange_routes); Type: CAST; Schema: pg_catalog; Owner: - -- CREATE CAST (public.current_exchange_routes AS public.exchange_routes) WITH INOUT; -- -- Name: CAST (public.elsewhere AS public.elsewhere_with_participant); Type: CAST; Schema: pg_catalog; Owner: - -- CREATE CAST (public.elsewhere AS public.elsewhere_with_participant) WITH FUNCTION public.load_participant_for_elsewhere(public.elsewhere); SET search_path = public, pg_catalog; -- -- Name: absorptions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE absorptions ( id integer NOT NULL, "timestamp" timestamp with time zone DEFAULT now() NOT NULL, absorbed_was text NOT NULL, absorbed_by text NOT NULL, archived_as text NOT NULL ); -- -- Name: absorptions_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE absorptions_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: absorptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE absorptions_id_seq OWNED BY absorptions.id; -- -- Name: balances_at; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE balances_at ( participant bigint NOT NULL, at timestamp with time zone NOT NULL, balance numeric(35,2) NOT NULL ); -- -- Name: claims; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE claims ( nonce text NOT NULL, package_id bigint NOT NULL ); -- -- Name: communities; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE communities ( slug text NOT NULL, name text NOT NULL, nmembers integer NOT NULL, ctime timestamp with time zone NOT NULL, CONSTRAINT communities_nmembers_check CHECK ((nmembers > 0)) ); -- -- Name: community_members; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE community_members ( slug text NOT NULL, participant bigint NOT NULL, ctime timestamp with time zone NOT NULL, mtime timestamp with time zone DEFAULT now() NOT NULL, name text NOT NULL, is_member boolean NOT NULL ); -- -- Name: countries; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE countries ( id bigint NOT NULL, code text NOT NULL ); -- -- Name: countries_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE countries_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE countries_id_seq OWNED BY countries.id; -- -- Name: current_community_members; Type: VIEW; Schema: public; Owner: - -- CREATE VIEW current_community_members AS SELECT DISTINCT ON (c.participant, c.slug) c.slug, c.participant, c.ctime, c.mtime, c.name, c.is_member FROM community_members c ORDER BY c.participant, c.slug, c.mtime DESC; -- -- Name: payment_instructions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE payment_instructions ( id integer NOT NULL, ctime timestamp with time zone NOT NULL, mtime timestamp with time zone DEFAULT now() NOT NULL, amount numeric(35,2) NOT NULL, is_funded boolean DEFAULT false NOT NULL, due numeric(35,2) DEFAULT 0, participant_id bigint NOT NULL, team_id bigint NOT NULL ); -- -- Name: current_payment_instructions; Type: VIEW; Schema: public; Owner: - -- CREATE VIEW current_payment_instructions AS SELECT DISTINCT ON (payment_instructions.participant_id, payment_instructions.team_id) payment_instructions.id, payment_instructions.ctime, payment_instructions.mtime, payment_instructions.amount, payment_instructions.is_funded, payment_instructions.due, payment_instructions.participant_id, payment_instructions.team_id FROM payment_instructions ORDER BY payment_instructions.participant_id, payment_instructions.team_id, payment_instructions.mtime DESC; -- -- Name: takes; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE takes ( id bigint NOT NULL, ctime timestamp with time zone NOT NULL, mtime timestamp with time zone DEFAULT now() NOT NULL, participant_id bigint NOT NULL, team_id bigint NOT NULL, amount numeric(35,2) NOT NULL, recorder_id bigint NOT NULL, CONSTRAINT not_negative CHECK ((amount >= (0)::numeric)) ); -- -- Name: current_takes; Type: VIEW; Schema: public; Owner: - -- CREATE VIEW current_takes AS SELECT anon.id, anon.ctime, anon.mtime, anon.participant_id, anon.team_id, anon.amount, anon.recorder_id FROM ( SELECT DISTINCT ON (t.participant_id, t.team_id) t.id, t.ctime, t.mtime, t.participant_id, t.team_id, t.amount, t.recorder_id FROM (takes t JOIN participants p ON ((p.id = t.participant_id))) WHERE (p.is_suspicious IS NOT TRUE) ORDER BY t.participant_id, t.team_id, t.mtime DESC) anon WHERE (anon.amount > (0)::numeric); -- -- Name: tips; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE tips ( id integer NOT NULL, ctime timestamp with time zone NOT NULL, mtime timestamp with time zone DEFAULT now() NOT NULL, tipper text NOT NULL, tippee text NOT NULL, amount numeric(35,2) NOT NULL, is_funded boolean DEFAULT false NOT NULL ); -- -- Name: current_tips; Type: VIEW; Schema: public; Owner: - -- CREATE VIEW current_tips AS SELECT DISTINCT ON (tips.tipper, tips.tippee) tips.id, tips.ctime, tips.mtime, tips.tipper, tips.tippee, tips.amount, tips.is_funded FROM tips ORDER BY tips.tipper, tips.tippee, tips.mtime DESC; -- -- Name: elsewhere_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE elsewhere_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: elsewhere_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE elsewhere_id_seq OWNED BY elsewhere.id; -- -- Name: email_addresses; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE email_addresses ( id integer NOT NULL, address text NOT NULL, verified boolean, nonce text, verification_start timestamp with time zone DEFAULT now() NOT NULL, verification_end timestamp with time zone, participant_id bigint NOT NULL, CONSTRAINT verified_cant_be_false CHECK ((verified IS NOT FALSE)) ); -- -- Name: email_messages; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE email_messages ( id integer NOT NULL, participant bigint, spt_name text NOT NULL, context bytea NOT NULL, user_initiated boolean DEFAULT true NOT NULL, ctime timestamp with time zone DEFAULT now() NOT NULL, result text, remote_message_id text, email_address text, CONSTRAINT email_or_participant_required CHECK (((participant IS NOT NULL) OR (email_address IS NOT NULL))) ); -- -- Name: email_queue_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE email_queue_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: email_queue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE email_queue_id_seq OWNED BY email_messages.id; -- -- Name: emails_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE emails_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE emails_id_seq OWNED BY email_addresses.id; -- -- Name: events; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE events ( id integer NOT NULL, ts timestamp without time zone DEFAULT now() NOT NULL, type text NOT NULL, payload json ); -- -- Name: events_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE events_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE events_id_seq OWNED BY events.id; -- -- Name: exchange_routes_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE exchange_routes_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: exchange_routes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE exchange_routes_id_seq OWNED BY exchange_routes.id; -- -- Name: exchanges; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE exchanges ( id integer NOT NULL, "timestamp" timestamp with time zone DEFAULT now() NOT NULL, amount numeric(35,2) NOT NULL, fee numeric(35,2) NOT NULL, participant text NOT NULL, recorder text, note text, status exchange_status NOT NULL, route bigint NOT NULL, ref text ); -- -- Name: exchanges_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE exchanges_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: exchanges_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE exchanges_id_seq OWNED BY exchanges.id; -- -- Name: packages; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE packages ( id bigint NOT NULL, package_manager text NOT NULL, name text NOT NULL, description text NOT NULL, emails text[] NOT NULL ); -- -- Name: packages_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE packages_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: packages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE packages_id_seq OWNED BY packages.id; -- -- Name: participant_identities; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE participant_identities ( id bigint NOT NULL, participant_id bigint NOT NULL, country_id bigint NOT NULL, schema_name text NOT NULL, info bytea NOT NULL, _info_last_keyed timestamp with time zone DEFAULT now() NOT NULL, is_verified boolean DEFAULT false NOT NULL ); -- -- Name: participant_identities_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE participant_identities_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: participant_identities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE participant_identities_id_seq OWNED BY participant_identities.id; -- -- Name: participants_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE participants_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: participants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE participants_id_seq OWNED BY participants.id; -- -- Name: payday_participants; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE payday_participants ( id bigint, username text, claimed_time timestamp with time zone, old_balance numeric(35,2), new_balance numeric(35,2), is_suspicious boolean, card_hold_ok boolean, has_credit_card boolean, braintree_customer_id text, giving_today numeric(35,2) ); -- -- Name: payday_payment_instructions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE payday_payment_instructions ( id integer, participant_id bigint, team_id bigint, amount numeric(35,2), due numeric(35,2), is_funded boolean ); -- -- Name: payday_payments; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE payday_payments ( "timestamp" timestamp with time zone DEFAULT now(), participant text NOT NULL, team text NOT NULL, amount numeric(35,2) NOT NULL, direction payment_direction NOT NULL ); -- -- Name: payday_payments_done; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE payday_payments_done ( id bigint, "timestamp" timestamp with time zone, participant text, team text, amount numeric(35,2), direction payment_direction, payday integer ); -- -- Name: payday_takes; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE payday_takes ( team_id bigint, participant_id bigint, amount numeric(35,2) ); -- -- Name: payday_teams; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE payday_teams ( id bigint, slug text, owner text, available numeric(35,2), balance numeric(35,2), available_today numeric(35,2), is_drained boolean ); -- -- Name: paydays_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE paydays_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: paydays_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE paydays_id_seq OWNED BY paydays.id; -- -- Name: payment_instructions_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE payment_instructions_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: payment_instructions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE payment_instructions_id_seq OWNED BY payment_instructions.id; -- -- Name: payments; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE payments ( id bigint NOT NULL, "timestamp" timestamp with time zone DEFAULT now() NOT NULL, participant text NOT NULL, team text NOT NULL, amount numeric(35,2) NOT NULL, direction payment_direction NOT NULL, payday integer, CONSTRAINT positive CHECK ((amount > (0)::numeric)) ); -- -- Name: payments_for_open_source; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE payments_for_open_source ( secret text NOT NULL, ctime timestamp with time zone DEFAULT now() NOT NULL, amount bigint NOT NULL, braintree_transaction_id text, braintree_result_message text, name text NOT NULL, email_address text NOT NULL, promotion_name text DEFAULT ''::text NOT NULL, promotion_url text DEFAULT ''::text NOT NULL, promotion_twitter text DEFAULT ''::text NOT NULL, promotion_message text DEFAULT ''::text NOT NULL, on_mailing_list boolean DEFAULT true NOT NULL, id bigint NOT NULL, image_oid_original oid DEFAULT 0 NOT NULL, image_oid_large oid DEFAULT 0 NOT NULL, image_oid_small oid DEFAULT 0 NOT NULL, image_type supported_image_types ); -- -- Name: payments_for_open_source_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE payments_for_open_source_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: payments_for_open_source_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE payments_for_open_source_id_seq OWNED BY payments_for_open_source.id; -- -- Name: payments_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE payments_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: payments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE payments_id_seq OWNED BY payments.id; -- -- Name: statements; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE statements ( participant bigint NOT NULL, lang text NOT NULL, content text NOT NULL, search_vector tsvector, search_conf regconfig NOT NULL, content_scrubbed text DEFAULT ''::text NOT NULL, CONSTRAINT statements_content_check CHECK ((content <> ''::text)) ); -- -- Name: takes_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE takes_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: takes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE takes_id_seq OWNED BY takes.id; -- -- Name: teams; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE teams ( slug text NOT NULL, id bigint NOT NULL, ctime timestamp with time zone DEFAULT now() NOT NULL, slug_lower text NOT NULL, name text NOT NULL, homepage text NOT NULL, product_or_service text NOT NULL, getting_involved text, getting_paid text, owner text NOT NULL, is_closed boolean DEFAULT false NOT NULL, is_approved boolean, receiving numeric(35,2) DEFAULT 0 NOT NULL, nreceiving_from integer DEFAULT 0 NOT NULL, distributing numeric(35,2) DEFAULT 0 NOT NULL, ndistributing_to integer DEFAULT 0 NOT NULL, revenue_model text DEFAULT ''::text, onboarding_url text DEFAULT ''::text NOT NULL, review_url text, image_oid_original oid DEFAULT 0 NOT NULL, image_oid_large oid DEFAULT 0 NOT NULL, image_oid_small oid DEFAULT 0 NOT NULL, image_type supported_image_types, available numeric(35,2) DEFAULT 0 NOT NULL, CONSTRAINT available_not_negative CHECK ((available >= (0)::numeric)) ); -- -- Name: teams_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE teams_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: teams_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE teams_id_seq OWNED BY teams.id; -- -- Name: teams_to_packages; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE teams_to_packages ( team_id bigint, package_id bigint ); -- -- Name: tips_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE tips_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: tips_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE tips_id_seq OWNED BY tips.id; -- -- Name: transfers; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE transfers ( id integer NOT NULL, "timestamp" timestamp with time zone DEFAULT now() NOT NULL, tipper text NOT NULL, tippee text NOT NULL, amount numeric(35,2) NOT NULL, context context_type NOT NULL, payday integer ); -- -- Name: transfers_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- CREATE SEQUENCE transfers_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; -- -- Name: transfers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- ALTER SEQUENCE transfers_id_seq OWNED BY transfers.id; -- -- Name: worker_coordination; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE worker_coordination ( npm_last_seq bigint DEFAULT '-1'::integer NOT NULL ); -- -- Name: absorptions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY absorptions ALTER COLUMN id SET DEFAULT nextval('absorptions_id_seq'::regclass); -- -- Name: countries id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY countries ALTER COLUMN id SET DEFAULT nextval('countries_id_seq'::regclass); -- -- Name: elsewhere id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY elsewhere ALTER COLUMN id SET DEFAULT nextval('elsewhere_id_seq'::regclass); -- -- Name: email_addresses id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY email_addresses ALTER COLUMN id SET DEFAULT nextval('emails_id_seq'::regclass); -- -- Name: email_messages id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY email_messages ALTER COLUMN id SET DEFAULT nextval('email_queue_id_seq'::regclass); -- -- Name: events id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY events ALTER COLUMN id SET DEFAULT nextval('events_id_seq'::regclass); -- -- Name: exchange_routes id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY exchange_routes ALTER COLUMN id SET DEFAULT nextval('exchange_routes_id_seq'::regclass); -- -- Name: exchanges id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY exchanges ALTER COLUMN id SET DEFAULT nextval('exchanges_id_seq'::regclass); -- -- Name: packages id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY packages ALTER COLUMN id SET DEFAULT nextval('packages_id_seq'::regclass); -- -- Name: participant_identities id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY participant_identities ALTER COLUMN id SET DEFAULT nextval('participant_identities_id_seq'::regclass); -- -- Name: participants id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY participants ALTER COLUMN id SET DEFAULT nextval('participants_id_seq'::regclass); -- -- Name: paydays id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY paydays ALTER COLUMN id SET DEFAULT nextval('paydays_id_seq'::regclass); -- -- Name: payment_instructions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY payment_instructions ALTER COLUMN id SET DEFAULT nextval('payment_instructions_id_seq'::regclass); -- -- Name: payments id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY payments ALTER COLUMN id SET DEFAULT nextval('payments_id_seq'::regclass); -- -- Name: payments_for_open_source id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY payments_for_open_source ALTER COLUMN id SET DEFAULT nextval('payments_for_open_source_id_seq'::regclass); -- -- Name: takes id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY takes ALTER COLUMN id SET DEFAULT nextval('takes_id_seq'::regclass); -- -- Name: teams id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY teams ALTER COLUMN id SET DEFAULT nextval('teams_id_seq'::regclass); -- -- Name: tips id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY tips ALTER COLUMN id SET DEFAULT nextval('tips_id_seq'::regclass); -- -- Name: transfers id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY transfers ALTER COLUMN id SET DEFAULT nextval('transfers_id_seq'::regclass); -- -- Name: absorptions absorptions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY absorptions ADD CONSTRAINT absorptions_pkey PRIMARY KEY (id); -- -- Name: balances_at balances_at_participant_at_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY balances_at ADD CONSTRAINT balances_at_participant_at_key UNIQUE (participant, at); -- -- Name: claims claims_nonce_package_id_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY claims ADD CONSTRAINT claims_nonce_package_id_key UNIQUE (nonce, package_id); -- -- Name: communities communities_name_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY communities ADD CONSTRAINT communities_name_key UNIQUE (name); -- -- Name: communities communities_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY communities ADD CONSTRAINT communities_pkey PRIMARY KEY (slug); -- -- Name: countries countries_code_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY countries ADD CONSTRAINT countries_code_key UNIQUE (code); -- -- Name: countries countries_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY countries ADD CONSTRAINT countries_pkey PRIMARY KEY (id); -- -- Name: elsewhere elsewhere_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY elsewhere ADD CONSTRAINT elsewhere_pkey PRIMARY KEY (id); -- -- Name: elsewhere elsewhere_platform_participant_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY elsewhere ADD CONSTRAINT elsewhere_platform_participant_key UNIQUE (platform, participant); -- -- Name: elsewhere elsewhere_platform_user_id_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY elsewhere ADD CONSTRAINT elsewhere_platform_user_id_key UNIQUE (platform, user_id); -- -- Name: email_messages email_queue_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY email_messages ADD CONSTRAINT email_queue_pkey PRIMARY KEY (id); -- -- Name: email_addresses emails_address_verified_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY email_addresses ADD CONSTRAINT emails_address_verified_key UNIQUE (address, verified); -- -- Name: email_addresses emails_nonce_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY email_addresses ADD CONSTRAINT emails_nonce_key UNIQUE (nonce); -- -- Name: email_addresses emails_participant_id_address_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY email_addresses ADD CONSTRAINT emails_participant_id_address_key UNIQUE (participant_id, address); -- -- Name: email_addresses emails_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY email_addresses ADD CONSTRAINT emails_pkey PRIMARY KEY (id); -- -- Name: events events_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY events ADD CONSTRAINT events_pkey PRIMARY KEY (id); -- -- Name: exchange_routes exchange_routes_participant_network_address_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY exchange_routes ADD CONSTRAINT exchange_routes_participant_network_address_key UNIQUE (participant, network, address); -- -- Name: exchange_routes exchange_routes_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY exchange_routes ADD CONSTRAINT exchange_routes_pkey PRIMARY KEY (id); -- -- Name: exchanges exchanges_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY exchanges ADD CONSTRAINT exchanges_pkey PRIMARY KEY (id); -- -- Name: packages packages_package_manager_name_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY packages ADD CONSTRAINT packages_package_manager_name_key UNIQUE (package_manager, name); -- -- Name: packages packages_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY packages ADD CONSTRAINT packages_pkey PRIMARY KEY (id); -- -- Name: participant_identities participant_identities_participant_id_country_id_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY participant_identities ADD CONSTRAINT participant_identities_participant_id_country_id_key UNIQUE (participant_id, country_id); -- -- Name: participant_identities participant_identities_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY participant_identities ADD CONSTRAINT participant_identities_pkey PRIMARY KEY (id); -- -- Name: participants participants_email_address_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY participants ADD CONSTRAINT participants_email_address_key UNIQUE (email_address); -- -- Name: participants participants_id_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY participants ADD CONSTRAINT participants_id_key UNIQUE (id); -- -- Name: participants participants_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY participants ADD CONSTRAINT participants_pkey PRIMARY KEY (username); -- -- Name: participants participants_session_token_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY participants ADD CONSTRAINT participants_session_token_key UNIQUE (session_token); -- -- Name: participants participants_username_lower_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY participants ADD CONSTRAINT participants_username_lower_key UNIQUE (username_lower); -- -- Name: paydays paydays_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY paydays ADD CONSTRAINT paydays_pkey PRIMARY KEY (id); -- -- Name: paydays paydays_ts_end_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY paydays ADD CONSTRAINT paydays_ts_end_key UNIQUE (ts_end); -- -- Name: payment_instructions payment_instructions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payment_instructions ADD CONSTRAINT payment_instructions_pkey PRIMARY KEY (id); -- -- Name: payments_for_open_source payments_for_open_source_braintree_transaction_id_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payments_for_open_source ADD CONSTRAINT payments_for_open_source_braintree_transaction_id_key UNIQUE (braintree_transaction_id); -- -- Name: payments_for_open_source payments_for_open_source_id_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payments_for_open_source ADD CONSTRAINT payments_for_open_source_id_key UNIQUE (id); -- -- Name: payments_for_open_source payments_for_open_source_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payments_for_open_source ADD CONSTRAINT payments_for_open_source_pkey PRIMARY KEY (secret); -- -- Name: payments payments_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payments ADD CONSTRAINT payments_pkey PRIMARY KEY (id); -- -- Name: transfers positive; Type: CHECK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE transfers ADD CONSTRAINT positive CHECK ((amount > (0)::numeric)) NOT VALID; -- -- Name: statements statements_participant_lang_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY statements ADD CONSTRAINT statements_participant_lang_key UNIQUE (participant, lang); -- -- Name: takes takes_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY takes ADD CONSTRAINT takes_pkey PRIMARY KEY (id); -- -- Name: teams teams_id_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY teams ADD CONSTRAINT teams_id_key UNIQUE (id); -- -- Name: teams teams_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY teams ADD CONSTRAINT teams_pkey PRIMARY KEY (slug); -- -- Name: teams teams_slug_lower_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY teams ADD CONSTRAINT teams_slug_lower_key UNIQUE (slug_lower); -- -- Name: teams_to_packages teams_to_packages_package_id_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY teams_to_packages ADD CONSTRAINT teams_to_packages_package_id_key UNIQUE (package_id); -- -- Name: teams_to_packages teams_to_packages_team_id_key; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY teams_to_packages ADD CONSTRAINT teams_to_packages_team_id_key UNIQUE (team_id); -- -- Name: tips tips_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY tips ADD CONSTRAINT tips_pkey PRIMARY KEY (id); -- -- Name: transfers transfers_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY transfers ADD CONSTRAINT transfers_pkey PRIMARY KEY (id); -- -- Name: community_members_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX community_members_idx ON community_members USING btree (slug, participant, mtime DESC); -- -- Name: community_trgm_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX community_trgm_idx ON communities USING gist (name gist_trgm_ops); -- -- Name: elsewhere_participant; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX elsewhere_participant ON elsewhere USING btree (participant); -- -- Name: events_ts; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX events_ts ON events USING btree (ts); -- -- Name: events_type; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX events_type ON events USING btree (type); -- -- Name: participants_claimed_time; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX participants_claimed_time ON participants USING btree (claimed_time DESC) WHERE ((is_suspicious IS NOT TRUE) AND (claimed_time IS NOT NULL)); -- -- Name: payday_participants_id_idx; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX payday_participants_id_idx ON payday_participants USING btree (id); -- -- Name: payday_participants_username_idx; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX payday_participants_username_idx ON payday_participants USING btree (username); -- -- Name: payday_payment_instructions_participant_id_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX payday_payment_instructions_participant_id_idx ON payday_payment_instructions USING btree (participant_id); -- -- Name: payday_payment_instructions_team_id_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX payday_payment_instructions_team_id_idx ON payday_payment_instructions USING btree (team_id); -- -- Name: statements_fts_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX statements_fts_idx ON statements USING gist (search_vector); -- -- Name: tips_all; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX tips_all ON tips USING btree (tipper, tippee, mtime DESC); -- -- Name: transfers_timestamp_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX transfers_timestamp_idx ON transfers USING btree ("timestamp"); -- -- Name: transfers_tippee_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX transfers_tippee_idx ON transfers USING btree (tippee); -- -- Name: transfers_tipper_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX transfers_tipper_idx ON transfers USING btree (tipper); -- -- Name: username_trgm_idx; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX username_trgm_idx ON participants USING gist (username_lower gist_trgm_ops) WHERE ((claimed_time IS NOT NULL) AND (NOT is_closed)); -- -- Name: participant_identities enforce_email_for_participant_identity; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER enforce_email_for_participant_identity BEFORE INSERT ON participant_identities FOR EACH ROW EXECUTE PROCEDURE fail_if_no_email(); -- -- Name: payday_teams process_draw; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER process_draw BEFORE UPDATE OF is_drained ON payday_teams FOR EACH ROW WHEN (((new.is_drained IS TRUE) AND (old.is_drained IS NOT TRUE))) EXECUTE PROCEDURE process_draw(); -- -- Name: payday_payment_instructions process_payment_instruction; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER process_payment_instruction BEFORE UPDATE OF is_funded ON payday_payment_instructions FOR EACH ROW WHEN (((new.is_funded IS TRUE) AND (old.is_funded IS NOT TRUE))) EXECUTE PROCEDURE process_payment_instruction(); -- -- Name: payday_takes process_take; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER process_take AFTER INSERT ON payday_takes FOR EACH ROW EXECUTE PROCEDURE process_take(); -- -- Name: statements search_vector_update; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER search_vector_update BEFORE INSERT OR UPDATE ON statements FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger_column('search_vector', 'search_conf', 'content_scrubbed'); -- -- Name: current_payment_instructions update_current_payment_instruction; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER update_current_payment_instruction INSTEAD OF UPDATE ON current_payment_instructions FOR EACH ROW EXECUTE PROCEDURE update_payment_instruction(); -- -- Name: current_tips update_current_tip; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER update_current_tip INSTEAD OF UPDATE ON current_tips FOR EACH ROW EXECUTE PROCEDURE update_tip(); -- -- Name: participants update_status_of_1_0_payout; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER update_status_of_1_0_payout AFTER UPDATE OF balance ON participants FOR EACH ROW WHEN (((old.balance > (0)::numeric) AND (new.balance = (0)::numeric))) EXECUTE PROCEDURE complete_1_0_payout(); -- -- Name: community_members upsert_community; Type: TRIGGER; Schema: public; Owner: - -- CREATE TRIGGER upsert_community BEFORE INSERT ON community_members FOR EACH ROW EXECUTE PROCEDURE upsert_community(); -- -- Name: absorptions absorptions_absorbed_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY absorptions ADD CONSTRAINT absorptions_absorbed_by_fkey FOREIGN KEY (absorbed_by) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: absorptions absorptions_archived_as_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY absorptions ADD CONSTRAINT absorptions_archived_as_fkey FOREIGN KEY (archived_as) REFERENCES participants(username) ON UPDATE RESTRICT ON DELETE RESTRICT; -- -- Name: balances_at balances_at_participant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY balances_at ADD CONSTRAINT balances_at_participant_fkey FOREIGN KEY (participant) REFERENCES participants(id); -- -- Name: claims claims_nonce_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY claims ADD CONSTRAINT claims_nonce_fkey FOREIGN KEY (nonce) REFERENCES email_addresses(nonce) ON UPDATE RESTRICT ON DELETE CASCADE; -- -- Name: claims claims_package_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY claims ADD CONSTRAINT claims_package_id_fkey FOREIGN KEY (package_id) REFERENCES packages(id) ON UPDATE RESTRICT ON DELETE RESTRICT; -- -- Name: community_members community_members_participant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY community_members ADD CONSTRAINT community_members_participant_fkey FOREIGN KEY (participant) REFERENCES participants(id); -- -- Name: elsewhere elsewhere_participant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY elsewhere ADD CONSTRAINT elsewhere_participant_fkey FOREIGN KEY (participant) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: email_messages email_queue_participant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY email_messages ADD CONSTRAINT email_queue_participant_fkey FOREIGN KEY (participant) REFERENCES participants(id); -- -- Name: email_addresses emails_participant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY email_addresses ADD CONSTRAINT emails_participant_id_fkey FOREIGN KEY (participant_id) REFERENCES participants(id) ON UPDATE RESTRICT ON DELETE RESTRICT; -- -- Name: exchange_routes exchange_routes_participant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY exchange_routes ADD CONSTRAINT exchange_routes_participant_fkey FOREIGN KEY (participant) REFERENCES participants(id); -- -- Name: exchanges exchanges_participant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY exchanges ADD CONSTRAINT exchanges_participant_fkey FOREIGN KEY (participant) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: exchanges exchanges_recorder_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY exchanges ADD CONSTRAINT exchanges_recorder_fkey FOREIGN KEY (recorder) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: exchanges exchanges_route_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY exchanges ADD CONSTRAINT exchanges_route_fkey FOREIGN KEY (route) REFERENCES exchange_routes(id); -- -- Name: participant_identities participant_identities_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY participant_identities ADD CONSTRAINT participant_identities_country_id_fkey FOREIGN KEY (country_id) REFERENCES countries(id); -- -- Name: participant_identities participant_identities_participant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY participant_identities ADD CONSTRAINT participant_identities_participant_id_fkey FOREIGN KEY (participant_id) REFERENCES participants(id); -- -- Name: payment_instructions payment_instructions_participant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payment_instructions ADD CONSTRAINT payment_instructions_participant_id_fkey FOREIGN KEY (participant_id) REFERENCES participants(id) ON UPDATE RESTRICT ON DELETE RESTRICT; -- -- Name: payment_instructions payment_instructions_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payment_instructions ADD CONSTRAINT payment_instructions_team_id_fkey FOREIGN KEY (team_id) REFERENCES teams(id) ON UPDATE RESTRICT ON DELETE RESTRICT; -- -- Name: payments payments_participant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payments ADD CONSTRAINT payments_participant_fkey FOREIGN KEY (participant) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: payments payments_payday_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payments ADD CONSTRAINT payments_payday_fkey FOREIGN KEY (payday) REFERENCES paydays(id) ON UPDATE RESTRICT ON DELETE RESTRICT; -- -- Name: payments payments_team_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY payments ADD CONSTRAINT payments_team_fkey FOREIGN KEY (team) REFERENCES teams(slug) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: statements statements_participant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY statements ADD CONSTRAINT statements_participant_fkey FOREIGN KEY (participant) REFERENCES participants(id); -- -- Name: takes takes_participant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY takes ADD CONSTRAINT takes_participant_id_fkey FOREIGN KEY (participant_id) REFERENCES participants(id); -- -- Name: takes takes_recorder_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY takes ADD CONSTRAINT takes_recorder_id_fkey FOREIGN KEY (recorder_id) REFERENCES participants(id); -- -- Name: takes takes_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY takes ADD CONSTRAINT takes_team_id_fkey FOREIGN KEY (team_id) REFERENCES teams(id); -- -- Name: teams teams_owner_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY teams ADD CONSTRAINT teams_owner_fkey FOREIGN KEY (owner) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: teams_to_packages teams_to_packages_package_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY teams_to_packages ADD CONSTRAINT teams_to_packages_package_id_fkey FOREIGN KEY (package_id) REFERENCES packages(id) ON DELETE RESTRICT; -- -- Name: teams_to_packages teams_to_packages_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY teams_to_packages ADD CONSTRAINT teams_to_packages_team_id_fkey FOREIGN KEY (team_id) REFERENCES teams(id) ON DELETE RESTRICT; -- -- Name: tips tips_tippee_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY tips ADD CONSTRAINT tips_tippee_fkey FOREIGN KEY (tippee) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: tips tips_tipper_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY tips ADD CONSTRAINT tips_tipper_fkey FOREIGN KEY (tipper) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: transfers transfers_payday_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY transfers ADD CONSTRAINT transfers_payday_fkey FOREIGN KEY (payday) REFERENCES paydays(id) ON UPDATE RESTRICT ON DELETE RESTRICT; -- -- Name: transfers transfers_tippee_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY transfers ADD CONSTRAINT transfers_tippee_fkey FOREIGN KEY (tippee) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- Name: transfers transfers_tipper_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY transfers ADD CONSTRAINT transfers_tipper_fkey FOREIGN KEY (tipper) REFERENCES participants(username) ON UPDATE CASCADE ON DELETE RESTRICT; -- -- PostgreSQL database dump complete --
the_stack
-- 2020-02-21T12:18:31.048Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 13:18:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_Para_ID=540460 ; -- 2020-02-21T12:18:35.136Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 13:18:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_Para_ID=540460 ; -- 2020-02-21T12:18:58.504Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 13:18:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542210 AND AD_Language='de_CH' ; -- 2020-02-21T12:18:58.536Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542210,'de_CH') ; -- 2020-02-21T12:19:00.203Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 13:19:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542210 AND AD_Language='de_DE' ; -- 2020-02-21T12:19:00.204Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542210,'de_DE') ; -- 2020-02-21T12:19:00.215Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(542210,'de_DE') ; -- 2020-02-21T12:19:23.154Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.',Updated=TO_TIMESTAMP('2020-02-21 13:19:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542210 AND AD_Language='en_US' ; -- 2020-02-21T12:19:23.157Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542210,'en_US') ; -- 2020-02-21T12:19:27.823Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.',Updated=TO_TIMESTAMP('2020-02-21 13:19:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542210 AND AD_Language='de_DE' ; -- 2020-02-21T12:19:27.824Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542210,'de_DE') ; -- 2020-02-21T12:19:27.829Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(542210,'de_DE') ; -- 2020-02-21T12:19:27.831Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='IsRecreatePrintout', Name='Druckstücke neu erstellen', Description='Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.', Help=NULL WHERE AD_Element_ID=542210 ; -- 2020-02-21T12:19:27.832Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsRecreatePrintout', Name='Druckstücke neu erstellen', Description='Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.', Help=NULL, AD_Element_ID=542210 WHERE UPPER(ColumnName)='ISRECREATEPRINTOUT' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-21T12:19:27.835Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsRecreatePrintout', Name='Druckstücke neu erstellen', Description='Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.', Help=NULL WHERE AD_Element_ID=542210 AND IsCentrallyMaintained='Y' ; -- 2020-02-21T12:19:27.837Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Druckstücke neu erstellen', Description='Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.', Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=542210) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 542210) ; -- 2020-02-21T12:19:27.846Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Druckstücke neu erstellen', Description='Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.', Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 542210 ; -- 2020-02-21T12:19:27.848Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Druckstücke neu erstellen', Description='Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.', Help=NULL WHERE AD_Element_ID = 542210 ; -- 2020-02-21T12:19:27.849Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Druckstücke neu erstellen', Description = 'Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 542210 ; -- 2020-02-21T12:19:34.392Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Wenn angehakt, dann wird pro neuem Warteschlangen-Datensatz auch ein neues Druckstück und ein neuer Archiv-Datensatz erstellt. Ansonsten wird nur ein neuer Warteschlangeneintrag für das bestehende Druckstück erstellt.',Updated=TO_TIMESTAMP('2020-02-21 13:19:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=542210 AND AD_Language='de_CH' ; -- 2020-02-21T12:19:34.393Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(542210,'de_CH') ; -- 2020-02-21T12:23:51.673Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577556,0,'IsProcessedPrintingqueueItems',TO_TIMESTAMP('2020-02-21 13:23:51','YYYY-MM-DD HH24:MI:SS'),100,'Legt fest, ob nach verarbeiteten oder nach nicht verarbeiteten Druck-Warteschlangen-Datensätzen gefiltert werden soll','de.metas.printing','Y','Verarbeitete Datensätze','Verarbeitete Datensätze',TO_TIMESTAMP('2020-02-21 13:23:51','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-21T12:23:51.675Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577556 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2020-02-21T12:23:55.324Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 13:23:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577556 AND AD_Language='de_CH' ; -- 2020-02-21T12:23:55.325Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577556,'de_CH') ; -- 2020-02-21T12:23:57.772Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 13:23:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577556 AND AD_Language='de_DE' ; -- 2020-02-21T12:23:57.773Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577556,'de_DE') ; -- 2020-02-21T12:23:57.778Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577556,'de_DE') ; -- 2020-02-21T12:24:18.858Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='', Name='Processed', PrintName='Processed',Updated=TO_TIMESTAMP('2020-02-21 13:24:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577556 AND AD_Language='en_US' ; -- 2020-02-21T12:24:18.860Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577556,'en_US') ; -- 2020-02-21T12:24:23.060Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 13:24:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577556 AND AD_Language='en_US' ; -- 2020-02-21T12:24:23.061Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577556,'en_US') ; -- 2020-02-21T12:24:40.347Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='ProcessedQueueItems',Updated=TO_TIMESTAMP('2020-02-21 13:24:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577556 ; -- 2020-02-21T12:24:40.351Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='ProcessedQueueItems', Name='Verarbeitete Datensätze', Description='Legt fest, ob nach verarbeiteten oder nach nicht verarbeiteten Druck-Warteschlangen-Datensätzen gefiltert werden soll', Help=NULL WHERE AD_Element_ID=577556 ; -- 2020-02-21T12:24:40.353Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='ProcessedQueueItems', Name='Verarbeitete Datensätze', Description='Legt fest, ob nach verarbeiteten oder nach nicht verarbeiteten Druck-Warteschlangen-Datensätzen gefiltert werden soll', Help=NULL, AD_Element_ID=577556 WHERE UPPER(ColumnName)='PROCESSEDQUEUEITEMS' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-21T12:24:40.354Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='ProcessedQueueItems', Name='Verarbeitete Datensätze', Description='Legt fest, ob nach verarbeiteten oder nach nicht verarbeiteten Druck-Warteschlangen-Datensätzen gefiltert werden soll', Help=NULL WHERE AD_Element_ID=577556 AND IsCentrallyMaintained='Y' ; -- 2020-02-21T12:30:48.678Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='FilterByProcessedQueueItems',Updated=TO_TIMESTAMP('2020-02-21 13:30:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577556 ; -- 2020-02-21T12:30:48.681Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='FilterByProcessedQueueItems', Name='Verarbeitete Datensätze', Description='Legt fest, ob nach verarbeiteten oder nach nicht verarbeiteten Druck-Warteschlangen-Datensätzen gefiltert werden soll', Help=NULL WHERE AD_Element_ID=577556 ; -- 2020-02-21T12:30:48.682Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='FilterByProcessedQueueItems', Name='Verarbeitete Datensätze', Description='Legt fest, ob nach verarbeiteten oder nach nicht verarbeiteten Druck-Warteschlangen-Datensätzen gefiltert werden soll', Help=NULL, AD_Element_ID=577556 WHERE UPPER(ColumnName)='FILTERBYPROCESSEDQUEUEITEMS' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-21T12:30:48.683Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='FilterByProcessedQueueItems', Name='Verarbeitete Datensätze', Description='Legt fest, ob nach verarbeiteten oder nach nicht verarbeiteten Druck-Warteschlangen-Datensätzen gefiltert werden soll', Help=NULL WHERE AD_Element_ID=577556 AND IsCentrallyMaintained='Y' ; -- 2020-02-21T12:30:59.801Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Element_ID=577556, ColumnName='ProcessedQueueItems',Updated=TO_TIMESTAMP('2020-02-21 13:30:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540456 ; -- 2020-02-21T12:31:10.751Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='FilterByProcessedQueueItems',Updated=TO_TIMESTAMP('2020-02-21 13:31:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540456 ; -- 2020-02-21T12:36:41.678Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577557,0,'SelectedQueueItems',TO_TIMESTAMP('2020-02-21 13:36:41','YYYY-MM-DD HH24:MI:SS'),100,'Wenn angehakt, dann werden nur die Datensätze der derzeitigen Selektion/Suchabfrage in Betracht gezogen.','de.metas.printing','Y','Selektierte Datensätze','Selektierte Datensätze',TO_TIMESTAMP('2020-02-21 13:36:41','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2020-02-21T12:36:41.680Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577557 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2020-02-21T12:36:44.516Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 13:36:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577557 AND AD_Language='de_CH' ; -- 2020-02-21T12:36:44.517Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577557,'de_CH') ; -- 2020-02-21T12:36:46.992Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-02-21 13:36:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577557 AND AD_Language='de_DE' ; -- 2020-02-21T12:36:46.993Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577557,'de_DE') ; -- 2020-02-21T12:36:47Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(577557,'de_DE') ; -- 2020-02-21T12:37:03.624Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='', IsTranslated='Y', Name='Selected queue items', PrintName='Selected queue items',Updated=TO_TIMESTAMP('2020-02-21 13:37:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577557 AND AD_Language='en_US' ; -- 2020-02-21T12:37:03.625Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577557,'en_US') ; -- 2020-02-21T12:37:34.701Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET AD_Element_ID=577557, ColumnName='SelectedQueueItems',Updated=TO_TIMESTAMP('2020-02-21 13:37:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540455 ; -- 2020-02-21T12:38:20.105Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='FilterBySelectedQueueItems',Updated=TO_TIMESTAMP('2020-02-21 13:38:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540455 ; -- 2020-02-21T12:38:25.002Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='FilterBySelectedQueueItems',Updated=TO_TIMESTAMP('2020-02-21 13:38:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577557 ; -- 2020-02-21T12:38:25.006Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='FilterBySelectedQueueItems', Name='Selektierte Datensätze', Description='Wenn angehakt, dann werden nur die Datensätze der derzeitigen Selektion/Suchabfrage in Betracht gezogen.', Help=NULL WHERE AD_Element_ID=577557 ; -- 2020-02-21T12:38:25.007Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='FilterBySelectedQueueItems', Name='Selektierte Datensätze', Description='Wenn angehakt, dann werden nur die Datensätze der derzeitigen Selektion/Suchabfrage in Betracht gezogen.', Help=NULL, AD_Element_ID=577557 WHERE UPPER(ColumnName)='FILTERBYSELECTEDQUEUEITEMS' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-21T12:38:25.008Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='FilterBySelectedQueueItems', Name='Selektierte Datensätze', Description='Wenn angehakt, dann werden nur die Datensätze der derzeitigen Selektion/Suchabfrage in Betracht gezogen.', Help=NULL WHERE AD_Element_ID=577557 AND IsCentrallyMaintained='Y' ; -- 2020-02-21T12:47:35.741Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET AccessLevel='3', Name='Auswahl Druckjobs erzeugen', Value='C_Print_Job_Create',Updated=TO_TIMESTAMP('2020-02-21 13:47:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540314 ; -- 2020-02-21T13:00:39.156Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET IsDisplayed='N', IsDisplayedGrid='N',Updated=TO_TIMESTAMP('2020-02-21 14:00:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=565072 ; -- 2020-02-21T13:02:09.910Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table SET Name='C_Print_Job',Updated=TO_TIMESTAMP('2020-02-21 14:02:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=540437 ; -- 2020-02-21T13:02:17.026Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Window SET InternalName='C_Print_Job',Updated=TO_TIMESTAMP('2020-02-21 14:02:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=540166 ; -- 2020-02-21T13:06:33.155Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', IsTranslated='Y', Name='Login als Druck-HostKey benutzen', PrintName='Login als Druck-HostKey benutzen',Updated=TO_TIMESTAMP('2020-02-21 14:06:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543081 AND AD_Language='de_CH' ; -- 2020-02-21T13:06:33.157Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543081,'de_CH') ; -- 2020-02-21T13:06:42.531Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet',Updated=TO_TIMESTAMP('2020-02-21 14:06:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543081 AND AD_Language='de_DE' ; -- 2020-02-21T13:06:42.532Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543081,'de_DE') ; -- 2020-02-21T13:06:42.539Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(543081,'de_DE') ; -- 2020-02-21T13:06:42.542Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='IsLoginAsHostKey', Name='Login As HostKey ', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL WHERE AD_Element_ID=543081 ; -- 2020-02-21T13:06:42.543Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsLoginAsHostKey', Name='Login As HostKey ', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL, AD_Element_ID=543081 WHERE UPPER(ColumnName)='ISLOGINASHOSTKEY' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-21T13:06:42.544Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsLoginAsHostKey', Name='Login As HostKey ', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL WHERE AD_Element_ID=543081 AND IsCentrallyMaintained='Y' ; -- 2020-02-21T13:06:42.549Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Login As HostKey ', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=543081) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 543081) ; -- 2020-02-21T13:06:42.562Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Login As HostKey ', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 543081 ; -- 2020-02-21T13:06:42.564Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Login As HostKey ', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL WHERE AD_Element_ID = 543081 ; -- 2020-02-21T13:06:42.565Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Login As HostKey ', Description = 'Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 543081 ; -- 2020-02-21T13:06:54.287Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Login als Druck-HostKey benutzen', PrintName='Login als Druck-HostKey benutzen',Updated=TO_TIMESTAMP('2020-02-21 14:06:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543081 AND AD_Language='de_DE' ; -- 2020-02-21T13:06:54.288Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543081,'de_DE') ; -- 2020-02-21T13:06:54.294Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_ad_element_on_ad_element_trl_update(543081,'de_DE') ; -- 2020-02-21T13:06:54.296Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='IsLoginAsHostKey', Name='Login als Druck-HostKey benutzen', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL WHERE AD_Element_ID=543081 ; -- 2020-02-21T13:06:54.297Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsLoginAsHostKey', Name='Login als Druck-HostKey benutzen', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL, AD_Element_ID=543081 WHERE UPPER(ColumnName)='ISLOGINASHOSTKEY' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2020-02-21T13:06:54.298Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='IsLoginAsHostKey', Name='Login als Druck-HostKey benutzen', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL WHERE AD_Element_ID=543081 AND IsCentrallyMaintained='Y' ; -- 2020-02-21T13:06:54.299Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Login als Druck-HostKey benutzen', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=543081) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 543081) ; -- 2020-02-21T13:06:54.310Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Login als Druck-HostKey benutzen', Name='Login als Druck-HostKey benutzen' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=543081) ; -- 2020-02-21T13:06:54.311Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Tab SET Name='Login als Druck-HostKey benutzen', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 543081 ; -- 2020-02-21T13:06:54.313Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_WINDOW SET Name='Login als Druck-HostKey benutzen', Description='Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', Help=NULL WHERE AD_Element_ID = 543081 ; -- 2020-02-21T13:06:54.314Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Menu SET Name = 'Login als Druck-HostKey benutzen', Description = 'Wenn gesetzt und ein Nutzer meldet sich an, dann wird immer der jeweilige User-Login als Hostkey benutzt, egal von welchem Computer aus sich der Nutzer anmeldet', WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 543081 ; -- 2020-02-21T13:07:12.436Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element_Trl SET Name='Use Login As Printing HostKey', PrintName='Use Login As Printing HostKey',Updated=TO_TIMESTAMP('2020-02-21 14:07:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=543081 AND AD_Language='en_US' ; -- 2020-02-21T13:07:12.437Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator /* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(543081,'en_US') ; -- 2020-02-21T13:51:50.401Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Value='ConcatenatePdfs',Updated=TO_TIMESTAMP('2020-02-21 14:51:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540315 ; -- 2020-02-21T13:57:43.501Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET IsActive='N', TechnicalNote='Deaktivating for now; it tried to store the PDFs in a local folder; could be modernized to provide the DBs as download to the webui-user',Updated=TO_TIMESTAMP('2020-02-21 14:57:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540315 ; -- 2020-02-21T13:59:30.676Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET AccessLevel='3', Name='Job-Druckanweisungen neu erstellen',Updated=TO_TIMESTAMP('2020-02-21 14:59:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=540324 ;
the_stack
-- MySQL dump 10.17 Distrib 10.3.12-MariaDB, for Linux (x86_64) -- -- Host: localhost Database: schema-generator@airbnb -- ------------------------------------------------------ -- Server version 5.7.23 -- -- Table structure for table `Amenities` -- DROP TABLE IF EXISTS `Amenities`; CREATE TABLE `Amenities` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `elevator` tinyint(1) NOT NULL, `petsAllowed` tinyint(1) NOT NULL, `internet` tinyint(1) NOT NULL, `kitchen` tinyint(1) NOT NULL, `wirelessInternet` tinyint(1) NOT NULL, `familyKidFriendly` tinyint(1) NOT NULL, `freeParkingOnPremises` tinyint(1) NOT NULL, `hotTub` tinyint(1) NOT NULL, `pool` tinyint(1) NOT NULL, `smokingAllowed` tinyint(1) NOT NULL, `wheelchairAccessible` tinyint(1) NOT NULL, `breakfast` tinyint(1) NOT NULL, `cableTv` tinyint(1) NOT NULL, `suitableForEvents` tinyint(1) NOT NULL, `dryer` tinyint(1) NOT NULL, `washer` tinyint(1) NOT NULL, `indoorFireplace` tinyint(1) NOT NULL, `tv` tinyint(1) NOT NULL, `heating` tinyint(1) NOT NULL, `hangers` tinyint(1) NOT NULL, `iron` tinyint(1) NOT NULL, `hairDryer` tinyint(1) NOT NULL, `doorman` tinyint(1) NOT NULL, `paidParkingOffPremises` tinyint(1) NOT NULL, `freeParkingOnStreet` tinyint(1) NOT NULL, `gym` tinyint(1) NOT NULL, `airConditioning` tinyint(1) NOT NULL, `shampoo` tinyint(1) NOT NULL, `essentials` tinyint(1) NOT NULL, `laptopFriendlyWorkspace` tinyint(1) NOT NULL, `privateEntrance` tinyint(1) NOT NULL, `buzzerWirelessIntercom` tinyint(1) NOT NULL, `babyBath` tinyint(1) NOT NULL, `babyMonitor` tinyint(1) NOT NULL, `babysitterRecommendations` tinyint(1) NOT NULL, `bathtub` tinyint(1) NOT NULL, `changingTable` tinyint(1) NOT NULL, `childrensBooksAndToys` tinyint(1) NOT NULL, `childrensDinnerware` tinyint(1) NOT NULL, `crib` tinyint(1) NOT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Booking` -- DROP TABLE IF EXISTS `Booking`; CREATE TABLE `Booking` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `startDate` datetime(3) NOT NULL, `endDate` datetime(3) NOT NULL, `updatedAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `City` -- DROP TABLE IF EXISTS `City`; CREATE TABLE `City` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `name` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `CreditCardInformation` -- DROP TABLE IF EXISTS `CreditCardInformation`; CREATE TABLE `CreditCardInformation` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `cardNumber` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `expiresOnMonth` int(11) NOT NULL, `expiresOnYear` int(11) NOT NULL, `securityCode` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `firstName` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `lastName` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `postalCode` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `country` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `updatedAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Experience` -- DROP TABLE IF EXISTS `Experience`; CREATE TABLE `Experience` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `title` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `pricePerPerson` int(11) NOT NULL, `popularity` int(11) NOT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `ExperienceCategory` -- DROP TABLE IF EXISTS `ExperienceCategory`; CREATE TABLE `ExperienceCategory` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `mainColor` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `name` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `GuestRequirements` -- DROP TABLE IF EXISTS `GuestRequirements`; CREATE TABLE `GuestRequirements` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `govIssuedId` tinyint(1) NOT NULL, `recommendationsFromOtherHosts` tinyint(1) NOT NULL, `guestTripInformation` tinyint(1) NOT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `HouseRules` -- DROP TABLE IF EXISTS `HouseRules`; CREATE TABLE `HouseRules` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `updatedAt` datetime(3) NOT NULL, `suitableForChildren` tinyint(1) DEFAULT NULL, `suitableForInfants` tinyint(1) DEFAULT NULL, `petsAllowed` tinyint(1) DEFAULT NULL, `smokingAllowed` tinyint(1) DEFAULT NULL, `partiesAndEventsAllowed` tinyint(1) DEFAULT NULL, `additionalRules` mediumtext COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Location` -- DROP TABLE IF EXISTS `Location`; CREATE TABLE `Location` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `lat` decimal(65,30) NOT NULL, `lng` decimal(65,30) NOT NULL, `address` mediumtext COLLATE utf8mb4_unicode_ci, `directions` mediumtext COLLATE utf8mb4_unicode_ci, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Message` -- DROP TABLE IF EXISTS `Message`; CREATE TABLE `Message` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `deliveredAt` datetime(3) NOT NULL, `readAt` datetime(3) NOT NULL, `updatedAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Neighbourhood` -- DROP TABLE IF EXISTS `Neighbourhood`; CREATE TABLE `Neighbourhood` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `name` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `slug` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `featured` tinyint(1) NOT NULL, `popularity` int(11) NOT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Notification` -- DROP TABLE IF EXISTS `Notification`; CREATE TABLE `Notification` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `link` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `readDate` datetime(3) NOT NULL, `updatedAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Payment` -- DROP TABLE IF EXISTS `Payment`; CREATE TABLE `Payment` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `serviceFee` decimal(65,30) NOT NULL, `placePrice` decimal(65,30) NOT NULL, `totalPrice` decimal(65,30) NOT NULL, `updatedAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `PaymentAccount` -- DROP TABLE IF EXISTS `PaymentAccount`; CREATE TABLE `PaymentAccount` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `updatedAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `PaypalInformation` -- DROP TABLE IF EXISTS `PaypalInformation`; CREATE TABLE `PaypalInformation` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `email` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `updatedAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Picture` -- DROP TABLE IF EXISTS `Picture`; CREATE TABLE `Picture` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `url` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Place` -- DROP TABLE IF EXISTS `Place`; CREATE TABLE `Place` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `name` mediumtext COLLATE utf8mb4_unicode_ci, `size` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `shortDescription` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `slug` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `maxGuests` int(11) NOT NULL, `numBedrooms` int(11) NOT NULL, `numBeds` int(11) NOT NULL, `numBaths` int(11) NOT NULL, `popularity` int(11) NOT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Policies` -- DROP TABLE IF EXISTS `Policies`; CREATE TABLE `Policies` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `updatedAt` datetime(3) NOT NULL, `checkInStartTime` decimal(65,30) NOT NULL, `checkInEndTime` decimal(65,30) NOT NULL, `checkoutTime` decimal(65,30) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Pricing` -- DROP TABLE IF EXISTS `Pricing`; CREATE TABLE `Pricing` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `monthlyDiscount` int(11) DEFAULT NULL, `weeklyDiscount` int(11) DEFAULT NULL, `perNight` int(11) NOT NULL, `smartPricing` tinyint(1) NOT NULL, `basePrice` int(11) NOT NULL, `averageWeekly` int(11) NOT NULL, `averageMonthly` int(11) NOT NULL, `cleaningFee` int(11) DEFAULT NULL, `securityDeposit` int(11) DEFAULT NULL, `extraGuests` int(11) DEFAULT NULL, `weekendPricing` int(11) DEFAULT NULL, `currency` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Restaurant` -- DROP TABLE IF EXISTS `Restaurant`; CREATE TABLE `Restaurant` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `title` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `avgPricePerPerson` int(11) NOT NULL, `isCurated` tinyint(1) NOT NULL, `slug` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `popularity` int(11) NOT NULL, `updatedAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Review` -- DROP TABLE IF EXISTS `Review`; CREATE TABLE `Review` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `text` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `stars` int(11) NOT NULL, `accuracy` int(11) NOT NULL, `location` int(11) NOT NULL, `checkIn` int(11) NOT NULL, `value` int(11) NOT NULL, `cleanliness` int(11) NOT NULL, `communication` int(11) NOT NULL, `updatedAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `User` -- DROP TABLE IF EXISTS `User`; CREATE TABLE `User` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `createdAt` datetime(3) NOT NULL, `updatedAt` datetime(3) NOT NULL, `firstName` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `lastName` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `email` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `password` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `phone` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `responseRate` decimal(65,30) DEFAULT NULL, `responseTime` int(11) DEFAULT NULL, `isSuperHost` tinyint(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), UNIQUE KEY `email_UNIQUE` (`email`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `Views` -- DROP TABLE IF EXISTS `Views`; CREATE TABLE `Views` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `lastWeek` int(11) NOT NULL, `updatedAt` datetime(3) NOT NULL, `createdAt` datetime(3) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_AmenitiesToPlace` -- DROP TABLE IF EXISTS `_AmenitiesToPlace`; CREATE TABLE `_AmenitiesToPlace` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_AmenitiesToPlace_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Amenities` (`id`) ON DELETE CASCADE, CONSTRAINT `_AmenitiesToPlace_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Place` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_BookingToPayment` -- DROP TABLE IF EXISTS `_BookingToPayment`; CREATE TABLE `_BookingToPayment` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_BookingToPayment_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Booking` (`id`) ON DELETE CASCADE, CONSTRAINT `_BookingToPayment_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Payment` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_BookingToPlace` -- DROP TABLE IF EXISTS `_BookingToPlace`; CREATE TABLE `_BookingToPlace` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_BookingToPlace_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Booking` (`id`) ON DELETE CASCADE, CONSTRAINT `_BookingToPlace_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Place` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_BookingToUser` -- DROP TABLE IF EXISTS `_BookingToUser`; CREATE TABLE `_BookingToUser` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_BookingToUser_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Booking` (`id`) ON DELETE CASCADE, CONSTRAINT `_BookingToUser_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_CityToNeighbourhood` -- DROP TABLE IF EXISTS `_CityToNeighbourhood`; CREATE TABLE `_CityToNeighbourhood` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_CityToNeighbourhood_ibfk_1` FOREIGN KEY (`A`) REFERENCES `City` (`id`) ON DELETE CASCADE, CONSTRAINT `_CityToNeighbourhood_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Neighbourhood` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_CreditCardInformationToPaymentAccount` -- DROP TABLE IF EXISTS `_CreditCardInformationToPaymentAccount`; CREATE TABLE `_CreditCardInformationToPaymentAccount` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_CreditCardInformationToPaymentAccount_ibfk_1` FOREIGN KEY (`A`) REFERENCES `CreditCardInformation` (`id`) ON DELETE CASCADE, CONSTRAINT `_CreditCardInformationToPaymentAccount_ibfk_2` FOREIGN KEY (`B`) REFERENCES `PaymentAccount` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_ExperienceToExperienceCategory` -- DROP TABLE IF EXISTS `_ExperienceToExperienceCategory`; CREATE TABLE `_ExperienceToExperienceCategory` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_ExperienceToExperienceCategory_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Experience` (`id`) ON DELETE CASCADE, CONSTRAINT `_ExperienceToExperienceCategory_ibfk_2` FOREIGN KEY (`B`) REFERENCES `ExperienceCategory` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_ExperienceToLocation` -- DROP TABLE IF EXISTS `_ExperienceToLocation`; CREATE TABLE `_ExperienceToLocation` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_ExperienceToLocation_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Experience` (`id`) ON DELETE CASCADE, CONSTRAINT `_ExperienceToLocation_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Location` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_ExperienceToPicture` -- DROP TABLE IF EXISTS `_ExperienceToPicture`; CREATE TABLE `_ExperienceToPicture` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_ExperienceToPicture_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Experience` (`id`) ON DELETE CASCADE, CONSTRAINT `_ExperienceToPicture_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Picture` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_ExperienceToReview` -- DROP TABLE IF EXISTS `_ExperienceToReview`; CREATE TABLE `_ExperienceToReview` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_ExperienceToReview_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Experience` (`id`) ON DELETE CASCADE, CONSTRAINT `_ExperienceToReview_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Review` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_ExperienceToUser` -- DROP TABLE IF EXISTS `_ExperienceToUser`; CREATE TABLE `_ExperienceToUser` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_ExperienceToUser_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Experience` (`id`) ON DELETE CASCADE, CONSTRAINT `_ExperienceToUser_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_GuestRequirementsToPlace` -- DROP TABLE IF EXISTS `_GuestRequirementsToPlace`; CREATE TABLE `_GuestRequirementsToPlace` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_GuestRequirementsToPlace_ibfk_1` FOREIGN KEY (`A`) REFERENCES `GuestRequirements` (`id`) ON DELETE CASCADE, CONSTRAINT `_GuestRequirementsToPlace_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Place` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_HouseRulesToPlace` -- DROP TABLE IF EXISTS `_HouseRulesToPlace`; CREATE TABLE `_HouseRulesToPlace` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_HouseRulesToPlace_ibfk_1` FOREIGN KEY (`A`) REFERENCES `HouseRules` (`id`) ON DELETE CASCADE, CONSTRAINT `_HouseRulesToPlace_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Place` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_LocationToNeighbourhood` -- DROP TABLE IF EXISTS `_LocationToNeighbourhood`; CREATE TABLE `_LocationToNeighbourhood` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_LocationToNeighbourhood_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Location` (`id`) ON DELETE CASCADE, CONSTRAINT `_LocationToNeighbourhood_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Neighbourhood` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_LocationToPlace` -- DROP TABLE IF EXISTS `_LocationToPlace`; CREATE TABLE `_LocationToPlace` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_LocationToPlace_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Location` (`id`) ON DELETE CASCADE, CONSTRAINT `_LocationToPlace_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Place` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_LocationToRestaurant` -- DROP TABLE IF EXISTS `_LocationToRestaurant`; CREATE TABLE `_LocationToRestaurant` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_LocationToRestaurant_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Location` (`id`) ON DELETE CASCADE, CONSTRAINT `_LocationToRestaurant_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Restaurant` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_LocationToUser` -- DROP TABLE IF EXISTS `_LocationToUser`; CREATE TABLE `_LocationToUser` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_LocationToUser_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Location` (`id`) ON DELETE CASCADE, CONSTRAINT `_LocationToUser_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_NeighbourhoodToPicture` -- DROP TABLE IF EXISTS `_NeighbourhoodToPicture`; CREATE TABLE `_NeighbourhoodToPicture` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_NeighbourhoodToPicture_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Neighbourhood` (`id`) ON DELETE CASCADE, CONSTRAINT `_NeighbourhoodToPicture_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Picture` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_NotificationToUser` -- DROP TABLE IF EXISTS `_NotificationToUser`; CREATE TABLE `_NotificationToUser` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_NotificationToUser_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Notification` (`id`) ON DELETE CASCADE, CONSTRAINT `_NotificationToUser_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PaymentAccountToPaypalInformation` -- DROP TABLE IF EXISTS `_PaymentAccountToPaypalInformation`; CREATE TABLE `_PaymentAccountToPaypalInformation` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PaymentAccountToPaypalInformation_ibfk_1` FOREIGN KEY (`A`) REFERENCES `PaymentAccount` (`id`) ON DELETE CASCADE, CONSTRAINT `_PaymentAccountToPaypalInformation_ibfk_2` FOREIGN KEY (`B`) REFERENCES `PaypalInformation` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PaymentAccountToUser` -- DROP TABLE IF EXISTS `_PaymentAccountToUser`; CREATE TABLE `_PaymentAccountToUser` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PaymentAccountToUser_ibfk_1` FOREIGN KEY (`A`) REFERENCES `PaymentAccount` (`id`) ON DELETE CASCADE, CONSTRAINT `_PaymentAccountToUser_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PaymentToPaymentAccount` -- DROP TABLE IF EXISTS `_PaymentToPaymentAccount`; CREATE TABLE `_PaymentToPaymentAccount` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PaymentToPaymentAccount_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Payment` (`id`) ON DELETE CASCADE, CONSTRAINT `_PaymentToPaymentAccount_ibfk_2` FOREIGN KEY (`B`) REFERENCES `PaymentAccount` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PictureToPlace` -- DROP TABLE IF EXISTS `_PictureToPlace`; CREATE TABLE `_PictureToPlace` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PictureToPlace_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Picture` (`id`) ON DELETE CASCADE, CONSTRAINT `_PictureToPlace_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Place` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PictureToRestaurant` -- DROP TABLE IF EXISTS `_PictureToRestaurant`; CREATE TABLE `_PictureToRestaurant` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PictureToRestaurant_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Picture` (`id`) ON DELETE CASCADE, CONSTRAINT `_PictureToRestaurant_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Restaurant` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PictureToUser` -- DROP TABLE IF EXISTS `_PictureToUser`; CREATE TABLE `_PictureToUser` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PictureToUser_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Picture` (`id`) ON DELETE CASCADE, CONSTRAINT `_PictureToUser_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PlaceToPolicies` -- DROP TABLE IF EXISTS `_PlaceToPolicies`; CREATE TABLE `_PlaceToPolicies` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PlaceToPolicies_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Place` (`id`) ON DELETE CASCADE, CONSTRAINT `_PlaceToPolicies_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Policies` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PlaceToPricing` -- DROP TABLE IF EXISTS `_PlaceToPricing`; CREATE TABLE `_PlaceToPricing` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PlaceToPricing_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Place` (`id`) ON DELETE CASCADE, CONSTRAINT `_PlaceToPricing_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Pricing` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PlaceToReview` -- DROP TABLE IF EXISTS `_PlaceToReview`; CREATE TABLE `_PlaceToReview` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PlaceToReview_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Place` (`id`) ON DELETE CASCADE, CONSTRAINT `_PlaceToReview_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Review` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PlaceToUser` -- DROP TABLE IF EXISTS `_PlaceToUser`; CREATE TABLE `_PlaceToUser` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PlaceToUser_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Place` (`id`) ON DELETE CASCADE, CONSTRAINT `_PlaceToUser_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_PlaceToViews` -- DROP TABLE IF EXISTS `_PlaceToViews`; CREATE TABLE `_PlaceToViews` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_PlaceToViews_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Place` (`id`) ON DELETE CASCADE, CONSTRAINT `_PlaceToViews_ibfk_2` FOREIGN KEY (`B`) REFERENCES `Views` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_ReceivedMessages` -- DROP TABLE IF EXISTS `_ReceivedMessages`; CREATE TABLE `_ReceivedMessages` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_ReceivedMessages_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Message` (`id`) ON DELETE CASCADE, CONSTRAINT `_ReceivedMessages_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_RelayId` -- DROP TABLE IF EXISTS `_RelayId`; CREATE TABLE `_RelayId` ( `id` char(25) CHARACTER SET utf8 NOT NULL, `stableModelIdentifier` char(25) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `_SentMessages` -- DROP TABLE IF EXISTS `_SentMessages`; CREATE TABLE `_SentMessages` ( `A` char(25) CHARACTER SET utf8 NOT NULL, `B` char(25) CHARACTER SET utf8 NOT NULL, UNIQUE KEY `AB_unique` (`A`,`B`), KEY `A` (`A`), KEY `B` (`B`), CONSTRAINT `_SentMessages_ibfk_1` FOREIGN KEY (`A`) REFERENCES `Message` (`id`) ON DELETE CASCADE, CONSTRAINT `_SentMessages_ibfk_2` FOREIGN KEY (`B`) REFERENCES `User` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dump completed on 2019-04-29 12:50:23
the_stack
-- -- PostgreSQL database dump -- SET statement_timeout = 0; SET client_encoding = 'SQL_ASCII'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; SET search_path = public, pg_catalog; -- -- Name: restore_pg_class_stats(boolean); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION restore_pg_class_stats(skip_nonexist boolean) RETURNS void LANGUAGE plpgsql AS $$ DECLARE rel_pages INTEGER; rel_tuples DOUBLE PRECISION; rel_allvisible INTEGER; rel_name NAME; nsp_name NAME; nsp_oid OID; rel_oid OID; exist_flag INTEGER; CURSOR stats IS SELECT relname, nspname, relpages, reltuples, relallvisible FROM pg_class_stats; BEGIN OPEN stats; LOOP FETCH stats INTO rel_name, nsp_name, rel_pages, rel_tuples, rel_allvisible; exit when stats%notfound; exist_flag := 0; SELECT count(*) FROM pg_namespace WHERE nspname = nsp_name INTO exist_flag; IF exist_flag <> 0 THEN SELECT oid FROM pg_namespace WHERE nspname = nsp_name INTO nsp_oid; ELSIF skip_nonexist THEN CONTINUE; ELSE RAISE EXCEPTION 'Failed to found namespace: %', nsp_name; END IF; exist_flag := 0; SELECT count(*) FROM pg_class WHERE relnamespace = nsp_oid and relname = rel_name INTO exist_flag; IF exist_flag <> 0 THEN SELECT oid FROM pg_class WHERE relnamespace = nsp_oid and relname = rel_name INTO rel_oid; ELSIF skip_nonexist THEN CONTINUE; ELSE RAISE EXCEPTION 'Failed to found table: %.%', nsp_name,rel_name; END IF; UPDATE pg_class SET (relpages, reltuples, relallvisible) = (rel_pages, rel_tuples, rel_allvisible) WHERE oid = rel_oid; END LOOP; END$$; -- -- Name: restore_pg_statistic_ext_stats(boolean); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION restore_pg_statistic_ext_stats(skip_nonexist boolean) RETURNS void LANGUAGE plpgsql AS $$ DECLARE cursor_exist INT; cursor_relid OID; cursor_nspoid OID; cursor_starelkind CHAR; cursor_stakey INT2VECTOR; cursor_relname NAME; cursor_relnspname NAME; cursor_typname NAME; cursor_typnspname NAME; cursor_stainherit BOOL; cursor_stanullfrac FLOAT4; cursor_stawidth INT4; cursor_stadistinct FLOAT4; cursor_stadndistinct FLOAT4; cursor_stakind1 INT2; cursor_stakind2 INT2; cursor_stakind3 INT2; cursor_stakind4 INT2; cursor_stakind5 INT2; cursor_staop1 OID; cursor_staop2 OID; cursor_staop3 OID; cursor_staop4 OID; cursor_staop5 OID; cursor_stanumbers1 TEXT; cursor_stanumbers2 TEXT; cursor_stanumbers3 TEXT; cursor_stanumbers4 TEXT; cursor_stanumbers5 TEXT; cursor_stavalues1 TEXT; cursor_stavalues2 TEXT; cursor_stavalues3 TEXT; cursor_stavalues4 TEXT; cursor_stavalues5 TEXT; CURSOR cursor_statistic IS SELECT relname,relnspname,stakey,starelkind,stainherit,stanullfrac,stawidth,stadistinct,stadndistinct, stakind1,stakind2,stakind3,stakind4,stakind5, staop1,staop2,staop3,staop4,staop5, stanumbers1,stanumbers2,stanumbers3,stanumbers4,stanumbers5, stavalues1,stavalues2,stavalues3,stavalues4,stavalues5 FROM PG_STATISTIC_EXT_STATS; BEGIN OPEN cursor_statistic; LOOP FETCH cursor_statistic INTO cursor_relname,cursor_relnspname,cursor_stakey,cursor_starelkind,cursor_stainherit,cursor_stanullfrac,cursor_stawidth,cursor_stadistinct,cursor_stadndistinct,cursor_stakind1,cursor_stakind2,cursor_stakind3,cursor_stakind4,cursor_stakind5,cursor_staop1,cursor_staop2,cursor_staop3,cursor_staop4,cursor_staop5,cursor_stanumbers1,cursor_stanumbers2,cursor_stanumbers3,cursor_stanumbers4,cursor_stanumbers5,cursor_stavalues1,cursor_stavalues2,cursor_stavalues3,cursor_stavalues4,cursor_stavalues5; EXIT WHEN cursor_statistic%NOTFOUND; cursor_exist := 0; SELECT count(*) FROM pg_namespace WHERE nspname = cursor_relnspname INTO cursor_exist; IF cursor_exist <> 0 THEN SELECT oid FROM pg_namespace WHERE nspname = cursor_relnspname INTO cursor_nspoid; ELSIF skip_nonexist THEN CONTINUE; ELSE RAISE EXCEPTION 'Failed to found namespace: %', cursor_relnspname; END IF; cursor_exist := 0; SELECT count(*) FROM pg_class where relname=cursor_relname AND relnamespace=cursor_nspoid INTO cursor_exist; IF cursor_exist <> 0 then SELECT oid FROM pg_class where relname=cursor_relname AND relnamespace=cursor_nspoid INTO cursor_relid; ELSIF skip_nonexist THEN CONTINUE; ELSE RAISE EXCEPTION 'Failed to found table: %.%', cursor_relname,cursor_relname; END IF; cursor_exist := 0; SELECT count(*) FROM pg_statistic_ext WHERE starelid = cursor_relid AND stakey = cursor_stakey and stainherit = cursor_stainherit INTO cursor_exist; IF cursor_exist <> 0 THEN UPDATE pg_statistic_ext SET (stainherit,stanullfrac,stawidth,stadistinct,stadndistinct) = (cursor_stainherit,cursor_stanullfrac,cursor_stawidth,cursor_stadistinct,cursor_stadndistinct) WHERE starelid = cursor_relid AND stakey = cursor_stakey; UPDATE pg_statistic_ext SET (stakind1,stakind2,stakind3,stakind4,stakind5) = (cursor_stakind1,cursor_stakind2,cursor_stakind3,cursor_stakind4,cursor_stakind5) WHERE starelid = cursor_relid AND stakey = cursor_stakey; UPDATE pg_statistic_ext SET (staop1,staop2,staop3,staop4,staop5) = (cursor_staop1,cursor_staop2,cursor_staop3,cursor_staop4,cursor_staop5) WHERE starelid = cursor_relid AND stakey = cursor_stakey; ELSE INSERT INTO pg_statistic_ext (starelid,stakey,starelkind,stainherit,stanullfrac,stawidth,stadistinct,stadndistinct,stakind1,stakind2,stakind3,stakind4,stakind5,staop1,staop2,staop3,staop4,staop5) VALUES (cursor_relid,cursor_stakey,cursor_starelkind,cursor_stainherit,cursor_stanullfrac,cursor_stawidth,cursor_stadistinct,cursor_stadndistinct,cursor_stakind1,cursor_stakind2,cursor_stakind3,cursor_stakind4,cursor_stakind5,cursor_staop1,cursor_staop2,cursor_staop3,cursor_staop4,cursor_staop5); END IF; IF cursor_stanumbers1 != '' THEN UPDATE pg_statistic_ext SET stanumbers1 = cursor_stanumbers1::real[] WHERE starelid = cursor_relid AND stakey = cursor_stakey; END IF; IF cursor_stanumbers2 != '' THEN UPDATE pg_statistic_ext SET stanumbers2 = cursor_stanumbers2::real[] WHERE starelid = cursor_relid AND stakey = cursor_stakey; END IF; IF cursor_stanumbers3 != '' THEN UPDATE pg_statistic_ext SET stanumbers3 = cursor_stanumbers3::real[] WHERE starelid = cursor_relid AND stakey = cursor_stakey; END IF; IF cursor_stanumbers4 != '' THEN UPDATE pg_statistic_ext SET stanumbers4 = cursor_stanumbers4::real[] WHERE starelid = cursor_relid AND stakey = cursor_stakey; END IF; IF cursor_stanumbers5 != '' THEN UPDATE pg_statistic_ext SET stanumbers5 = cursor_stanumbers5::real[] WHERE starelid = cursor_relid AND stakey = cursor_stakey; END IF; if cursor_stavalues1 != '' THEN UPDATE pg_statistic_ext SET stavalues1 = complex_array_in(cursor_stavalues1::cstring, cursor_relid, cursor_stakey) WHERE starelid = cursor_relid AND stakey = cursor_stakey; END IF; if cursor_stavalues2 != '' THEN UPDATE pg_statistic_ext SET stavalues2 = complex_array_in(cursor_stavalues2::cstring, cursor_relid, cursor_stakey) WHERE starelid = cursor_relid AND stakey = cursor_stakey; END IF; if cursor_stavalues3 != '' THEN UPDATE pg_statistic_ext SET stavalues3 = complex_array_in(cursor_stavalues3::cstring, cursor_relid, cursor_stakey) WHERE starelid = cursor_relid AND stakey = cursor_stakey; END IF; if cursor_stavalues4 != '' THEN Update pg_statistic_ext SET stavalues4 = complex_array_in(cursor_stavalues4::cstring, cursor_relid, cursor_stakey) WHERE starelid = cursor_relid And stakey = cursor_stakey; END IF; if cursor_stavalues5 != '' THEN UPDATE pg_statistic_ext SET stavalues5 = complex_array_in(cursor_stavalues5::cstring, cursor_relid, cursor_stakey) WHERE starelid = cursor_relid AND stakey = cursor_stakey; END IF; END LOOP; CLOSE cursor_statistic; END$$; -- -- Name: restore_pg_statistic_stats(boolean); Type: FUNCTION; Schema: public; Owner: - -- CREATE FUNCTION restore_pg_statistic_stats(skip_nonexist boolean) RETURNS void LANGUAGE plpgsql AS $$ DECLARE cursor_exist INT; cursor_relid OID; cursor_nspoid OID; cursor_starelkind CHAR; cursor_staattnum INT2; cursor_relname NAME; cursor_relnspname NAME; cursor_typname NAME; cursor_typnspname NAME; cursor_stainherit BOOL; cursor_stanullfrac FLOAT4; cursor_stawidth INT4; cursor_stadistinct FLOAT4; cursor_stadndistinct FLOAT4; cursor_stakind1 INT2; cursor_stakind2 INT2; cursor_stakind3 INT2; cursor_stakind4 INT2; cursor_stakind5 INT2; cursor_staop1 OID; cursor_staop2 OID; cursor_staop3 OID; cursor_staop4 OID; cursor_staop5 OID; cursor_stanumbers1 TEXT; cursor_stanumbers2 TEXT; cursor_stanumbers3 TEXT; cursor_stanumbers4 TEXT; cursor_stanumbers5 TEXT; cursor_stavalues1 TEXT; cursor_stavalues2 TEXT; cursor_stavalues3 TEXT; cursor_stavalues4 TEXT; cursor_stavalues5 TEXT; atttypid OID; attnspid OID; CURSOR cursor_statistic IS SELECT relname,relnspname,staattnum,starelkind,typname,typnspname,stainherit,stanullfrac,stawidth,stadistinct,stadndistinct, stakind1,stakind2,stakind3,stakind4,stakind5, staop1,staop2,staop3,staop4,staop5, stanumbers1,stanumbers2,stanumbers3,stanumbers4,stanumbers5, stavalues1,stavalues2,stavalues3,stavalues4,stavalues5 FROM PG_STATISTIC_STATS; BEGIN OPEN cursor_statistic; LOOP FETCH cursor_statistic INTO cursor_relname,cursor_relnspname,cursor_staattnum,cursor_starelkind,cursor_typname,cursor_typnspname,cursor_stainherit,cursor_stanullfrac,cursor_stawidth,cursor_stadistinct,cursor_stadndistinct,cursor_stakind1,cursor_stakind2,cursor_stakind3,cursor_stakind4,cursor_stakind5,cursor_staop1,cursor_staop2,cursor_staop3,cursor_staop4,cursor_staop5,cursor_stanumbers1,cursor_stanumbers2,cursor_stanumbers3,cursor_stanumbers4,cursor_stanumbers5,cursor_stavalues1,cursor_stavalues2,cursor_stavalues3,cursor_stavalues4,cursor_stavalues5; EXIT WHEN cursor_statistic%NOTFOUND; cursor_exist := 0; SELECT count(*) FROM pg_namespace WHERE nspname = cursor_relnspname INTO cursor_exist; IF cursor_exist <> 0 THEN SELECT oid FROM pg_namespace WHERE nspname = cursor_relnspname INTO cursor_nspoid; ELSIF skip_nonexist THEN CONTINUE; ELSE RAISE EXCEPTION 'Failed to found namespace: %', cursor_relnspname; END IF; cursor_exist := 0; SELECT count(*) FROM pg_class where relname=cursor_relname AND relnamespace=cursor_nspoid INTO cursor_exist; IF cursor_exist <> 0 then SELECT oid FROM pg_class where relname=cursor_relname AND relnamespace=cursor_nspoid INTO cursor_relid; ELSIF skip_nonexist THEN CONTINUE; ELSE RAISE EXCEPTION 'Failed to found table: %.%', cursor_relname,cursor_relname; END IF; cursor_exist := 0; SELECT count(*) FROM pg_statistic WHERE starelid = cursor_relid AND staattnum = cursor_staattnum and stainherit = cursor_stainherit INTO cursor_exist; IF cursor_exist <> 0 THEN UPDATE pg_statistic SET (stainherit,stanullfrac,stawidth,stadistinct,stadndistinct) = (cursor_stainherit,cursor_stanullfrac,cursor_stawidth,cursor_stadistinct,cursor_stadndistinct) WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; UPDATE pg_statistic SET (stakind1,stakind2,stakind3,stakind4,stakind5) = (cursor_stakind1,cursor_stakind2,cursor_stakind3,cursor_stakind4,cursor_stakind5) WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; UPDATE pg_statistic SET (staop1,staop2,staop3,staop4,staop5) = (cursor_staop1,cursor_staop2,cursor_staop3,cursor_staop4,cursor_staop5) WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; ELSE INSERT INTO pg_statistic (starelid,staattnum,starelkind,stainherit,stanullfrac,stawidth,stadistinct,stadndistinct,stakind1,stakind2,stakind3,stakind4,stakind5,staop1,staop2,staop3,staop4,staop5) VALUES (cursor_relid,cursor_staattnum,cursor_starelkind,cursor_stainherit,cursor_stanullfrac,cursor_stawidth,cursor_stadistinct,cursor_stadndistinct,cursor_stakind1,cursor_stakind2,cursor_stakind3,cursor_stakind4,cursor_stakind5,cursor_staop1,cursor_staop2,cursor_staop3,cursor_staop4,cursor_staop5); END IF; IF cursor_stanumbers1 != '' THEN UPDATE pg_statistic SET stanumbers1 = cursor_stanumbers1::real[] WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; END IF; IF cursor_stanumbers2 != '' THEN UPDATE pg_statistic SET stanumbers2 = cursor_stanumbers2::real[] WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; END IF; IF cursor_stanumbers3 != '' THEN UPDATE pg_statistic SET stanumbers3 = cursor_stanumbers3::real[] WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; END IF; IF cursor_stanumbers4 != '' THEN UPDATE pg_statistic SET stanumbers4 = cursor_stanumbers4::real[] WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; END IF; IF cursor_stanumbers5 != '' THEN UPDATE pg_statistic SET stanumbers5 = cursor_stanumbers5::real[] WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; END IF; cursor_exist := 0; SELECT count(*) FROM pg_namespace where nspname = cursor_typnspname INTO cursor_exist; IF cursor_exist <> 0 THEN SELECT oid FROM pg_namespace where nspname = cursor_typnspname INTO attnspid; ELSIF skip_nonexist THEN CONTINUE; ELSE RAISE EXCEPTION 'Failed to found namespace: %', cursor_typnspname; END IF; cursor_exist := 0; SELECT count(*) FROM pg_type where typname=cursor_typname AND typnamespace=attnspid INTO cursor_exist; IF cursor_exist <> 0 then SELECT oid FROM pg_type where typname=cursor_typname AND typnamespace=attnspid INTO atttypid; ELSIF skip_nonexist THEN CONTINUE; ELSE RAISE EXCEPTION 'Failed to found type: %.%', cursor_typnspname,cursor_typname; END IF; if cursor_stavalues1 != '' THEN UPDATE pg_statistic SET stavalues1 = array_in(cursor_stavalues1::cstring, atttypid, -1) WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; END IF; if cursor_stavalues2 != '' THEN UPDATE pg_statistic SET stavalues2 = array_in(cursor_stavalues2::cstring, atttypid, -1) WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; END IF; if cursor_stavalues3 != '' THEN UPDATE pg_statistic SET stavalues3 = array_in(cursor_stavalues3::cstring, atttypid, -1) WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; END IF; if cursor_stavalues4 != '' THEN Update pg_statistic SET stavalues4 = array_in(cursor_stavalues4::cstring, atttypid, -1) WHERE starelid = cursor_relid And staattnum = cursor_staattnum; END IF; if cursor_stavalues5 != '' THEN UPDATE pg_statistic SET stavalues5 = array_in(cursor_stavalues5::cstring, atttypid, -1) WHERE starelid = cursor_relid AND staattnum = cursor_staattnum; END IF; END LOOP; CLOSE cursor_statistic; END$$; SET default_tablespace = ''; SET default_with_oids = false; -- -- Name: pg_class_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE UNLOGGED TABLE pg_class_stats ( relname name, nspname name, relpages double precision, reltuples double precision, relallvisible integer ) WITH (orientation=row, compression=no) DISTRIBUTE BY HASH (relallvisible); -- -- Name: pg_statistic_ext_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE UNLOGGED TABLE pg_statistic_ext_stats ( relname name, relnspname name, stakey int2vector, starelkind "char", stainherit boolean, stanullfrac real, stawidth integer, stadistinct real, stadndistinct real, stakind1 smallint, stakind2 smallint, stakind3 smallint, stakind4 smallint, stakind5 smallint, staop1 oid, staop2 oid, staop3 oid, staop4 oid, staop5 oid, stanumbers1 text, stanumbers2 text, stanumbers3 text, stanumbers4 text, stanumbers5 text, stavalues1 text, stavalues2 text, stavalues3 text, stavalues4 text, stavalues5 text ) WITH (orientation=row, compression=no) DISTRIBUTE BY HASH (starelkind); -- -- Name: pg_statistic_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE UNLOGGED TABLE pg_statistic_stats ( relname name, relnspname name, staattnum smallint, starelkind "char", typname name, typnspname name, stainherit boolean, stanullfrac real, stawidth integer, stadistinct real, stadndistinct real, stakind1 smallint, stakind2 smallint, stakind3 smallint, stakind4 smallint, stakind5 smallint, staop1 oid, staop2 oid, staop3 oid, staop4 oid, staop5 oid, stanumbers1 text, stanumbers2 text, stanumbers3 text, stanumbers4 text, stanumbers5 text, stavalues1 text, stavalues2 text, stavalues3 text, stavalues4 text, stavalues5 text ) WITH (orientation=row, compression=no) DISTRIBUTE BY HASH (staattnum); -- -- Name: pg_class_stats; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE UNLOGGED TABLE pgxc_class_ng ( relname name, nspname name, pgroup name, relallvisible integer ) WITH (orientation=row, compression=no) DISTRIBUTE BY HASH (relallvisible); CREATE FUNCTION restore_pgxc_class_ng(skip_nonexist boolean) RETURNS void LANGUAGE plpgsql AS $$ DECLARE rel_name NAME; nsp_name NAME; p_group NAME; nsp_oid OID; rel_oid OID; rel_allvisible INTEGER; exist_flag INTEGER; CURSOR stats IS SELECT relname, nspname, pgroup, relallvisible FROM pgxc_class_ng; BEGIN OPEN stats; LOOP FETCH stats INTO rel_name, nsp_name, p_group, rel_allvisible; exit when stats%notfound; exist_flag := 0; SELECT count(*) FROM pg_class WHERE relname = rel_name INTO exist_flag; IF exist_flag <> 0 THEN SELECT C.oid FROM pg_class C, pg_namespace N WHERE C.relname = rel_name AND N.oid = C.relnamespace AND N.nspname = nsp_name INTO rel_oid; UPDATE pgxc_class SET (pgroup) = (p_group) WHERE pcrelid = rel_oid; ELSIF skip_nonexist THEN CONTINUE; RAISE EXCEPTION 'Failed to find relname: %', rel_name; END IF; END LOOP; END$$; CREATE FUNCTION restore_nodeoids(skip_nonexist boolean) RETURNS void LANGUAGE plpgsql AS $$ DECLARE groupname NAME; groupmembers oidvector; exist_flag INTEGER; CURSOR stats IS SELECT group_name, group_members FROM pgxc_group; BEGIN OPEN stats; LOOP FETCH stats INTO groupname, groupmembers; exit when stats%notfound; exist_flag := 0; SELECT count(*) FROM pgxc_class WHERE pgroup = groupname INTO exist_flag; IF exist_flag <> 0 THEN UPDATE pgxc_class SET nodeoids = groupmembers WHERE pgroup = groupname; ELSIF skip_nonexist THEN CONTINUE; ELSE RAISE EXCEPTION 'Failed to find pgroup: %', groupname; END IF; END LOOP; END$$;
the_stack
-- -- PostgreSQL database dump -- -- Dumped from database version 10.1 -- Dumped by pg_dump version 11.1 SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET client_min_messages = warning; SET row_security = off; -- -- Name: schema-generator$relations; Type: SCHEMA; Schema: -; Owner: - -- CREATE SCHEMA "schema-generator$relations"; SET default_tablespace = ''; SET default_with_oids = false; -- -- Name: BillingInfo; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."BillingInfo" ( id character varying(25) NOT NULL, account text NOT NULL, "updatedAt" timestamp(3) without time zone NOT NULL, "createdAt" timestamp(3) without time zone NOT NULL ); -- -- Name: BillingInfoWithoutConnection; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."BillingInfoWithoutConnection" ( id character varying(25) NOT NULL, account text NOT NULL, "updatedAt" timestamp(3) without time zone NOT NULL, "createdAt" timestamp(3) without time zone NOT NULL ); -- -- Name: OptionalDetails; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."OptionalDetails" ( id character varying(25) NOT NULL, text text NOT NULL, "updatedAt" timestamp(3) without time zone NOT NULL, "createdAt" timestamp(3) without time zone NOT NULL ); -- -- Name: OptionalDetailsWithoutConnection; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."OptionalDetailsWithoutConnection" ( id character varying(25) NOT NULL, text text NOT NULL, "updatedAt" timestamp(3) without time zone NOT NULL, "createdAt" timestamp(3) without time zone NOT NULL ); -- -- Name: Post; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."Post" ( id character varying(25) NOT NULL, text text NOT NULL, count integer NOT NULL, "updatedAt" timestamp(3) without time zone NOT NULL, "createdAt" timestamp(3) without time zone NOT NULL ); -- -- Name: PostWithoutConnection; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."PostWithoutConnection" ( id character varying(25) NOT NULL, text text NOT NULL, count integer NOT NULL, "updatedAt" timestamp(3) without time zone NOT NULL, "createdAt" timestamp(3) without time zone NOT NULL ); -- -- Name: User; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."User" ( id character varying(25) NOT NULL, name text NOT NULL, "updatedAt" timestamp(3) without time zone NOT NULL, "createdAt" timestamp(3) without time zone NOT NULL ); -- -- Name: _BillingInfoToUser; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."_BillingInfoToUser" ( "A" character varying(25) NOT NULL, "B" character varying(25) NOT NULL ); -- -- Name: _BillingInfoWithoutConnectionToUser; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."_BillingInfoWithoutConnectionToUser" ( "A" character varying(25) NOT NULL, "B" character varying(25) NOT NULL ); -- -- Name: _LikesByUser; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."_LikesByUser" ( "A" character varying(25) NOT NULL, "B" character varying(25) NOT NULL ); -- -- Name: _OptionalDetailsToUser; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."_OptionalDetailsToUser" ( "A" character varying(25) NOT NULL, "B" character varying(25) NOT NULL ); -- -- Name: _OptionalDetailsWithoutConnectionToUser; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."_OptionalDetailsWithoutConnectionToUser" ( "A" character varying(25) NOT NULL, "B" character varying(25) NOT NULL ); -- -- Name: _PostWithoutConnectionToUser; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."_PostWithoutConnectionToUser" ( "A" character varying(25) NOT NULL, "B" character varying(25) NOT NULL ); -- -- Name: _PostsByUser; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."_PostsByUser" ( "A" character varying(25) NOT NULL, "B" character varying(25) NOT NULL ); -- -- Name: _RelayId; Type: TABLE; Schema: schema-generator$relations; Owner: - -- CREATE TABLE "schema-generator$relations"."_RelayId" ( id character varying(36) NOT NULL, "stableModelIdentifier" character varying(25) NOT NULL ); -- -- Name: BillingInfoWithoutConnection BillingInfoWithoutConnection_pkey; Type: CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."BillingInfoWithoutConnection" ADD CONSTRAINT "BillingInfoWithoutConnection_pkey" PRIMARY KEY (id); -- -- Name: BillingInfo BillingInfo_pkey; Type: CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."BillingInfo" ADD CONSTRAINT "BillingInfo_pkey" PRIMARY KEY (id); -- -- Name: OptionalDetailsWithoutConnection OptionalDetailsWithoutConnection_pkey; Type: CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."OptionalDetailsWithoutConnection" ADD CONSTRAINT "OptionalDetailsWithoutConnection_pkey" PRIMARY KEY (id); -- -- Name: OptionalDetails OptionalDetails_pkey; Type: CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."OptionalDetails" ADD CONSTRAINT "OptionalDetails_pkey" PRIMARY KEY (id); -- -- Name: PostWithoutConnection PostWithoutConnection_pkey; Type: CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."PostWithoutConnection" ADD CONSTRAINT "PostWithoutConnection_pkey" PRIMARY KEY (id); -- -- Name: Post Post_pkey; Type: CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."Post" ADD CONSTRAINT "Post_pkey" PRIMARY KEY (id); -- -- Name: User User_pkey; Type: CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."User" ADD CONSTRAINT "User_pkey" PRIMARY KEY (id); -- -- Name: _RelayId pk_RelayId; Type: CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_RelayId" ADD CONSTRAINT "pk_RelayId" PRIMARY KEY (id); -- -- Name: _BillingInfoToUser_A; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_BillingInfoToUser_A" ON "schema-generator$relations"."_BillingInfoToUser" USING btree ("A"); -- -- Name: _BillingInfoToUser_AB_unique; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE UNIQUE INDEX "_BillingInfoToUser_AB_unique" ON "schema-generator$relations"."_BillingInfoToUser" USING btree ("A", "B"); -- -- Name: _BillingInfoToUser_B; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_BillingInfoToUser_B" ON "schema-generator$relations"."_BillingInfoToUser" USING btree ("B"); -- -- Name: _BillingInfoWithoutConnectionToUser_A; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_BillingInfoWithoutConnectionToUser_A" ON "schema-generator$relations"."_BillingInfoWithoutConnectionToUser" USING btree ("A"); -- -- Name: _BillingInfoWithoutConnectionToUser_AB_unique; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE UNIQUE INDEX "_BillingInfoWithoutConnectionToUser_AB_unique" ON "schema-generator$relations"."_BillingInfoWithoutConnectionToUser" USING btree ("A", "B"); -- -- Name: _BillingInfoWithoutConnectionToUser_B; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_BillingInfoWithoutConnectionToUser_B" ON "schema-generator$relations"."_BillingInfoWithoutConnectionToUser" USING btree ("B"); -- -- Name: _LikesByUser_A; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_LikesByUser_A" ON "schema-generator$relations"."_LikesByUser" USING btree ("A"); -- -- Name: _LikesByUser_AB_unique; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE UNIQUE INDEX "_LikesByUser_AB_unique" ON "schema-generator$relations"."_LikesByUser" USING btree ("A", "B"); -- -- Name: _LikesByUser_B; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_LikesByUser_B" ON "schema-generator$relations"."_LikesByUser" USING btree ("B"); -- -- Name: _OptionalDetailsToUser_A; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_OptionalDetailsToUser_A" ON "schema-generator$relations"."_OptionalDetailsToUser" USING btree ("A"); -- -- Name: _OptionalDetailsToUser_AB_unique; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE UNIQUE INDEX "_OptionalDetailsToUser_AB_unique" ON "schema-generator$relations"."_OptionalDetailsToUser" USING btree ("A", "B"); -- -- Name: _OptionalDetailsToUser_B; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_OptionalDetailsToUser_B" ON "schema-generator$relations"."_OptionalDetailsToUser" USING btree ("B"); -- -- Name: _OptionalDetailsWithoutConnectionToUser_A; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_OptionalDetailsWithoutConnectionToUser_A" ON "schema-generator$relations"."_OptionalDetailsWithoutConnectionToUser" USING btree ("A"); -- -- Name: _OptionalDetailsWithoutConnectionToUser_AB_unique; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE UNIQUE INDEX "_OptionalDetailsWithoutConnectionToUser_AB_unique" ON "schema-generator$relations"."_OptionalDetailsWithoutConnectionToUser" USING btree ("A", "B"); -- -- Name: _OptionalDetailsWithoutConnectionToUser_B; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_OptionalDetailsWithoutConnectionToUser_B" ON "schema-generator$relations"."_OptionalDetailsWithoutConnectionToUser" USING btree ("B"); -- -- Name: _PostWithoutConnectionToUser_A; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_PostWithoutConnectionToUser_A" ON "schema-generator$relations"."_PostWithoutConnectionToUser" USING btree ("A"); -- -- Name: _PostWithoutConnectionToUser_AB_unique; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE UNIQUE INDEX "_PostWithoutConnectionToUser_AB_unique" ON "schema-generator$relations"."_PostWithoutConnectionToUser" USING btree ("A", "B"); -- -- Name: _PostWithoutConnectionToUser_B; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_PostWithoutConnectionToUser_B" ON "schema-generator$relations"."_PostWithoutConnectionToUser" USING btree ("B"); -- -- Name: _PostsByUser_A; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_PostsByUser_A" ON "schema-generator$relations"."_PostsByUser" USING btree ("A"); -- -- Name: _PostsByUser_AB_unique; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE UNIQUE INDEX "_PostsByUser_AB_unique" ON "schema-generator$relations"."_PostsByUser" USING btree ("A", "B"); -- -- Name: _PostsByUser_B; Type: INDEX; Schema: schema-generator$relations; Owner: - -- CREATE INDEX "_PostsByUser_B" ON "schema-generator$relations"."_PostsByUser" USING btree ("B"); -- -- Name: _BillingInfoToUser _BillingInfoToUser_A_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_BillingInfoToUser" ADD CONSTRAINT "_BillingInfoToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "schema-generator$relations"."BillingInfo"(id) ON DELETE CASCADE; -- -- Name: _BillingInfoToUser _BillingInfoToUser_B_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_BillingInfoToUser" ADD CONSTRAINT "_BillingInfoToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "schema-generator$relations"."User"(id) ON DELETE CASCADE; -- -- Name: _BillingInfoWithoutConnectionToUser _BillingInfoWithoutConnectionToUser_A_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_BillingInfoWithoutConnectionToUser" ADD CONSTRAINT "_BillingInfoWithoutConnectionToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "schema-generator$relations"."BillingInfoWithoutConnection"(id) ON DELETE CASCADE; -- -- Name: _BillingInfoWithoutConnectionToUser _BillingInfoWithoutConnectionToUser_B_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_BillingInfoWithoutConnectionToUser" ADD CONSTRAINT "_BillingInfoWithoutConnectionToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "schema-generator$relations"."User"(id) ON DELETE CASCADE; -- -- Name: _LikesByUser _LikesByUser_A_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_LikesByUser" ADD CONSTRAINT "_LikesByUser_A_fkey" FOREIGN KEY ("A") REFERENCES "schema-generator$relations"."Post"(id) ON DELETE CASCADE; -- -- Name: _LikesByUser _LikesByUser_B_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_LikesByUser" ADD CONSTRAINT "_LikesByUser_B_fkey" FOREIGN KEY ("B") REFERENCES "schema-generator$relations"."User"(id) ON DELETE CASCADE; -- -- Name: _OptionalDetailsToUser _OptionalDetailsToUser_A_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_OptionalDetailsToUser" ADD CONSTRAINT "_OptionalDetailsToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "schema-generator$relations"."OptionalDetails"(id) ON DELETE CASCADE; -- -- Name: _OptionalDetailsToUser _OptionalDetailsToUser_B_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_OptionalDetailsToUser" ADD CONSTRAINT "_OptionalDetailsToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "schema-generator$relations"."User"(id) ON DELETE CASCADE; -- -- Name: _OptionalDetailsWithoutConnectionToUser _OptionalDetailsWithoutConnectionToUser_A_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_OptionalDetailsWithoutConnectionToUser" ADD CONSTRAINT "_OptionalDetailsWithoutConnectionToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "schema-generator$relations"."OptionalDetailsWithoutConnection"(id) ON DELETE CASCADE; -- -- Name: _OptionalDetailsWithoutConnectionToUser _OptionalDetailsWithoutConnectionToUser_B_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_OptionalDetailsWithoutConnectionToUser" ADD CONSTRAINT "_OptionalDetailsWithoutConnectionToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "schema-generator$relations"."User"(id) ON DELETE CASCADE; -- -- Name: _PostWithoutConnectionToUser _PostWithoutConnectionToUser_A_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_PostWithoutConnectionToUser" ADD CONSTRAINT "_PostWithoutConnectionToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "schema-generator$relations"."PostWithoutConnection"(id) ON DELETE CASCADE; -- -- Name: _PostWithoutConnectionToUser _PostWithoutConnectionToUser_B_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_PostWithoutConnectionToUser" ADD CONSTRAINT "_PostWithoutConnectionToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "schema-generator$relations"."User"(id) ON DELETE CASCADE; -- -- Name: _PostsByUser _PostsByUser_A_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_PostsByUser" ADD CONSTRAINT "_PostsByUser_A_fkey" FOREIGN KEY ("A") REFERENCES "schema-generator$relations"."Post"(id) ON DELETE CASCADE; -- -- Name: _PostsByUser _PostsByUser_B_fkey; Type: FK CONSTRAINT; Schema: schema-generator$relations; Owner: - -- ALTER TABLE ONLY "schema-generator$relations"."_PostsByUser" ADD CONSTRAINT "_PostsByUser_B_fkey" FOREIGN KEY ("B") REFERENCES "schema-generator$relations"."User"(id) ON DELETE CASCADE; -- -- PostgreSQL database dump complete --
the_stack
/************************************************************* Stored procedure to Acquire export jobs **************************************************************/ -- -- STORED PROCEDURE -- Acquires export jobs. -- -- DESCRIPTION -- Timestamps the available export jobs and sets their statuses to running. -- -- PARAMETERS -- @jobHeartbeatTimeoutThresholdInSeconds -- * The number of seconds that must pass before an export job is considered stale -- @maximumNumberOfConcurrentJobsAllowed -- * The maximum number of running jobs we can have at once -- -- RETURN VALUE -- The updated jobs that are now running. -- CREATE OR ALTER PROCEDURE dbo.AcquireExportJobs @jobHeartbeatTimeoutThresholdInSeconds bigint, @maximumNumberOfConcurrentJobsAllowed int AS SET NOCOUNT ON; SET XACT_ABORT ON; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN TRANSACTION; -- We will consider a job to be stale if its timestamp is smaller than or equal to this. DECLARE @expirationDateTime AS DATETIME2 (7); SELECT @expirationDateTime = DATEADD(second, -@jobHeartbeatTimeoutThresholdInSeconds, SYSUTCDATETIME()); -- Get the number of jobs that are running and not stale. -- Acquire and hold an exclusive table lock for the entire transaction to prevent jobs from being created, updated or deleted during acquisitions. DECLARE @numberOfRunningJobs AS INT; SELECT @numberOfRunningJobs = COUNT(*) FROM dbo.ExportJob WITH (TABLOCKX) WHERE Status = 'Running' AND HeartbeatDateTime > @expirationDateTime; -- Determine how many available jobs we can pick up. DECLARE @limit AS INT = @maximumNumberOfConcurrentJobsAllowed - @numberOfRunningJobs; IF (@limit > 0) BEGIN DECLARE @availableJobs TABLE ( Id VARCHAR (64) COLLATE Latin1_General_100_CS_AS NOT NULL, JobVersion BINARY (8) NOT NULL); -- Get the available jobs, which are export jobs that are queued or stale. -- Older jobs will be prioritized over newer ones. INSERT INTO @availableJobs SELECT TOP (@limit) Id, JobVersion FROM dbo.ExportJob WHERE (Status = 'Queued' OR (Status = 'Running' AND HeartbeatDateTime <= @expirationDateTime)) ORDER BY HeartbeatDateTime; DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); -- Update each available job's status to running both in the export table's status column and in the raw export job record JSON. UPDATE dbo.ExportJob SET Status = 'Running', HeartbeatDateTime = @heartbeatDateTime, RawJobRecord = JSON_MODIFY(RawJobRecord, '$.status', 'Running') OUTPUT inserted.RawJobRecord, inserted.JobVersion FROM dbo.ExportJob AS job INNER JOIN @availableJobs AS availableJob ON job.Id = availableJob.Id AND job.JobVersion = availableJob.JobVersion; END COMMIT TRANSACTION; GO /************************************************************* Stored procedure to Acquire reindex jobs **************************************************************/ -- -- STORED PROCEDURE -- Acquires reindex jobs. -- -- DESCRIPTION -- Timestamps the available reindex jobs and sets their statuses to running. -- -- PARAMETERS -- @jobHeartbeatTimeoutThresholdInSeconds -- * The number of seconds that must pass before a reindex job is considered stale -- @maximumNumberOfConcurrentJobsAllowed -- * The maximum number of running jobs we can have at once -- -- RETURN VALUE -- The updated jobs that are now running. -- CREATE OR ALTER PROCEDURE dbo.AcquireReindexJobs @jobHeartbeatTimeoutThresholdInSeconds bigint, @maximumNumberOfConcurrentJobsAllowed int AS SET NOCOUNT ON; SET XACT_ABORT ON; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN TRANSACTION; -- We will consider a job to be stale if its timestamp is smaller than or equal to this. DECLARE @expirationDateTime AS DATETIME2 (7); SELECT @expirationDateTime = DATEADD(second, -@jobHeartbeatTimeoutThresholdInSeconds, SYSUTCDATETIME()); -- Get the number of jobs that are running and not stale. -- Acquire and hold an exclusive table lock for the entire transaction to prevent jobs from being created, updated or deleted during acquisitions. DECLARE @numberOfRunningJobs AS INT; SELECT @numberOfRunningJobs = COUNT(*) FROM dbo.ReindexJob WITH (TABLOCKX) WHERE Status = 'Running' AND HeartbeatDateTime > @expirationDateTime; -- Determine how many available jobs we can pick up. DECLARE @limit AS INT = @maximumNumberOfConcurrentJobsAllowed - @numberOfRunningJobs; IF (@limit > 0) BEGIN DECLARE @availableJobs TABLE ( Id VARCHAR (64) COLLATE Latin1_General_100_CS_AS NOT NULL, JobVersion BINARY (8) NOT NULL); -- Get the available jobs, which are reindex jobs that are queued or stale. -- Older jobs will be prioritized over newer ones. INSERT INTO @availableJobs SELECT TOP (@limit) Id, JobVersion FROM dbo.ReindexJob WHERE (Status = 'Queued' OR (Status = 'Running' AND HeartbeatDateTime <= @expirationDateTime)) ORDER BY HeartbeatDateTime; DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); -- Update each available job's status to running both in the reindex table's status column and in the raw reindex job record JSON. UPDATE dbo.ReindexJob SET Status = 'Running', HeartbeatDateTime = @heartbeatDateTime, RawJobRecord = JSON_MODIFY(RawJobRecord, '$.status', 'Running') OUTPUT inserted.RawJobRecord, inserted.JobVersion FROM dbo.ReindexJob AS job INNER JOIN @availableJobs AS availableJob ON job.Id = availableJob.Id AND job.JobVersion = availableJob.JobVersion; END COMMIT TRANSACTION; GO /************************************************************* Stored procedure - AddPartitionOnResourceChanges **************************************************************/ -- -- STORED PROCEDURE -- AddPartitionOnResourceChanges -- -- DESCRIPTION -- Creates a new partition at the right for the future date which will be -- the next hour of the right-most partition boundry. -- -- PARAMETERS -- @partitionBoundary -- * The output parameter to stores the added partition boundary. -- CREATE OR ALTER PROCEDURE dbo.AddPartitionOnResourceChanges @partitionBoundary datetime2(7) OUTPUT AS BEGIN /* using XACT_ABORT to force a rollback on any error. */ SET XACT_ABORT ON; BEGIN TRANSACTION; /* Finds the highest boundary value */ DECLARE @rightPartitionBoundary AS DATETIME2 (7) = CAST ((SELECT TOP (1) value FROM sys.partition_range_values AS prv INNER JOIN sys.partition_functions AS pf ON pf.function_id = prv.function_id WHERE pf.name = N'PartitionFunction_ResourceChangeData_Timestamp' ORDER BY prv.boundary_id DESC) AS DATETIME2 (7)); /* Rounds the current datetime to the hour. */ DECLARE @timestamp AS DATETIME2 (7) = DATEADD(hour, DATEDIFF(hour, 0, sysutcdatetime()), 0); /* Ensures the next boundary value is greater than the current datetime. */ IF (@rightPartitionBoundary < @timestamp) BEGIN SET @rightPartitionBoundary = @timestamp; END /* Adds one hour for the next partition. */ SET @rightPartitionBoundary = DATEADD(hour, 1, @rightPartitionBoundary); /* Creates new empty partition by creating new boundary value and specifying NEXT USED file group. */ ALTER PARTITION SCHEME PartitionScheme_ResourceChangeData_Timestamp NEXT USED [Primary]; ALTER PARTITION FUNCTION PartitionFunction_ResourceChangeData_Timestamp( ) SPLIT RANGE (@rightPartitionBoundary); SET @partitionBoundary = @rightPartitionBoundary; COMMIT TRANSACTION; END GO /************************************************************* Stored procedures for batch delete ResourceParams **************************************************************/ -- -- STORED PROCEDURE -- BatchDeleteResourceParams -- -- DESCRIPTION -- Batch delete ResourceParams -- -- PARAMETERS -- @tableName -- * Resource params table name -- @resourceTypeId -- * Resource type id -- @startResourceSurrogateId -- * The start ResourceSurrogateId -- @endResourceSurrogateId -- * The end ResourceSurrogateId -- @batchSize -- * Max batch size for delete operation CREATE OR ALTER PROCEDURE dbo.BatchDeleteResourceParams @tableName nvarchar(128), @resourceTypeId smallint, @startResourceSurrogateId bigint, @endResourceSurrogateId bigint, @batchSize int AS SET XACT_ABORT ON; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN TRANSACTION; DECLARE @Sql AS NVARCHAR (MAX); DECLARE @ParmDefinition AS NVARCHAR (512); IF OBJECT_ID(@tableName) IS NOT NULL BEGIN SET @sql = N'DELETE TOP(@BatchSizeParam) FROM ' + @tableName + N' WITH (TABLOCK) WHERE ResourceTypeId = @ResourceTypeIdParam AND ResourceSurrogateId >= @StartResourceSurrogateIdParam AND ResourceSurrogateId < @EndResourceSurrogateIdParam'; SET @parmDefinition = N'@BatchSizeParam int, @ResourceTypeIdParam smallint, @StartResourceSurrogateIdParam bigint, @EndResourceSurrogateIdParam bigint'; EXECUTE sp_executesql @sql, @parmDefinition, @BatchSizeParam = @batchSize, @ResourceTypeIdParam = @resourceTypeId, @StartResourceSurrogateIdParam = @startResourceSurrogateId, @EndResourceSurrogateIdParam = @endResourceSurrogateId; END COMMIT TRANSACTION; RETURN @@rowcount; GO /************************************************************* Stored procedures for batch delete resources **************************************************************/ -- -- STORED PROCEDURE -- BatchDeleteResources -- -- DESCRIPTION -- Batch delete resources -- -- PARAMETERS -- @resourceTypeId -- * The resoruce type id -- @startResourceSurrogateId -- * The start ResourceSurrogateId -- @endResourceSurrogateId -- * The end ResourceSurrogateId -- @batchSize -- * Max batch size for delete operation CREATE OR ALTER PROCEDURE dbo.BatchDeleteResources @resourceTypeId smallint, @startResourceSurrogateId bigint, @endResourceSurrogateId bigint, @batchSize int AS SET XACT_ABORT ON; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN TRANSACTION; DELETE TOP (@batchSize) dbo.Resource WITH (TABLOCK) WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId >= @startResourceSurrogateId AND ResourceSurrogateId < @endResourceSurrogateId; COMMIT TRANSACTION; RETURN @@rowcount; GO /************************************************************* Stored procedures for batch delete ResourceWriteClaims **************************************************************/ -- -- STORED PROCEDURE -- BatchDeleteResourceWriteClaims -- -- DESCRIPTION -- Batch delete ResourceWriteClaims -- -- PARAMETERS -- @startResourceSurrogateId -- * The start ResourceSurrogateId -- @endResourceSurrogateId -- * The end ResourceSurrogateId -- @batchSize -- * Max batch size for delete operation CREATE OR ALTER PROCEDURE dbo.BatchDeleteResourceWriteClaims @startResourceSurrogateId bigint, @endResourceSurrogateId bigint, @batchSize int AS SET XACT_ABORT ON; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN TRANSACTION; DELETE TOP (@batchSize) dbo.ResourceWriteClaim WITH (TABLOCK) WHERE ResourceSurrogateId >= @startResourceSurrogateId AND ResourceSurrogateId < @endResourceSurrogateId; COMMIT TRANSACTION; RETURN @@rowcount; GO /************************************************************* Stored procedure BulkReindexResources_2 **************************************************************/ -- -- STORED PROCEDURE -- BulkReindexResources_2 -- -- DESCRIPTION -- Updates the search indices of a batch of resources -- -- PARAMETERS -- @resourcesToReindex -- * The type IDs, IDs, eTags and hashes of the resources to reindex -- @resourceWriteClaims -- * Claims on the principal that performed the write -- @compartmentAssignments -- * Compartments that the resource is part of -- @referenceSearchParams -- * Extracted reference search params -- @tokenSearchParams -- * Extracted token search params -- @tokenTextSearchParams -- * The text representation of extracted token search params -- @stringSearchParams -- * Extracted string search params -- @numberSearchParams -- * Extracted number search params -- @quantitySearchParams -- * Extracted quantity search params -- @uriSearchParams -- * Extracted URI search params -- @dateTimeSearchParms -- * Extracted datetime search params -- @referenceTokenCompositeSearchParams -- * Extracted reference$token search params -- @tokenTokenCompositeSearchParams -- * Extracted token$token tokensearch params -- @tokenDateTimeCompositeSearchParams -- * Extracted token$datetime search params -- @tokenQuantityCompositeSearchParams -- * Extracted token$quantity search params -- @tokenStringCompositeSearchParams -- * Extracted token$string search params -- @tokenNumberNumberCompositeSearchParams -- * Extracted token$number$number search params -- -- RETURN VALUE -- The number of resources that failed to reindex due to versioning conflicts. -- CREATE OR ALTER PROCEDURE dbo.BulkReindexResources_2 @resourcesToReindex dbo.BulkReindexResourceTableType_1 READONLY, @resourceWriteClaims dbo.BulkResourceWriteClaimTableType_1 READONLY, @compartmentAssignments dbo.BulkCompartmentAssignmentTableType_1 READONLY, @referenceSearchParams dbo.BulkReferenceSearchParamTableType_1 READONLY, @tokenSearchParams dbo.BulkTokenSearchParamTableType_1 READONLY, @tokenTextSearchParams dbo.BulkTokenTextTableType_1 READONLY, @stringSearchParams dbo.BulkStringSearchParamTableType_2 READONLY, @numberSearchParams dbo.BulkNumberSearchParamTableType_1 READONLY, @quantitySearchParams dbo.BulkQuantitySearchParamTableType_1 READONLY, @uriSearchParams dbo.BulkUriSearchParamTableType_1 READONLY, @dateTimeSearchParms dbo.BulkDateTimeSearchParamTableType_2 READONLY, @referenceTokenCompositeSearchParams dbo.BulkReferenceTokenCompositeSearchParamTableType_1 READONLY, @tokenTokenCompositeSearchParams dbo.BulkTokenTokenCompositeSearchParamTableType_1 READONLY, @tokenDateTimeCompositeSearchParams dbo.BulkTokenDateTimeCompositeSearchParamTableType_1 READONLY, @tokenQuantityCompositeSearchParams dbo.BulkTokenQuantityCompositeSearchParamTableType_1 READONLY, @tokenStringCompositeSearchParams dbo.BulkTokenStringCompositeSearchParamTableType_1 READONLY, @tokenNumberNumberCompositeSearchParams dbo.BulkTokenNumberNumberCompositeSearchParamTableType_1 READONLY AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; DECLARE @computedValues TABLE ( Offset INT NOT NULL, ResourceTypeId SMALLINT NOT NULL, VersionProvided BIGINT NULL, SearchParamHash VARCHAR (64) NOT NULL, ResourceSurrogateId BIGINT NULL, VersionInDatabase BIGINT NULL); INSERT INTO @computedValues SELECT resourceToReindex.Offset, resourceToReindex.ResourceTypeId, resourceToReindex.ETag, resourceToReindex.SearchParamHash, resourceInDB.ResourceSurrogateId, resourceInDB.Version FROM @resourcesToReindex AS resourceToReindex LEFT OUTER JOIN dbo.Resource AS resourceInDB WITH (UPDLOCK, INDEX (IX_Resource_ResourceTypeId_ResourceId)) ON resourceInDB.ResourceTypeId = resourceToReindex.ResourceTypeId AND resourceInDB.ResourceId = resourceToReindex.ResourceId AND resourceInDB.IsHistory = 0; DECLARE @versionDiff AS INT; SET @versionDiff = (SELECT COUNT(*) FROM @computedValues WHERE VersionProvided IS NOT NULL AND VersionProvided <> VersionInDatabase); IF (@versionDiff > 0) BEGIN -- Don't reindex resources that have outdated versions DELETE @computedValues WHERE VersionProvided IS NOT NULL AND VersionProvided <> VersionInDatabase; END -- Update the search parameter hash value in the main resource table UPDATE resourceInDB SET resourceInDB.SearchParamHash = resourceToReindex.SearchParamHash FROM @computedValues AS resourceToReindex INNER JOIN dbo.Resource AS resourceInDB ON resourceInDB.ResourceTypeId = resourceToReindex.ResourceTypeId AND resourceInDB.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; -- First, delete all the indices of the resources to reindex. DELETE searchIndex FROM dbo.ResourceWriteClaim AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.CompartmentAssignment AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.ReferenceSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.TokenSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.TokenText AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.StringSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.UriSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.NumberSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.QuantitySearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.DateTimeSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.ReferenceTokenCompositeSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.TokenTokenCompositeSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.TokenDateTimeCompositeSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.TokenQuantityCompositeSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.TokenStringCompositeSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; DELETE searchIndex FROM dbo.TokenNumberNumberCompositeSearchParam AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.ResourceTypeId = resourceToReindex.ResourceTypeId AND searchIndex.ResourceSurrogateId = resourceToReindex.ResourceSurrogateId; -- Next, insert all the new indices. INSERT INTO dbo.ResourceWriteClaim (ResourceSurrogateId, ClaimTypeId, ClaimValue) SELECT DISTINCT resourceToReindex.ResourceSurrogateId, searchIndex.ClaimTypeId, searchIndex.ClaimValue FROM @resourceWriteClaims AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.CompartmentAssignment (ResourceTypeId, ResourceSurrogateId, CompartmentTypeId, ReferenceResourceId, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.CompartmentTypeId, searchIndex.ReferenceResourceId, 0 FROM @compartmentAssignments AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.ReferenceSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, BaseUri, ReferenceResourceTypeId, ReferenceResourceId, ReferenceResourceVersion, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.BaseUri, searchIndex.ReferenceResourceTypeId, searchIndex.ReferenceResourceId, searchIndex.ReferenceResourceVersion, 0 FROM @referenceSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.TokenSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId, Code, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.SystemId, searchIndex.Code, 0 FROM @tokenSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.TokenText (ResourceTypeId, ResourceSurrogateId, SearchParamId, Text, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.Text, 0 FROM @tokenTextSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.StringSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, Text, TextOverflow, IsHistory, IsMin, IsMax) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.Text, searchIndex.TextOverflow, 0, searchIndex.IsMin, searchIndex.IsMax FROM @stringSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.UriSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, Uri, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.Uri, 0 FROM @uriSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.NumberSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SingleValue, LowValue, HighValue, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.SingleValue, searchIndex.LowValue, searchIndex.HighValue, 0 FROM @numberSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.QuantitySearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId, QuantityCodeId, SingleValue, LowValue, HighValue, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.SystemId, searchIndex.QuantityCodeId, searchIndex.SingleValue, searchIndex.LowValue, searchIndex.HighValue, 0 FROM @quantitySearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.DateTimeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, StartDateTime, EndDateTime, IsLongerThanADay, IsHistory, IsMin, IsMax) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.StartDateTime, searchIndex.EndDateTime, searchIndex.IsLongerThanADay, 0, searchIndex.IsMin, searchIndex.IsMax FROM @dateTimeSearchParms AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.ReferenceTokenCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, BaseUri1, ReferenceResourceTypeId1, ReferenceResourceId1, ReferenceResourceVersion1, SystemId2, Code2, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.BaseUri1, searchIndex.ReferenceResourceTypeId1, searchIndex.ReferenceResourceId1, searchIndex.ReferenceResourceVersion1, searchIndex.SystemId2, searchIndex.Code2, 0 FROM @referenceTokenCompositeSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.TokenTokenCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, SystemId2, Code2, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.SystemId1, searchIndex.Code1, searchIndex.SystemId2, searchIndex.Code2, 0 FROM @tokenTokenCompositeSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.TokenDateTimeCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, StartDateTime2, EndDateTime2, IsLongerThanADay2, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.SystemId1, searchIndex.Code1, searchIndex.StartDateTime2, searchIndex.EndDateTime2, searchIndex.IsLongerThanADay2, 0 FROM @tokenDateTimeCompositeSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.TokenQuantityCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, SystemId2, QuantityCodeId2, LowValue2, HighValue2, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.SystemId1, searchIndex.Code1, searchIndex.SingleValue2, searchIndex.SystemId2, searchIndex.QuantityCodeId2, searchIndex.LowValue2, searchIndex.HighValue2, 0 FROM @tokenQuantityCompositeSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.TokenStringCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, Text2, TextOverflow2, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.SystemId1, searchIndex.Code1, searchIndex.Text2, searchIndex.TextOverflow2, 0 FROM @tokenStringCompositeSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; INSERT INTO dbo.TokenNumberNumberCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, LowValue2, HighValue2, SingleValue3, LowValue3, HighValue3, HasRange, IsHistory) SELECT DISTINCT resourceToReindex.ResourceTypeId, resourceToReindex.ResourceSurrogateId, searchIndex.SearchParamId, searchIndex.SystemId1, searchIndex.Code1, searchIndex.SingleValue2, searchIndex.LowValue2, searchIndex.HighValue2, searchIndex.SingleValue3, searchIndex.LowValue3, searchIndex.HighValue3, searchIndex.HasRange, 0 FROM @tokenNumberNumberCompositeSearchParams AS searchIndex INNER JOIN @computedValues AS resourceToReindex ON searchIndex.Offset = resourceToReindex.Offset; SELECT @versionDiff; COMMIT TRANSACTION; GO /************************************************************* Stored procedures for cancel task **************************************************************/ -- -- STORED PROCEDURE -- CancelTask -- -- DESCRIPTION -- Cancel the task and update task status. -- -- PARAMETERS -- @taskId -- * The ID of the task record -- CREATE OR ALTER PROCEDURE [dbo].[CancelTask] @taskId varchar(64) AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; -- We will timestamp the jobs when we update them to track stale jobs. DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); IF NOT EXISTS (SELECT * FROM [dbo].[TaskInfo] WHERE TaskId = @taskId) BEGIN THROW 50404, 'Task not exist', 1; END UPDATE dbo.TaskInfo SET IsCanceled = 1, HeartbeatDateTime = @heartbeatDateTime WHERE TaskId = @taskId; SELECT TaskId, QueueId, Status, TaskTypeId, RunId, IsCanceled, RetryCount, MaxRetryCount, HeartbeatDateTime, InputData, TaskContext, Result FROM [dbo].[TaskInfo] WHERE TaskId = @taskId; COMMIT TRANSACTION; GO /************************************************************* Stored procedures for capturing and fetching resource changes **************************************************************/ -- -- STORED PROCEDURE -- CaptureResourceChanges -- -- DESCRIPTION -- Inserts resource change data -- -- PARAMETERS -- @isDeleted -- * Whether this resource marks the resource as deleted. -- @version -- * The version of the resource being written -- @resourceId -- * The resource ID -- @resourceTypeId -- * The ID of the resource type -- -- RETURN VALUE -- It does not return a value. -- CREATE OR ALTER PROCEDURE dbo.CaptureResourceChanges @isDeleted bit, @version int, @resourceId varchar(64), @resourceTypeId smallint AS BEGIN /* The CaptureResourceChanges procedure is intended to be called from the UpsertResource_5 procedure, so it does not begin a new transaction here. */ DECLARE @changeType AS SMALLINT; IF (@isDeleted = 1) BEGIN SET @changeType = 2; /* DELETION */ END ELSE BEGIN IF (@version = 1) BEGIN SET @changeType = 0; /* CREATION */ END ELSE BEGIN SET @changeType = 1; /* UPDATE */ END END INSERT INTO dbo.ResourceChangeData (ResourceId, ResourceTypeId, ResourceVersion, ResourceChangeTypeId) VALUES (@resourceId, @resourceTypeId, @version, @changeType); END GO /************************************************************* Stored procedures for complete task with result **************************************************************/ -- -- STORED PROCEDURE -- CompleteTask -- -- DESCRIPTION -- Complete the task and update task result. -- -- PARAMETERS -- @taskId -- * The ID of the task record -- @taskResult -- * The result for the task execution -- @runId -- * Current runId for this exuction of the task -- CREATE OR ALTER PROCEDURE [dbo].[CompleteTask] @taskId varchar(64), @taskResult varchar(max), @runId varchar(50) AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; -- Can only complete task with same runid IF NOT EXISTS (SELECT * FROM [dbo].[TaskInfo] WHERE TaskId = @taskId AND RunId = @runId) BEGIN THROW 50404, 'Task not exist or runid not match', 1; END -- We will timestamp the jobs when we update them to track stale jobs. DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); UPDATE dbo.TaskInfo SET Status = 3, HeartbeatDateTime = @heartbeatDateTime, Result = @taskResult WHERE TaskId = @taskId; SELECT TaskId, QueueId, Status, TaskTypeId, RunId, IsCanceled, RetryCount, MaxRetryCount, HeartbeatDateTime, InputData, TaskContext, Result FROM [dbo].[TaskInfo] WHERE TaskId = @taskId; COMMIT TRANSACTION; GO /************************************************************* Purge partition feature for resource change data **************************************************************/ -- -- STORED PROCEDURE -- ConfigurePartitionOnResourceChanges -- -- DESCRIPTION -- Creates initial partitions for future datetimes on the resource change data table if they do not already exist. -- -- PARAMETERS -- @numberOfFuturePartitionsToAdd -- * The number of partitions to add for future datetimes. -- CREATE OR ALTER PROCEDURE dbo.ConfigurePartitionOnResourceChanges @numberOfFuturePartitionsToAdd int AS BEGIN /* using XACT_ABORT to force a rollback on any error. */ SET XACT_ABORT ON; BEGIN TRANSACTION; /* Creates the partitions for future datetimes on the resource change data table. */ /* Rounds the current datetime to the hour. */ DECLARE @partitionBoundary AS DATETIME2 (7) = DATEADD(hour, DATEDIFF(hour, 0, sysutcdatetime()), 0); /* Finds the highest boundary value. */ DECLARE @startingRightPartitionBoundary AS DATETIME2 (7) = CAST ((SELECT TOP (1) value FROM sys.partition_range_values AS prv INNER JOIN sys.partition_functions AS pf ON pf.function_id = prv.function_id WHERE pf.name = N'PartitionFunction_ResourceChangeData_Timestamp' ORDER BY prv.boundary_id DESC) AS DATETIME2 (7)); /* Adds one due to starting from the current hour. */ DECLARE @numberOfPartitionsToAdd AS INT = @numberOfFuturePartitionsToAdd + 1; WHILE @numberOfPartitionsToAdd > 0 BEGIN /* Checks if a partition exists. */ IF (@startingRightPartitionBoundary < @partitionBoundary) BEGIN ALTER PARTITION SCHEME PartitionScheme_ResourceChangeData_Timestamp NEXT USED [PRIMARY]; ALTER PARTITION FUNCTION PartitionFunction_ResourceChangeData_Timestamp( ) SPLIT RANGE (@partitionBoundary); END /* Adds one hour for the next partition. */ SET @partitionBoundary = DATEADD(hour, 1, @partitionBoundary); SET @numberOfPartitionsToAdd -= 1; END COMMIT TRANSACTION; END GO /************************************************************* Stored procedures for exporting **************************************************************/ -- -- STORED PROCEDURE -- Creates an export job. -- -- DESCRIPTION -- Creates a new row to the ExportJob table, adding a new job to the queue of jobs to be processed. -- -- PARAMETERS -- @id -- * The ID of the export job record -- @hash -- * The SHA256 hash of the export job record ID -- @status -- * The status of the export job -- @rawJobRecord -- * A JSON document -- -- RETURN VALUE -- The row version of the created export job. -- CREATE OR ALTER PROCEDURE dbo.CreateExportJob @id varchar(64), @hash varchar(64), @status varchar(10), @rawJobRecord varchar(max) AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); INSERT INTO dbo.ExportJob (Id, Hash, Status, HeartbeatDateTime, RawJobRecord) VALUES (@id, @hash, @status, @heartbeatDateTime, @rawJobRecord); SELECT CAST (MIN_ACTIVE_ROWVERSION() AS INT); COMMIT TRANSACTION; GO /************************************************************* Stored procedures for reindexing **************************************************************/ -- -- STORED PROCEDURE -- Creates an reindex job. -- -- DESCRIPTION -- Creates a new row to the ReindexJob table, adding a new job to the queue of jobs to be processed. -- -- PARAMETERS -- @id -- * The ID of the reindex job record -- @status -- * The status of the reindex job -- @rawJobRecord -- * A JSON document -- -- RETURN VALUE -- The row version of the created reindex job. -- CREATE OR ALTER PROCEDURE dbo.CreateReindexJob @id varchar(64), @status varchar(10), @rawJobRecord varchar(max) AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); INSERT INTO dbo.ReindexJob (Id, Status, HeartbeatDateTime, RawJobRecord) VALUES (@id, @status, @heartbeatDateTime, @rawJobRecord); SELECT CAST (MIN_ACTIVE_ROWVERSION() AS INT); COMMIT TRANSACTION; GO /************************************************************* Stored procedures for general task **************************************************************/ -- -- STORED PROCEDURE -- CreateTask_2 -- -- DESCRIPTION -- Create task for given task payload. -- -- PARAMETERS -- @taskId -- * The ID of the task record to create -- @queueId -- * The number of seconds that must pass before an export job is considered stale -- @taskTypeId -- * The maximum number of running jobs we can have at once -- @maxRetryCount -- * The maximum number for retry operation -- @inputData -- * Input data payload for the task -- @isUniqueTaskByType -- * Only create task if there's no other active task with same task type id -- CREATE OR ALTER PROCEDURE [dbo].[CreateTask_2] @taskId varchar(64), @queueId varchar(64), @taskTypeId smallint, @maxRetryCount smallint = 3, @inputData varchar(max), @isUniqueTaskByType bit AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); DECLARE @status AS SMALLINT = 1; DECLARE @retryCount AS SMALLINT = 0; DECLARE @isCanceled AS BIT = 0; -- Check if the task already be created IF (@isUniqueTaskByType = 1) BEGIN IF EXISTS (SELECT * FROM [dbo].[TaskInfo] WHERE TaskId = @taskId OR (TaskTypeId = @taskTypeId AND Status <> 3)) BEGIN THROW 50409, 'Task already existed', 1; END END ELSE BEGIN IF EXISTS (SELECT * FROM [dbo].[TaskInfo] WHERE TaskId = @taskId) BEGIN THROW 50409, 'Task already existed', 1; END END -- Create new task INSERT INTO [dbo].[TaskInfo] (TaskId, QueueId, Status, TaskTypeId, IsCanceled, RetryCount, MaxRetryCount, HeartbeatDateTime, InputData) VALUES (@taskId, @queueId, @status, @taskTypeId, @isCanceled, @retryCount, @maxRetryCount, @heartbeatDateTime, @inputData); SELECT TaskId, QueueId, Status, TaskTypeId, RunId, IsCanceled, RetryCount, MaxRetryCount, HeartbeatDateTime, InputData FROM [dbo].[TaskInfo] WHERE TaskId = @taskId; COMMIT TRANSACTION; GO /************************************************************* Stored procedures for disable index **************************************************************/ -- -- STORED PROCEDURE -- DisableIndex -- -- DESCRIPTION -- Stored procedures for disable index -- -- PARAMETERS -- @tableName -- * index table name -- @indexName -- * index name CREATE OR ALTER PROCEDURE [dbo].[DisableIndex] @tableName nvarchar(128), @indexName nvarchar(128) AS SET NOCOUNT ON; SET XACT_ABORT ON; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; DECLARE @IsExecuted AS INT; SET @IsExecuted = 0; BEGIN TRANSACTION; IF EXISTS (SELECT * FROM [sys].[indexes] WHERE name = @indexName AND object_id = OBJECT_ID(@tableName) AND is_disabled = 0) BEGIN DECLARE @Sql AS NVARCHAR (MAX); SET @Sql = N'ALTER INDEX ' + QUOTENAME(@indexName) + N' on ' + @tableName + ' Disable'; EXECUTE sp_executesql @Sql; SET @IsExecuted = 1; END COMMIT TRANSACTION; RETURN @IsExecuted; GO /************************************************************* Stored procedures for get next available task **************************************************************/ -- -- STORED PROCEDURE -- GetNextTask -- -- DESCRIPTION -- Get next available tasks -- -- PARAMETERS -- @queueId -- * The ID of the task record -- @count -- * Batch count for tasks list -- @taskHeartbeatTimeoutThresholdInSeconds -- * Timeout threshold in seconds for heart keep alive CREATE OR ALTER PROCEDURE [dbo].[GetNextTask_2] @queueId varchar(64), @count smallint, @taskHeartbeatTimeoutThresholdInSeconds int = 600 AS SET NOCOUNT ON; SET XACT_ABORT ON; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN TRANSACTION; DECLARE @expirationDateTime AS DATETIME2 (7); SELECT @expirationDateTime = DATEADD(second, -@taskHeartbeatTimeoutThresholdInSeconds, SYSUTCDATETIME()); DECLARE @availableJobs TABLE ( TaskId VARCHAR (64) , QueueId VARCHAR (64) , Status SMALLINT , TaskTypeId SMALLINT , IsCanceled BIT , RetryCount SMALLINT , HeartbeatDateTime DATETIME2 , InputData VARCHAR (MAX), TaskContext VARCHAR (MAX), Result VARCHAR (MAX)); INSERT INTO @availableJobs SELECT TOP (@count) TaskId, QueueId, Status, TaskTypeId, IsCanceled, RetryCount, HeartbeatDateTime, InputData, TaskContext, Result FROM dbo.TaskInfo WHERE (QueueId = @queueId AND (Status = 1 OR (Status = 2 AND HeartbeatDateTime <= @expirationDateTime))) ORDER BY HeartbeatDateTime; DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); UPDATE dbo.TaskInfo SET Status = 2, HeartbeatDateTime = @heartbeatDateTime, RunId = CAST (NEWID() AS NVARCHAR (50)) FROM dbo.TaskInfo AS task INNER JOIN @availableJobs AS availableJob ON task.TaskId = availableJob.TaskId; SELECT task.TaskId, task.QueueId, task.Status, task.TaskTypeId, task.RunId, task.IsCanceled, task.RetryCount, task.MaxRetryCount, task.HeartbeatDateTime, task.InputData, task.TaskContext, task.Result FROM dbo.TaskInfo AS task INNER JOIN @availableJobs AS availableJob ON task.TaskId = availableJob.TaskId; COMMIT TRANSACTION; GO /************************************************************* Stored procedures - HardDeleteResource_2 **************************************************************/ -- -- STORED PROCEDURE -- Deletes a single resource's history, and optionally the resource itself -- -- DESCRIPTION -- Permanently deletes all history data related to a resource. Optionally removes all data, including the current resource version. -- Data remains recoverable from the transaction log, however. -- -- PARAMETERS -- @resourceTypeId -- * The ID of the resource type (See ResourceType table) -- @resourceId -- * The resource ID (must be the same as in the resource itself) -- @keepCurrentVersion -- * When 1, the current resource version kept, else all data is removed. -- CREATE OR ALTER PROCEDURE dbo.HardDeleteResource_2 @resourceTypeId smallint, @resourceId varchar(64), @keepCurrentVersion smallint AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; DECLARE @resourceSurrogateIds TABLE ( ResourceSurrogateId BIGINT NOT NULL); DELETE dbo.Resource OUTPUT deleted.ResourceSurrogateId INTO @resourceSurrogateIds WHERE ResourceTypeId = @resourceTypeId AND ResourceId = @resourceId AND NOT (@keepCurrentVersion = 1 AND IsHistory = 0); DELETE dbo.ResourceWriteClaim WHERE ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.CompartmentAssignment WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.ReferenceSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.TokenSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.TokenText WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.StringSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.UriSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.NumberSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.QuantitySearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.DateTimeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.ReferenceTokenCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.TokenTokenCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.TokenDateTimeCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.TokenQuantityCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.TokenStringCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); DELETE dbo.TokenNumberNumberCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId IN (SELECT ResourceSurrogateId FROM @resourceSurrogateIds); COMMIT TRANSACTION; Go /************************************************************* Stored procedures for rebuild index **************************************************************/ -- -- STORED PROCEDURE -- RebuildIndex -- -- DESCRIPTION -- Stored procedures for rebuild index -- -- PARAMETERS -- @tableName -- * index table name -- @indexName -- * index name CREATE OR ALTER PROCEDURE [dbo].[RebuildIndex] @tableName nvarchar(128), @indexName nvarchar(128) AS SET NOCOUNT ON; SET XACT_ABORT ON; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; DECLARE @IsExecuted AS INT; SET @IsExecuted = 0; BEGIN TRANSACTION; IF EXISTS (SELECT * FROM [sys].[indexes] WHERE name = @indexName AND object_id = OBJECT_ID(@tableName) AND is_disabled = 1) BEGIN DECLARE @Sql AS NVARCHAR (MAX); SET @Sql = N'ALTER INDEX ' + QUOTENAME(@indexName) + N' on ' + @tableName + ' Rebuild'; EXECUTE sp_executesql @Sql; SET @IsExecuted = 1; END COMMIT TRANSACTION; RETURN @IsExecuted; GO /************************************************************* Stored procedures - ReindexResource_2 **************************************************************/ -- -- STORED PROCEDURE -- ReindexResource_2 -- -- DESCRIPTION -- Updates the search indices of a given resource -- -- PARAMETERS -- @resourceTypeId -- * The ID of the resource type (See ResourceType table) -- @resourceId -- * The resource ID (must be the same as the in the resource itself) -- @etag -- * If specified, the version of the resource to update -- @searchParamHash -- * A hash of the resource's latest indexed search parameters -- @resourceWriteClaims -- * Claims on the principal that performed the write -- @compartmentAssignments -- * Compartments that the resource is part of -- @referenceSearchParams -- * Extracted reference search params -- @tokenSearchParams -- * Extracted token search params -- @tokenTextSearchParams -- * The text representation of extracted token search params -- @stringSearchParams -- * Extracted string search params -- @numberSearchParams -- * Extracted number search params -- @quantitySearchParams -- * Extracted quantity search params -- @uriSearchParams -- * Extracted URI search params -- @dateTimeSearchParms -- * Extracted datetime search params -- @referenceTokenCompositeSearchParams -- * Extracted reference$token search params -- @tokenTokenCompositeSearchParams -- * Extracted token$token tokensearch params -- @tokenDateTimeCompositeSearchParams -- * Extracted token$datetime search params -- @tokenQuantityCompositeSearchParams -- * Extracted token$quantity search params -- @tokenStringCompositeSearchParams -- * Extracted token$string search params -- @tokenNumberNumberCompositeSearchParams -- * Extracted token$number$number search params -- CREATE OR ALTER PROCEDURE dbo.ReindexResource_2 @resourceTypeId smallint, @resourceId varchar(64), @eTag int = NULL, @searchParamHash varchar(64), @resourceWriteClaims dbo.BulkResourceWriteClaimTableType_1 READONLY, @compartmentAssignments dbo.BulkCompartmentAssignmentTableType_1 READONLY, @referenceSearchParams dbo.BulkReferenceSearchParamTableType_1 READONLY, @tokenSearchParams dbo.BulkTokenSearchParamTableType_1 READONLY, @tokenTextSearchParams dbo.BulkTokenTextTableType_1 READONLY, @stringSearchParams dbo.BulkStringSearchParamTableType_2 READONLY, @numberSearchParams dbo.BulkNumberSearchParamTableType_1 READONLY, @quantitySearchParams dbo.BulkQuantitySearchParamTableType_1 READONLY, @uriSearchParams dbo.BulkUriSearchParamTableType_1 READONLY, @dateTimeSearchParms dbo.BulkDateTimeSearchParamTableType_2 READONLY, @referenceTokenCompositeSearchParams dbo.BulkReferenceTokenCompositeSearchParamTableType_1 READONLY, @tokenTokenCompositeSearchParams dbo.BulkTokenTokenCompositeSearchParamTableType_1 READONLY, @tokenDateTimeCompositeSearchParams dbo.BulkTokenDateTimeCompositeSearchParamTableType_1 READONLY, @tokenQuantityCompositeSearchParams dbo.BulkTokenQuantityCompositeSearchParamTableType_1 READONLY, @tokenStringCompositeSearchParams dbo.BulkTokenStringCompositeSearchParamTableType_1 READONLY, @tokenNumberNumberCompositeSearchParams dbo.BulkTokenNumberNumberCompositeSearchParamTableType_1 READONLY AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; DECLARE @resourceSurrogateId AS BIGINT; DECLARE @version AS BIGINT; -- This should place a range lock on a row in the IX_Resource_ResourceTypeId_ResourceId nonclustered filtered index SELECT @resourceSurrogateId = ResourceSurrogateId, @version = Version FROM dbo.Resource WITH (UPDLOCK, HOLDLOCK) WHERE ResourceTypeId = @resourceTypeId AND ResourceId = @resourceId AND IsHistory = 0; IF (@etag IS NOT NULL AND @etag <> @version) BEGIN THROW 50412, 'Precondition failed', 1; END UPDATE dbo.Resource SET SearchParamHash = @searchParamHash WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; -- First, delete all the resource's indices. DELETE dbo.ResourceWriteClaim WHERE ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.CompartmentAssignment WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.ReferenceSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.TokenSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.TokenText WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.StringSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.UriSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.NumberSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.QuantitySearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.DateTimeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.ReferenceTokenCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.TokenTokenCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.TokenDateTimeCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.TokenQuantityCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.TokenStringCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; DELETE dbo.TokenNumberNumberCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @resourceSurrogateId; -- Next, insert all the new indices. INSERT INTO dbo.ResourceWriteClaim (ResourceSurrogateId, ClaimTypeId, ClaimValue) SELECT @resourceSurrogateId, ClaimTypeId, ClaimValue FROM @resourceWriteClaims; INSERT INTO dbo.CompartmentAssignment (ResourceTypeId, ResourceSurrogateId, CompartmentTypeId, ReferenceResourceId, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, CompartmentTypeId, ReferenceResourceId, 0 FROM @compartmentAssignments; INSERT INTO dbo.ReferenceSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, BaseUri, ReferenceResourceTypeId, ReferenceResourceId, ReferenceResourceVersion, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, BaseUri, ReferenceResourceTypeId, ReferenceResourceId, ReferenceResourceVersion, 0 FROM @referenceSearchParams; INSERT INTO dbo.TokenSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId, Code, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId, Code, 0 FROM @tokenSearchParams; INSERT INTO dbo.TokenText (ResourceTypeId, ResourceSurrogateId, SearchParamId, Text, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, Text, 0 FROM @tokenTextSearchParams; INSERT INTO dbo.StringSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, Text, TextOverflow, IsHistory, IsMin, IsMax) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, Text, TextOverflow, 0, IsMin, IsMax FROM @stringSearchParams; INSERT INTO dbo.UriSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, Uri, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, Uri, 0 FROM @uriSearchParams; INSERT INTO dbo.NumberSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SingleValue, LowValue, HighValue, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SingleValue, LowValue, HighValue, 0 FROM @numberSearchParams; INSERT INTO dbo.QuantitySearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId, QuantityCodeId, SingleValue, LowValue, HighValue, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId, QuantityCodeId, SingleValue, LowValue, HighValue, 0 FROM @quantitySearchParams; INSERT INTO dbo.DateTimeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, StartDateTime, EndDateTime, IsLongerThanADay, IsHistory, IsMin, IsMax) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, StartDateTime, EndDateTime, IsLongerThanADay, 0, IsMin, IsMax FROM @dateTimeSearchParms; INSERT INTO dbo.ReferenceTokenCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, BaseUri1, ReferenceResourceTypeId1, ReferenceResourceId1, ReferenceResourceVersion1, SystemId2, Code2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, BaseUri1, ReferenceResourceTypeId1, ReferenceResourceId1, ReferenceResourceVersion1, SystemId2, Code2, 0 FROM @referenceTokenCompositeSearchParams; INSERT INTO dbo.TokenTokenCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, SystemId2, Code2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, SystemId2, Code2, 0 FROM @tokenTokenCompositeSearchParams; INSERT INTO dbo.TokenDateTimeCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, StartDateTime2, EndDateTime2, IsLongerThanADay2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, StartDateTime2, EndDateTime2, IsLongerThanADay2, 0 FROM @tokenDateTimeCompositeSearchParams; INSERT INTO dbo.TokenQuantityCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, SystemId2, QuantityCodeId2, LowValue2, HighValue2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, SystemId2, QuantityCodeId2, LowValue2, HighValue2, 0 FROM @tokenQuantityCompositeSearchParams; INSERT INTO dbo.TokenStringCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, Text2, TextOverflow2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, Text2, TextOverflow2, 0 FROM @tokenStringCompositeSearchParams; INSERT INTO dbo.TokenNumberNumberCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, LowValue2, HighValue2, SingleValue3, LowValue3, HighValue3, HasRange, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, LowValue2, HighValue2, SingleValue3, LowValue3, HighValue3, HasRange, 0 FROM @tokenNumberNumberCompositeSearchParams; COMMIT TRANSACTION; GO /************************************************************* Stored procedures for reset task **************************************************************/ -- -- STORED PROCEDURE -- ResetTask -- -- DESCRIPTION -- Reset the task status. -- -- PARAMETERS -- @taskId -- * The ID of the task record -- @runId -- * Current runId for this exuction of the task -- CREATE OR ALTER PROCEDURE [dbo].[ResetTask] @taskId varchar(64), @runId varchar(50), @result varchar(max) AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; -- Can only reset task with same runid DECLARE @retryCount AS SMALLINT; DECLARE @status AS SMALLINT; DECLARE @maxRetryCount AS SMALLINT; SELECT @retryCount = RetryCount, @status = Status, @maxRetryCount = MaxRetryCount FROM [dbo].[TaskInfo] WHERE TaskId = @taskId AND RunId = @runId; -- We will timestamp the jobs when we update them to track stale jobs. IF (@retryCount IS NULL) BEGIN THROW 50404, 'Task not exist or runid not match', 1; END DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); IF (@retryCount >= @maxRetryCount) BEGIN UPDATE dbo.TaskInfo SET Status = 3, HeartbeatDateTime = @heartbeatDateTime, Result = @result WHERE TaskId = @taskId; END ELSE IF (@status <> 3) BEGIN UPDATE dbo.TaskInfo SET Status = 1, HeartbeatDateTime = @heartbeatDateTime, Result = @result, RetryCount = @retryCount + 1 WHERE TaskId = @taskId; END SELECT TaskId, QueueId, Status, TaskTypeId, RunId, IsCanceled, RetryCount, MaxRetryCount, HeartbeatDateTime, InputData, TaskContext, Result FROM [dbo].[TaskInfo] WHERE TaskId = @taskId; COMMIT TRANSACTION; GO /************************************************************* Stored procedures for keepalive task **************************************************************/ -- -- STORED PROCEDURE -- TaskKeepAlive -- -- DESCRIPTION -- Task keep-alive. -- -- PARAMETERS -- @taskId -- * The ID of the task record -- @runId -- * Current runId for this exuction of the task -- CREATE OR ALTER PROCEDURE [dbo].[TaskKeepAlive] @taskId varchar(64), @runId varchar(50) AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; -- Can only update task context with same runid IF NOT EXISTS (SELECT * FROM [dbo].[TaskInfo] WHERE TaskId = @taskId AND RunId = @runId) BEGIN THROW 50404, 'Task not exist or runid not match', 1; END -- We will timestamp the jobs when we update them to track stale jobs. DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); UPDATE dbo.TaskInfo SET HeartbeatDateTime = @heartbeatDateTime WHERE TaskId = @taskId; SELECT TaskId, QueueId, Status, TaskTypeId, RunId, IsCanceled, RetryCount, MaxRetryCount, HeartbeatDateTime, InputData, TaskContext, Result FROM [dbo].[TaskInfo] WHERE TaskId = @taskId; COMMIT TRANSACTION; GO /************************************************************* Stored procedures - UpdateExportJob **************************************************************/ -- -- STORED PROCEDURE -- Updates an export job. -- -- DESCRIPTION -- Modifies an existing job in the ExportJob table. -- -- PARAMETERS -- @id -- * The ID of the export job record -- @status -- * The status of the export job -- @rawJobRecord -- * A JSON document -- @jobVersion -- * The version of the job to update must match this -- -- RETURN VALUE -- The row version of the updated export job. -- CREATE OR ALTER PROCEDURE dbo.UpdateExportJob @id varchar(64), @status varchar(10), @rawJobRecord varchar(max), @jobVersion binary(8) AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; DECLARE @currentJobVersion AS BINARY (8); -- Acquire and hold an update lock on a row in the ExportJob table for the entire transaction. -- This ensures the version check and update occur atomically. SELECT @currentJobVersion = JobVersion FROM dbo.ExportJob WITH (UPDLOCK, HOLDLOCK) WHERE Id = @id; IF (@currentJobVersion IS NULL) BEGIN THROW 50404, 'Export job record not found', 1; END IF (@jobVersion <> @currentJobVersion) BEGIN THROW 50412, 'Precondition failed', 1; END -- We will timestamp the jobs when we update them to track stale jobs. DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); UPDATE dbo.ExportJob SET Status = @status, HeartbeatDateTime = @heartbeatDateTime, RawJobRecord = @rawJobRecord WHERE Id = @id; SELECT @@DBTS; COMMIT TRANSACTION; GO /************************************************************* Stored procedures - UpdateReindexJob **************************************************************/ -- -- STORED PROCEDURE -- Updates a reindex job. -- -- DESCRIPTION -- Modifies an existing job in the ReindexJob table. -- -- PARAMETERS -- @id -- * The ID of the reindex job record -- @status -- * The status of the reindex job -- @rawJobRecord -- * A JSON document -- @jobVersion -- * The version of the job to update must match this -- -- RETURN VALUE -- The row version of the updated reindex job. -- CREATE OR ALTER PROCEDURE dbo.UpdateReindexJob @id varchar(64), @status varchar(10), @rawJobRecord varchar(max), @jobVersion binary(8) AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; DECLARE @currentJobVersion AS BINARY (8); -- Acquire and hold an update lock on a row in the ReindexJob table for the entire transaction. -- This ensures the version check and update occur atomically. SELECT @currentJobVersion = JobVersion FROM dbo.ReindexJob WITH (UPDLOCK, HOLDLOCK) WHERE Id = @id; IF (@currentJobVersion IS NULL) BEGIN THROW 50404, 'Reindex job record not found', 1; END IF (@jobVersion <> @currentJobVersion) BEGIN THROW 50412, 'Precondition failed', 1; END -- We will timestamp the jobs when we update them to track stale jobs. DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); UPDATE dbo.ReindexJob SET Status = @status, HeartbeatDateTime = @heartbeatDateTime, RawJobRecord = @rawJobRecord WHERE Id = @id; SELECT @@DBTS; COMMIT TRANSACTION; GO /************************************************************* Stored procedures for update task context **************************************************************/ -- -- STORED PROCEDURE -- UpdateTaskContext -- -- DESCRIPTION -- Update task context. -- -- PARAMETERS -- @taskId -- * The ID of the task record -- @taskContext -- * The context of the task -- @runId -- * Current runId for this exuction of the task -- CREATE OR ALTER PROCEDURE [dbo].[UpdateTaskContext] @taskId varchar(64), @taskContext varchar(max), @runId varchar(50) AS SET NOCOUNT ON; SET XACT_ABORT ON; BEGIN TRANSACTION; -- Can only update task context with same runid IF NOT EXISTS (SELECT * FROM [dbo].[TaskInfo] WHERE TaskId = @taskId AND RunId = @runId) BEGIN THROW 50404, 'Task not exist or runid not match', 1; END -- We will timestamp the jobs when we update them to track stale jobs. DECLARE @heartbeatDateTime AS DATETIME2 (7) = SYSUTCDATETIME(); UPDATE dbo.TaskInfo SET HeartbeatDateTime = @heartbeatDateTime, TaskContext = @taskContext WHERE TaskId = @taskId; SELECT TaskId, QueueId, Status, TaskTypeId, RunId, IsCanceled, RetryCount, MaxRetryCount, HeartbeatDateTime, InputData, TaskContext, Result FROM [dbo].[TaskInfo] WHERE TaskId = @taskId; COMMIT TRANSACTION; GO /************************************************************* Stored procedures for creating and deleting **************************************************************/ -- -- STORED PROCEDURE -- UpsertResource_5 -- -- DESCRIPTION -- Creates or updates (including marking deleted) a FHIR resource -- -- PARAMETERS -- @baseResourceSurrogateId -- * A bigint to which a value between [0, 80000) is added, forming a unique ResourceSurrogateId. -- * This value should be the current UTC datetime, truncated to millisecond precision, with its 100ns ticks component bitshifted left by 3. -- @resourceTypeId -- * The ID of the resource type (See ResourceType table) -- @resourceId -- * The resource ID (must be the same as the in the resource itself) -- @etag -- * If specified, the version of the resource to update -- @allowCreate -- * If false, an error is thrown if the resource does not already exist -- @isDeleted -- * Whether this resource marks the resource as deleted -- @keepHistory -- * Whether the existing version of the resource should be preserved -- @requestMethod -- * The HTTP method/verb used for the request -- @searchParamHash -- * A hash of the resource's latest indexed search parameters -- @rawResource -- * A compressed UTF16-encoded JSON document -- @resourceWriteClaims -- * Claims on the principal that performed the write -- @compartmentAssignments -- * Compartments that the resource is part of -- @referenceSearchParams -- * Extracted reference search params -- @tokenSearchParams -- * Extracted token search params -- @tokenTextSearchParams -- * The text representation of extracted token search params -- @stringSearchParams -- * Extracted string search params -- @numberSearchParams -- * Extracted number search params -- @quantitySearchParams -- * Extracted quantity search params -- @uriSearchParams -- * Extracted URI search params -- @dateTimeSearchParms -- * Extracted datetime search params -- @referenceTokenCompositeSearchParams -- * Extracted reference$token search params -- @tokenTokenCompositeSearchParams -- * Extracted token$token tokensearch params -- @tokenDateTimeCompositeSearchParams -- * Extracted token$datetime search params -- @tokenQuantityCompositeSearchParams -- * Extracted token$quantity search params -- @tokenStringCompositeSearchParams -- * Extracted token$string search params -- @tokenNumberNumberCompositeSearchParams -- * Extracted token$number$number search params -- @isResourceChangeCaptureEnabled -- * Whether capturing resource change data -- -- RETURN VALUE -- The version of the resource as a result set. Will be empty if no insertion was done. -- CREATE OR ALTER PROCEDURE dbo.UpsertResource_5 @baseResourceSurrogateId bigint, @resourceTypeId smallint, @resourceId varchar(64), @eTag int = NULL, @allowCreate bit, @isDeleted bit, @keepHistory bit, @requestMethod varchar(10), @searchParamHash varchar(64), @rawResource varbinary(max), @resourceWriteClaims dbo.BulkResourceWriteClaimTableType_1 READONLY, @compartmentAssignments dbo.BulkCompartmentAssignmentTableType_1 READONLY, @referenceSearchParams dbo.BulkReferenceSearchParamTableType_1 READONLY, @tokenSearchParams dbo.BulkTokenSearchParamTableType_1 READONLY, @tokenTextSearchParams dbo.BulkTokenTextTableType_1 READONLY, @stringSearchParams dbo.BulkStringSearchParamTableType_2 READONLY, @numberSearchParams dbo.BulkNumberSearchParamTableType_1 READONLY, @quantitySearchParams dbo.BulkQuantitySearchParamTableType_1 READONLY, @uriSearchParams dbo.BulkUriSearchParamTableType_1 READONLY, @dateTimeSearchParms dbo.BulkDateTimeSearchParamTableType_2 READONLY, @referenceTokenCompositeSearchParams dbo.BulkReferenceTokenCompositeSearchParamTableType_1 READONLY, @tokenTokenCompositeSearchParams dbo.BulkTokenTokenCompositeSearchParamTableType_1 READONLY, @tokenDateTimeCompositeSearchParams dbo.BulkTokenDateTimeCompositeSearchParamTableType_1 READONLY, @tokenQuantityCompositeSearchParams dbo.BulkTokenQuantityCompositeSearchParamTableType_1 READONLY, @tokenStringCompositeSearchParams dbo.BulkTokenStringCompositeSearchParamTableType_1 READONLY, @tokenNumberNumberCompositeSearchParams dbo.BulkTokenNumberNumberCompositeSearchParamTableType_1 READONLY, @isResourceChangeCaptureEnabled bit = 0 AS SET NOCOUNT ON; SET XACT_ABORT ON; -- variables for the existing version of the resource that will be replaced BEGIN TRANSACTION; DECLARE @previousResourceSurrogateId AS BIGINT; DECLARE @previousVersion AS BIGINT; DECLARE @previousIsDeleted AS BIT; -- This should place a range lock on a row in the IX_Resource_ResourceTypeId_ResourceId nonclustered filtered index SELECT @previousResourceSurrogateId = ResourceSurrogateId, @previousVersion = Version, @previousIsDeleted = IsDeleted FROM dbo.Resource WITH (UPDLOCK, HOLDLOCK) WHERE ResourceTypeId = @resourceTypeId AND ResourceId = @resourceId AND IsHistory = 0; IF (@etag IS NOT NULL AND @etag <> @previousVersion) BEGIN THROW 50412, 'Precondition failed', 1; END DECLARE @version AS INT; -- the version of the resource being written IF (@previousResourceSurrogateId IS NULL) BEGIN -- There is no previous version of this resource IF (@isDeleted = 1) BEGIN -- Don't bother marking the resource as deleted since it already does not exist. COMMIT TRANSACTION; RETURN; END IF (@etag IS NOT NULL) BEGIN -- You can't update a resource with a specified version if the resource does not exist THROW 50404, 'Resource with specified version not found', 1; END IF (@allowCreate = 0) BEGIN THROW 50405, 'Resource does not exist and create is not allowed', 1; END SET @version = 1; END ELSE BEGIN -- There is a previous version IF (@isDeleted = 1 AND @previousIsDeleted = 1) BEGIN -- Already deleted - don't create a new version COMMIT TRANSACTION; RETURN; END SET @version = @previousVersion + 1; IF (@keepHistory = 1) BEGIN -- Set the existing resource as history UPDATE dbo.Resource SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; -- Set the indexes for this resource as history. -- Note there is no IsHistory column on ResourceWriteClaim since we do not query it. UPDATE dbo.CompartmentAssignment SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.ReferenceSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.TokenSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.TokenText SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.StringSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.UriSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.NumberSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.QuantitySearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.DateTimeSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.ReferenceTokenCompositeSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.TokenTokenCompositeSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.TokenDateTimeCompositeSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.TokenQuantityCompositeSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.TokenStringCompositeSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; UPDATE dbo.TokenNumberNumberCompositeSearchParam SET IsHistory = 1 WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; END ELSE BEGIN -- Not keeping history. Delete the current resource and all associated indexes. DELETE dbo.Resource WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.ResourceWriteClaim WHERE ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.CompartmentAssignment WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.ReferenceSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.TokenSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.TokenText WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.StringSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.UriSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.NumberSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.QuantitySearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.DateTimeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.ReferenceTokenCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.TokenTokenCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.TokenDateTimeCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.TokenQuantityCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.TokenStringCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; DELETE dbo.TokenNumberNumberCompositeSearchParam WHERE ResourceTypeId = @resourceTypeId AND ResourceSurrogateId = @previousResourceSurrogateId; END END DECLARE @resourceSurrogateId AS BIGINT = @baseResourceSurrogateId + ( NEXT VALUE FOR ResourceSurrogateIdUniquifierSequence); DECLARE @isRawResourceMetaSet AS BIT; IF (@version = 1) BEGIN SET @isRawResourceMetaSet = 1; END ELSE BEGIN SET @isRawResourceMetaSet = 0; END INSERT INTO dbo.Resource (ResourceTypeId, ResourceId, Version, IsHistory, ResourceSurrogateId, IsDeleted, RequestMethod, RawResource, IsRawResourceMetaSet, SearchParamHash) VALUES (@resourceTypeId, @resourceId, @version, 0, @resourceSurrogateId, @isDeleted, @requestMethod, @rawResource, @isRawResourceMetaSet, @searchParamHash); INSERT INTO dbo.ResourceWriteClaim (ResourceSurrogateId, ClaimTypeId, ClaimValue) SELECT @resourceSurrogateId, ClaimTypeId, ClaimValue FROM @resourceWriteClaims; INSERT INTO dbo.CompartmentAssignment (ResourceTypeId, ResourceSurrogateId, CompartmentTypeId, ReferenceResourceId, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, CompartmentTypeId, ReferenceResourceId, 0 FROM @compartmentAssignments; INSERT INTO dbo.ReferenceSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, BaseUri, ReferenceResourceTypeId, ReferenceResourceId, ReferenceResourceVersion, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, BaseUri, ReferenceResourceTypeId, ReferenceResourceId, ReferenceResourceVersion, 0 FROM @referenceSearchParams; INSERT INTO dbo.TokenSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId, Code, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId, Code, 0 FROM @tokenSearchParams; INSERT INTO dbo.TokenText (ResourceTypeId, ResourceSurrogateId, SearchParamId, Text, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, Text, 0 FROM @tokenTextSearchParams; INSERT INTO dbo.StringSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, Text, TextOverflow, IsHistory, IsMin, IsMax) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, Text, TextOverflow, 0, IsMin, IsMax FROM @stringSearchParams; INSERT INTO dbo.UriSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, Uri, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, Uri, 0 FROM @uriSearchParams; INSERT INTO dbo.NumberSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SingleValue, LowValue, HighValue, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SingleValue, LowValue, HighValue, 0 FROM @numberSearchParams; INSERT INTO dbo.QuantitySearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId, QuantityCodeId, SingleValue, LowValue, HighValue, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId, QuantityCodeId, SingleValue, LowValue, HighValue, 0 FROM @quantitySearchParams; INSERT INTO dbo.DateTimeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, StartDateTime, EndDateTime, IsLongerThanADay, IsHistory, IsMin, IsMax) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, StartDateTime, EndDateTime, IsLongerThanADay, 0, IsMin, IsMax FROM @dateTimeSearchParms; INSERT INTO dbo.ReferenceTokenCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, BaseUri1, ReferenceResourceTypeId1, ReferenceResourceId1, ReferenceResourceVersion1, SystemId2, Code2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, BaseUri1, ReferenceResourceTypeId1, ReferenceResourceId1, ReferenceResourceVersion1, SystemId2, Code2, 0 FROM @referenceTokenCompositeSearchParams; INSERT INTO dbo.TokenTokenCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, SystemId2, Code2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, SystemId2, Code2, 0 FROM @tokenTokenCompositeSearchParams; INSERT INTO dbo.TokenDateTimeCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, StartDateTime2, EndDateTime2, IsLongerThanADay2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, StartDateTime2, EndDateTime2, IsLongerThanADay2, 0 FROM @tokenDateTimeCompositeSearchParams; INSERT INTO dbo.TokenQuantityCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, SystemId2, QuantityCodeId2, LowValue2, HighValue2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, SystemId2, QuantityCodeId2, LowValue2, HighValue2, 0 FROM @tokenQuantityCompositeSearchParams; INSERT INTO dbo.TokenStringCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, Text2, TextOverflow2, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, Text2, TextOverflow2, 0 FROM @tokenStringCompositeSearchParams; INSERT INTO dbo.TokenNumberNumberCompositeSearchParam (ResourceTypeId, ResourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, LowValue2, HighValue2, SingleValue3, LowValue3, HighValue3, HasRange, IsHistory) SELECT DISTINCT @resourceTypeId, @resourceSurrogateId, SearchParamId, SystemId1, Code1, SingleValue2, LowValue2, HighValue2, SingleValue3, LowValue3, HighValue3, HasRange, 0 FROM @tokenNumberNumberCompositeSearchParams; SELECT @version; IF (@isResourceChangeCaptureEnabled = 1) BEGIN --If the resource change capture feature is enabled, to execute a stored procedure called CaptureResourceChanges to insert resource change data. EXECUTE dbo.CaptureResourceChanges @isDeleted = @isDeleted, @version = @version, @resourceId = @resourceId, @resourceTypeId = @resourceTypeId; END COMMIT TRANSACTION; GO /************************************************************* Stored procedures - UpsertSearchParams **************************************************************/ -- -- STORED PROCEDURE -- UpsertSearchParams -- -- DESCRIPTION -- Given a set of search parameters, creates or updates the parameters. -- -- PARAMETERS -- @searchParams -- * The updated existing search parameters or the new search parameters -- -- RETURN VALUE -- The IDs and URIs of the search parameters that were inserted (not updated). -- CREATE OR ALTER PROCEDURE dbo.UpsertSearchParams @searchParams dbo.SearchParamTableType_1 READONLY AS SET NOCOUNT ON; SET XACT_ABORT ON; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN TRANSACTION; DECLARE @lastUpdated AS DATETIMEOFFSET (7) = SYSDATETIMEOFFSET(); DECLARE @summaryOfChanges TABLE ( Uri VARCHAR (128) COLLATE Latin1_General_100_CS_AS NOT NULL, Action VARCHAR (20) NOT NULL); -- Acquire and hold an exclusive table lock for the entire transaction to prevent parameters from being added or modified during upsert. MERGE INTO dbo.SearchParam WITH (TABLOCKX) AS target USING @searchParams AS source ON target.Uri = source.Uri WHEN MATCHED THEN UPDATE SET Status = source.Status, LastUpdated = @lastUpdated, IsPartiallySupported = source.IsPartiallySupported WHEN NOT MATCHED BY TARGET THEN INSERT (Uri, Status, LastUpdated, IsPartiallySupported) VALUES (source.Uri, source.Status, @lastUpdated, source.IsPartiallySupported) OUTPUT source.Uri, $ACTION INTO @summaryOfChanges; SELECT SearchParamId, SearchParam.Uri FROM dbo.SearchParam AS searchParam INNER JOIN @summaryOfChanges AS upsertedSearchParam ON searchParam.Uri = upsertedSearchParam.Uri WHERE upsertedSearchParam.Action = 'INSERT'; COMMIT TRANSACTION; GO
the_stack
SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; /* ORGANIZATIONS */ INSERT INTO public."platform_organization" ( "createdAt", "updatedAt", id, name, address, city, "zipCode", country, "businessType", "tradeRegistryCompanyNumber", "vatNumber", "signatoryFullName", "signatoryAddress", "signatoryCity", "signatoryZipCode", "signatoryCountry", "signatoryEmail", "signatoryPhoneNumber", status, "blockchainAccountAddress", "blockchainAccountSignedMessage" ) VALUES ( '2020-03-30 09:55:25.962333+02', '2020-03-30 09:55:25.962333+02', 1, 'Issuer Organization', 'Address', 'City', 'Zip code', 'GB', 'Issuer', '1000', 'UK1000', 'Issuer signatory', 'Address', 'City', 'Zip code', 'GB', 'issuer@mailinator.com', 'Phone number', 'Active', '0xd173313a51f8fc37bcf67569b463abd89d81844f', '0x09790e96275e023b965f6b267512b5267bcb18f5b5fdaaf46de899a0f91f2a8d006c7fbaebddf5ad36c116775c961aca3c32525b6dd1529bdee41eee5e9730a71c' ); INSERT INTO public."platform_organization" ( "createdAt", "updatedAt", id, name, address, city, "zipCode", country, "businessType", "tradeRegistryCompanyNumber", "vatNumber", "signatoryFullName", "signatoryAddress", "signatoryCity", "signatoryZipCode", "signatoryCountry", "signatoryEmail", "signatoryPhoneNumber", status, "blockchainAccountAddress", "blockchainAccountSignedMessage" ) VALUES ( '2020-03-30 09:55:25.962333+02', '2020-03-30 09:55:25.962333+02', 2, 'Device Manager Organization', 'Address', 'City', 'Zip code', 'GB', 'Issuer', '1000', 'UK1000', 'Issuer signatory', 'Address', 'City', 'Zip code', 'GB', 'devicemanager@mailinator.com', 'Phone number', 'Active', '0x5b1b89a48c1fb9b6ef7fb77c453f2aaf4b156d45', '0xe6f70568571f331ae431bb4d3249aaf4a01c548ddd6e0a1fbefdd207cf31b13d419f43ff28cf011df17697eb7856c470e361b4239898f53613cacbcc589e5d6a1c' ); INSERT INTO public."platform_organization" ( "createdAt", "updatedAt", id, name, address, city, "zipCode", country, "businessType", "tradeRegistryCompanyNumber", "vatNumber", "signatoryFullName", "signatoryAddress", "signatoryCity", "signatoryZipCode", "signatoryCountry", "signatoryEmail", "signatoryPhoneNumber", status, "blockchainAccountAddress", "blockchainAccountSignedMessage" ) VALUES ( '2020-03-30 09:55:25.962333+02', '2020-03-30 09:55:25.962333+02', 3, 'Device Manager Second Organization', 'Address', 'City', 'Zip code', 'GB', 'Issuer', '1000', 'UK1000', 'Issuer signatory', 'Address', 'City', 'Zip code', 'GB', 'devicemanager2@mailinator.com', 'Phone number', 'Active', '0xfd863c662307fcf0c15f0b9f74f1d06544f19908', '0x617ba0b0b20d547272001e2b1d9a9ef7da24b5e58c2a97767fb2e65a294010906862458c503dbe1a6db0db782cddf9bd98409bdaa0930754b3bd18863c8d99ab1b' ); INSERT INTO public."platform_organization" ( "createdAt", "updatedAt", id, name, address, city, "zipCode", country, "businessType", "tradeRegistryCompanyNumber", "vatNumber", "signatoryFullName", "signatoryAddress", "signatoryCity", "signatoryZipCode", "signatoryCountry", "signatoryEmail", "signatoryPhoneNumber", status, "blockchainAccountAddress", "blockchainAccountSignedMessage" ) VALUES ( '2020-03-30 09:55:25.962333+02', '2020-03-30 09:55:25.962333+02', 4, 'Trader Organization', 'Address', 'City', 'Zip code', 'GB', 'Issuer', '1000', 'UK1000', 'Issuer signatory', 'Address', 'City', 'Zip code', 'GB', 'trader@mailinator.com', 'Phone number', 'Active', '0x7672fa3f8c04abbcbad14d896aad8bedece72d2b', '0xb0a804f410f2934278703eb992e5ba12f9e8b9068b68ff6d1246a56cf52e48677d3648057453d86f4372b2ffd98fa189aee1562d8c564ac62bc416d6cdc474051c' ); INSERT INTO public."platform_organization" ( "createdAt", "updatedAt", id, name, address, city, "zipCode", country, "businessType", "tradeRegistryCompanyNumber", "vatNumber", "signatoryFullName", "signatoryAddress", "signatoryCity", "signatoryZipCode", "signatoryCountry", "signatoryEmail", "signatoryPhoneNumber", status ) VALUES ( '2020-03-30 09:55:25.962333+02', '2020-03-30 09:55:25.962333+02', 5, 'Platform Operator Organization', 'Address', 'City', 'Zip code', 'GB', 'Issuer', '1000', 'UK1000', 'Operator', 'Address', 'City', 'Zip code', 'GB', 'admin@mailinator.com', 'Phone number', 'Active' ); /* USERS */ INSERT INTO public."user" ( "createdAt", "updatedAt", id, title, "firstName", "lastName", email, telephone, password, notifications, rights, "organizationId", status, "kycStatus" ) VALUES ( '2020-03-30 10:08:33.510625+02', '2020-03-30 10:08:33.652639+02', 1, 'Mr', 'Issuer', 'Surname', 'issuer@mailinator.com', '111-111-111', '$2a$08$R5nXlTeycdggncK6ElVtDehsv3ZUcBfyekPv5uYdt6dS76.rcAB.m', 'f', '8', '1', 'Active', 'Passed' ); INSERT INTO public."user" ( "createdAt", "updatedAt", id, title, "firstName", "lastName", email, telephone, password, notifications, rights, "organizationId", status, "kycStatus" ) VALUES ( '2020-03-30 10:08:33.510625+02', '2020-03-30 10:08:33.652639+02', 2, 'Mr', 'Device', 'Manager', 'devicemanager@mailinator.com', '111-111-111', '$2a$08$kBdGu/H3pAHzGupU2qB0NeHIBtRVCOFpLXkQay.LxnjGVm2oFxUSK', 't', '1', '2', 'Active', 'Passed' ); INSERT INTO public."user" ( "createdAt", "updatedAt", id, title, "firstName", "lastName", email, telephone, password, notifications, rights, "organizationId", status, "kycStatus" ) VALUES ( '2020-03-30 10:08:33.510625+02', '2020-03-30 10:08:33.652639+02', 3, 'Mr', 'Device', 'Manager 2', 'devicemanager2@mailinator.com', '111-111-111', '$2a$08$hxfSpn5Y7mZ9MjmcV5QdZemmi3aST8U2RFmod4bjpTZbWcwxAFgaO', 't', '1', '3', 'Active', 'Passed' ); INSERT INTO public."user" ( "createdAt", "updatedAt", id, title, "firstName", "lastName", email, telephone, password, notifications, rights, "organizationId", status, "kycStatus" ) VALUES ( '2020-03-30 10:08:33.510625+02', '2020-03-30 10:08:33.652639+02', 4, 'Mr', 'Trader', 'Surname', 'trader@mailinator.com', '111-111-111', '$2a$08$j8LnGtFdbTfKN5F.0InfdO2gxMWXHbrjWvRziCIl0lRj.kxOKJ/b6', 'f', '1', '4', 'Active', 'Passed' ); INSERT INTO "public"."user"( "createdAt", "updatedAt", "id", "title", "firstName", "lastName", "email", "telephone", "password", "notifications", "rights", "organizationId", "status", "kycStatus" ) VALUES ( '2020-03-30 08:08:33.510625+00', '2020-03-30 08:08:33.652639+00', 5, 'Mr', 'Admin', 'Surname', 'admin@mailinator.com', '111-111-111', '$2a$08$j8LnGtFdbTfKN5F.0InfdO2gxMWXHbrjWvRziCIl0lRj.kxOKJ/b6', 'f', '16', 5, 'Active', 'Passed' ); INSERT INTO "public"."user"( "createdAt", "updatedAt", "id", "title", "firstName", "lastName", "email", "telephone", "password", "notifications", "rights", "organizationId", "status", "kycStatus" ) VALUES ( '2020-03-30 08:08:33.510625+00', '2020-03-30 08:08:33.652639+00', 6, 'Mr', 'Agents', 'Surname', 'agents@mailinator.com', '111-111-111', '$2a$08$j8LnGtFdbTfKN5F.0InfdO2gxMWXHbrjWvRziCIl0lRj.kxOKJ/b6', 'f', '32', 5, 'Active', 'Passed' ); INSERT INTO public.device ( "createdAt", "updatedAt", id, status, "facilityName", "description", images, address, region, province, country, "operationalSince", "capacityInW", "gpsLatitude", "gpsLongitude", timezone, "deviceType", "complianceRegistry", "otherGreenAttributes", "typeOfPublicSupport", "deviceGroup", "smartMeterReads", "externalDeviceIds", "organizationId", "gridOperator" ) VALUES ( '2020-03-30 09:36:02.607206+02', '2020-03-30 09:36:02.607206+02', 1, 'Active', 'Wuthering Heights Windfarm', '', '', '95 Moo 7, Sa Si Mum Sub-district, Kamphaeng Saen District, Nakhon Province 73140', 'Central', 'Nakhon Pathom', 'Thailand', '1514764800', '10000', '14.059500', '99.977800', 'Asia/Bangkok', 'Wind;Onshore', 'I-REC', 'N.A.', 'N.A.', '', '[]', '[{"id":123,"type":"Smart Meter Readings API ID"},{"id":"ABQ123-1","type":"Issuer ID"}]', '2', 'TH-PEA' ); INSERT INTO public.device ( "createdAt", "updatedAt", id, status, "facilityName", "description", images, address, region, province, country, "operationalSince", "capacityInW", "gpsLatitude", "gpsLongitude", timezone, "deviceType", "complianceRegistry", "otherGreenAttributes", "typeOfPublicSupport", "deviceGroup", "smartMeterReads", "externalDeviceIds", "organizationId", "gridOperator" ) VALUES ( '2020-03-30 09:36:02.607206+02', '2020-03-30 09:36:02.607206+02', 2, 'Active', 'Solar Facility A', '', '', 'Phuket', 'South', 'Phuket', 'Thailand', '1483228800', '70000', '15.1739', '101.4928', 'Asia/Bangkok', 'Solar;Photovoltaic;Roof mounted', 'I-REC', 'N.A.', 'N.A.', '', '[]', '[{"id":"ABQ123-2","type":"Issuer ID"}]', '3', 'TH-MEA' ); INSERT INTO public.device ( "createdAt", "updatedAt", id, status, "facilityName", "description", images, address, region, province, country, "operationalSince", "capacityInW", "gpsLatitude", "gpsLongitude", timezone, "deviceType", "complianceRegistry", "otherGreenAttributes", "typeOfPublicSupport", "deviceGroup", "smartMeterReads", "externalDeviceIds", "organizationId", "gridOperator" ) VALUES ( '2020-03-30 09:36:02.607206+02', '2020-03-30 09:36:02.607206+02', 3, 'Active', 'Biomass Facility', '', '', '95 Moo 7, Sa Si Mum Sub-district, Kamphaeng Saen District, Nakhon Province 73140', 'Central', 'Nakhon Pathom', 'Thailand', '1514764800', '10000', '14.059500', '99.977800', 'Asia/Bangkok', 'Solid;Biomass from agriculture;Agricultural products', 'I-REC', 'N.A.', 'N.A.', '', '[]', '[{"id":"ABQ123-3","type":"Issuer ID"}]', '2', 'TH-PEA' ); SELECT setval( pg_get_serial_sequence('public.user', 'id'), ( SELECT MAX("id") FROM public.user ) + 1 ); SELECT setval( pg_get_serial_sequence('public.platform_organization', 'id'), ( SELECT MAX("id") FROM public.platform_organization ) + 1 ); SELECT setval( pg_get_serial_sequence('public.device', 'id'), ( SELECT MAX("id") FROM public.device ) + 1 ); /* DEVICE REGISTRIES */ -- INSERT INTO public."irec_device_registry_device" ( -- "createdAt", -- "updatedAt", -- "id", -- "ownerId", -- "code", -- "name", -- "defaultAccount", -- "deviceType", -- "fuel", -- "countryCode", -- "registrantOrganization", -- "issuer", -- "capacity", -- "commissioningDate", -- "registrationDate", -- "address", -- "latitude", -- "longitude", -- "notes", -- "status", -- "timezone", -- "gridOperator" -- ) -- VALUES ( -- '2020-03-30 09:36:02.607206+02', -- '2020-03-30 09:36:02.607206+02', -- '0e01b315-4f80-4d65-ab9d-84232769ef9d', -- '1', -- 'TESTDEVICE001', -- 'Wuthering Heights Windfarm', -- 'ORG001TRADE001', -- 'TC210', -- 'ES200', -- 'TH', -- 'ORG001', -- 'ISSER001', -- '10000', -- '2020-01-01T00:00:00.000Z', -- '2020-01-02T00:00:00.000Z', -- '95 Moo 7, Sa Si Mum Sub-district, Kamphaeng Saen District, Nakhon Province 73140', -- '14.059500', -- '99.977800', -- 'Notes...', -- 'Active', -- 'Asia/Bangkok', -- 'TH-PEA' -- ); -- INSERT INTO public."device_registry_device" ( -- "createdAt", -- "updatedAt", -- "id", -- "owner", -- "externalRegistryId", -- "smartMeterId", -- "description" -- ) -- VALUES ( -- '2020-03-30 09:36:02.607206+02', -- '2020-03-30 09:36:02.607206+02', -- 'be2df88a-90c2-4dad-9de4-8ef423a7d3f0', -- '1', -- '0e01b315-4f80-4d65-ab9d-84232769ef9d', -- 'METER001', -- 'Wuthering Heights Windfarm description' -- ); -- INSERT INTO public."irec_device_registry_device" ( -- "createdAt", -- "updatedAt", -- "id", -- "ownerId", -- "code", -- "name", -- "defaultAccount", -- "deviceType", -- "fuel", -- "countryCode", -- "registrantOrganization", -- "issuer", -- "capacity", -- "commissioningDate", -- "registrationDate", -- "address", -- "latitude", -- "longitude", -- "notes", -- "status", -- "timezone", -- "gridOperator" -- ) -- VALUES ( -- '2020-03-30 09:36:02.607206+02', -- '2020-03-30 09:36:02.607206+02', -- 'd242c965-81a0-4917-afa1-f5217937afd6', -- '2', -- 'TESTDEVICE002', -- 'Solar Facility A', -- 'ORG002TRADE001', -- 'TC140', -- 'ES100', -- 'TH', -- 'ORG002', -- 'ISSER001', -- '70000', -- '2020-01-01T00:00:00.000Z', -- '2020-01-02T00:00:00.000Z', -- '1 Wind Farm Avenue, Thailand', -- '15.1739', -- '101.4928', -- 'Notes...', -- 'Active', -- 'Asia/Bangkok', -- 'TH-MEA' -- ); -- INSERT INTO public."device_registry_device" ( -- "createdAt", -- "updatedAt", -- "id", -- "owner", -- "externalRegistryId", -- "smartMeterId", -- "description" -- ) -- VALUES ( -- '2020-03-30 09:36:02.607206+02', -- '2020-03-30 09:36:02.607206+02', -- '5c9c6eb4-af2c-4336-8aae-1d579194bb4f', -- '2', -- 'd242c965-81a0-4917-afa1-f5217937afd6', -- 'METER002', -- 'Solar Facility A description' -- ); -- INSERT INTO public."irec_device_registry_device" ( -- "createdAt", -- "updatedAt", -- "id", -- "ownerId", -- "code", -- "name", -- "defaultAccount", -- "deviceType", -- "fuel", -- "countryCode", -- "registrantOrganization", -- "issuer", -- "capacity", -- "commissioningDate", -- "registrationDate", -- "address", -- "latitude", -- "longitude", -- "notes", -- "status", -- "timezone", -- "gridOperator" -- ) -- VALUES ( -- '2020-03-30 09:36:02.607206+02', -- '2020-03-30 09:36:02.607206+02', -- 'd49f7fed-2f79-4d10-8985-41a0c3e9ba03', -- '3', -- 'TESTDEVICE003', -- 'Biomass Facility', -- 'ORG003TRADE001', -- 'TC140', -- 'ES560', -- 'TH', -- 'ORG003', -- 'ISSER001', -- '10000', -- '2020-01-01T00:00:00.000Z', -- '2020-01-02T00:00:00.000Z', -- '95 Moo 7, Sa Si Mum Sub-district, Kamphaeng Saen District, Nakhon Province 73140', -- '14.059500', -- '99.977800', -- 'Notes...', -- 'Active', -- 'Asia/Bangkok', -- 'TH-PEA' -- ); -- INSERT INTO public."device_registry_device" ( -- "createdAt", -- "updatedAt", -- "id", -- "owner", -- "externalRegistryId", -- "smartMeterId", -- "description" -- ) -- VALUES ( -- '2020-03-30 09:36:02.607206+02', -- '2020-03-30 09:36:02.607206+02', -- '7f8fa2f6-d95a-4237-8e53-d9876318e077', -- '3', -- 'd49f7fed-2f79-4d10-8985-41a0c3e9ba03', -- 'METER003', -- 'Biomass Facility description' -- );
the_stack
-- -- XDBPM_UTILITIES should be created under XDBPM -- alter session set current_schema = XDBPM / create or replace type RESOURCE_ID_TABLE as table of RAW(16) / grant execute on RESOURCE_ID_TABLE to public / create or replace public synonym RESOURCE_ID_TABLE for RESOURCE_ID_TABLE / create or replace package XDBPM_UTILITIES authid CURRENT_USER as DEFAULT_FILENAME constant varchar2(2000) := 'ls.xml'; DEFAULT_DIRECTORY constant varchar2(32) := USER; DEFAULT_BATCH_SIZE constant number(10) := 1; /* ** ** Deprecated in XDB_UTILITIES. Moved to XDB_XMLSCHEMA_UTILITIES ** ** procedure renameCollectionTable (XMLTABLE varchar2, XPATH varchar2, COLLECTION_TABLE_PREFIX varchar2); ** function printNestedTables(XML_TABLE varchar2) return XMLType; ** function getDefaultTableName(P_RESOURCE_PATH VARCHAR2) return VARCHAR2; ** */ function getBinaryContent(P_FILE bfile) return BLOB; function getBinaryContent(P_FILENAME varchar2, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY) return BLOB; function getBinaryContent(P_FILE bfile, P_CONTENT IN OUT BLOB) return BLOB; function getBinaryContent(P_FILENAME varchar2, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_CONTENT IN OUT BLOB) return BLOB; function getFileContent(P_FILE bfile, P_CHARSET varchar2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT) return CLOB; function getFileContent(P_FILENAME varchar2, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_CHARSET varchar2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT) return CLOB; function getFileContent(P_FILE bfile, P_CHARSET varchar2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT, P_CONTENT IN OUT CLOB) return CLOB; function getFileContent(P_FILENAME varchar2, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_CHARSET varchar2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT, P_CONTENT IN OUT CLOB) return CLOB; procedure mkdir(P_FOLDER_PATH varchar2,force varchar2 default 'FALSE'); procedure mkdir(P_FOLDER_PATH varchar2,force boolean default FALSE); procedure rmdir(P_FOLDER_PATH varchar2,force varchar2 default 'FALSE'); procedure rmdir(P_FOLDER_PATH varchar2,force boolean default FALSE); procedure uploadFiles(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_TARGET_FOLDER varchar2 default XDB_CONSTANTS.FOLDER_USER_HOME , P_BATCH_SIZE number default DEFAULT_BATCH_SIZE); procedure uploadBinaryFiles(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_TARGET_FOLDER varchar2 default XDB_CONSTANTS.FOLDER_USER_HOME , P_BATCH_SIZE number default DEFAULT_BATCH_SIZE); procedure uploadTextFiles(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_TARGET_FOLDER varchar2 default XDB_CONSTANTS.FOLDER_USER_HOME , P_BATCH_SIZE number default DEFAULT_BATCH_SIZE); procedure uploadXMLFiles(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_TARGET_FOLDER varchar2 default XDB_CONSTANTS.FOLDER_USER_HOME , P_BATCH_SIZE number default DEFAULT_BATCH_SIZE); procedure uploadToXMLTable(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, TABLE_NAME varchar2, P_BATCH_SIZE number default DEFAULT_BATCH_SIZE); procedure updateXMLContent(P_RESOURCE_PATH VARCHAR2, P_CONTENT XMLType); procedure updateBinaryContent(P_RESOURCE_PATH VARCHAR2,P_CONTENT BLOB); procedure updateCharacterContent(P_RESOURCE_PATH VARCHAR2, P_CONTENT VARCHAR2, P_DB_CHARSET VARCHAR2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT); procedure updateCharacterContent(P_RESOURCE_PATH VARCHAR2, P_CONTENT CLOB, P_DB_CHARSET VARCHAR2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT); procedure createHomeFolder; procedure createPublicFolder; procedure setPublicIndexPageContent; function getXMLReference(P_RESOURCE_PATH VARCHAR2) return REF XMLType; function getXMLReferenceByResID(P_RESOID RAW) return REF XMLType; function isCheckedOutByRESID(P_RESOID RAW) return BOOLEAN; function getVersionsByPath(P_RESOURCE_PATH VARCHAR2) return RESOURCE_ID_TABLE pipelined; function getVersionsByResid(RESID RAW) return RESOURCE_ID_TABLE pipelined; function IS_VERSIONED(P_RESOURCE DBMS_XMLDOM.DOMDocument) return BOOLEAN; function IS_VERSIONED(P_RESOURCE XMLTYPE) return BOOLEAN; function IS_VERSIONED(P_RESOURCE_PATH VARCHAR2) return BOOLEAN; procedure UPDATECONTENT(P_RESOURCE_PATH VARCHAR2, P_CONTENT BLOB, P_BLOB_CHARSET VARCHAR2 DEFAULT 'AL32UTF8'); procedure UPDATECONTENT(P_RESOURCE_PATH VARCHAR2, P_CONTENT CLOB); procedure UPDATECONTENT(P_RESOURCE_PATH VARCHAR2, P_CONTENT XMLTYPE); procedure UPLOADRESOURCE(P_RESOURCE_PATH VARCHAR2, P_CONTENT BLOB, P_BLOB_CHARSET VARCHAR2 DEFAULT 'AL32UTF8', P_DUPLICATE_POLICY VARCHAR2 DEFAULT XDB_CONSTANTS.RAISE_ERROR); procedure UPLOADRESOURCE(P_RESOURCE_PATH VARCHAR2, P_CONTENT CLOB, P_DUPLICATE_POLICY VARCHAR2 DEFAULT XDB_CONSTANTS.RAISE_ERROR); procedure UPLOADRESOURCE(P_RESOURCE_PATH VARCHAR2, P_CONTENT XMLTYPE, P_DUPLICATE_POLICY VARCHAR2 DEFAULT XDB_CONSTANTS.RAISE_ERROR); procedure printXMLToFile(P_XML_CONTENT XMLType, P_TARGET_DIRECTORY varchar2, P_FILENAME VARCHAR2); function READ_LINES(P_RESOURCE_PATH VARCHAR2) return XDB.XDB$STRING_LIST_T pipelined; $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN -- Depricated Post 10.2.x : Provided by DBMS_XDB procedure changeOwner(resourcePath varchar2, owner varchar2, recursive boolean default false); $ELSIF DBMS_DB_VERSION.VER_LE_11_1 $THEN function IS_VERSIONED(P_RESOURCE DBMS_XDBRESOURCE.XDBResource) return BOOLEAN; function migrateACL(ACL XMLTYPE) return XMLTYPE; function migrateACLResource(resourceXML XMLTYPE) return XMLTYPE; $ELSE -- Starting 11.2.x function IS_VERSIONED(P_RESOURCE DBMS_XDBRESOURCE.XDBResource) return BOOLEAN; function migrateACL(ACL XMLTYPE) return XMLTYPE; function migrateACLResource(resourceXML XMLTYPE) return XMLTYPE; function serializeResource(xdbResource DBMS_XDBRESOURCE.XDBResource) return xmltype; function serializeEvent(repositoryEvent DBMS_XEVENT.XDBRepositoryEvent) return xmltype; procedure freeResConfig(P_RESCONFIG_PATH VARCHAR2); procedure appendContent(P_RESOURCE_PATH VARCHAR2, P_CONTENT VARCHAR2, P_DB_CHARSET VARCHAR2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT); procedure appendContent(P_RESOURCE_PATH VARCHAR2, P_CONTENT CLOB, P_DB_CHARSET VARCHAR2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT); procedure freeAcl(P_TARGET_ACL VARCHAR2,P_REPLACEMENT_ACL VARCHAR2); $END -- end XDBPM_UTILITIES; / show errors -- create or replace synonym XDB_UTILITIES for XDBPM_UTILITIES / grant execute on XDBPM_UTILITIES to public / create or replace package body XDBPM_UTILITIES as LOAD_ANY_RESOURCE constant number(2) := 0; LOAD_BINARY_RESOURCE constant number(2) := 1; LOAD_CLOB_RESOURCE constant number(2) := 2; LOAD_XML_RESOURCE constant number(2) := 3; LOAD_XML_TABLE constant number(2) := 5; -- -- When using getBinaryContent() or getFileContent() the application must explicitly free the CLOB/BLOB that the function returns -- MIGRATE_ACL_10200_TO_11100 xmlType := XMLTYPE( '<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ACL="http://xmlns.oracle.com/xdb/acl.xsd"> <xsl:output indent="yes" encoding="utf-8"/> <xsl:template match="@*|node()"> <xsl:choose> <xsl:when test="((name()=''ace'') and (namespace-uri()=''http://xmlns.oracle.com/xdb/acl.xsd''))"> <xsl:element name="ACL:ace"> <xsl:copy-of select="ACL:grant"/> <xsl:copy-of select="ACL:principal"/> <xsl:copy-of select="ACL:privilege"/> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>'); -- -- Depricated on XDB_UTILITIES -- procedure renameCollectionTable (XMLTABLE varchar2, XPATH varchar2, COLLECTION_TABLE_PREFIX varchar2) as begin XDB_XMLSCHEMA_UTILITIES.renameCollectionTable(XMLTABLE,XPATH,COLLECTION_TABLE_PREFIX); end; -- function printNestedTables(XML_TABLE varchar2) return XMLType as begin return XDB_XMLSCHEMA_UTILITIES.printNestedTables(XML_TABLE); end; -- function getDefaultTableName(P_RESOURCE_PATH VARCHAR2) return VARCHAR2 as begin return XDB_XMLSCHEMA_UTILITIES.getDefaultTableName(P_RESOURCE_PATH); end; -- -- End deprecated methods -- function getBinaryContent(P_FILE bfile, P_CONTENT IN OUT BLOB) return BLOB is targetFile bfile; dest_offset number := 1; src_offset number := 1; lang_context number := 0; conv_warning number := 0; begin targetFile := P_FILE; if (P_CONTENT is null) then DBMS_LOB.createTemporary(P_CONTENT,true,DBMS_LOB.SESSION); else DBMS_LOB.trim(P_CONTENT,0); end if; DBMS_LOB.fileopen(targetFile, DBMS_LOB.file_readonly); DBMS_LOB.loadBlobfromFile( P_CONTENT, targetFile, DBMS_LOB.getLength(targetFile), dest_offset, src_offset ); DBMS_LOB.fileclose(targetFile); return P_CONTENT; end; -- function getBinaryContent(P_FILE bfile) return BLOB is P_CONTENT BLOB := NULL; begin return getBinaryContent(P_FILE,P_CONTENT); end; -- function getBinaryContent(P_FILENAME varchar2, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_CONTENT IN OUT BLOB) return BLOB is V_FILE bfile := bfilename(P_DIRECTORY,P_FILENAME); begin return getBinaryContent(V_FILE,P_CONTENT); end; -- function getBinaryContent(P_FILENAME varchar2, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY) return BLOB is P_CONTENT BLOB := NULL; begin return getBinaryContent(P_FILENAME,P_DIRECTORY,P_CONTENT); end; -- function getFileContent(P_FILE bfile, P_CHARSET varchar2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT, P_CONTENT IN OUT CLOB) return CLOB is targetFile bfile; dest_offset number := 1; src_offset number := 1; lang_context number := 0; conv_warning number := 0; begin targetFile := P_FILE; if (P_CONTENT is null) then DBMS_LOB.createTemporary(P_CONTENT,true,DBMS_LOB.SESSION); else DBMS_LOB.trim(P_CONTENT,0); end if; DBMS_LOB.fileopen(targetFile, DBMS_LOB.file_readonly); DBMS_LOB.loadClobfromFile( P_CONTENT, targetFile, DBMS_LOB.getLength(targetFile), dest_offset, src_offset, nls_charset_id(P_CHARSET), lang_context, conv_warning ); DBMS_LOB.fileclose(targetFile); return P_CONTENT; end; -- function getFileContent(P_FILE bfile, P_CHARSET varchar2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT ) return CLOB is P_CONTENT CLOB := NULL; begin return getFileContent(P_FILE,P_CHARSET,P_CONTENT); end; -- -- When using getFileContent() the application must explicitly free the CLOB that the function returns -- function getFileContent(P_FILENAME varchar2, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_CHARSET varchar2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT, P_CONTENT IN OUT CLOB) return CLOB is V_FILE bfile := bfilename(P_DIRECTORY,P_FILENAME); begin return getFileContent(V_FILE,P_CHARSET,P_CONTENT); end; -- function getFileContent(P_FILENAME varchar2, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_CHARSET varchar2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT) return CLOB is V_CONTENT CLOB := NULL; begin return getFileContent(P_FILENAME,P_DIRECTORY,P_CHARSET,V_CONTENT); end; -- procedure makeFolders(P_TARGET_FOLDER varchar2,P_FILELIST XMLType) as cursor getFolderList(P_FILELIST XMLType) is select * from ( select extractValue(value(f),'/directory/text()') FOLDERPATH from table(xmlsequence(extract(P_FILELIST,'//directory'))) f ); begin for f in getFolderList(P_FILELIST) loop mkdir(P_TARGET_FOLDER || f.FOLDERPATH, TRUE); end loop; end; -- procedure uploadFileContent(OPERATION NUMBER, P_DIRECTORY VARCHAR2, P_FILELIST VARCHAR2, TARGET VARCHAR2, P_BATCH_SIZE NUMBER) as file_not_found1 exception; PRAGMA EXCEPTION_INIT( file_not_found1 , -22288 ); file_not_found2 exception; PRAGMA EXCEPTION_INIT( file_not_found2 , -22285 ); cursor getFileList(P_FILELIST XMLType) is select * from ( select extractValue(value(f),'/file/text()') FILENAME, nvl(extractValue(value(f),'/file/@replace'),'FALSE') REPLACE, extractValue(value(f),'/file/@encoding') ENCODING, nvl(extractValue(value(f),'/file/@binary'),'FALSE') BINARY from table(xmlsequence(extract(P_FILELIST,'//file'))) f ); REPLACE_MODE boolean; BINARY_MODE boolean; XML_MODE boolean; REPLACE_FILE boolean; FILELIST_CONTENT XMLTYPE; FILE_ENCODING varchar2(32) := DBMS_XDB_CONSTANTS.ENCODING_DEFAULT; CLOB_CONTENT CLOB; BLOB_CONTENT BLOB; XML_CONTENT XMLType; TARGET_RESOURCE VARCHAR2(2000); RES BOOLEAN; STATEMENT VARCHAR2(2000); FILECOUNT pls_integer := 0; begin FILELIST_CONTENT := XMLType(bfilename(P_DIRECTORY,P_FILELIST),nls_charset_id(DBMS_XDB_CONSTANTS.ENCODING_DEFAULT)); if (OPERATION != LOAD_XML_TABLE) then makeFolders(TARGET,FILELIST_CONTENT); end if; REPLACE_MODE := FILELIST_CONTENT.existsNode('/Upload/files[@replace="true"]') = 1; BINARY_MODE := FILELIST_CONTENT.existsNode('/Upload/files[@binary="true"]') = 1; XML_MODE := FILELIST_CONTENT.existsNode('/Upload/files[@xml="true"]') = 1; for f in getFileList(FILELIST_CONTENT) loop TARGET_RESOURCE := TARGET || F.FILENAME; if (F.ENCODING is not null) then FILE_ENCODING := F.ENCODING; else FILE_ENCODING := DBMS_XDB_CONSTANTS.ENCODING_DEFAULT; end if; begin if (OPERATION != LOAD_XML_TABLE) then REPLACE_FILE := (REPLACE_MODE and (f.REPLACE <> 'false')) or (f.REPLACE = 'true'); if (REPLACE_FILE and DBMS_XDB.existsResource(TARGET_RESOURCE)) then DBMS_XDB.deleteResource(TARGET_RESOURCE); end if; if (OPERATION = LOAD_ANY_RESOURCE or OPERATION = LOAD_BINARY_RESOURCE) then res := DBMS_XDB.createResource(TARGET_RESOURCE,bfilename(P_DIRECTORY,F.FILENAME)); end if; if (OPERATION = LOAD_CLOB_RESOURCE) then res := DBMS_XDB.createResource(TARGET_RESOURCE,bfilename(P_DIRECTORY,F.FILENAME),NLS_CHARSET_ID(FILE_ENCODING)); end if; if (OPERATION = LOAD_XML_RESOURCE) then res := DBMS_XDB.createResource(TARGET_RESOURCE,xmltype(bfilename(P_DIRECTORY,F.FILENAME),nls_charset_id(FILE_ENCODING))); end if; else STATEMENT := ' insert into "' || TARGET || '" values ( xmltype ( bfilename(:1,:2), NLS_CHARSET_ID(:3) ) )'; EXECUTE IMMEDIATE STATEMENT USING P_DIRECTORY, F.FILENAME, FILE_ENCODING; end if; filecount := filecount + 1; if (filecount = P_BATCH_SIZE) then filecount := 0; commit; end if; exception when FILE_NOT_FOUND1 then XDB_OUTPUT.createLogFile(TARGET || P_FILELIST || '.log',FALSE); XDB_OUTPUT.writeLogFileEntry('Error opening ' || F.FILENAME); XDB_OUTPUT.logException(); XDB_OUTPUT.flushLogFile(); when FILE_NOT_FOUND2 then XDB_OUTPUT.createLogFile(TARGET || P_FILELIST || '.log',FALSE); XDB_OUTPUT.writeLogFileEntry('Error opening ' || F.FILENAME); XDB_OUTPUT.logException(); XDB_OUTPUT.flushLogFile(); when others then XDB_OUTPUT.createLogFile(TARGET || P_FILELIST || '.log',FALSE); XDB_OUTPUT.writeLogFileEntry('Error processing ' || F.FILENAME); XDB_OUTPUT.logException(); XDB_OUTPUT.flushLogFile(); end; end loop; end; -- procedure uploadBinaryFiles(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_TARGET_FOLDER varchar2 default XDB_CONSTANTS.FOLDER_USER_HOME , P_BATCH_SIZE number default DEFAULT_BATCH_SIZE) as begin uploadFileContent(LOAD_BINARY_RESOURCE,P_DIRECTORY,P_FILELIST,P_TARGET_FOLDER,P_BATCH_SIZE); end; -- procedure uploadTextFiles(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_TARGET_FOLDER varchar2 default XDB_CONSTANTS.FOLDER_USER_HOME , P_BATCH_SIZE number default DEFAULT_BATCH_SIZE) as begin uploadFileContent(LOAD_CLOB_RESOURCE,P_DIRECTORY,P_FILELIST,P_TARGET_FOLDER,P_BATCH_SIZE); end; -- procedure uploadXMLFiles(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_TARGET_FOLDER varchar2 default XDB_CONSTANTS.FOLDER_USER_HOME , P_BATCH_SIZE number default DEFAULT_BATCH_SIZE) as begin uploadFileContent(LOAD_XML_RESOURCE,P_DIRECTORY,P_FILELIST,P_TARGET_FOLDER,P_BATCH_SIZE); end; -- procedure uploadToXMLTable(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, TABLE_NAME varchar2, P_BATCH_SIZE number default DEFAULT_BATCH_SIZE) as begin uploadFileContent(LOAD_XML_TABLE,P_DIRECTORY, P_FILELIST, TABLE_NAME, P_BATCH_SIZE); end; -- -- Legacy Method. -- procedure uploadFiles(P_FILELIST varchar2 default DEFAULT_FILENAME, P_DIRECTORY varchar2 default DEFAULT_DIRECTORY, P_TARGET_FOLDER varchar2 default XDB_CONSTANTS.FOLDER_USER_HOME , P_BATCH_SIZE number default DEFAULT_BATCH_SIZE) as begin uploadFileContent(LOAD_ANY_RESOURCE,P_DIRECTORY,P_FILELIST,P_TARGET_FOLDER,P_BATCH_SIZE); end; -- procedure createFolderTree(P_FOLDER_PATH varchar2) as pathSeperator varchar2(1) := '/'; parentFolderPath varchar2(256); result boolean; begin if (not DBMS_XDB.existsResource(P_FOLDER_PATH)) then if instr(P_FOLDER_PATH,pathSeperator,-1) > 1 then parentFolderPath := substr(P_FOLDER_PATH,1,instr(P_FOLDER_PATH,pathSeperator,-1)-1); createFolderTree(parentFolderPath); end if; result := DBMS_XDB.createFolder(P_FOLDER_PATH); end if; end; -- procedure mkdir(P_FOLDER_PATH varchar2,force boolean default false) as res boolean; begin if (not DBMS_XDB.existsResource(P_FOLDER_PATH)) then if (force) then createFolderTree(P_FOLDER_PATH); else res := DBMS_XDB.createFolder(P_FOLDER_PATH); end if; end if; end; -- procedure mkdir(P_FOLDER_PATH varchar2,force varchar2 default 'FALSE') as f boolean; begin mkdir(P_FOLDER_PATH,upper(force) = 'TRUE'); end; -- procedure deleteFolderTree(P_FOLDER_PATH varchar2) as cursor getSubFolders is select path, extractValue(res,'/Resource/RefCount') REFCOUNT from path_view where under_path(res,1,P_FOLDER_PATH) = 1; begin delete from path_view where under_path(res,1,P_FOLDER_PATH) = 1 and existsNode(res,'/Resource[@Container = "false"]') = 1; -- At this point only subFolders should remain. -- Delete Recursively where REFCOUNT is 1 and remove Link where REFCOUNT > 1 for folder in getSubFolders loop if (folder.REFCOUNT = 1 ) then deleteFolderTree(folder.path); else DBMS_XDB.deleteResource(folder.path); end if; end loop; DBMS_XDB.deleteResource(P_FOLDER_PATH); end; -- procedure rmdir(P_FOLDER_PATH varchar2,force boolean default FALSE) as begin if (force) then deleteFolderTree(P_FOLDER_PATH); else DBMS_XDB.deleteResource(P_FOLDER_PATH); end if; end; -- procedure rmdir(P_FOLDER_PATH varchar2,force varchar2 default 'FALSE') as begin rmdir(P_FOLDER_PATH,upper(force) = 'TRUE'); end; -- procedure cloneXMLContent(P_RESOURCE_PATH varchar2) as begin update resource_view set res = updateXML(res,'/Resource/DisplayName',extract(res,'/Resource/DisplayName')) where equals_path(res, P_RESOURCE_PATH) = 1; end; -- procedure updateXMLContent(P_RESOURCE_PATH varchar2, P_CONTENT xmltype) as defaultTableName varchar2(32); sqlStatement varchar2(1000); begin defaultTableName := XDB_XMLSCHEMA_UTILITIES.getDefaultTableName(P_RESOURCE_PATH); cloneXMLContent(P_RESOURCE_PATH); sqlStatement := 'update "' || defaultTableName || '" d set object_value = :1 where ref(d) = xdb_utilities.getXMLReference(:2)'; execute immediate sqlStatement using P_CONTENT , P_RESOURCE_PATH; end; -- procedure updateBinaryContent(P_RESOURCE_PATH VARCHAR2,P_CONTENT BLOB) is xmllob BLOB; begin update RESOURCE_VIEW set res = updateXML(res,'/Resource/DisplayName/text()',extractValue(res,'/Resource/DisplayName/text()')) where equals_path(res,P_RESOURCE_PATH) = 1; select extractValue(res,'/Resource/XMLLob') into xmllob from RESOURCE_VIEW where equals_path(res,P_RESOURCE_PATH) = 1; dbms_lob.open(xmllob,dbms_lob.lob_readwrite); dbms_lob.trim(xmllob,0); dbms_lob.copy(xmllob,P_CONTENT,dbms_lob.getLength(P_CONTENT),1,1); dbms_lob.close(xmllob); end; -- procedure updateCharacterContent(P_RESOURCE_PATH VARCHAR2, P_CONTENT CLOB, P_DB_CHARSET VARCHAR2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT) is xmllob BLOB; source_offset integer := 1; target_offset integer := 1; warning integer; lang_context integer := 0; begin update RESOURCE_VIEW set res = updateXML(res,'/Resource/DisplayName/text()',extractValue(res,'/Resource/DisplayName/text()')) where equals_path(res,P_RESOURCE_PATH) = 1; select extractValue(res,'/Resource/XMLLob') into xmllob from RESOURCE_VIEW where equals_path(res,P_RESOURCE_PATH) = 1; dbms_lob.open(xmllob,dbms_lob.lob_readwrite); dbms_lob.trim(xmllob,0); dbms_lob.convertToBlob(xmllob,P_CONTENT,dbms_lob.getLength(P_CONTENT),source_offset,target_offset,nls_charset_id(P_DB_CHARSET),lang_context,warning); dbms_lob.close(xmllob); end; -- procedure updateCharacterContent(P_RESOURCE_PATH VARCHAR2, P_CONTENT VARCHAR2, P_DB_CHARSET VARCHAR2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT) as V_CLOB_CONTENT CLOB := P_CONTENT; begin updateCharacterContent(P_RESOURCE_PATH, V_CLOB_CONTENT, P_DB_CHARSET); DBMS_LOB.freeTemporary(V_CLOB_CONTENT); end; -- $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN $ELSIF DBMS_DB_VERSION.VER_LE_11_1 $THEN $ELSE procedure appendContent(P_RESOURCE_PATH VARCHAR2,P_CONTENT CLOB, P_DB_CHARSET VARCHAR2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT) as V_NEW_CONTENT BLOB; V_CURRENT_CONTENT BLOB; V_SOURCE_OFFSET NUMBER := 1; V_DEST_OFFSET NUMBER :=1; V_LANG_CTX NUMBER := 0; V_WARNING NUMBER := 0; begin update RESOURCE_VIEW set res = updateXML(res,'/Resource/DisplayName/text()',extractValue(res,'/Resource/DisplayName/text()')) where equals_path(res,P_RESOURCE_PATH) = 1; /* update RESOURCE_VIEW set res = XMLQUERY( 'declare namespace r = "http://xmlns.oracle.com/xdb/XDBResource.xsd"; (: :) copy $NEWRES := $RES modify ( let $DN := $NEWRES/r:Resource/r:DisplayName return replace value of node $DN with $RES/r:Resource/r:DisplayName/text() ) return $NEWRES' passing RES as "RES" returning content ) where equals_path(res,P_RESOURCE_PATH) = 1; */ select XMLCAST( XMLQUERY( 'declare namespace r="http://xmlns.oracle.com/xdb/XDBResource.xsd"; (: :) /r:Resource/r:XMLLob' passing RES returning CONTENT ) as BLOB ) CONTENT into V_CURRENT_CONTENT from RESOURCE_VIEW where equals_path(RES,P_RESOURCE_PATH) = 1 for update; DBMS_LOB.createTemporary(V_NEW_CONTENT,FALSE); DBMS_LOB.convertToBlob(V_NEW_CONTENT,P_CONTENT,LENGTH(P_CONTENT),V_SOURCE_OFFSET,V_DEST_OFFSET,NLS_CHARSET_ID(P_DB_CHARSET),V_LANG_CTX,V_WARNING); DBMS_LOB.open(V_CURRENT_CONTENT,DBMS_LOB.lob_readwrite); DBMS_LOB.append(V_CURRENT_CONTENT,V_NEW_CONTENT); DBMS_LOB.close(V_CURRENT_CONTENT); DBMS_LOB.freeTemporary(V_NEW_CONTENT); end; -- $END -- procedure appendContent(P_RESOURCE_PATH VARCHAR2, P_CONTENT VARCHAR2, P_DB_CHARSET VARCHAR2 default DBMS_XDB_CONSTANTS.ENCODING_DEFAULT) as V_CLOB_CONTENT CLOB := P_CONTENT; begin appendContent(P_RESOURCE_PATH, V_CLOB_CONTENT, P_DB_CHARSET); DBMS_LOB.freeTemporary(V_CLOB_CONTENT); end; -- function getXMLReferenceByResID(P_RESOID RAW) return REF XMLType as begin return XDB_HELPER.getXMLReferenceByResID(P_RESOID); end; -- function getXMLReference(P_RESOURCE_PATH varchar2) return REF XMLType as begin return XDB_HELPER.getXMLReference(P_RESOURCE_PATH); end; -- function isCheckedOutbyRESID(P_RESOID RAW) return BOOLEAN as begin return XDB_HELPER.isCheckedOutByRESID(P_RESOID); end; -- procedure createHomeFolder as begin XDBPM_UTILITIES_INTERNAL.createHomeFolder(XDB_USERNAME.GET_USERNAME()); end; -- procedure createPublicFolder as begin XDBPM_UTILITIES_INTERNAL.createPublicFolder(XDB_USERNAME.GET_USERNAME()); end; -- function getVersionsByPath(P_RESOURCE_PATH VARCHAR2) return RESOURCE_ID_TABLE pipelined as RESOURCE_ID raw(16); SOURCE_LIST DBMS_XDB_VERSION.RESID_LIST_TYPE; begin select resid into RESOURCE_ID from resource_view where equals_path(res,P_RESOURCE_PATH) = 1; pipe row (RESOURCE_ID); SOURCE_LIST := DBMS_XDB_VERSION.GETPREDECESSORS(P_RESOURCE_PATH); while SOURCE_LIST.COUNT > 0 loop pipe row (SOURCE_LIST(1)); SOURCE_LIST := DBMS_XDB_VERSION.GETPREDSBYRESID(SOURCE_LIST(1)); end loop; return; end; -- function getVersionsByResid(RESID RAW) return RESOURCE_ID_TABLE pipelined as SOURCE_LIST DBMS_XDB_VERSION.RESID_LIST_TYPE; begin pipe row (RESID); SOURCE_LIST := DBMS_XDB_VERSION.GETPREDSBYRESID(RESID); while SOURCE_LIST.COUNT > 0 loop pipe row (SOURCE_LIST(1)); SOURCE_LIST := DBMS_XDB_VERSION.GETPREDSBYRESID(SOURCE_LIST(1)); end loop; return; end; -- procedure printXMLToFile(P_XML_CONTENT XMLType, P_TARGET_DIRECTORY varchar2, P_FILENAME VARCHAR2) is fHandle utl_file.File_Type; xmlText CLOB := P_XML_CONTENT.getClobVal(); xmlTextCopy CLOB; xmlTextSize binary_integer := dbms_lob.getLength(xmlText) + 1; offset binary_integer := 1; buffer varchar2(32767); linesize binary_integer := 32767; byteCount binary_integer; lob1 clob; begin dbms_lob.createtemporary(xmlTextCopy,TRUE); dbms_lob.copy(xmlTextCopy, xmlText, xmlTextSize); fhandle := utl_file.fopen(P_TARGET_DIRECTORY,P_FILENAME,'w',linesize); while (offset < xmlTextSize) loop if (xmlTextSize - offset > linesize) then byteCount := linesize; else byteCount := xmlTextSize - offset; end if; dbms_lob.read(xmlTextCopy, byteCount, offset, buffer); offset := offset + byteCount; utl_file.put(fHandle, buffer); utl_file.fflush(fHandle); end loop; utl_file.new_line(fhandle); utl_file.fclose(fhandle); dbms_lob.freeTemporary(xmlTextCopy); end; -- procedure setPublicIndexPageContent as begin XDBPM_UTILITIES_INTERNAL.setPublicIndexPageContent(XDB_USERNAME.GET_USERNAME()); end; -- $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN -- procedure changeOwner(resourcePath varchar2, owner varchar2, recursive boolean default false) as cursor recursiveOperation is select path from path_view where under_path(res,resourcePath) = 1; begin update resource_view set res = updateXml(res,'/Resource/Owner/text()',owner) where equals_path(res,resourcePath) = 1; if (recursive) then for res in recursiveOperation loop update resource_view set res = updateXml(res,'/Resource/Owner/text()',owner) where equals_path(res,res.path) = 1; end loop; end if; end; -- $ELSE -- function migrateACL(ACL XMLTYPE) return XMLTYPE as newACL XMLTYPE; begin newACL := ACL; if (newACL.isSchemaValid() = 0) then newACL := newACL.TRANSFORM(MIGRATE_ACL_10200_TO_11100); end if; return newACL; end; -- function migrateACLResource(resourceXML XMLTYPE) return XMLTYPE as ACL XMLTYPE; newResource XMLTYPE; begin newResource := resourceXML; ACL := RESOURCEXML.extract('/r:Resource/r:Contents/*', XDB_NAMESPACES.RESOURCE_PREFIX_R); if (ACL.isSchemaValid() = 0) then ACL := ACL.TRANSFORM(MIGRATE_ACL_10200_TO_11100); select UPDATEXML ( RESOURCEXML, '/r:Resource/r:Contents/*', ACL, XDB_NAMESPACES.RESOURCE_PREFIX_R ) into NEWRESOURCE from DUAL; end if; return NEWRESOURCE; end; -- function addResource(root in out DBMS_XMLDOM.DOMELEMENT, xdbResource dbms_xdbResource.XDBResource) return DBMS_XMLDOM.DOMELEMENT as doc dbms_xmldom.DOMDocument; elem dbms_xmldom.DOMElement; text dbms_xmldom.DOMText; begin /* doc := dbms_xdbResource.makeDocument(xdbResource); elem := dbms_xmldom.getDocumentElement(doc); doc := dbms_xmldom.getOwnerDocument(dbms_xmldom.makeNode(root)); elem := dbms_xmldom.makeElement(dbms_xmldom.importNode(doc,dbms_xmldom.makeNode(elem),TRUE)); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(elem))); */ doc := dbms_xmldom.getOwnerDocument(dbms_xmldom.makeNode(root)); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'ACL', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getACL(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'Author', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getAuthor(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'CharacterSet', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getCharacterSet(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'Comment', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getComment(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'ContentType', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getContentType(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'CreationDate', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getCreationDate(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'Creator', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getCreator(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'DisplayName', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getDisplayName(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'Language', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getLanguage(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'ModificationDate', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getModificationDate(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'LastModifier', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getLastModifier(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'Owner', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getOwner(xdbResource))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'RefCount', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xdbResource.getRefCOunt(xdbResource))))); return root; end; -- function serializeResource(xdbResource dbms_xdbResource.XDBResource) return xmltype as userMetadata XMLType; doc dbms_xmldom.DOMDocument; root dbms_xmldom.DOMElement; elem dbms_xmldom.DOMElement; text dbms_xmldom.DOMText; begin doc := dbms_xmldom.newDOMDocument(); root := dbms_xmldom.createElement(doc,'Resource',XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE); root := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(doc),dbms_xmldom.makeNode(root))); root := addResource(root,xdbResource); return dbms_xmldom.getXMLType(doc); end; -- function serializeEvent(repositoryEvent dbms_xevent.XDBRepositoryEvent) return xmltype as doc dbms_xmldom.DOMDocument; root dbms_xmldom.DOMElement; elem dbms_xmldom.DOMElement; text dbms_xmldom.DOMText; textValue varchar2(2000); xdbEvent dbms_xevent.XDBEvent; resourcePath varchar2(700); begin xdbEvent := dbms_xevent.getXDBEvent(repositoryEvent); doc := dbms_xmldom.newDOMDocument(); root := dbms_xmldom.createElement(doc,'ResourceEvent',XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE); root := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(doc),dbms_xmldom.makeNode(root))); DBMS_XMLDOM.SETATTRIBUTE(root,'xmlns',XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'CurrentUser', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xevent.getCurrentUser(xdbEvent))))); /* elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'DAVOwner', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xevent.getDAVOwner(repositoryEvent))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'DAVToken', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xevent.getDAVToken(repositoryEvent))))); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'ExpiryDate', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xevent.getExpiry(repositoryEvent))))); */ elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'EventType', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,dbms_xevent.getEvent(xdbEvent))))); resourcePath := dbms_xevent.getName(dbms_xevent.getPath(repositoryEvent)); elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'resourcePath', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,resourcePath)))); -- Append Resource ID to Payload /* elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'ResourceID', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); text := dbms_xmldom.makeText(dbms_xmldom.appendChild(dbms_xmldom.makeNode(elem),dbms_xmldom.makeNode(dbms_xmldom.createTextNode(doc,DBMS_XDB.getResOID(resourcePath))))); */ -- Append Old Resource details to Payload elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'new', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); elem := addResource(elem, dbms_xevent.getResource(repositoryEvent)); -- Append New Resource details to Payload /* elem := dbms_xmldom.makeElement(dbms_xmldom.appendChild(dbms_xmldom.makeNode(root),dbms_xmldom.makeNode(dbms_xmldom.createElement(doc,'old', XDB_NAMESPACES.RESOURCE_EVENT_NAMESPACE)))); elem := addResource(elem, dbms_xevent.getOldResource(repositoryEvent)); */ return dbms_xmldom.getXMLType(doc); end; -- $END -- -- From a DBMS_XMLDOM.DOMDocument object -- function IS_VERSIONED(P_RESOURCE DBMS_XMLDOM.DOMDocument) return BOOLEAN as V_RESOURCE_ELEMENT DBMS_XMLDOM.DOMElement; begin V_RESOURCE_ELEMENT := DBMS_XMLDOM.getDocumentElement(P_RESOURCE); return DBMS_XMLDOM.hasAttribute(V_RESOURCE_ELEMENT,'VersionID'); end; -- -- From an XMLType object -- function IS_VERSIONED(P_RESOURCE XMLTYPE) return BOOLEAN as begin return IS_VERSIONED(DBMS_XMLDOM.NEWDOMDocument(P_RESOURCE)); end; -- -- From a Path -- function IS_VERSIONED(P_RESOURCE_PATH VARCHAR2) return BOOLEAN as V_RESOURCE XMLType; begin -- $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN select RES into V_RESOURCE from RESOURCE_VIEW where equals_path(res,P_RESOURCE_PATH) = 1; return IS_VERSIONED(V_RESOURCE); $ELSE return IS_VERSIONED(DBMS_XDB.getResource(P_RESOURCE_PATH)); $END -- end; -- $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN $ELSE -- -- From an XDB.XDB$RESOURCE object (11.1.x and Greater) -- function IS_VERSIONED(P_RESOURCE DBMS_XDBRESOURCE.XDBRESOURCE) return BOOLEAN as begin return IS_VERSIONED(DBMS_XDBRESOURCE.makeDocument(P_RESOURCE)); end; -- $END -- $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN $ELSIF DBMS_DB_VERSION.VER_LE_11_1 $THEN $ELSE procedure freeResConfig(P_RESCONFIG_PATH VARCHAR2) as cursor getResConfigUsage(C_RESCONFIG_PATH VARCHAR2) is select RV.ANY_PATH from RESOURCE_VIEW RV, RESOURCE_VIEW rcrv, XMLTable( 'declare default element namespace "http://xmlns.oracle.com/xdb/XDBResource.xsd"; (: :) $R/Resource/RCList/OID' passing rv.RES as "R" columns OBJECT_ID RAW(16) path '.' ) rce where XMLEXists( 'declare default element namespace "http://xmlns.oracle.com/xdb/XDBResource.xsd"; (: :) $R/Resource/RCList' passing rv.RES as "R" ) and equals_path(rcrv.RES,C_RESCONFIG_PATH) = 1 and SYS_OP_R2O( XMLCast( XMLQuery( 'declare default element namespace "http://xmlns.oracle.com/xdb/XDBResource.xsd"; (: :) fn:data($RES/Resource/XMLRef)' passing rcrv.RES as "RES" returning content ) as REF XMLType ) ) = rce.OBJECT_ID; begin for r in getResConfigUsage(P_RESCONFIG_PATH) loop DBMS_RESCONFIG.deleteResConfig(r.ANY_PATH,P_RESCONFIG_PATH,DBMS_RESCONFIG.DELETE_RESOURCE); end loop; end; -- $END -- $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN $ELSIF DBMS_DB_VERSION.VER_LE_11_1 $THEN $ELSE procedure freeAcl(P_TARGET_ACL VARCHAR2,P_REPLACEMENT_ACL VARCHAR2) as cursor getAclUsage(C_ACL_PATH VARCHAR2) is select r.ANY_PATH RESOURCE_PATH from XDB.RESOURCE_VIEW r, RESOURCE_VIEW ar where equals_path(ar.res,C_ACL_PATH) = 1 and XMLCast( XMLQuery( 'declare default element namespace "http://xmlns.oracle.com/xdb/XDBResource.xsd"; (: :) $RES/Resource/ACLOID' passing r.RES as "RES" returning content ) as RAW(16) ) = SYS_OP_R2O( XMLCast( XMLQuery( 'declare default element namespace "http://xmlns.oracle.com/xdb/XDBResource.xsd"; (: :) fn:data($RES/Resource/XMLRef)' passing ar.RES as "RES" returning content ) as REF XMLType ) ); begin for r in getAclUsage(P_TARGET_ACL) loop DBMS_XDB.setAcl(r.RESOURCE_PATH,P_REPLACEMENT_ACL); end loop; end; -- $END -- procedure UPDATECONTENT_IMPL(P_RESOURCE_PATH VARCHAR2, P_CONTENT_BLOB BLOB, P_CONTENT_CLOB CLOB, P_CONTENT_XML XMLTYPE, P_BLOB_CHARSET VARCHAR2 DEFAULT 'AL32UTF8') as V_LOB_LOCATOR BLOB; V_XMLREF REF XMLTYPE; V_CONTENT_BLOB BLOB; V_CONTENT_CLOB CLOB; V_CONTENT_XML XMLTYPE; V_DEST_OFFSET NUMBER(38) := 1; V_SRC_OFFSET NUMBER(38) := 1; V_LANG_CONTEXT NUMBER(38) := 0; V_WARNING NUMBER(38) := 0; V_CHARSET_ID NUMBER(4); V_RESID RAW(16); begin select RESID, extractValue(RES,'/Resource/XMLLob'), extractValue(RES,'/Resource/XMLRef') into V_RESID, V_LOB_LOCATOR, V_XMLREF from RESOURCE_VIEW where equals_path(RES,P_RESOURCE_PATH) = 1 for update; $IF $$DEBUG $THEN if (V_LOB_LOCATOR is NULL) then XDB_OUTPUT.writeDebugFileEntry($$PLSQL_UNIT || '.UPDATECONTENT_IMPL(): Current Lob Locator is NULL',TRUE); end if; if (V_XMLREF is null) then XDB_OUTPUT.writeDebugFileEntry($$PLSQL_UNIT || '.UPDATECONTENT_IMPL(): Current XMLRef is NULL',TRUE); end if; if (P_CONTENT_BLOB is not NULL) then XDB_OUTPUT.writeDebugFileEntry($$PLSQL_UNIT || '.UPDATECONTENT_IMPL(): Revised content is BLOB. Length ' || DBMS_LOB.getLength(P_CONTENT_BLOB),TRUE); end if; if (P_CONTENT_CLOB is not NULL) then XDB_OUTPUT.writeDebugFileEntry($$PLSQL_UNIT || '.UPDATECONTENT_IMPL(): Revised content is CLOB. Length ' || DBMS_LOB.getLength(P_CONTENT_CLOB),TRUE); end if; if (P_CONTENT_XML is not NULL) then XDB_OUTPUT.writeDebugFileEntry($$PLSQL_UNIT || '.UPDATECONTENT_IMPL(): Revised content is XML.',TRUE); end if; $END if (V_XMLREF is not null) then if (P_CONTENT_XML is not null) then updateXMLContent(P_RESOURCE_PATH, P_CONTENT_XML); else if (P_CONTENT_BLOB IS NOT NULL) then V_CONTENT_XML := xmltype(P_CONTENT_BLOB,nls_charset_id(P_BLOB_CHARSET)); else V_CONTENT_XML := xmltype(P_CONTENT_CLOB); end if; updateXMLContent(P_RESOURCE_PATH, V_CONTENT_XML); end if; else if (V_LOB_LOCATOR is NULL) then XDBPM_SYSDBA_INTERNAL.resetLobLocator(V_RESID); end if; update RESOURCE_VIEW set res = updateXML(res,'/Resource/DisplayName/text()',extractValue(res,'/Resource/DisplayName/text()')) where equals_path(res,P_RESOURCE_PATH) = 1; select extractValue(RES,'/Resource/XMLLob') into V_LOB_LOCATOR from RESOURCE_VIEW where equals_path(RES,P_RESOURCE_PATH) = 1; DBMS_LOB.OPEN(V_LOB_LOCATOR,DBMS_LOB.LOB_READWRITE); DBMS_LOB.TRIM(V_LOB_LOCATOR,0); if (P_CONTENT_BLOB IS NOT NULL) then DBMS_LOB.COPY(V_LOB_LOCATOR,P_CONTENT_BLOB,DBMS_LOB.getLength(P_CONTENT_BLOB),1,1); else select NLS_CHARSET_ID(VALUE) into V_CHARSET_ID from NLS_DATABASE_PARAMETERS where PARAMETER = 'NLS_CHARACTERSET'; if (P_CONTENT_CLOB IS NOT NULL) then DBMS_LOB.convertToBlob(V_LOB_LOCATOR,P_CONTENT_CLOB,DBMS_LOB.GETLENGTH(P_CONTENT_CLOB),V_DEST_OFFSET,V_SRC_OFFSET,V_CHARSET_ID,V_LANG_CONTEXT,V_WARNING); else V_CONTENT_CLOB := P_CONTENT_XML.getClobVal(); DBMS_LOB.convertToBlob(V_LOB_LOCATOR,V_CONTENT_CLOB,DBMS_LOB.GETLENGTH(V_CONTENT_CLOB),V_DEST_OFFSET,V_SRC_OFFSET,V_CHARSET_ID,V_LANG_CONTEXT,V_WARNING); end if; end if; DBMS_LOB.CLOSE(V_LOB_LOCATOR); end if; end; -- procedure UPDATECONTENT(P_RESOURCE_PATH VARCHAR2, P_CONTENT BLOB, P_BLOB_CHARSET VARCHAR2 DEFAULT 'AL32UTF8') as begin UPDATECONTENT_IMPL(P_RESOURCE_PATH => P_RESOURCE_PATH, P_CONTENT_BLOB => P_CONTENT, P_BLOB_CHARSET => P_BLOB_CHARSET, P_CONTENT_CLOB => NULL, P_CONTENT_XML => NULL); end; -- procedure UPDATECONTENT(P_RESOURCE_PATH VARCHAR2, P_CONTENT CLOB) as begin UPDATECONTENT_IMPL(P_RESOURCE_PATH => P_RESOURCE_PATH, P_CONTENT_CLOB => P_CONTENT, P_CONTENT_BLOB => NULL, P_BLOB_CHARSET => NULL, P_CONTENT_XML => NULL); end; -- procedure UPDATECONTENT(P_RESOURCE_PATH VARCHAR2, P_CONTENT XMLTYPE) as begin UPDATECONTENT_IMPL(P_RESOURCE_PATH => P_RESOURCE_PATH, P_CONTENT_XML => P_CONTENT, P_CONTENT_BLOB => NULL, P_BLOB_CHARSET => NULL, P_CONTENT_CLOB => NULL); end; -- procedure UPLOADRESOURCE_IMPL(P_RESOURCE_PATH VARCHAR2, P_CONTENT_BLOB BLOB, P_CONTENT_CLOB CLOB, P_CONTENT_XML XMLTYPE, P_BLOB_CHARSET VARCHAR2, P_DUPLICATE_POLICY VARCHAR2 DEFAULT XDB_CONSTANTS.RAISE_ERROR) as /* Positibilites : 1. Resource does not exist or Item Exists and duplicate policy is RAISE; 2. Resource is not versioned - Version it - Check it out - Update it - Check it back in 3. Resource is versioned but is not checked out - Check it out - Update it - Check it back in 4. Resource already checked out - Update it. */ V_RESULT BOOLEAN; V_CURRENTLY_CHECKED_OUT BOOLEAN; V_RESID RAW(16); begin if ((not DBMS_XDB.existsResource(P_RESOURCE_PATH)) or (P_DUPLICATE_POLICY = XDB_CONSTANTS.RAISE_ERROR)) then if (P_CONTENT_BLOB is not NULL) then V_RESULT := DBMS_XDB.createResource(P_RESOURCE_PATH,P_CONTENT_BLOB); else if (P_CONTENT_CLOB is not NULL) then V_RESULT := DBMS_XDB.createResource(P_RESOURCE_PATH,P_CONTENT_CLOB); else V_RESULT := DBMS_XDB.createResource(P_RESOURCE_PATH,P_CONTENT_XML); end if; end if; $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN $ELSE -- -- Corner case - /dev/null type folder where the resource is deleted by a repository event. -- if DBMS_XDB.existsResource(P_RESOURCE_PATH) then DBMS_XDB.refreshContentSize(P_RESOURCE_PATH); end if; $END return; end if; if (P_DUPLICATE_POLICY = XDB_CONSTANTS.OVERWRITE) then UPDATECONTENT_IMPL(P_RESOURCE_PATH,P_CONTENT_BLOB,P_CONTENT_CLOB,P_CONTENT_XML,P_BLOB_CHARSET); -- DBMS_XDBRESOURCE.setContent(V_RESOURCE,P_CONTENT); $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN $ELSE DBMS_XDB.refreshContentSize(P_RESOURCE_PATH); $END end if; if (P_DUPLICATE_POLICY = XDB_CONSTANTS.VERSION) then if (not IS_VERSIONED(P_RESOURCE_PATH)) then V_RESID := DBMS_XDB_VERSION.makeVersioned(P_RESOURCE_PATH); end if; V_CURRENTLY_CHECKED_OUT := TRUE; if (not DBMS_XDB_VERSION.isCheckedOut(P_RESOURCE_PATH)) then V_CURRENTLY_CHECKED_OUT := FALSE; DBMS_XDB_VERSION.checkOut(P_RESOURCE_PATH); end if; -- DBMS_XDBRESOURCE.setContent(V_RESOURCE,P_CONTENT); UPDATECONTENT_IMPL(P_RESOURCE_PATH,P_CONTENT_BLOB,P_CONTENT_CLOB,P_CONTENT_XML,P_BLOB_CHARSET); $IF DBMS_DB_VERSION.VER_LE_10_2 $THEN $ELSE DBMS_XDB.refreshContentSize(P_RESOURCE_PATH); $END if (not V_CURRENTLY_CHECKED_OUT) then V_RESID := DBMS_XDB_VERSION.checkIn(P_RESOURCE_PATH); end if; return; end if; end; -- procedure UPLOADRESOURCE(P_RESOURCE_PATH VARCHAR2, P_CONTENT BLOB, P_BLOB_CHARSET VARCHAR2 DEFAULT 'AL32UTF8', P_DUPLICATE_POLICY VARCHAR2 DEFAULT XDB_CONSTANTS.RAISE_ERROR) as begin UPLOADRESOURCE_IMPL(P_RESOURCE_PATH => P_RESOURCE_PATH, P_DUPLICATE_POLICY => P_DUPLICATE_POLICY, P_CONTENT_BLOB => P_CONTENT, P_BLOB_CHARSET => P_BLOB_CHARSET, P_CONTENT_CLOB => NULL, P_CONTENT_XML => NULL); end; -- procedure UPLOADRESOURCE(P_RESOURCE_PATH VARCHAR2, P_CONTENT CLOB, P_DUPLICATE_POLICY VARCHAR2 DEFAULT XDB_CONSTANTS.RAISE_ERROR) as begin UPLOADRESOURCE_IMPL(P_RESOURCE_PATH => P_RESOURCE_PATH, P_DUPLICATE_POLICY => P_DUPLICATE_POLICY, P_CONTENT_CLOB => P_CONTENT, P_CONTENT_BLOB => NULL, P_BLOB_CHARSET => NULL, P_CONTENT_XML => NULL); end; -- procedure UPLOADRESOURCE(P_RESOURCE_PATH VARCHAR2, P_CONTENT XMLTYPE, P_DUPLICATE_POLICY VARCHAR2 DEFAULT XDB_CONSTANTS.RAISE_ERROR) as begin UPLOADRESOURCE_IMPL(P_RESOURCE_PATH => P_RESOURCE_PATH, P_DUPLICATE_POLICY => P_DUPLICATE_POLICY, P_CONTENT_XML => P_CONTENT, P_CONTENT_BLOB => NULL, P_BLOB_CHARSET => NULL, P_CONTENT_CLOB => NULL); end; -- function READ_LINES(P_RESOURCE_PATH VARCHAR2) return XDB.XDB$STRING_LIST_T pipelined as V_CONTENT CLOB := XDBURITYPE(P_RESOURCE_PATH).getClob(); V_CONTENT_LENGTH PLS_INTEGER := DBMS_LOB.getLength(V_CONTENT); V_AMOUNT PLS_INTEGER := 32767; V_OFFSET PLS_INTEGER := 1; V_BUFFER VARCHAR2(32767); V_BUFFER_LENGTH PLS_INTEGER; V_BUFFER_OFFSET PLS_INTEGER := 1; V_NEWLINE_INDEX PLS_INTEGER := 0; V_NEXT_LINE VARCHAR2(32767); begin while (V_OFFSET < V_CONTENT_LENGTH ) loop DBMS_LOB.READ(V_CONTENT,V_AMOUNT,V_OFFSET,V_BUFFER); V_OFFSET := V_OFFSET + V_AMOUNT; V_BUFFER_LENGTH := V_AMOUNT; V_AMOUNT := 32767; V_BUFFER_OFFSET := 1; V_NEWLINE_INDEX := INSTR(V_BUFFER,CHR(10),V_BUFFER_OFFSET); WHILE (V_NEWLINE_INDEX > 0) loop V_NEXT_LINE := V_NEXT_LINE || SUBSTR(V_BUFFER,V_BUFFER_OFFSET,(V_NEWLINE_INDEX-V_BUFFER_OFFSET)); pipe row (V_NEXT_LINE); V_NEXT_LINE := NULL; V_BUFFER_OFFSET := V_NEWLINE_INDEX + 1; if (SUBSTR(V_BUFFER,V_BUFFER_OFFSET,1) = CHR(13)) then V_BUFFER_OFFSET := V_BUFFER_OFFSET + 1; end if; V_NEWLINE_INDEX := INSTR(V_BUFFER,CHR(10),V_BUFFER_OFFSET); end loop; V_NEXT_LINE := SUBSTR(V_BUFFER,V_BUFFER_OFFSET); end loop; if (length(V_NEXT_LINE) > 0) then pipe row (V_NEXT_LINE); end if; end; -- end XDBPM_UTILITIES; / show errors -- alter SESSION SET CURRENT_SCHEMA = SYS / --
the_stack
-- -- PostgreSQL database dump -- SET client_encoding = 'UTF8'; SET standard_conforming_strings = off; SET check_function_bodies = false; SET client_min_messages = warning; SET escape_string_warning = off; SET search_path = public, pg_catalog; -- -- Name: actor_actor_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('actor_actor_id_seq', 200, true); -- -- Name: category_category_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('category_category_id_seq', 16, true); -- -- Name: film_film_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('film_film_id_seq', 1000, true); -- -- Name: address_address_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('address_address_id_seq', 605, true); -- -- Name: city_city_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('city_city_id_seq', 600, true); -- -- Name: country_country_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('country_country_id_seq', 109, true); -- -- Name: customer_customer_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('customer_customer_id_seq', 599, true); -- -- Name: inventory_inventory_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('inventory_inventory_id_seq', 4581, true); -- -- Name: language_language_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('language_language_id_seq', 6, true); -- -- Name: payment_payment_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('payment_payment_id_seq', 32098, true); -- -- Name: rental_rental_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('rental_rental_id_seq', 16049, true); -- -- Name: staff_staff_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('staff_staff_id_seq', 2, true); -- -- Name: store_store_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('store_store_id_seq', 2, true); -- -- Data for Name: actor; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE actor DISABLE TRIGGER ALL; INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (1, 'PENELOPE', 'GUINESS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (2, 'NICK', 'WAHLBERG', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (3, 'ED', 'CHASE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (4, 'JENNIFER', 'DAVIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (5, 'JOHNNY', 'LOLLOBRIGIDA', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (6, 'BETTE', 'NICHOLSON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (7, 'GRACE', 'MOSTEL', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (8, 'MATTHEW', 'JOHANSSON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (9, 'JOE', 'SWANK', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (10, 'CHRISTIAN', 'GABLE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (11, 'ZERO', 'CAGE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (12, 'KARL', 'BERRY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (13, 'UMA', 'WOOD', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (14, 'VIVIEN', 'BERGEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (15, 'CUBA', 'OLIVIER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (16, 'FRED', 'COSTNER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (17, 'HELEN', 'VOIGHT', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (18, 'DAN', 'TORN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (19, 'BOB', 'FAWCETT', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (20, 'LUCILLE', 'TRACY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (21, 'KIRSTEN', 'PALTROW', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (22, 'ELVIS', 'MARX', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (23, 'SANDRA', 'KILMER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (24, 'CAMERON', 'STREEP', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (25, 'KEVIN', 'BLOOM', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (26, 'RIP', 'CRAWFORD', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (27, 'JULIA', 'MCQUEEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (28, 'WOODY', 'HOFFMAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (29, 'ALEC', 'WAYNE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (30, 'SANDRA', 'PECK', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (31, 'SISSY', 'SOBIESKI', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (32, 'TIM', 'HACKMAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (33, 'MILLA', 'PECK', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (34, 'AUDREY', 'OLIVIER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (35, 'JUDY', 'DEAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (36, 'BURT', 'DUKAKIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (37, 'VAL', 'BOLGER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (38, 'TOM', 'MCKELLEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (39, 'GOLDIE', 'BRODY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (40, 'JOHNNY', 'CAGE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (41, 'JODIE', 'DEGENERES', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (42, 'TOM', 'MIRANDA', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (43, 'KIRK', 'JOVOVICH', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (44, 'NICK', 'STALLONE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (45, 'REESE', 'KILMER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (46, 'PARKER', 'GOLDBERG', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (47, 'JULIA', 'BARRYMORE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (48, 'FRANCES', 'DAY-LEWIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (49, 'ANNE', 'CRONYN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (50, 'NATALIE', 'HOPKINS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (51, 'GARY', 'PHOENIX', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (52, 'CARMEN', 'HUNT', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (53, 'MENA', 'TEMPLE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (54, 'PENELOPE', 'PINKETT', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (55, 'FAY', 'KILMER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (56, 'DAN', 'HARRIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (57, 'JUDE', 'CRUISE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (58, 'CHRISTIAN', 'AKROYD', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (59, 'DUSTIN', 'TAUTOU', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (60, 'HENRY', 'BERRY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (61, 'CHRISTIAN', 'NEESON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (62, 'JAYNE', 'NEESON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (63, 'CAMERON', 'WRAY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (64, 'RAY', 'JOHANSSON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (65, 'ANGELA', 'HUDSON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (66, 'MARY', 'TANDY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (67, 'JESSICA', 'BAILEY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (68, 'RIP', 'WINSLET', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (69, 'KENNETH', 'PALTROW', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (70, 'MICHELLE', 'MCCONAUGHEY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (71, 'ADAM', 'GRANT', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (72, 'SEAN', 'WILLIAMS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (73, 'GARY', 'PENN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (74, 'MILLA', 'KEITEL', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (75, 'BURT', 'POSEY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (76, 'ANGELINA', 'ASTAIRE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (77, 'CARY', 'MCCONAUGHEY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (78, 'GROUCHO', 'SINATRA', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (79, 'MAE', 'HOFFMAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (80, 'RALPH', 'CRUZ', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (81, 'SCARLETT', 'DAMON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (82, 'WOODY', 'JOLIE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (83, 'BEN', 'WILLIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (84, 'JAMES', 'PITT', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (85, 'MINNIE', 'ZELLWEGER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (86, 'GREG', 'CHAPLIN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (87, 'SPENCER', 'PECK', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (88, 'KENNETH', 'PESCI', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (89, 'CHARLIZE', 'DENCH', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (90, 'SEAN', 'GUINESS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (91, 'CHRISTOPHER', 'BERRY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (92, 'KIRSTEN', 'AKROYD', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (93, 'ELLEN', 'PRESLEY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (94, 'KENNETH', 'TORN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (95, 'DARYL', 'WAHLBERG', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (96, 'GENE', 'WILLIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (97, 'MEG', 'HAWKE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (98, 'CHRIS', 'BRIDGES', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (99, 'JIM', 'MOSTEL', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (100, 'SPENCER', 'DEPP', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (101, 'SUSAN', 'DAVIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (102, 'WALTER', 'TORN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (103, 'MATTHEW', 'LEIGH', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (104, 'PENELOPE', 'CRONYN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (105, 'SIDNEY', 'CROWE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (106, 'GROUCHO', 'DUNST', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (107, 'GINA', 'DEGENERES', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (108, 'WARREN', 'NOLTE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (109, 'SYLVESTER', 'DERN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (110, 'SUSAN', 'DAVIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (111, 'CAMERON', 'ZELLWEGER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (112, 'RUSSELL', 'BACALL', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (113, 'MORGAN', 'HOPKINS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (114, 'MORGAN', 'MCDORMAND', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (115, 'HARRISON', 'BALE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (116, 'DAN', 'STREEP', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (117, 'RENEE', 'TRACY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (118, 'CUBA', 'ALLEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (119, 'WARREN', 'JACKMAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (120, 'PENELOPE', 'MONROE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (121, 'LIZA', 'BERGMAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (122, 'SALMA', 'NOLTE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (123, 'JULIANNE', 'DENCH', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (124, 'SCARLETT', 'BENING', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (125, 'ALBERT', 'NOLTE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (126, 'FRANCES', 'TOMEI', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (127, 'KEVIN', 'GARLAND', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (128, 'CATE', 'MCQUEEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (129, 'DARYL', 'CRAWFORD', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (130, 'GRETA', 'KEITEL', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (131, 'JANE', 'JACKMAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (132, 'ADAM', 'HOPPER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (133, 'RICHARD', 'PENN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (134, 'GENE', 'HOPKINS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (135, 'RITA', 'REYNOLDS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (136, 'ED', 'MANSFIELD', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (137, 'MORGAN', 'WILLIAMS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (138, 'LUCILLE', 'DEE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (139, 'EWAN', 'GOODING', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (140, 'WHOOPI', 'HURT', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (141, 'CATE', 'HARRIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (142, 'JADA', 'RYDER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (143, 'RIVER', 'DEAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (144, 'ANGELA', 'WITHERSPOON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (145, 'KIM', 'ALLEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (146, 'ALBERT', 'JOHANSSON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (147, 'FAY', 'WINSLET', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (148, 'EMILY', 'DEE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (149, 'RUSSELL', 'TEMPLE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (150, 'JAYNE', 'NOLTE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (151, 'GEOFFREY', 'HESTON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (152, 'BEN', 'HARRIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (153, 'MINNIE', 'KILMER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (154, 'MERYL', 'GIBSON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (155, 'IAN', 'TANDY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (156, 'FAY', 'WOOD', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (157, 'GRETA', 'MALDEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (158, 'VIVIEN', 'BASINGER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (159, 'LAURA', 'BRODY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (160, 'CHRIS', 'DEPP', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (161, 'HARVEY', 'HOPE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (162, 'OPRAH', 'KILMER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (163, 'CHRISTOPHER', 'WEST', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (164, 'HUMPHREY', 'WILLIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (165, 'AL', 'GARLAND', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (166, 'NICK', 'DEGENERES', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (167, 'LAURENCE', 'BULLOCK', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (168, 'WILL', 'WILSON', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (169, 'KENNETH', 'HOFFMAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (170, 'MENA', 'HOPPER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (171, 'OLYMPIA', 'PFEIFFER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (172, 'GROUCHO', 'WILLIAMS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (173, 'ALAN', 'DREYFUSS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (174, 'MICHAEL', 'BENING', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (175, 'WILLIAM', 'HACKMAN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (176, 'JON', 'CHASE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (177, 'GENE', 'MCKELLEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (178, 'LISA', 'MONROE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (179, 'ED', 'GUINESS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (180, 'JEFF', 'SILVERSTONE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (181, 'MATTHEW', 'CARREY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (182, 'DEBBIE', 'AKROYD', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (183, 'RUSSELL', 'CLOSE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (184, 'HUMPHREY', 'GARLAND', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (185, 'MICHAEL', 'BOLGER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (186, 'JULIA', 'ZELLWEGER', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (187, 'RENEE', 'BALL', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (188, 'ROCK', 'DUKAKIS', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (189, 'CUBA', 'BIRCH', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (190, 'AUDREY', 'BAILEY', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (191, 'GREGORY', 'GOODING', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (192, 'JOHN', 'SUVARI', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (193, 'BURT', 'TEMPLE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (194, 'MERYL', 'ALLEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (195, 'JAYNE', 'SILVERSTONE', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (196, 'BELA', 'WALKEN', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (197, 'REESE', 'WEST', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (198, 'MARY', 'KEITEL', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (199, 'JULIA', 'FAWCETT', '2006-02-15 09:34:33'); INSERT INTO actor (actor_id, first_name, last_name, last_update) VALUES (200, 'THORA', 'TEMPLE', '2006-02-15 09:34:33'); ALTER TABLE actor ENABLE TRIGGER ALL; -- -- Data for Name: address; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE address DISABLE TRIGGER ALL; ALTER TABLE address ENABLE TRIGGER ALL; -- -- Data for Name: category; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE category DISABLE TRIGGER ALL; INSERT INTO category (category_id, name, last_update) VALUES (1, 'Action', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (2, 'Animation', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (3, 'Children', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (4, 'Classics', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (5, 'Comedy', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (6, 'Documentary', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (7, 'Drama', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (8, 'Family', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (9, 'Foreign', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (10, 'Games', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (11, 'Horror', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (12, 'Music', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (13, 'New', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (14, 'Sci-Fi', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (15, 'Sports', '2006-02-15 09:46:27'); INSERT INTO category (category_id, name, last_update) VALUES (16, 'Travel', '2006-02-15 09:46:27'); ALTER TABLE category ENABLE TRIGGER ALL; -- -- Data for Name: city; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE city DISABLE TRIGGER ALL; ALTER TABLE city ENABLE TRIGGER ALL; -- -- Data for Name: country; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE country DISABLE TRIGGER ALL; INSERT INTO country (country_id, country, last_update) VALUES (1, 'Afghanistan', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (2, 'Algeria', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (3, 'American Samoa', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (4, 'Angola', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (5, 'Anguilla', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (6, 'Argentina', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (7, 'Armenia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (8, 'Australia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (9, 'Austria', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (10, 'Azerbaijan', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (11, 'Bahrain', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (12, 'Bangladesh', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (13, 'Belarus', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (14, 'Bolivia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (15, 'Brazil', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (16, 'Brunei', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (17, 'Bulgaria', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (18, 'Cambodia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (19, 'Cameroon', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (20, 'Canada', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (21, 'Chad', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (22, 'Chile', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (23, 'China', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (24, 'Colombia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (25, 'Congo, The Democratic Republic of the', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (26, 'Czech Republic', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (27, 'Dominican Republic', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (28, 'Ecuador', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (29, 'Egypt', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (30, 'Estonia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (31, 'Ethiopia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (32, 'Faroe Islands', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (33, 'Finland', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (34, 'France', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (35, 'French Guiana', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (36, 'French Polynesia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (37, 'Gambia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (38, 'Germany', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (39, 'Greece', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (40, 'Greenland', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (41, 'Holy See (Vatican City State)', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (42, 'Hong Kong', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (43, 'Hungary', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (44, 'India', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (45, 'Indonesia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (46, 'Iran', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (47, 'Iraq', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (48, 'Israel', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (49, 'Italy', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (50, 'Japan', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (51, 'Kazakstan', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (52, 'Kenya', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (53, 'Kuwait', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (54, 'Latvia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (55, 'Liechtenstein', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (56, 'Lithuania', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (57, 'Madagascar', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (58, 'Malawi', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (59, 'Malaysia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (60, 'Mexico', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (61, 'Moldova', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (62, 'Morocco', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (63, 'Mozambique', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (64, 'Myanmar', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (65, 'Nauru', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (66, 'Nepal', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (67, 'Netherlands', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (68, 'New Zealand', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (69, 'Nigeria', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (70, 'North Korea', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (71, 'Oman', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (72, 'Pakistan', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (73, 'Paraguay', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (74, 'Peru', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (75, 'Philippines', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (76, 'Poland', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (77, 'Puerto Rico', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (78, 'Romania', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (79, 'Runion', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (80, 'Russian Federation', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (81, 'Saint Vincent and the Grenadines', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (82, 'Saudi Arabia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (83, 'Senegal', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (84, 'Slovakia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (85, 'South Africa', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (86, 'South Korea', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (87, 'Spain', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (88, 'Sri Lanka', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (89, 'Sudan', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (90, 'Sweden', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (91, 'Switzerland', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (92, 'Taiwan', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (93, 'Tanzania', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (94, 'Thailand', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (95, 'Tonga', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (96, 'Tunisia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (97, 'Turkey', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (98, 'Turkmenistan', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (99, 'Tuvalu', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (100, 'Ukraine', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (101, 'United Arab Emirates', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (102, 'United Kingdom', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (103, 'United States', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (104, 'Venezuela', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (105, 'Vietnam', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (106, 'Virgin Islands, U.S.', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (107, 'Yemen', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (108, 'Yugoslavia', '2006-02-15 09:44:00'); INSERT INTO country (country_id, country, last_update) VALUES (109, 'Zambia', '2006-02-15 09:44:00'); ALTER TABLE country ENABLE TRIGGER ALL; -- -- Data for Name: customer; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE customer DISABLE TRIGGER ALL; ALTER TABLE customer ENABLE TRIGGER ALL; -- -- Data for Name: film; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE film DISABLE TRIGGER ALL; ALTER TABLE film ENABLE TRIGGER ALL; -- -- Data for Name: film_actor; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE film_actor DISABLE TRIGGER ALL; ALTER TABLE film_actor ENABLE TRIGGER ALL; -- -- Data for Name: film_category; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE film_category DISABLE TRIGGER ALL; ALTER TABLE film_category ENABLE TRIGGER ALL; -- -- Data for Name: inventory; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE inventory DISABLE TRIGGER ALL; ALTER TABLE inventory ENABLE TRIGGER ALL; -- -- Data for Name: language; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE language DISABLE TRIGGER ALL; ALTER TABLE language ENABLE TRIGGER ALL; -- -- Data for Name: payment; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE payment DISABLE TRIGGER ALL; ALTER TABLE payment ENABLE TRIGGER ALL; -- -- Data for Name: payment_p2007_01; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE payment_p2007_01 DISABLE TRIGGER ALL; ALTER TABLE payment_p2007_01 ENABLE TRIGGER ALL; -- -- Data for Name: payment_p2007_02; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE payment_p2007_02 DISABLE TRIGGER ALL; ALTER TABLE payment_p2007_02 ENABLE TRIGGER ALL; -- -- Data for Name: payment_p2007_03; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE payment_p2007_03 DISABLE TRIGGER ALL; ALTER TABLE payment_p2007_03 ENABLE TRIGGER ALL; -- -- Data for Name: payment_p2007_04; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE payment_p2007_04 DISABLE TRIGGER ALL; ALTER TABLE payment_p2007_04 ENABLE TRIGGER ALL; -- -- Data for Name: payment_p2007_05; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE payment_p2007_05 DISABLE TRIGGER ALL; ALTER TABLE payment_p2007_05 ENABLE TRIGGER ALL; -- -- Data for Name: payment_p2007_06; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE payment_p2007_06 DISABLE TRIGGER ALL; ALTER TABLE payment_p2007_06 ENABLE TRIGGER ALL; -- -- Data for Name: rental; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE rental DISABLE TRIGGER ALL; ALTER TABLE rental ENABLE TRIGGER ALL; -- -- Data for Name: staff; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE staff DISABLE TRIGGER ALL; ALTER TABLE staff ENABLE TRIGGER ALL; -- -- Data for Name: store; Type: TABLE DATA; Schema: public; Owner: postgres -- ALTER TABLE store DISABLE TRIGGER ALL; ALTER TABLE store ENABLE TRIGGER ALL; -- -- PostgreSQL database dump complete --
the_stack
-- 2021-01-27T16:03:21.516Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,Value,ValueName) VALUES (0,0,148,542253,TO_TIMESTAMP('2021-01-27 18:03:21','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Bedarfsmeldung',TO_TIMESTAMP('2021-01-27 18:03:21','YYYY-MM-DD HH24:MI:SS'),100,'REQ','Requisition') ; -- 2021-01-27T16:03:21.518Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Ref_List_ID=542253 AND NOT EXISTS (SELECT 1 FROM AD_Ref_List_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Ref_List_ID=t.AD_Ref_List_ID) ; -- 2021-01-28T08:03:56.600Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_DocType (AD_Client_ID,AD_Org_ID,C_DocType_ID,Created,CreatedBy,DocBaseType,DocNoSequence_ID,DocSubType,DocumentCopies,EntityType,GL_Category_ID,HasCharges,HasProforma,IsActive,IsCopyDescriptionToDocument,IsCreateCounter,IsDefault,IsDefaultCounterDoc,IsDocNoControlled,IsIndexed,IsInTransit,IsOverwriteDateOnComplete,IsOverwriteSeqOnComplete,IsPickQAConfirm,IsShipConfirm,IsSOTrx,IsSplitWhenDifference,Name,PrintName,Updated,UpdatedBy) VALUES (1000000,0,541008,TO_TIMESTAMP('2021-01-28 10:03:56','YYYY-MM-DD HH24:MI:SS'),100,'POO',545465,'REQ',1,'de.metas.swat',1000001,'N','N','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','Bedarfsmeldung','Bedarfsmeldung',TO_TIMESTAMP('2021-01-28 10:03:56','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-01-28T08:03:56.602Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO C_DocType_Trl (AD_Language,C_DocType_ID, Description,DocumentNote,Name,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.C_DocType_ID, t.Description,t.DocumentNote,t.Name,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_DocType t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.C_DocType_ID=541008 AND NOT EXISTS (SELECT 1 FROM C_DocType_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_DocType_ID=t.C_DocType_ID) ; -- 2021-01-28T08:03:56.603Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 1000000,0,'Y', now(),100, now(),100, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID) WHERE client.AD_Client_ID=1000000 AND doctype.C_DocType_ID=541008 AND rol.IsManual='N') ; -- 2021-01-28T08:04:05.625Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_DocType_Trl SET PrintName='Requisition',Updated=TO_TIMESTAMP('2021-01-28 10:04:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND C_DocType_ID=541008 ; -- 2021-01-28T10:48:43.044Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_DocType_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-01-28 12:48:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND C_DocType_ID=541008 ; -- 2021-01-28T10:49:34.870Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE C_DocType_Trl SET Name='Requisition',Updated=TO_TIMESTAMP('2021-01-28 12:49:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND C_DocType_ID=541008 ; -- 2021-01-28T12:09:58.686Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,Classname,Created,CreatedBy,Description,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsNotifyUserAfterExecution,IsOneInstanceOnly,IsReport,IsTranslateExcelHeaders,IsUseBPartnerLanguage,Name,PostgrestResponseFormat,RefreshAllAfterExecution,ShowHelp,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,584794,'N','de.metas.order.process.C_Order_CreatePOFromRequisition',TO_TIMESTAMP('2021-01-28 14:09:58','YYYY-MM-DD HH24:MI:SS'),100,'Erzeugt einen Bestellung aus einem bestehenden Bedarfsmeldung','U','Y','N','Y','N','N','N','N','Y','Y','Bestellung aus Bedarfsmeldung','json','N','Y','Java',TO_TIMESTAMP('2021-01-28 14:09:58','YYYY-MM-DD HH24:MI:SS'),100,'C_Order_CreatePOFromRequisition') ; -- 2021-01-28T12:09:58.698Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_ID=584794 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 2021-01-28T12:10:40.157Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Create Sales Order from this Quotation',Updated=TO_TIMESTAMP('2021-01-28 14:10:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584794 ; -- 2021-01-28T12:13:40.296Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Table_ID,AD_Table_Process_ID,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,WEBUI_DocumentAction,WEBUI_IncludedTabTopAction,WEBUI_ViewAction,WEBUI_ViewQuickAction,WEBUI_ViewQuickAction_Default) VALUES (0,0,584794,259,540893,TO_TIMESTAMP('2021-01-28 14:13:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2021-01-28 14:13:40','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N') ; -- 2021-01-28T12:33:45.514Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,AD_Reference_Value_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,196,0,584794,541914,19,170,'C_DocType_ID',TO_TIMESTAMP('2021-01-28 14:33:45','YYYY-MM-DD HH24:MI:SS'),100,'1000016','Belegart oder Verarbeitungsvorgaben','U',0,'Die Belegart bestimmt den Nummernkreis und die Vorgaben für die Belegverarbeitung.','Y','N','Y','N','Y','N','Belegart',10,TO_TIMESTAMP('2021-01-28 14:33:45','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-01-28T12:33:45.517Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541914 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-01-28T12:34:06.910Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET EntityType='D',Updated=TO_TIMESTAMP('2021-01-28 14:34:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541914 ; -- 2021-01-28T12:56:26.945Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,268,0,584794,541915,15,'DateOrdered',TO_TIMESTAMP('2021-01-28 14:56:26','YYYY-MM-DD HH24:MI:SS'),100,'Datum des Auftrags','D',0,'Bezeichnet das Datum, an dem die Ware bestellt wurde.','Y','N','Y','N','N','N','Auftragsdatum',20,TO_TIMESTAMP('2021-01-28 14:56:26','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-01-28T12:56:26.948Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541915 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-01-28T12:57:11.713Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,952,0,584794,541916,10,'POReference',TO_TIMESTAMP('2021-01-28 14:57:11','YYYY-MM-DD HH24:MI:SS'),100,'Referenz-Nummer des Kunden','U',0,'The business partner order reference is the order reference for this specific transaction; Often Purchase Order numbers are given to print on Invoices for easier reference. A standard number can be defined in the Business Partner (Customer) window.','Y','N','Y','N','N','N','Referenz',30,TO_TIMESTAMP('2021-01-28 14:57:11','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-01-28T12:57:11.714Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541916 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-01-28T12:57:58.591Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,584794,541917,20,'CompleteIt',TO_TIMESTAMP('2021-01-28 14:57:58','YYYY-MM-DD HH24:MI:SS'),100,'U',0,'Y','N','Y','N','N','N','Au',40,TO_TIMESTAMP('2021-01-28 14:57:58','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-01-28T12:57:58.593Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541917 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-01-28T12:58:53.215Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET EntityType='D',Updated=TO_TIMESTAMP('2021-01-28 14:58:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541916 ; -- 2021-01-28T14:51:43.515Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET EntityType='D', Name='Bestellung ',Updated=TO_TIMESTAMP('2021-01-28 16:51:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541917 ; -- 2021-01-28T14:52:12.655Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET Name='Bestellung abschließen',Updated=TO_TIMESTAMP('2021-01-28 16:52:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=541917 ; -- 2021-01-28T14:52:55.956Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Process_Para_Trl WHERE AD_Process_Para_ID=541917 ; -- 2021-01-28T14:52:55.964Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_Process_Para WHERE AD_Process_Para_ID=541917 ; -- 2021-01-28T14:53:31.428Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,0,584794,541918,20,'CompleteIt',TO_TIMESTAMP('2021-01-28 16:53:31','YYYY-MM-DD HH24:MI:SS'),100,'D',0,'Y','N','Y','N','N','N','Bestellung abschließen',40,TO_TIMESTAMP('2021-01-28 16:53:31','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2021-01-28T14:53:31.430Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_Para_ID=541918 AND NOT EXISTS (SELECT 1 FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID) ; -- 2021-01-28T14:54:20.424Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para_Trl SET Name='Automatically Complete Order',Updated=TO_TIMESTAMP('2021-01-28 16:54:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_Para_ID=541918 ; -- 2021-01-28T15:02:40.203Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET Name='Create Purchase Order from this Requisition',Updated=TO_TIMESTAMP('2021-01-28 17:02:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584794 ; -- 2021-01-28T15:04:45.623Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET Description='Creates a Purchase Order from this Requisition',Updated=TO_TIMESTAMP('2021-01-28 17:04:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584794 ; -- 2021-01-28T15:25:37.510Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-01-28 17:25:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_Para_ID=541918 ; -- 2021-02-02T14:18:15.717Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process (AD_Client_ID,IsActive,Created,CreatedBy,Updated,IsReport,IsDirectPrint,AccessLevel,ShowHelp,IsBetaFunctionality,CopyFromProcess,UpdatedBy,AD_Process_ID,AllowProcessReRun,IsUseBPartnerLanguage,IsApplySecuritySettings,RefreshAllAfterExecution,IsOneInstanceOnly,LockWaitTimeout,Type,IsTranslateExcelHeaders,IsNotifyUserAfterExecution,PostgrestResponseFormat,Classname,AD_Org_ID,Value,Name,EntityType) VALUES (0,'Y',TO_TIMESTAMP('2021-02-02 16:18:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-02-02 16:18:15','YYYY-MM-DD HH24:MI:SS'),'N','N','3','N','N','N',100,584795,'Y','Y','N','N','N',0,'Java','Y','N','json','de.metas.purchasecandidate.process.C_PurchaseCandiate_Create_Requisitions',0,'Requisition','Create Requisitions for selection','D') ; -- 2021-02-02T14:18:15.729Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Process_ID=584795 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) ; -- 2021-02-02T14:19:09.773Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table_Process (AD_Client_ID,AD_Org_ID,AD_Process_ID,AD_Table_ID,AD_Table_Process_ID,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,WEBUI_DocumentAction,WEBUI_IncludedTabTopAction,WEBUI_ViewAction,WEBUI_ViewQuickAction,WEBUI_ViewQuickAction_Default) VALUES (0,0,584795,540861,540894,TO_TIMESTAMP('2021-02-02 16:19:09','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2021-02-02 16:19:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','Y','N') ; -- 2021-02-02T16:40:56.221Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET Name='Bedarfsmeldungen für Auswahl erstellen',Updated=TO_TIMESTAMP('2021-02-02 18:40:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=584795 ; -- 2021-02-02T16:40:58.797Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process SET Help=NULL, Description=NULL, Name='Bedarfsmeldungen für Auswahl erstellen',Updated=TO_TIMESTAMP('2021-02-02 18:40:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=584795 ; -- 2021-02-02T16:40:58.789Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET Name='Bedarfsmeldungen für Auswahl erstellen',Updated=TO_TIMESTAMP('2021-02-02 18:40:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_ID=584795 ; -- 2021-02-02T16:42:12.358Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET Name='Bedarfsmeldungen für Auswahl erstellen',Updated=TO_TIMESTAMP('2021-02-02 18:42:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='nl_NL' AND AD_Process_ID=584795 ; -- 2021-02-02T16:42:14.851Z -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2021-02-02 18:42:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584795 ;
the_stack
SET LOCAL yb_non_ddl_txn_for_sys_tables_allowed TO true; INSERT INTO pg_catalog.pg_proc ( oid, proname, pronamespace, proowner, prolang, procost, prorows, provariadic, protransform, prokind, prosecdef, proleakproof, proisstrict, proretset, provolatile, proparallel, pronargs, pronargdefaults, prorettype, proargtypes, proallargtypes, proargmodes, proargnames, proargdefaults, protrftypes, prosrc, probin, proconfig, proacl ) VALUES -- Inserting I/O procedures for types before inserting types. (4001, 'jsonpath_in', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 1, 0, 8003, '2275', NULL, NULL, NULL, NULL, NULL, 'jsonpath_in', NULL, NULL, NULL), (4002, 'jsonpath_recv', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 1, 0, 8003, '2281', NULL, NULL, NULL, NULL, NULL, 'jsonpath_recv', NULL, NULL, NULL), (4003, 'jsonpath_out', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 1, 0, 2275, '8003', NULL, NULL, NULL, NULL, NULL, 'jsonpath_out', NULL, NULL, NULL), (4004, 'jsonpath_send', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 1, 0, 17, '8003', NULL, NULL, NULL, NULL, NULL, 'jsonpath_send', NULL, NULL, NULL), -- implementation of @? operator (4010, 'jsonb_path_exists_opr', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 2, 0, 16, '3802 8003', NULL, NULL, NULL, NULL, NULL, 'jsonb_path_exists_opr', NULL, NULL, NULL), -- implementation of @@ operator (4011, 'jsonb_path_match_opr', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 2, 0, 16, '3802 8003', NULL, NULL, NULL, NULL, NULL, 'jsonb_path_match_opr', NULL, NULL, NULL) ON CONFLICT DO NOTHING; INSERT INTO pg_catalog.pg_type ( oid, typname, typnamespace, typowner, typlen, typbyval, typtype, typcategory, typispreferred, typisdefined, typdelim, typrelid, typelem, typarray, typinput, typoutput, typreceive, typsend, typmodin, typmodout, typanalyze, typalign, typstorage, typnotnull, typbasetype, typtypmod, typndims, typcollation, typdefaultbin, typdefault, typacl ) VALUES (8003, 'jsonpath', 11, 10, -1, false, 'b', 'U', false, true, ',', 0, 0, 8004, 'jsonpath_in', 'jsonpath_out', 'jsonpath_recv', 'jsonpath_send', '-', '-', '-', 'i', 'x', false, 0, -1, 0, 0, NULL, NULL, NULL), (8004, '_jsonpath', 11, 10, -1, false, 'b', 'A', false, true, ',', 0, 8003, 0, 'array_in', 'array_out', 'array_recv', 'array_send', '-', '-', 'array_typanalyze', 'i', 'x', false, 0, -1, 0, 0, NULL, NULL, NULL) ON CONFLICT DO NOTHING; INSERT INTO pg_catalog.pg_operator ( oid, oprname, oprnamespace, oprowner, oprkind, oprcanmerge, oprcanhash, oprleft, oprright, oprresult, oprcom, oprnegate, oprcode, oprrest, oprjoin ) VALUES (4012, '@?', 11, 10, 'b', false, false, 3802, 8003, 16, 0, 0, 'jsonb_path_exists_opr', 'contsel', 'contjoinsel'), (4013, '@@', 11, 10, 'b', false, false, 3802, 8003, 16, 0, 0, 'jsonb_path_match_opr', 'contsel', 'contjoinsel') ON CONFLICT DO NOTHING; INSERT INTO pg_catalog.pg_amop ( amopfamily, amoplefttype, amoprighttype, amopstrategy, amoppurpose, amopopr, amopmethod, amopsortfamily ) VALUES (4036, 3802, 8003, 15, 's', 4012, 2742, 0), (4036, 3802, 8003, 16, 's', 4013, 2742, 0), (4037, 3802, 8003, 15, 's', 4012, 2742, 0), (4037, 3802, 8003, 16, 's', 4013, 2742, 0) ON CONFLICT DO NOTHING; INSERT INTO pg_catalog.pg_proc ( oid, proname, pronamespace, proowner, prolang, procost, prorows, provariadic, protransform, prokind, prosecdef, proleakproof, proisstrict, proretset, provolatile, proparallel, pronargs, pronargdefaults, prorettype, proargtypes, proallargtypes, proargmodes, proargnames, proargdefaults, protrftypes, prosrc, probin, proconfig, proacl ) VALUES -- json_path_* functions (4005, 'jsonb_path_exists', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 4, 2, 16, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 95 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 144 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_exists', NULL, NULL, NULL), (4006, 'jsonb_path_query', 11, 10, 12, 1, 1000, 0, '-', 'f', false, false, true, true, 'i', 's', 4, 2, 3802, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 94 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 142 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_query', NULL, NULL, NULL), (4007, 'jsonb_path_query_array', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 4, 2, 3802, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 100 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 154 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_query_array', NULL, NULL, NULL), (4008, 'jsonb_path_query_first', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 4, 2, 3802, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 100 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 154 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_query_first', NULL, NULL, NULL), (4009, 'jsonb_path_match', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 'i', 's', 4, 2, 16, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 94 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 142 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_match', NULL, NULL, NULL), -- json_path_*_tz functions (8005, 'jsonb_path_exists_tz', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 's', 's', 4, 2, 16, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 98 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 147 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_exists_tz', NULL, NULL, NULL), (8006, 'jsonb_path_query_tz', 11, 10, 12, 1, 1000, 0, '-', 'f', false, false, true, true, 's', 's', 4, 2, 3802, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 97 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 145 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_query_tz', NULL, NULL, NULL), (8007, 'jsonb_path_query_array_tz', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 's', 's', 4, 2, 3802, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 103 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 157 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_query_array_tz', NULL, NULL, NULL), (8008, 'jsonb_path_query_first_tz', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 's', 's', 4, 2, 3802, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 103 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 157 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_query_first_tz', NULL, NULL, NULL), (8009, 'jsonb_path_match_tz', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, true, false, 's', 's', 4, 2, 16, '3802 8003 3802 16', NULL, NULL, '{target,path,vars,silent}', '({CONST :consttype 3802 :consttypmod -1 :constcollid 0 :constlen -1 :constbyval false :constisnull false :location 97 :constvalue 8 [ 32 0 0 0 0 0 0 32 ]} {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 145 :constvalue 1 [ 0 0 0 0 0 0 0 0 ]})', NULL, 'jsonb_path_match_tz', NULL, NULL, NULL), -- Set part of a jsonb, handle NULL value (8945, 'jsonb_set_lax', 11, 10, 12, 1, 0, 0, '-', 'f', false, false, false, false, 'i', 's', 5, 2, 3802, '3802 1009 3802 16 25', NULL, NULL, '{jsonb_in,path,replacement,create_if_missing,null_value_treatment}', '({CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location 138 :constvalue 1 [ 1 0 0 0 0 0 0 0 ]} {CONST :consttype 25 :consttypmod -1 :constcollid 100 :constlen -1 :constbyval false :constisnull false :location 190 :constvalue 17 [ 68 0 0 0 117 115 101 95 106 115 111 110 95 110 117 108 108 ]})', NULL, 'jsonb_set_lax', NULL, NULL, NULL) ON CONFLICT DO NOTHING; -- Create dependency records for everything we (possibly) created. -- Since pg_depend has no OID or unique constraint, using PL/pgSQL instead. DO $$ BEGIN IF NOT EXISTS ( SELECT FROM pg_catalog.pg_depend WHERE refclassid = 1247 AND refobjid = 8003 ) THEN INSERT INTO pg_catalog.pg_depend ( classid, objid, objsubid, refclassid, refobjid, refobjsubid, deptype ) VALUES -- pg_type (0, 0, 0, 1247, 8003, 0, 'p'), (0, 0, 0, 1247, 8004, 0, 'p'), -- pg_operator (0, 0, 0, 2617, 4012, 0, 'p'), (0, 0, 0, 2617, 4013, 0, 'p'), -- pg_proc (0, 0, 0, 1255, 4001, 0, 'p'), (0, 0, 0, 1255, 4002, 0, 'p'), (0, 0, 0, 1255, 4003, 0, 'p'), (0, 0, 0, 1255, 4004, 0, 'p'), (0, 0, 0, 1255, 4005, 0, 'p'), (0, 0, 0, 1255, 4006, 0, 'p'), (0, 0, 0, 1255, 4007, 0, 'p'), (0, 0, 0, 1255, 4008, 0, 'p'), (0, 0, 0, 1255, 4009, 0, 'p'), (0, 0, 0, 1255, 4010, 0, 'p'), (0, 0, 0, 1255, 4011, 0, 'p'), (0, 0, 0, 1255, 8005, 0, 'p'), (0, 0, 0, 1255, 8006, 0, 'p'), (0, 0, 0, 1255, 8007, 0, 'p'), (0, 0, 0, 1255, 8008, 0, 'p'), (0, 0, 0, 1255, 8009, 0, 'p'), (0, 0, 0, 1255, 8945, 0, 'p'); -- pg_amop (dynamic OIDs) INSERT INTO pg_catalog.pg_depend ( classid, objid, objsubid, refclassid, refobjid, refobjsubid, deptype ) SELECT 0, 0, 0, 2602, oid, 0, 'p' FROM pg_catalog.pg_amop WHERE amopopr IN (4012, 4013); END IF; END $$;
the_stack
----------------------------------------------------------------------------- -- (c) Copyright IBM Corp. 2008 All rights reserved. -- -- The following sample of source code ("Sample") is owned by International -- Business Machines Corporation or one of its subsidiaries ("IBM") and is -- copyrighted and licensed, not sold. You may use, copy, modify, and -- distribute the Sample in any form without payment to IBM, for the purpose of -- assisting you in the development of your applications. -- -- The Sample code is provided to you on an "AS IS" basis, without warranty of -- any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR -- IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do -- not allow for the exclusion or limitation of implied warranties, so the above -- limitations or exclusions may not apply to you. IBM shall not be liable for -- any damages you suffer as a result of using, copying, modifying or -- distributing the Sample, even if IBM has been advised of the possibility of -- such damages. ----------------------------------------------------------------------------- -- -- SAMPLE FILE NAME: xmlmdc.db2 -- -- PURPOSE: This sample demonstrates the following features -- 1. XML data type column in MDC tables. -- 2. Faster insert and faster delete options support in MDC tables -- having XML columns. -- -- USAGE SCENARIO: The scenario is for a Book Store that has two types -- of customers, retail customers and corporate customers. -- Corporate customers do bulk purchases of books for their company -- libraries. The store's DBA maintains the database, -- the store manager runs queries on different tables to view -- the book sales. -- -- The store expands and opens four more branches -- in the city, all the books are spread across different branches. -- The store manager complains to the DBA that queries to get details -- like availability of a particular book by a particular author -- in a particular branch are very slow. -- -- The DBA decides to improve the query performance by converting a -- non-MDC table, for books available in different branches of the -- store, into an MDC table. To further improve the query performace, -- the DBA decides to create partition on the MDC table based on -- the published date of the book. By creating an MDC table, the query -- performance increases and the sales clerk can do faster inserts into -- this table when he receives books from different suppliers. He can -- also do faster deletes when he wants to delete a particular type of -- book due to low sales in a particular branch for that category of -- book in that location. -- -- PREREQUISITE: The SAMPLE database should exist before running this script. -- -- EXECUTION: db2 -tvf xmlmdc.db2 -- -- INPUTS: NONE -- -- OUTPUTS: Successful execution of all the queries. -- -- OUTPUT FILE: xmlmdc.out (available in the online documentation) -- -- SQL STATEMENTS USED: -- CREATE TABLE -- INSERT -- DROP -- SQL/XML FUNCTIONS USED: -- XMLEXISTS -- ----------------------------------------------------------------------------- -- -- SAMPLE DESCRIPTION -- ----------------------------------------------------------------------------- -- This sample demonstrates : -- 1. Moving data from a non-MDC table to an MDC table. -- 2. MDC table with partition. -- 3. Faster inserts into MDC table containing an XML column. -- 4. Faster delete on MDC table containing an XML column. -- 5. Exploiting block indexes and XML indexes in a query. ----------------------------------------------------------------------------- -- -- SETUP -- ----------------------------------------------------------------------------- -- Connect to sample CONNECT TO SAMPLE; ----------------------------------------------------------------------------- -- 1. Moving data from a non-MDC table to an MDC table ----------------------------------------------------------------------------- -- Create schema testschema CREATE SCHEMA testschema; ----------------------------------------------------------------------------- -- Setting up tables for the sample ----------------------------------------------------------------------------- -- Create non-MDC table 'books' CREATE TABLE testschema.books(book_id VARCHAR(10), publish_date DATE, category VARCHAR(20), location VARCHAR(20), status VARCHAR(15)); -- Insert values into table 'books' INSERT INTO testschema.books VALUES ('BK101', '10-01-2008', 'Management', 'Tasman', 'available'); INSERT INTO testschema.books VALUES ('BK102', '01-01-2008', 'Fantasy', 'Cupertino', 'available'); INSERT INTO testschema.books VALUES('BK103', '10-10-2007', 'Fantasy', 'Cupertino', 'ordered'); INSERT INTO testschema.books VALUES ('BK104', '05-02-2007', 'Spiritual', 'Tasman', 'available'); -- Create 'books_mdc' table partitioned by 'publish date' and organized -- by multiple dimensions - category, location and status. CREATE TABLE testschema.books_mdc(book_id VARCHAR(20), publish_date DATE, category VARCHAR(20), location VARCHAR(20), status VARCHAR(15), book_details XML) DISTRIBUTE BY HASH(book_id) PARTITION BY RANGE(publish_date) (STARTING FROM ('01-01-2007') ENDING ('12-12-2008') EVERY 3 MONTHS) ORGANIZE BY DIMENSIONS (category, location, status); -- Move the book details data from 'books' table and insert -- them into 'books_mdc' table INSERT INTO testschema.books_mdc(book_id, publish_date, category, location, status) SELECT book_id, publish_date, category, location, status FROM testschema.books; -- Update the 'books_mdc' table with 'book_details' XML data UPDATE testschema.books_mdc SET book_details = '<book_details id="BK101"> <name>Communication skills</name> <author>Peter Sharon</author> <price>120</price> <publications>Wroxa</publications> </book_details>' WHERE book_id='BK101'; UPDATE testschema.books_mdc SET book_details = '<book_details id="BK102"> <name>Blue moon</name> <author>Paul Smith</author> <price>100</price> <publications>Orellier</publications> </book_details>' WHERE book_id='BK102'; UPDATE testschema.books_mdc SET book_details = '<book_details id="BK103"> <name>Paint your house</name> <author>Roger Martin</author> <price>120</price> <publications>BPBH</publications> </book_details>' WHERE book_id='BK103'; UPDATE testschema.books_mdc SET book_details = '<book_details id="BK104"> <name>Ramayan</name> <author>Eric Mathews</author> <price>90</price> <publications>Tata Ho</publications> </book_details>' WHERE book_id = 'BK104'; -- Display the contents of 'books_mdc' table SELECT book_id, publish_date, category, location, status FROM testschema.books_mdc; -------------------------------------------------------------------------- -- 2. MDC table with partition -------------------------------------------------------------------------- -- When a customer comes to the store 'Tasman' branch and asks for a management -- book by a particular author 'Peter Sharon', published on 1st October 2008, -- the following query issued by the sales clerk directly goes to the table -- partition (October to December) and gets the book details. -- This query gets the details of list of 'Management' books -- available in 'Tasman' branch whose published date is 10-01-2008 SELECT book_id, publish_date, category, location, status FROM testschema.books_mdc WHERE location='Tasman' and category='Management' and publish_date='10-01-2008' and XMLEXISTS ('$b/book_details[author="Peter Sharon"]' PASSING book_details as "b"); ---------------------------------------------------------------------------- -- 3. Faster inserts into MDC table containing an XML column. ---------------------------------------------------------------------------- -- The store receives in bulk management books from different -- suppliers, These books are entered into database by the sales clerk. -- As all the books to be inserted belong to same dimension -- (category, location and status), the sales clerk while inserting the -- book details into the books_mdc table enables the LOCKSIZE BLOCKINSERT -- option for faster insert on MDC table. He does the following operations. -- Enable the LOCKSIZE BLOCKINSERT option for faster insert on MDC table ALTER TABLE testschema.books_mdc LOCKSIZE BLOCKINSERT; UPDATE command options using c off; -- Insert values into 'books_mdc' table -- Insert data into block '0' INSERT INTO testschema.books_mdc VALUES('BK105', '12-10-2007', 'Management', 'Schaumberg', 'available','<book_details id="BK105"> <name>How to Sell or Market</name> <author>Rusty Harold</author> <price>450</price> <publications>Orellier</publications> </book_details>'); INSERT INTO testschema.books_mdc VALUES('BK106', '03-12-2007', 'Management', 'Schaumberg', 'available','<book_details id="BK106"> <name>How to become CEO</name> <author>Booster Hoa</author> <price>150</price> <publications>wroxa</publications> </book_details>'); INSERT INTO testschema.books_mdc VALUES('BK107', '06-25-2008', 'Management', 'Schaumberg', 'available','<book_details id="BK107"> <name>Effective Email communication</name> <author>Sajer Menon</author> <price>100</price> <publications>PHPB</publications> </book_details>'); COMMIT; -- Insert data into block '1' INSERT INTO testschema.books_mdc VALUES('BK108', '04-23-2008', 'Management', 'Cupertino', 'Not available','<book_details id="BK108"> <name>Presentation skills</name> <author>Martin Lither</author> <price>125</price> <publications>PHPB</publications> </book_details>'); INSERT INTO testschema.books_mdc VALUES('BK109', '09-25-2007', 'Management', 'Cupertino', 'Not available','<book_details id="BK109"> <name>Assertive Skills</name> <author>Robert Steve</author> <price>250</price> <publications>wroxa</publications> </book_details>'); INSERT INTO testschema.books_mdc VALUES('BK110', '05-29-2007', 'Management', 'Cupertino', 'Not available','<book_details id="BK110"> <name>Relationship building</name> <author>Bunting Mexa</author> <price>190</price> <publications>Tata Ho</publications> </book_details>'); COMMIT; -- Insert data into block '2' INSERT INTO testschema.books_mdc VALUES('BK111', '08-14-2008', 'Management', 'Tasman', 'available','<book_details id="BK111"> <name>Manage your Time</name> <author>Pankaj Singh</author> <price>125</price> <publications>Orellier</publications> </book_details>'); INSERT INTO testschema.books_mdc VALUES('BK112', '07-25-2008', 'Management', 'Tasman', 'available','<book_details id="BK112"> <name>Be in the Present</name> <author>Hellen Sinki</author> <price>200</price> <publications>Orellier</publications> </book_details>'); INSERT INTO testschema.books_mdc VALUES('BK113', '06-23-2008', 'Management', 'Tasman', 'available', '<book_details id="BK112"> <name>How to become Rich</name> <author>Booster Hoa</author> <price>200</price> <publications>wroxa</publications> </book_details>'); COMMIT; -- Insert data into block '3' INSERT INTO testschema.books_mdc VALUES('BK114', '08-08-2008', 'Fantasy', 'Schaumberg', 'available','<book_details id="BK113"> <name>Dream home</name> <author>Hellen Sinki</author> <price>250</price> <publications>wroxa</publications> </book_details>'); INSERT INTO testschema.books_mdc VALUES('BK115', '05-12-2008', 'Fantasy', 'Schaumberg', 'available', '<book_details id="BK115"> <name>Dream world</name> <author>Hellen Sinki</author> <price>100</price> <publications>wroxa</publications> </book_details>'); COMMIT; -- Insert data into block '4' INSERT INTO testschema.books_mdc VALUES('BK116', '09-10-2007', 'Fantasy', 'Cupertino', 'Not available','<book_details id="BK116"> <name>Mothers Island</name> <author>Booster Hoa</author> <price>250</price> <publications>wroxa</publications> </book_details>'); INSERT INTO testschema.books_mdc VALUES('BK117', '03-11-2007', 'Fantasy', 'Cupertino', 'Not available','<book_details id="BK117"> <name>The destiny </name> <author>Marran</author> <price>250</price> <publications>Orellier</publications> </book_details>'); COMMIT; -- Insert data into block '5' INSERT INTO testschema.books_mdc VALUES('BK118', '03-12-2007', 'Spiritual', 'Tasman', 'available','<book_details id="BK118"> <name>Mahabharat</name> <author>Narayana Murthy</author> <price>250</price> <publications>PHPB</publications> </book_details>'); INSERT INTO testschema.books_mdc VALUES('BK119', '09-09-2008', 'Spiritual', 'Tasman', 'available','<book_details id="BK119"> <name>Bhagavat Gita</name> <author>Narayana Murthy</author> <price>250</price> <publications>PHPB</publications> </book_details>'); COMMIT; -- Run Runstats command on MDC table to update statistics in the catalog -- tables. RUNSTATS ON TABLE testschema.books_mdc WITH DISTRIBUTION and DETAILED INDEXES ALL; -- Change the locksize to default ALTER TABLE testschema.books_mdc LOCKSIZE ROW; ------------------------------------------------------------------------ -- 4. Faster delete on MDC table containing an XML column. ------------------------------------------------------------------------ -- During monthly analysis the store manager finds out that the -- 'Fantasy' category books at 'Cupertino' branch don't have many sales. -- So he asks the DBA to delete these books from 'Cupertino' branch. -- As all deletes belong to one particular category, the DBA decides -- to set the following option to make the delete operation faster. -- Set MDC ROLLOUT option to make the delete operation faster. SET CURRENT MDC ROLLOUT MODE IMMEDIATE; -- Delete all 'Fantasy' category books from 'books_mdc' table DELETE FROM testschema.books_mdc WHERE category='Fantasy' AND location='Cupertino'; -- Note that the data is saved before it is rolled out. -------------------------------------------------------------------------- -- 5. Exploiting block indexes and XML indexes in a query -------------------------------------------------------------------------- -- For faster retrieval of data the DBA creates an XML index on the author -- element of book_details XML document. CREATE INDEX auth_ind ON testschema.books_mdc(book_details) GENERATE KEY USING XMLPATTERN '/book_details/author' AS SQL VARCHAR(20); -- Query the table to get all 'Management' books available in the store -- by author 'Booster Ho'. This query exploits both block index -- and XML index. SELECT book_id, publish_date, category, location, status FROM testschema.books_mdc WHERE category='Management' AND status='available' AND XMLEXISTS('$b/book_details[author="Booster Hoa"]' PASSING book_details as "b"); -------------------------------------------------------------------------- -- CLEANUP -------------------------------------------------------------------------- DROP INDEX auth_ind; DROP TABLE testschema.books; DROP TABLE testschema.books_mdc; DROP SCHEMA testschema RESTRICT;
the_stack
-- 2017-10-09T07:38:34.948 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator DELETE FROM AD_UI_Element WHERE AD_UI_Element_ID=543147 ; -- 2017-10-09T07:41:25.311 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-09 07:41:25','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Attributes',Description='' WHERE AD_Field_ID=555660 AND AD_Language='en_US' ; -- 2017-10-09T07:42:09.734 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-09 07:42:09','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Business Partner',Description='',Help='' WHERE AD_Field_ID=554032 AND AD_Language='en_US' ; -- 2017-10-09T07:42:23.291 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field_Trl SET UpdatedBy=100,Updated=TO_TIMESTAMP('2017-10-09 07:42:23','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y',Name='Location',Description='',Help='' WHERE AD_Field_ID=554034 AND AD_Language='en_US' ; -- 2017-10-09T07:43:04.214 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10305,0,654,540274,549007,'F',TO_TIMESTAMP('2017-10-09 07:43:04','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Sektion',10,0,0,TO_TIMESTAMP('2017-10-09 07:43:04','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-09T07:43:12.351 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,10304,0,654,540274,549008,'F',TO_TIMESTAMP('2017-10-09 07:43:12','YYYY-MM-DD HH24:MI:SS'),100,'Y','N','Y','N','N','Mandant',20,0,0,TO_TIMESTAMP('2017-10-09 07:43:12','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2017-10-09T07:43:56.296 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=10,Updated=TO_TIMESTAMP('2017-10-09 07:43:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543131 ; -- 2017-10-09T07:43:56.298 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=20,Updated=TO_TIMESTAMP('2017-10-09 07:43:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543139 ; -- 2017-10-09T07:43:56.304 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=100,Updated=TO_TIMESTAMP('2017-10-09 07:43:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543130 ; -- 2017-10-09T07:43:56.307 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=110,Updated=TO_TIMESTAMP('2017-10-09 07:43:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549007 ; -- 2017-10-09T07:44:19.643 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-10-09 07:44:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549007 ; -- 2017-10-09T07:44:26.571 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-10-09 07:44:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549008 ; -- 2017-10-09T07:44:28.012 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-10-09 07:44:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543130 ; -- 2017-10-09T07:44:30.206 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-10-09 07:44:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543131 ; -- 2017-10-09T07:44:31.851 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-10-09 07:44:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543132 ; -- 2017-10-09T07:44:33.338 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-10-09 07:44:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543133 ; -- 2017-10-09T07:44:34.964 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-10-09 07:44:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543134 ; -- 2017-10-09T07:44:36.794 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-10-09 07:44:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543135 ; -- 2017-10-09T07:44:38.739 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-10-09 07:44:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543136 ; -- 2017-10-09T07:44:40.267 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-10-09 07:44:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543137 ; -- 2017-10-09T07:44:41.771 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-10-09 07:44:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543138 ; -- 2017-10-09T07:44:48.259 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-10-09 07:44:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543139 ; -- 2017-10-09T07:45:18.469 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-10-09 07:45:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543130 ; -- 2017-10-09T07:45:20.527 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=10,Updated=TO_TIMESTAMP('2017-10-09 07:45:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543131 ; -- 2017-10-09T07:45:22.156 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-10-09 07:45:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543132 ; -- 2017-10-09T07:45:23.653 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-10-09 07:45:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543133 ; -- 2017-10-09T07:45:24.936 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-10-09 07:45:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543134 ; -- 2017-10-09T07:45:26.343 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-10-09 07:45:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543135 ; -- 2017-10-09T07:45:27.771 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-10-09 07:45:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543136 ; -- 2017-10-09T07:45:29.158 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-10-09 07:45:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543137 ; -- 2017-10-09T07:45:31.057 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-10-09 07:45:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543138 ; -- 2017-10-09T07:45:32.555 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-10-09 07:45:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543139 ; -- 2017-10-09T07:45:34.111 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=100,Updated=TO_TIMESTAMP('2017-10-09 07:45:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549007 ; -- 2017-10-09T07:45:36.149 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-10-09 07:45:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549008 ; -- 2017-10-09T07:45:46.059 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=110,Updated=TO_TIMESTAMP('2017-10-09 07:45:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549007 ; -- 2017-10-09T07:45:49.303 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=120,Updated=TO_TIMESTAMP('2017-10-09 07:45:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549008 ; -- 2017-10-09T07:47:46.828 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=40,Updated=TO_TIMESTAMP('2017-10-09 07:47:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543136 ; -- 2017-10-09T07:47:46.829 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=50,Updated=TO_TIMESTAMP('2017-10-09 07:47:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543137 ; -- 2017-10-09T07:47:46.831 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=60,Updated=TO_TIMESTAMP('2017-10-09 07:47:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543133 ; -- 2017-10-09T07:47:46.835 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=70,Updated=TO_TIMESTAMP('2017-10-09 07:47:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543134 ; -- 2017-10-09T07:47:46.837 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayedGrid='Y', SeqNoGrid=80,Updated=TO_TIMESTAMP('2017-10-09 07:47:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543135 ; -- 2017-10-09T07:48:01.509 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=20,Updated=TO_TIMESTAMP('2017-10-09 07:48:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543139 ; -- 2017-10-09T07:48:03.414 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2017-10-09 07:48:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543132 ; -- 2017-10-09T07:48:04.862 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2017-10-09 07:48:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543136 ; -- 2017-10-09T07:48:06.225 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=50,Updated=TO_TIMESTAMP('2017-10-09 07:48:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543137 ; -- 2017-10-09T07:48:07.693 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=60,Updated=TO_TIMESTAMP('2017-10-09 07:48:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543133 ; -- 2017-10-09T07:48:09.110 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=70,Updated=TO_TIMESTAMP('2017-10-09 07:48:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543134 ; -- 2017-10-09T07:48:10.528 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=80,Updated=TO_TIMESTAMP('2017-10-09 07:48:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543135 ; -- 2017-10-09T07:48:12.222 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET SeqNo=90,Updated=TO_TIMESTAMP('2017-10-09 07:48:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543138 ; -- 2017-10-09T07:48:39.045 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=10,Updated=TO_TIMESTAMP('2017-10-09 07:48:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543131 ; -- 2017-10-09T07:48:39.046 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=20,Updated=TO_TIMESTAMP('2017-10-09 07:48:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543139 ; -- 2017-10-09T07:48:39.047 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=30,Updated=TO_TIMESTAMP('2017-10-09 07:48:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543132 ; -- 2017-10-09T07:48:39.047 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=40,Updated=TO_TIMESTAMP('2017-10-09 07:48:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=543137 ; -- 2017-10-09T07:48:39.048 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_Element SET IsDisplayed_SideList='Y', SeqNo_SideList=50,Updated=TO_TIMESTAMP('2017-10-09 07:48:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=549007 ; -- 2017-10-09T07:48:50.995 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_UI_ElementGroup SET UIStyle='primary',Updated=TO_TIMESTAMP('2017-10-09 07:48:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_ElementGroup_ID=540274 ; -- 2017-10-09T07:54:53.114 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:54:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53638 ; -- 2017-10-09T07:54:54.238 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:54:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10301 ; -- 2017-10-09T07:54:54.926 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:54:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10306 ; -- 2017-10-09T07:54:56.116 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:54:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10310 ; -- 2017-10-09T07:54:57.694 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:54:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53639 ; -- 2017-10-09T07:54:58.414 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:54:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10308 ; -- 2017-10-09T07:54:59.141 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:54:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554032 ; -- 2017-10-09T07:54:59.941 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:54:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=554034 ; -- 2017-10-09T07:55:00.557 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:55:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10304 ; -- 2017-10-09T07:55:01.215 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:55:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10307 ; -- 2017-10-09T07:55:01.801 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:55:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10305 ; -- 2017-10-09T07:55:02.782 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10302 ; -- 2017-10-09T07:55:06.153 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:55:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10303 ; -- 2017-10-09T07:55:13.100 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=1.000000000000,Updated=TO_TIMESTAMP('2017-10-09 07:55:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10301 ; -- 2017-10-09T07:56:11.094 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=1.000000000000,Updated=TO_TIMESTAMP('2017-10-09 07:56:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10292 ; -- 2017-10-09T07:56:13.543 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=2.000000000000,Updated=TO_TIMESTAMP('2017-10-09 07:56:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10291 ; -- 2017-10-09T07:56:15.062 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:56:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10293 ; -- 2017-10-09T07:56:16.158 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:56:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10299 ; -- 2017-10-09T07:56:17.493 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:56:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10294 ; -- 2017-10-09T07:56:18.281 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:56:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10290 ; -- 2017-10-09T07:56:18.846 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:56:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10296 ; -- 2017-10-09T07:56:19.583 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:56:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10297 ; -- 2017-10-09T07:56:20.569 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:56:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10295 ; -- 2017-10-09T07:56:21.063 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:56:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10300 ; -- 2017-10-09T07:56:23.774 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:56:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10298 ; -- 2017-10-09T07:57:01.614 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=NULL,Updated=TO_TIMESTAMP('2017-10-09 07:57:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10292 ; -- 2017-10-09T07:57:04.187 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET SortNo=1.000000000000,Updated=TO_TIMESTAMP('2017-10-09 07:57:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10291 ;
the_stack
-- -- XC_ALTER_TABLE -- -- Check on dropped columns CREATE TABLE xc_alter_table_1 (id serial, name varchar(80), code varchar(80)) DISTRIBUTE BY HASH(id); EXPLAIN (VERBOSE true, COSTS false, NODES false) INSERT INTO xc_alter_table_1(name) VALUES ('aaa'),('bbb'),('ccc'); INSERT INTO xc_alter_table_1(name) VALUES ('aaa'),('bbb'),('ccc'); SELECT id, name, code FROM xc_alter_table_1 ORDER BY 1; -- Cannot drop distribution column ALTER TABLE xc_alter_table_1 DROP COLUMN id; -- Drop 1st column ALTER TABLE xc_alter_table_1 DROP COLUMN code; -- Check for query generation of remote INSERT INSERT INTO xc_alter_table_1(name) VALUES('ddd'),('eee'),('fff'); EXPLAIN (VERBOSE true, COSTS false, NODES false) INSERT INTO xc_alter_table_1(name) VALUES('ddd'),('eee'),('fff'); SELECT id, name FROM xc_alter_table_1 ORDER BY 1; -- Check for query generation of remote INSERT SELECT INSERT INTO xc_alter_table_1(name) SELECT 'ggg'; EXPLAIN (VERBOSE true, COSTS false, NODES false) INSERT INTO xc_alter_table_1(name) SELECT 'ggg'; SELECT id, name FROM xc_alter_table_1 ORDER BY 1; -- Check for query generation of remote UPDATE EXPLAIN (VERBOSE true, COSTS false, NODES false) UPDATE xc_alter_table_1 SET name = 'zzz' WHERE id = currval('xc_alter_table_1_id_seq'); UPDATE xc_alter_table_1 SET name = 'zzz' WHERE id = currval('xc_alter_table_1_id_seq'); SELECT id, name FROM xc_alter_table_1 ORDER BY 1; DROP TABLE xc_alter_table_1; -- Check for multiple columns dropped and created CREATE TABLE xc_alter_table_2 (a int, b varchar(20), c boolean, d text, e interval) distribute by replication; INSERT INTO xc_alter_table_2 VALUES (1, 'John', true, 'Master', '01:00:10'); INSERT INTO xc_alter_table_2 VALUES (2, 'Neo', true, 'Slave', '02:34:00'); INSERT INTO xc_alter_table_2 VALUES (3, 'James', false, 'Cascading slave', '00:12:05'); SELECT a, b, c, d, e FROM xc_alter_table_2 ORDER BY a; -- Go through standard planner SET enable_fast_query_shipping TO false; -- Drop a couple of columns ALTER TABLE xc_alter_table_2 DROP COLUMN a; ALTER TABLE xc_alter_table_2 DROP COLUMN d; ALTER TABLE xc_alter_table_2 DROP COLUMN e; -- Check for query generation of remote INSERT EXPLAIN (VERBOSE true, COSTS false, NODES false) INSERT INTO xc_alter_table_2 VALUES ('Kodek', false); INSERT INTO xc_alter_table_2 VALUES ('Kodek', false); SELECT b, c FROM xc_alter_table_2 ORDER BY b; -- Check for query generation of remote UPDATE EXPLAIN (VERBOSE true, COSTS false, NODES false) UPDATE xc_alter_table_2 SET b = 'Morphee', c = false WHERE b = 'Neo'; UPDATE xc_alter_table_2 SET b = 'Morphee', c = false WHERE b = 'Neo'; SELECT b, c FROM xc_alter_table_2 ORDER BY b; -- Add some new columns ALTER TABLE xc_alter_table_2 ADD COLUMN a int; ALTER TABLE xc_alter_table_2 ADD COLUMN a2 varchar(20); -- Check for query generation of remote INSERT EXPLAIN (VERBOSE true, COSTS false, NODES false) INSERT INTO xc_alter_table_2 (a, a2, b, c) VALUES (100, 'CEO', 'Gordon', true); INSERT INTO xc_alter_table_2 (a, a2, b, c) VALUES (100, 'CEO', 'Gordon', true); SELECT a, a2, b, c FROM xc_alter_table_2 ORDER BY b; -- Check for query generation of remote UPDATE EXPLAIN (VERBOSE true, COSTS false, NODES false) UPDATE xc_alter_table_2 SET a = 200, a2 = 'CTO' WHERE b = 'John'; UPDATE xc_alter_table_2 SET a = 200, a2 = 'CTO' WHERE b = 'John'; SELECT a, a2, b, c FROM xc_alter_table_2 ORDER BY b; DROP TABLE xc_alter_table_2; -- Tests for ALTER TABLE redistribution -- In the following test, a table is redistributed in all the ways possible -- and effects of redistribution is checked on all the dependent objects -- Table with integers CREATE TABLE xc_alter_table_3 (a int, b varchar(10)) DISTRIBUTE BY HASH(a); INSERT INTO xc_alter_table_3 VALUES (0, NULL); INSERT INTO xc_alter_table_3 VALUES (1, 'a'); INSERT INTO xc_alter_table_3 VALUES (2, 'aa'); INSERT INTO xc_alter_table_3 VALUES (3, 'aaa'); INSERT INTO xc_alter_table_3 VALUES (4, 'aaaa'); INSERT INTO xc_alter_table_3 VALUES (5, 'aaaaa'); INSERT INTO xc_alter_table_3 VALUES (6, 'aaaaaa'); INSERT INTO xc_alter_table_3 VALUES (7, 'aaaaaaa'); INSERT INTO xc_alter_table_3 VALUES (8, 'aaaaaaaa'); INSERT INTO xc_alter_table_3 VALUES (9, 'aaaaaaaaa'); INSERT INTO xc_alter_table_3 VALUES (10, 'aaaaaaaaaa'); -- Create some objects to check the effect of redistribution CREATE VIEW xc_alter_table_3_v AS SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; CREATE RULE xc_alter_table_3_insert AS ON UPDATE TO xc_alter_table_3 WHERE OLD.a = 11 DO INSERT INTO xc_alter_table_3 VALUES (OLD.a + 1, 'nnn'); PREPARE xc_alter_table_insert AS INSERT INTO xc_alter_table_3 VALUES ($1, $2); PREPARE xc_alter_table_delete AS DELETE FROM xc_alter_table_3 WHERE a = $1; PREPARE xc_alter_table_update AS UPDATE xc_alter_table_3 SET b = $2 WHERE a = $1; -- Now begin the tests ALTER TABLE xc_alter_table_3 DISTRIBUTE BY HASH(a); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; EXECUTE xc_alter_table_insert(11, 'b'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_update(11, 'bb'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_delete(11); SELECT b FROM xc_alter_table_3 WHERE a = 11 or a = 12; EXECUTE xc_alter_table_delete(12); ALTER TABLE xc_alter_table_3 DISTRIBUTE BY HASH(b); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; EXECUTE xc_alter_table_insert(11, 'b'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_update(11, 'bb'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_delete(11); SELECT b FROM xc_alter_table_3 WHERE a = 11 or a = 12; EXECUTE xc_alter_table_delete(12); ALTER TABLE xc_alter_table_3 DISTRIBUTE BY ROUNDROBIN; SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; EXECUTE xc_alter_table_insert(11, 'b'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_update(11, 'bb'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_delete(11); SELECT b FROM xc_alter_table_3 WHERE a = 11 or a = 12; EXECUTE xc_alter_table_delete(12); ALTER TABLE xc_alter_table_3 DISTRIBUTE BY MODULO(a); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; EXECUTE xc_alter_table_insert(11, 'b'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_update(11, 'bb'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_delete(11); SELECT b FROM xc_alter_table_3 WHERE a = 11 or a = 12; EXECUTE xc_alter_table_delete(12); ALTER TABLE xc_alter_table_3 DISTRIBUTE BY MODULO(b); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; EXECUTE xc_alter_table_insert(11, 'b'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_update(11, 'bb'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_delete(11); SELECT b FROM xc_alter_table_3 WHERE a = 11 or a = 12; EXECUTE xc_alter_table_delete(12); -- Index and redistribution CREATE INDEX xc_alter_table_3_index ON xc_alter_table_3(a); ALTER TABLE xc_alter_table_3 DISTRIBUTE BY HASH(a); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; EXECUTE xc_alter_table_insert(11, 'b'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_update(11, 'bb'); SELECT b FROM xc_alter_table_3 WHERE a = 11; EXECUTE xc_alter_table_delete(11); SELECT b FROM xc_alter_table_3 WHERE a = 11 or a = 12; EXECUTE xc_alter_table_delete(12); -- Add column on table ALTER TABLE xc_alter_table_3 ADD COLUMN c int DEFAULT 4; ALTER TABLE xc_alter_table_3 DISTRIBUTE BY REPLICATION; SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; SELECT * FROM xc_alter_table_3_v; -- Drop column on table ALTER TABLE xc_alter_table_3 DROP COLUMN b CASCADE; ALTER TABLE xc_alter_table_3 DISTRIBUTE BY HASH(a); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; SELECT * FROM xc_alter_table_3_v; -- Remanipulate table once again and distribute on old column ALTER TABLE xc_alter_table_3 DROP COLUMN c; ALTER TABLE xc_alter_table_3 ADD COLUMN b varchar(3) default 'aaa'; ALTER TABLE xc_alter_table_3 DISTRIBUTE BY HASH(a); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; -- Change the node list SELECT alter_table_change_nodes('xc_alter_table_3', '{1}', 'to', NULL); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; -- Add some nodes on it SELECT alter_table_change_nodes('xc_alter_table_3', '{2,4,5}', 'add', NULL); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check in tuple presence SELECT * FROM xc_alter_table_3_v; -- Remove some nodes on it SELECT alter_table_change_nodes('xc_alter_table_3', '{3}', 'add', NULL); SELECT alter_table_change_nodes('xc_alter_table_3', '{2,3,5}', 'delete', NULL); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; -- Multiple operations with replication SELECT alter_table_change_nodes('xc_alter_table_3', '{1,3,4,5}', 'to', 'replication'); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; -- Manipulate number of nodes to include and remove nodes on a replicated table -- On removed nodes data is deleted and on new nodes data is added SELECT alter_table_change_nodes('xc_alter_table_3', '{2,3,5}', 'to', NULL); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; -- Re-do a double operation with hash this time SELECT alter_table_change_nodes('xc_alter_table_3', '{2}', 'delete', 'hash(a)'); SELECT count(*), sum(a), avg(a) FROM xc_alter_table_3; -- Check on tuple presence SELECT * FROM xc_alter_table_3_v; -- Error checks ALTER TABLE xc_alter_table_3 ADD COLUMN b int, DISTRIBUTE BY HASH(a); -- Clean up DROP TABLE xc_alter_table_3 CASCADE;
the_stack
BEGIN; CREATE EXTENSION IF NOT EXISTS pg_stat_statements; COMMENT ON EXTENSION pg_stat_statements IS 'track execution statistics of all SQL statements executed'; CREATE FUNCTION update_lsif_data_definitions_schema_versions_insert() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN INSERT INTO lsif_data_definitions_schema_versions SELECT dump_id, MIN(schema_version) as min_schema_version, MAX(schema_version) as max_schema_version FROM newtab GROUP BY dump_id ON CONFLICT (dump_id) DO UPDATE SET -- Update with min(old_min, new_min) and max(old_max, new_max) min_schema_version = LEAST(lsif_data_definitions_schema_versions.min_schema_version, EXCLUDED.min_schema_version), max_schema_version = GREATEST(lsif_data_definitions_schema_versions.max_schema_version, EXCLUDED.max_schema_version); RETURN NULL; END $$; CREATE FUNCTION update_lsif_data_documents_schema_versions_insert() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN INSERT INTO lsif_data_documents_schema_versions SELECT dump_id, MIN(schema_version) as min_schema_version, MAX(schema_version) as max_schema_version FROM newtab GROUP BY dump_id ON CONFLICT (dump_id) DO UPDATE SET -- Update with min(old_min, new_min) and max(old_max, new_max) min_schema_version = LEAST(lsif_data_documents_schema_versions.min_schema_version, EXCLUDED.min_schema_version), max_schema_version = GREATEST(lsif_data_documents_schema_versions.max_schema_version, EXCLUDED.max_schema_version); RETURN NULL; END $$; CREATE FUNCTION update_lsif_data_references_schema_versions_insert() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN INSERT INTO lsif_data_references_schema_versions SELECT dump_id, MIN(schema_version) as min_schema_version, MAX(schema_version) as max_schema_version FROM newtab GROUP BY dump_id ON CONFLICT (dump_id) DO UPDATE SET -- Update with min(old_min, new_min) and max(old_max, new_max) min_schema_version = LEAST(lsif_data_references_schema_versions.min_schema_version, EXCLUDED.min_schema_version), max_schema_version = GREATEST(lsif_data_references_schema_versions.max_schema_version, EXCLUDED.max_schema_version); RETURN NULL; END $$; CREATE TABLE lsif_data_definitions ( dump_id integer NOT NULL, scheme text NOT NULL, identifier text NOT NULL, data bytea, schema_version integer NOT NULL, num_locations integer NOT NULL ); COMMENT ON TABLE lsif_data_definitions IS 'Associates (document, range) pairs with the import monikers attached to the range.'; COMMENT ON COLUMN lsif_data_definitions.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).'; COMMENT ON COLUMN lsif_data_definitions.scheme IS 'The moniker scheme.'; COMMENT ON COLUMN lsif_data_definitions.identifier IS 'The moniker identifier.'; COMMENT ON COLUMN lsif_data_definitions.data IS 'A gob-encoded payload conforming to an array of [LocationData](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L106:6) types.'; COMMENT ON COLUMN lsif_data_definitions.schema_version IS 'The schema version of this row - used to determine presence and encoding of data.'; COMMENT ON COLUMN lsif_data_definitions.num_locations IS 'The number of locations stored in the data field.'; CREATE TABLE lsif_data_definitions_schema_versions ( dump_id integer NOT NULL, min_schema_version integer, max_schema_version integer ); COMMENT ON TABLE lsif_data_definitions_schema_versions IS 'Tracks the range of schema_versions for each upload in the lsif_data_definitions table.'; COMMENT ON COLUMN lsif_data_definitions_schema_versions.dump_id IS 'The identifier of the associated dump in the lsif_uploads table.'; COMMENT ON COLUMN lsif_data_definitions_schema_versions.min_schema_version IS 'A lower-bound on the `lsif_data_definitions.schema_version` where `lsif_data_definitions.dump_id = dump_id`.'; COMMENT ON COLUMN lsif_data_definitions_schema_versions.max_schema_version IS 'An upper-bound on the `lsif_data_definitions.schema_version` where `lsif_data_definitions.dump_id = dump_id`.'; CREATE TABLE lsif_data_documentation_pages ( dump_id integer NOT NULL, path_id text NOT NULL, data bytea ); COMMENT ON TABLE lsif_data_documentation_pages IS 'Associates documentation pathIDs to their documentation page hierarchy chunk.'; COMMENT ON COLUMN lsif_data_documentation_pages.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).'; COMMENT ON COLUMN lsif_data_documentation_pages.path_id IS 'The documentation page path ID, see see GraphQL codeintel.schema:documentationPage for what this is.'; COMMENT ON COLUMN lsif_data_documentation_pages.data IS 'A gob-encoded payload conforming to a `type DocumentationPageData struct` pointer (lib/codeintel/semantic/types.go)'; CREATE TABLE lsif_data_documents ( dump_id integer NOT NULL, path text NOT NULL, data bytea, schema_version integer NOT NULL, num_diagnostics integer NOT NULL, ranges bytea, hovers bytea, monikers bytea, packages bytea, diagnostics bytea ); COMMENT ON TABLE lsif_data_documents IS 'Stores reference, hover text, moniker, and diagnostic data about a particular text document witin a dump.'; COMMENT ON COLUMN lsif_data_documents.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).'; COMMENT ON COLUMN lsif_data_documents.path IS 'The path of the text document relative to the associated dump root.'; COMMENT ON COLUMN lsif_data_documents.data IS 'A gob-encoded payload conforming to the [DocumentData](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L13:6) type. This field is being migrated across ranges, hovers, monikers, packages, and diagnostics columns and will be removed in a future release of Sourcegraph.'; COMMENT ON COLUMN lsif_data_documents.schema_version IS 'The schema version of this row - used to determine presence and encoding of data.'; COMMENT ON COLUMN lsif_data_documents.num_diagnostics IS 'The number of diagnostics stored in the data field.'; COMMENT ON COLUMN lsif_data_documents.ranges IS 'A gob-encoded payload conforming to the [Ranges](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L14:2) field of the DocumentDatatype.'; COMMENT ON COLUMN lsif_data_documents.hovers IS 'A gob-encoded payload conforming to the [HoversResults](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L15:2) field of the DocumentDatatype.'; COMMENT ON COLUMN lsif_data_documents.monikers IS 'A gob-encoded payload conforming to the [Monikers](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L16:2) field of the DocumentDatatype.'; COMMENT ON COLUMN lsif_data_documents.packages IS 'A gob-encoded payload conforming to the [PackageInformation](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L17:2) field of the DocumentDatatype.'; COMMENT ON COLUMN lsif_data_documents.diagnostics IS 'A gob-encoded payload conforming to the [Diagnostics](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L18:2) field of the DocumentDatatype.'; CREATE TABLE lsif_data_documents_schema_versions ( dump_id integer NOT NULL, min_schema_version integer, max_schema_version integer ); COMMENT ON TABLE lsif_data_documents_schema_versions IS 'Tracks the range of schema_versions for each upload in the lsif_data_documents table.'; COMMENT ON COLUMN lsif_data_documents_schema_versions.dump_id IS 'The identifier of the associated dump in the lsif_uploads table.'; COMMENT ON COLUMN lsif_data_documents_schema_versions.min_schema_version IS 'A lower-bound on the `lsif_data_documents.schema_version` where `lsif_data_documents.dump_id = dump_id`.'; COMMENT ON COLUMN lsif_data_documents_schema_versions.max_schema_version IS 'An upper-bound on the `lsif_data_documents.schema_version` where `lsif_data_documents.dump_id = dump_id`.'; CREATE TABLE lsif_data_metadata ( dump_id integer NOT NULL, num_result_chunks integer ); COMMENT ON TABLE lsif_data_metadata IS 'Stores the number of result chunks associated with a dump.'; COMMENT ON COLUMN lsif_data_metadata.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).'; COMMENT ON COLUMN lsif_data_metadata.num_result_chunks IS 'A bound of populated indexes in the lsif_data_result_chunks table for the associated dump. This value is used to hash identifiers into the result chunk index to which they belong.'; CREATE TABLE lsif_data_references ( dump_id integer NOT NULL, scheme text NOT NULL, identifier text NOT NULL, data bytea, schema_version integer NOT NULL, num_locations integer NOT NULL ); COMMENT ON TABLE lsif_data_references IS 'Associates (document, range) pairs with the export monikers attached to the range.'; COMMENT ON COLUMN lsif_data_references.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).'; COMMENT ON COLUMN lsif_data_references.scheme IS 'The moniker scheme.'; COMMENT ON COLUMN lsif_data_references.identifier IS 'The moniker identifier.'; COMMENT ON COLUMN lsif_data_references.data IS 'A gob-encoded payload conforming to an array of [LocationData](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L106:6) types.'; COMMENT ON COLUMN lsif_data_references.schema_version IS 'The schema version of this row - used to determine presence and encoding of data.'; COMMENT ON COLUMN lsif_data_references.num_locations IS 'The number of locations stored in the data field.'; CREATE TABLE lsif_data_references_schema_versions ( dump_id integer NOT NULL, min_schema_version integer, max_schema_version integer ); COMMENT ON TABLE lsif_data_references_schema_versions IS 'Tracks the range of schema_versions for each upload in the lsif_data_references table.'; COMMENT ON COLUMN lsif_data_references_schema_versions.dump_id IS 'The identifier of the associated dump in the lsif_uploads table.'; COMMENT ON COLUMN lsif_data_references_schema_versions.min_schema_version IS 'A lower-bound on the `lsif_data_references.schema_version` where `lsif_data_references.dump_id = dump_id`.'; COMMENT ON COLUMN lsif_data_references_schema_versions.max_schema_version IS 'An upper-bound on the `lsif_data_references.schema_version` where `lsif_data_references.dump_id = dump_id`.'; CREATE TABLE lsif_data_result_chunks ( dump_id integer NOT NULL, idx integer NOT NULL, data bytea ); COMMENT ON TABLE lsif_data_result_chunks IS 'Associates result set identifiers with the (document path, range identifier) pairs that compose the set.'; COMMENT ON COLUMN lsif_data_result_chunks.dump_id IS 'The identifier of the associated dump in the lsif_uploads table (state=completed).'; COMMENT ON COLUMN lsif_data_result_chunks.idx IS 'The unique result chunk index within the associated dump. Every result set identifier present should hash to this index (modulo lsif_data_metadata.num_result_chunks).'; COMMENT ON COLUMN lsif_data_result_chunks.data IS 'A gob-encoded payload conforming to the [ResultChunkData](https://sourcegraph.com/github.com/sourcegraph/sourcegraph@3.26/-/blob/enterprise/lib/codeintel/semantic/types.go#L76:6) type.'; ALTER TABLE ONLY lsif_data_definitions ADD CONSTRAINT lsif_data_definitions_pkey PRIMARY KEY (dump_id, scheme, identifier); ALTER TABLE ONLY lsif_data_definitions_schema_versions ADD CONSTRAINT lsif_data_definitions_schema_versions_pkey PRIMARY KEY (dump_id); ALTER TABLE ONLY lsif_data_documentation_pages ADD CONSTRAINT lsif_data_documentation_pages_pkey PRIMARY KEY (dump_id, path_id); ALTER TABLE ONLY lsif_data_documents ADD CONSTRAINT lsif_data_documents_pkey PRIMARY KEY (dump_id, path); ALTER TABLE ONLY lsif_data_documents_schema_versions ADD CONSTRAINT lsif_data_documents_schema_versions_pkey PRIMARY KEY (dump_id); ALTER TABLE ONLY lsif_data_metadata ADD CONSTRAINT lsif_data_metadata_pkey PRIMARY KEY (dump_id); ALTER TABLE ONLY lsif_data_references ADD CONSTRAINT lsif_data_references_pkey PRIMARY KEY (dump_id, scheme, identifier); ALTER TABLE ONLY lsif_data_references_schema_versions ADD CONSTRAINT lsif_data_references_schema_versions_pkey PRIMARY KEY (dump_id); ALTER TABLE ONLY lsif_data_result_chunks ADD CONSTRAINT lsif_data_result_chunks_pkey PRIMARY KEY (dump_id, idx); CREATE INDEX lsif_data_definitions_dump_id_schema_version ON lsif_data_definitions USING btree (dump_id, schema_version); CREATE INDEX lsif_data_definitions_schema_versions_dump_id_schema_version_bo ON lsif_data_definitions_schema_versions USING btree (dump_id, min_schema_version, max_schema_version); CREATE INDEX lsif_data_documents_dump_id_schema_version ON lsif_data_documents USING btree (dump_id, schema_version); CREATE INDEX lsif_data_documents_schema_versions_dump_id_schema_version_boun ON lsif_data_documents_schema_versions USING btree (dump_id, min_schema_version, max_schema_version); CREATE INDEX lsif_data_references_dump_id_schema_version ON lsif_data_references USING btree (dump_id, schema_version); CREATE INDEX lsif_data_references_schema_versions_dump_id_schema_version_bou ON lsif_data_references_schema_versions USING btree (dump_id, min_schema_version, max_schema_version); CREATE TRIGGER lsif_data_definitions_schema_versions_insert AFTER INSERT ON lsif_data_definitions REFERENCING NEW TABLE AS newtab FOR EACH STATEMENT EXECUTE FUNCTION update_lsif_data_definitions_schema_versions_insert(); CREATE TRIGGER lsif_data_documents_schema_versions_insert AFTER INSERT ON lsif_data_documents REFERENCING NEW TABLE AS newtab FOR EACH STATEMENT EXECUTE FUNCTION update_lsif_data_documents_schema_versions_insert(); CREATE TRIGGER lsif_data_references_schema_versions_insert AFTER INSERT ON lsif_data_references REFERENCING NEW TABLE AS newtab FOR EACH STATEMENT EXECUTE FUNCTION update_lsif_data_references_schema_versions_insert(); COMMIT;
the_stack
-- -- Cursor regression tests -- BEGIN; DECLARE foo1 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo2 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo3 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo4 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo5 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo6 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo7 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo8 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo9 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo10 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo11 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo12 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo13 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo14 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo15 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo16 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo17 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo18 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo19 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo20 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo21 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; DECLARE foo22 SCROLL CURSOR FOR SELECT * FROM tenk2; DECLARE foo23 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; FETCH 1 in foo1; FETCH 2 in foo2; FETCH 3 in foo3; FETCH 4 in foo4; FETCH 5 in foo5; FETCH 6 in foo6; FETCH 7 in foo7; FETCH 8 in foo8; FETCH 9 in foo9; FETCH 10 in foo10; FETCH 11 in foo11; FETCH 12 in foo12; FETCH 13 in foo13; FETCH 14 in foo14; FETCH 15 in foo15; FETCH 16 in foo16; FETCH 17 in foo17; FETCH 18 in foo18; FETCH 19 in foo19; FETCH 20 in foo20; FETCH 21 in foo21; FETCH 22 in foo22; FETCH 23 in foo23; FETCH backward 1 in foo23; FETCH backward 2 in foo22; FETCH backward 3 in foo21; FETCH backward 4 in foo20; FETCH backward 5 in foo19; FETCH backward 6 in foo18; FETCH backward 7 in foo17; FETCH backward 8 in foo16; FETCH backward 9 in foo15; FETCH backward 10 in foo14; FETCH backward 11 in foo13; FETCH backward 12 in foo12; FETCH backward 13 in foo11; FETCH backward 14 in foo10; FETCH backward 15 in foo9; FETCH backward 16 in foo8; FETCH backward 17 in foo7; FETCH backward 18 in foo6; FETCH backward 19 in foo5; FETCH backward 20 in foo4; FETCH backward 21 in foo3; FETCH backward 22 in foo2; FETCH backward 23 in foo1; CLOSE foo1; CLOSE foo2; CLOSE foo3; CLOSE foo4; CLOSE foo5; CLOSE foo6; CLOSE foo7; CLOSE foo8; CLOSE foo9; CLOSE foo10; CLOSE foo11; CLOSE foo12; -- leave some cursors open, to test that auto-close works. -- record this in the system view as well (don't query the time field there -- however) SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors ORDER BY 1; END; SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; -- -- NO SCROLL disallows backward fetching -- BEGIN; DECLARE foo24 NO SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; FETCH 1 FROM foo24; FETCH BACKWARD 1 FROM foo24; -- should fail END; BEGIN; DECLARE foo24 NO SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; FETCH 1 FROM foo24; FETCH ABSOLUTE 2 FROM foo24; -- allowed FETCH ABSOLUTE 1 FROM foo24; -- should fail END; -- -- Cursors outside transaction blocks -- SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; BEGIN; DECLARE foo25 SCROLL CURSOR WITH HOLD FOR SELECT * FROM tenk2; FETCH FROM foo25; FETCH FROM foo25; COMMIT; FETCH FROM foo25; FETCH BACKWARD FROM foo25; FETCH ABSOLUTE -1 FROM foo25; SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; CLOSE foo25; BEGIN; DECLARE foo25ns NO SCROLL CURSOR WITH HOLD FOR SELECT * FROM tenk2; FETCH FROM foo25ns; FETCH FROM foo25ns; COMMIT; FETCH FROM foo25ns; FETCH ABSOLUTE 4 FROM foo25ns; FETCH ABSOLUTE 4 FROM foo25ns; -- fail SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; CLOSE foo25ns; -- -- ROLLBACK should close holdable cursors -- BEGIN; DECLARE foo26 CURSOR WITH HOLD FOR SELECT * FROM tenk1 ORDER BY unique2; ROLLBACK; -- should fail FETCH FROM foo26; -- -- Parameterized DECLARE needs to insert param values into the cursor portal -- BEGIN; CREATE FUNCTION declares_cursor(text) RETURNS void AS 'DECLARE c CURSOR FOR SELECT stringu1 FROM tenk1 WHERE stringu1 LIKE $1;' LANGUAGE SQL; SELECT declares_cursor('AB%'); FETCH ALL FROM c; ROLLBACK; -- -- Test behavior of both volatile and stable functions inside a cursor; -- in particular we want to see what happens during commit of a holdable -- cursor -- create temp table tt1(f1 int); create function count_tt1_v() returns int8 as 'select count(*) from tt1' language sql volatile; create function count_tt1_s() returns int8 as 'select count(*) from tt1' language sql stable; begin; insert into tt1 values(1); declare c1 cursor for select count_tt1_v(), count_tt1_s(); insert into tt1 values(2); fetch all from c1; rollback; begin; insert into tt1 values(1); declare c2 cursor with hold for select count_tt1_v(), count_tt1_s(); insert into tt1 values(2); commit; delete from tt1; fetch all from c2; drop function count_tt1_v(); drop function count_tt1_s(); -- Create a cursor with the BINARY option and check the pg_cursors view BEGIN; SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; DECLARE bc BINARY CURSOR FOR SELECT * FROM tenk1; SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors ORDER BY 1; ROLLBACK; -- We should not see the portal that is created internally to -- implement EXECUTE in pg_cursors PREPARE cprep AS SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; EXECUTE cprep; -- test CLOSE ALL; SELECT name FROM pg_cursors ORDER BY 1; CLOSE ALL; SELECT name FROM pg_cursors ORDER BY 1; BEGIN; DECLARE foo1 CURSOR WITH HOLD FOR SELECT 1; DECLARE foo2 CURSOR WITHOUT HOLD FOR SELECT 1; SELECT name FROM pg_cursors ORDER BY 1; CLOSE ALL; SELECT name FROM pg_cursors ORDER BY 1; COMMIT; -- -- Tests for updatable cursors -- CREATE TEMP TABLE uctest(f1 int, f2 text); INSERT INTO uctest VALUES (1, 'one'), (2, 'two'), (3, 'three'); SELECT * FROM uctest; -- Check DELETE WHERE CURRENT BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest; FETCH 2 FROM c1; DELETE FROM uctest WHERE CURRENT OF c1; -- should show deletion SELECT * FROM uctest; -- cursor did not move FETCH ALL FROM c1; -- cursor is insensitive MOVE BACKWARD ALL IN c1; FETCH ALL FROM c1; COMMIT; -- should still see deletion SELECT * FROM uctest; -- Check UPDATE WHERE CURRENT; this time use FOR UPDATE BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; FETCH c1; UPDATE uctest SET f1 = 8 WHERE CURRENT OF c1; SELECT * FROM uctest; COMMIT; SELECT * FROM uctest; -- Check repeated-update and update-then-delete cases BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest; FETCH c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; SELECT * FROM uctest; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; SELECT * FROM uctest; -- insensitive cursor should not show effects of updates or deletes FETCH RELATIVE 0 FROM c1; DELETE FROM uctest WHERE CURRENT OF c1; SELECT * FROM uctest; DELETE FROM uctest WHERE CURRENT OF c1; -- no-op SELECT * FROM uctest; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- no-op SELECT * FROM uctest; FETCH RELATIVE 0 FROM c1; ROLLBACK; SELECT * FROM uctest; BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; FETCH c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; SELECT * FROM uctest; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; SELECT * FROM uctest; DELETE FROM uctest WHERE CURRENT OF c1; SELECT * FROM uctest; DELETE FROM uctest WHERE CURRENT OF c1; -- no-op SELECT * FROM uctest; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- no-op SELECT * FROM uctest; --- FOR UPDATE cursors can't currently scroll back, so this is an error: FETCH RELATIVE 0 FROM c1; ROLLBACK; SELECT * FROM uctest; -- Check insensitive cursor with INSERT -- (The above tests don't test the SQL notion of an insensitive cursor -- correctly, because per SQL standard, changes from WHERE CURRENT OF -- commands should be visible in the cursor. So here we make the -- changes with a command that is independent of the cursor.) BEGIN; DECLARE c1 INSENSITIVE CURSOR FOR SELECT * FROM uctest; INSERT INTO uctest VALUES (10, 'ten'); FETCH NEXT FROM c1; FETCH NEXT FROM c1; FETCH NEXT FROM c1; -- insert not visible COMMIT; SELECT * FROM uctest; DELETE FROM uctest WHERE f1 = 10; -- restore test table state -- Check inheritance cases CREATE TEMP TABLE ucchild () inherits (uctest); INSERT INTO ucchild values(100, 'hundred'); SELECT * FROM uctest; BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; FETCH 1 FROM c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; FETCH 1 FROM c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; FETCH 1 FROM c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; FETCH 1 FROM c1; COMMIT; SELECT * FROM uctest; -- Can update from a self-join, but only if FOR UPDATE says which to use BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5; FETCH 1 FROM c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- fail ROLLBACK; BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5 FOR UPDATE; FETCH 1 FROM c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- fail ROLLBACK; BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5 FOR SHARE OF a; FETCH 1 FROM c1; UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; SELECT * FROM uctest; ROLLBACK; -- Check various error cases DELETE FROM uctest WHERE CURRENT OF c1; -- fail, no such cursor DECLARE cx CURSOR WITH HOLD FOR SELECT * FROM uctest; DELETE FROM uctest WHERE CURRENT OF cx; -- fail, can't use held cursor BEGIN; DECLARE c CURSOR FOR SELECT * FROM tenk2; DELETE FROM uctest WHERE CURRENT OF c; -- fail, cursor on wrong table ROLLBACK; BEGIN; DECLARE c CURSOR FOR SELECT * FROM tenk2 FOR SHARE; DELETE FROM uctest WHERE CURRENT OF c; -- fail, cursor on wrong table ROLLBACK; BEGIN; DECLARE c CURSOR FOR SELECT * FROM tenk1 JOIN tenk2 USING (unique1); DELETE FROM tenk1 WHERE CURRENT OF c; -- fail, cursor is on a join ROLLBACK; BEGIN; DECLARE c CURSOR FOR SELECT f1,count(*) FROM uctest GROUP BY f1; DELETE FROM uctest WHERE CURRENT OF c; -- fail, cursor is on aggregation ROLLBACK; BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM uctest; DELETE FROM uctest WHERE CURRENT OF c1; -- fail, no current row ROLLBACK; BEGIN; DECLARE c1 CURSOR FOR SELECT MIN(f1) FROM uctest FOR UPDATE; ROLLBACK; -- WHERE CURRENT OF may someday work with views, but today is not that day. -- For now, just make sure it errors out cleanly. CREATE TEMP VIEW ucview AS SELECT * FROM uctest; CREATE RULE ucrule AS ON DELETE TO ucview DO INSTEAD DELETE FROM uctest WHERE f1 = OLD.f1; BEGIN; DECLARE c1 CURSOR FOR SELECT * FROM ucview; FETCH FROM c1; DELETE FROM ucview WHERE CURRENT OF c1; -- fail, views not supported ROLLBACK; -- Check WHERE CURRENT OF with an index-only scan BEGIN; EXPLAIN (costs off) DECLARE c1 CURSOR FOR SELECT stringu1 FROM onek WHERE stringu1 = 'DZAAAA'; DECLARE c1 CURSOR FOR SELECT stringu1 FROM onek WHERE stringu1 = 'DZAAAA'; FETCH FROM c1; DELETE FROM onek WHERE CURRENT OF c1; SELECT stringu1 FROM onek WHERE stringu1 = 'DZAAAA'; ROLLBACK; -- Check behavior with rewinding to a previous child scan node, -- as per bug #15395 BEGIN; CREATE TABLE current_check (currentid int, payload text); CREATE TABLE current_check_1 () INHERITS (current_check); CREATE TABLE current_check_2 () INHERITS (current_check); INSERT INTO current_check_1 SELECT i, 'p' || i FROM generate_series(1,9) i; INSERT INTO current_check_2 SELECT i, 'P' || i FROM generate_series(10,19) i; DECLARE c1 SCROLL CURSOR FOR SELECT * FROM current_check; -- This tests the fetch-backwards code path FETCH ABSOLUTE 12 FROM c1; FETCH ABSOLUTE 8 FROM c1; DELETE FROM current_check WHERE CURRENT OF c1 RETURNING *; -- This tests the ExecutorRewind code path FETCH ABSOLUTE 13 FROM c1; FETCH ABSOLUTE 1 FROM c1; DELETE FROM current_check WHERE CURRENT OF c1 RETURNING *; SELECT * FROM current_check; ROLLBACK; -- Make sure snapshot management works okay, per bug report in -- 235395b90909301035v7228ce63q392931f15aa74b31@mail.gmail.com BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; CREATE TABLE cursor (a int); INSERT INTO cursor VALUES (1); DECLARE c1 NO SCROLL CURSOR FOR SELECT * FROM cursor FOR UPDATE; UPDATE cursor SET a = 2; FETCH ALL FROM c1; COMMIT; DROP TABLE cursor; -- Check rewinding a cursor containing a stable function in LIMIT, -- per bug report in 8336843.9833.1399385291498.JavaMail.root@quick begin; create function nochange(int) returns int as 'select $1 limit 1' language sql stable; declare c cursor for select * from int8_tbl limit nochange(3); fetch all from c; move backward all in c; fetch all from c; rollback; -- Check handling of non-backwards-scan-capable plans with scroll cursors begin; explain (costs off) declare c1 cursor for select (select 42) as x; explain (costs off) declare c1 scroll cursor for select (select 42) as x; declare c1 scroll cursor for select (select 42) as x; fetch all in c1; fetch backward all in c1; rollback; begin; explain (costs off) declare c2 cursor for select generate_series(1,3) as g; explain (costs off) declare c2 scroll cursor for select generate_series(1,3) as g; declare c2 scroll cursor for select generate_series(1,3) as g; fetch all in c2; fetch backward all in c2; rollback; -- Check fetching of toasted datums via cursors. begin; -- Other compression algorithms may cause the compressed data to be stored -- inline. Use pglz to ensure consistent results. set default_toast_compression = 'pglz'; create table toasted_data (f1 int[]); insert into toasted_data select array_agg(i) from generate_series(12345678, 12345678 + 1000) i; declare local_portal cursor for select * from toasted_data; fetch all in local_portal; declare held_portal cursor with hold for select * from toasted_data; commit; drop table toasted_data; fetch all in held_portal; reset default_toast_compression;
the_stack
-- -- AGGREGATES -- SELECT avg(four) AS avg_1 FROM onek; SELECT avg(a) AS avg_32 FROM aggtest WHERE a < 100; -- In 7.1, avg(float4) is computed using float8 arithmetic. -- Round the result to 3 digits to avoid platform-specific results. SELECT avg(b)::numeric(10,3) AS avg_107_943 FROM aggtest; SELECT avg(gpa) AS avg_3_4 FROM ONLY student; SELECT sum(four) AS sum_1500 FROM onek; SELECT sum(a) AS sum_198 FROM aggtest; SELECT sum(b) AS avg_431_773 FROM aggtest; SELECT sum(gpa) AS avg_6_8 FROM ONLY student; SELECT max(four) AS max_3 FROM onek; SELECT max(a) AS max_100 FROM aggtest; SELECT max(aggtest.b) AS max_324_78 FROM aggtest; SELECT max(student.gpa) AS max_3_7 FROM student; SELECT stddev_pop(b) FROM aggtest; SELECT stddev_samp(b) FROM aggtest; SELECT var_pop(b) FROM aggtest; SELECT var_samp(b) FROM aggtest; SELECT stddev_pop(b::numeric) FROM aggtest; SELECT stddev_samp(b::numeric) FROM aggtest; SELECT var_pop(b::numeric) FROM aggtest; SELECT var_samp(b::numeric) FROM aggtest; -- population variance is defined for a single tuple, sample variance -- is not SELECT var_pop(1.0), var_samp(2.0); SELECT stddev_pop(3.0::numeric), stddev_samp(4.0::numeric); -- verify correct results for null and NaN inputs select sum(null::int4) from generate_series(1,3); select sum(null::int8) from generate_series(1,3); select sum(null::numeric) from generate_series(1,3); select sum(null::float8) from generate_series(1,3); select avg(null::int4) from generate_series(1,3); select avg(null::int8) from generate_series(1,3); select avg(null::numeric) from generate_series(1,3); select avg(null::float8) from generate_series(1,3); select sum('NaN'::numeric) from generate_series(1,3); select avg('NaN'::numeric) from generate_series(1,3); -- SQL2003 binary aggregates SELECT regr_count(b, a) FROM aggtest; SELECT regr_sxx(b, a) FROM aggtest; SELECT regr_syy(b, a) FROM aggtest; SELECT regr_sxy(b, a) FROM aggtest; SELECT regr_avgx(b, a), regr_avgy(b, a) FROM aggtest; SELECT regr_r2(b, a) FROM aggtest; SELECT regr_slope(b, a), regr_intercept(b, a) FROM aggtest; SELECT covar_pop(b, a), covar_samp(b, a) FROM aggtest; SELECT corr(b, a) FROM aggtest; SELECT count(four) AS cnt_1000 FROM onek; SELECT count(DISTINCT four) AS cnt_4 FROM onek; select ten, count(*), sum(four) from onek group by ten order by ten; select ten, count(four), sum(DISTINCT four) from onek group by ten order by ten; -- user-defined aggregates SELECT newavg(four) AS avg_1 FROM onek; SELECT newsum(four) AS sum_1500 FROM onek; SELECT newcnt(four) AS cnt_1000 FROM onek; SELECT newcnt(*) AS cnt_1000 FROM onek; SELECT oldcnt(*) AS cnt_1000 FROM onek; SELECT sum2(q1,q2) FROM int8_tbl; -- test for outer-level aggregates -- this should work select ten, sum(distinct four) from onek a group by ten having exists (select 1 from onek b where sum(distinct a.four) = b.four); -- this should fail because subquery has an agg of its own in WHERE select ten, sum(distinct four) from onek a group by ten having exists (select 1 from onek b where sum(distinct a.four + b.four) = b.four); -- Test handling of sublinks within outer-level aggregates. -- Per bug report from Daniel Grace. select (select max((select i.unique2 from tenk1 i where i.unique1 = o.unique1))) from tenk1 o; -- Test handling of Params within aggregate arguments in hashed aggregation. -- Per bug report from Jeevan Chalke. explain (verbose, costs off) select s1, s2, sm from generate_series(1, 3) s1, lateral (select s2, sum(s1 + s2) sm from generate_series(1, 3) s2 group by s2) ss order by 1, 2; select s1, s2, sm from generate_series(1, 3) s1, lateral (select s2, sum(s1 + s2) sm from generate_series(1, 3) s2 group by s2) ss order by 1, 2; explain (verbose, costs off) select array(select sum(x+y) s from generate_series(1,3) y group by y order by s) from generate_series(1,3) x; select array(select sum(x+y) s from generate_series(1,3) y group by y order by s) from generate_series(1,3) x; -- -- test boolean aggregates -- -- first test all possible transition and final states SELECT -- boolean and transitions -- null because strict booland_statefunc(NULL, NULL) IS NULL AS "t", booland_statefunc(TRUE, NULL) IS NULL AS "t", booland_statefunc(FALSE, NULL) IS NULL AS "t", booland_statefunc(NULL, TRUE) IS NULL AS "t", booland_statefunc(NULL, FALSE) IS NULL AS "t", -- and actual computations booland_statefunc(TRUE, TRUE) AS "t", NOT booland_statefunc(TRUE, FALSE) AS "t", NOT booland_statefunc(FALSE, TRUE) AS "t", NOT booland_statefunc(FALSE, FALSE) AS "t"; SELECT -- boolean or transitions -- null because strict boolor_statefunc(NULL, NULL) IS NULL AS "t", boolor_statefunc(TRUE, NULL) IS NULL AS "t", boolor_statefunc(FALSE, NULL) IS NULL AS "t", boolor_statefunc(NULL, TRUE) IS NULL AS "t", boolor_statefunc(NULL, FALSE) IS NULL AS "t", -- actual computations boolor_statefunc(TRUE, TRUE) AS "t", boolor_statefunc(TRUE, FALSE) AS "t", boolor_statefunc(FALSE, TRUE) AS "t", NOT boolor_statefunc(FALSE, FALSE) AS "t"; -- -- Test cases that should be optimized into indexscans instead of -- the generic aggregate implementation. -- -- Basic cases explain (costs off) select min(unique1) from tenk1; select min(unique1) from tenk1; explain (costs off) select max(unique1) from tenk1; select max(unique1) from tenk1; explain (costs off) select max(unique1) from tenk1 where unique1 < 42; select max(unique1) from tenk1 where unique1 < 42; explain (costs off) select max(unique1) from tenk1 where unique1 > 42; select max(unique1) from tenk1 where unique1 > 42; -- the planner may choose a generic aggregate here if parallel query is -- enabled, since that plan will be parallel safe and the "optimized" -- plan, which has almost identical cost, will not be. we want to test -- the optimized plan, so temporarily disable parallel query. begin; set local max_parallel_workers_per_gather = 0; explain (costs off) select max(unique1) from tenk1 where unique1 > 42000; select max(unique1) from tenk1 where unique1 > 42000; rollback; -- multi-column index (uses tenk1_thous_tenthous) explain (costs off) select max(tenthous) from tenk1 where thousand = 33; select max(tenthous) from tenk1 where thousand = 33; explain (costs off) select min(tenthous) from tenk1 where thousand = 33; select min(tenthous) from tenk1 where thousand = 33; -- check parameter propagation into an indexscan subquery explain (costs off) select f1, (select min(unique1) from tenk1 where unique1 > f1) AS gt from int4_tbl; select f1, (select min(unique1) from tenk1 where unique1 > f1) AS gt from int4_tbl; -- check some cases that were handled incorrectly in 8.3.0 explain (costs off) select distinct max(unique2) from tenk1; select distinct max(unique2) from tenk1; explain (costs off) select max(unique2) from tenk1 order by 1; select max(unique2) from tenk1 order by 1; explain (costs off) select max(unique2) from tenk1 order by max(unique2); select max(unique2) from tenk1 order by max(unique2); explain (costs off) select max(unique2) from tenk1 order by max(unique2)+1; select max(unique2) from tenk1 order by max(unique2)+1; explain (costs off) select max(unique2), generate_series(1,3) as g from tenk1 order by g desc; select max(unique2), generate_series(1,3) as g from tenk1 order by g desc; -- interesting corner case: constant gets optimized into a seqscan explain (costs off) select max(100) from tenk1; select max(100) from tenk1; -- check for correct detection of nested-aggregate errors select max(min(unique1)) from tenk1; select (select max(min(unique1)) from int8_tbl) from tenk1; -- -- Test removal of redundant GROUP BY columns -- create temp table t1 (a int, b int, c int, d int, primary key (a, b)); create temp table t2 (x int, y int, z int, primary key (x, y)); create temp table t3 (a int, b int, c int, primary key(a, b) deferrable); -- Non-primary-key columns can be removed from GROUP BY explain (costs off) select * from t1 group by a,b,c,d; -- No removal can happen if the complete PK is not present in GROUP BY explain (costs off) select a,c from t1 group by a,c,d; -- Test removal across multiple relations explain (costs off) select * from t1 inner join t2 on t1.a = t2.x and t1.b = t2.y group by t1.a,t1.b,t1.c,t1.d,t2.x,t2.y,t2.z; -- Test case where t1 can be optimized but not t2 explain (costs off) select t1.*,t2.x,t2.z from t1 inner join t2 on t1.a = t2.x and t1.b = t2.y group by t1.a,t1.b,t1.c,t1.d,t2.x,t2.z; -- Cannot optimize when PK is deferrable explain (costs off) select * from t3 group by a,b,c; -- Ensure we don't remove any columns when t1 has a child table explain (costs off) select * from t1 group by a,b,c,d; -- Okay to remove columns if we're only querying the parent. explain (costs off) select * from only t1 group by a,b,c,d; create temp table p_t1 ( a int, b int, c int, d int, primary key(a,b) ) partition by list(a); create temp table p_t1_1 partition of p_t1 for values in(1); create temp table p_t1_2 partition of p_t1 for values in(2); -- Ensure we can remove non-PK columns for partitioned tables. explain (costs off) select * from p_t1 group by a,b,c,d; drop table t1 cascade; drop table t2; drop table t3; drop table p_t1; -- -- Test combinations of DISTINCT and/or ORDER BY -- select array_agg(a order by b) from (values (1,4),(2,3),(3,1),(4,2)) v(a,b); select array_agg(a order by a) from (values (1,4),(2,3),(3,1),(4,2)) v(a,b); select array_agg(a order by a desc) from (values (1,4),(2,3),(3,1),(4,2)) v(a,b); select array_agg(b order by a desc) from (values (1,4),(2,3),(3,1),(4,2)) v(a,b); select array_agg(distinct a) from (values (1),(2),(1),(3),(null),(2)) v(a); select array_agg(distinct a order by a) from (values (1),(2),(1),(3),(null),(2)) v(a); select array_agg(distinct a order by a desc) from (values (1),(2),(1),(3),(null),(2)) v(a); select array_agg(distinct a order by a desc nulls last) from (values (1),(2),(1),(3),(null),(2)) v(a); -- multi-arg aggs, strict/nonstrict, distinct/order by select aggfstr(a,b,c) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); select aggfns(a,b,c) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); select aggfstr(distinct a,b,c) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,3) i; select aggfns(distinct a,b,c) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,3) i; select aggfstr(distinct a,b,c order by b) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,3) i; select aggfns(distinct a,b,c order by b) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,3) i; -- test specific code paths select aggfns(distinct a,a,c order by c using ~<~,a) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,2) i; select aggfns(distinct a,a,c order by c using ~<~) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,2) i; select aggfns(distinct a,a,c order by a) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,2) i; select aggfns(distinct a,b,c order by a,c using ~<~,b) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,2) i; -- check node I/O via view creation and usage, also deparsing logic create view agg_view1 as select aggfns(a,b,c) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); select * from agg_view1; select pg_get_viewdef('agg_view1'::regclass); create or replace view agg_view1 as select aggfns(distinct a,b,c) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,3) i; select * from agg_view1; select pg_get_viewdef('agg_view1'::regclass); create or replace view agg_view1 as select aggfns(distinct a,b,c order by b) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,3) i; select * from agg_view1; select pg_get_viewdef('agg_view1'::regclass); create or replace view agg_view1 as select aggfns(a,b,c order by b+1) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); select * from agg_view1; select pg_get_viewdef('agg_view1'::regclass); create or replace view agg_view1 as select aggfns(a,a,c order by b) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); select * from agg_view1; select pg_get_viewdef('agg_view1'::regclass); create or replace view agg_view1 as select aggfns(a,b,c order by c using ~<~) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); select * from agg_view1; select pg_get_viewdef('agg_view1'::regclass); create or replace view agg_view1 as select aggfns(distinct a,b,c order by a,c using ~<~,b) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,2) i; select * from agg_view1; select pg_get_viewdef('agg_view1'::regclass); drop view agg_view1; -- incorrect DISTINCT usage errors select aggfns(distinct a,b,c order by i) from (values (1,1,'foo')) v(a,b,c), generate_series(1,2) i; select aggfns(distinct a,b,c order by a,b+1) from (values (1,1,'foo')) v(a,b,c), generate_series(1,2) i; select aggfns(distinct a,b,c order by a,b,i,c) from (values (1,1,'foo')) v(a,b,c), generate_series(1,2) i; select aggfns(distinct a,a,c order by a,b) from (values (1,1,'foo')) v(a,b,c), generate_series(1,2) i; -- string_agg tests select string_agg(a,',') from (values('aaaa'),('bbbb'),('cccc')) g(a); select string_agg(a,',') from (values('aaaa'),(null),('bbbb'),('cccc')) g(a); select string_agg(a,'AB') from (values(null),(null),('bbbb'),('cccc')) g(a); select string_agg(a,',') from (values(null),(null)) g(a); -- check some implicit casting cases, as per bug #5564 select string_agg(distinct f1, ',' order by f1) from varchar_tbl; -- ok select string_agg(distinct f1::text, ',' order by f1) from varchar_tbl; -- not ok select string_agg(distinct f1, ',' order by f1::text) from varchar_tbl; -- not ok select string_agg(distinct f1::text, ',' order by f1::text) from varchar_tbl; -- ok -- string_agg bytea tests create table bytea_test_table(v bytea); select string_agg(v, '') from bytea_test_table; insert into bytea_test_table values(decode('ff','hex')); select string_agg(v, '') from bytea_test_table; insert into bytea_test_table values(decode('aa','hex')); select string_agg(v, '') from bytea_test_table; select string_agg(v, NULL) from bytea_test_table; select string_agg(v, decode('ee', 'hex')) from bytea_test_table; drop table bytea_test_table; -- FILTER tests select min(unique1) filter (where unique1 > 100) from tenk1; select sum(1/ten) filter (where ten > 0) from tenk1; select ten, sum(distinct four) filter (where four::text ~ '123') from onek a group by ten; select ten, sum(distinct four) filter (where four > 10) from onek a group by ten having exists (select 1 from onek b where sum(distinct a.four) = b.four); select max(foo COLLATE "C") filter (where (bar collate "POSIX") > '0') from (values ('a', 'b')) AS v(foo,bar); -- outer reference in FILTER (PostgreSQL extension) select (select count(*) from (values (1)) t0(inner_c)) from (values (2),(3)) t1(outer_c); -- inner query is aggregation query select (select count(*) filter (where outer_c <> 0) from (values (1)) t0(inner_c)) from (values (2),(3)) t1(outer_c); -- outer query is aggregation query select (select count(inner_c) filter (where outer_c <> 0) from (values (1)) t0(inner_c)) from (values (2),(3)) t1(outer_c); -- inner query is aggregation query select (select max((select i.unique2 from tenk1 i where i.unique1 = o.unique1)) filter (where o.unique1 < 10)) from tenk1 o; -- outer query is aggregation query -- subquery in FILTER clause (PostgreSQL extension) select sum(unique1) FILTER (WHERE unique1 IN (SELECT unique1 FROM onek where unique1 < 100)) FROM tenk1; -- exercise lots of aggregate parts with FILTER select aggfns(distinct a,b,c order by a,c using ~<~,b) filter (where a > 1) from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), generate_series(1,2) i; -- ordered-set aggregates select p, percentile_cont(p) within group (order by x::float8) from generate_series(1,5) x, (values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p) group by p order by p; select p, percentile_cont(p order by p) within group (order by x) -- error from generate_series(1,5) x, (values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p) group by p order by p; select p, sum() within group (order by x::float8) -- error from generate_series(1,5) x, (values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p) group by p order by p; select p, percentile_cont(p,p) -- error from generate_series(1,5) x, (values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p) group by p order by p; select percentile_cont(0.5) within group (order by b) from aggtest; select percentile_cont(0.5) within group (order by b), sum(b) from aggtest; select percentile_cont(0.5) within group (order by thousand) from tenk1; select percentile_disc(0.5) within group (order by thousand) from tenk1; select rank(3) within group (order by x) from (values (1),(1),(2),(2),(3),(3),(4)) v(x); select cume_dist(3) within group (order by x) from (values (1),(1),(2),(2),(3),(3),(4)) v(x); select percent_rank(3) within group (order by x) from (values (1),(1),(2),(2),(3),(3),(4),(5)) v(x); select dense_rank(3) within group (order by x) from (values (1),(1),(2),(2),(3),(3),(4)) v(x); select percentile_disc(array[0,0.1,0.25,0.5,0.75,0.9,1]) within group (order by thousand) from tenk1; select percentile_cont(array[0,0.25,0.5,0.75,1]) within group (order by thousand) from tenk1; select percentile_disc(array[[null,1,0.5],[0.75,0.25,null]]) within group (order by thousand) from tenk1; select percentile_cont(array[0,1,0.25,0.75,0.5,1,0.3,0.32,0.35,0.38,0.4]) within group (order by x) from generate_series(1,6) x; select ten, mode() within group (order by string4) from tenk1 group by ten; select percentile_disc(array[0.25,0.5,0.75]) within group (order by x) from unnest('{fred,jim,fred,jack,jill,fred,jill,jim,jim,sheila,jim,sheila}'::text[]) u(x); -- check collation propagates up in suitable cases: select pg_collation_for(percentile_disc(1) within group (order by x collate "POSIX")) from (values ('fred'),('jim')) v(x); -- ordered-set aggs created with CREATE AGGREGATE select test_rank(3) within group (order by x) from (values (1),(1),(2),(2),(3),(3),(4)) v(x); select test_percentile_disc(0.5) within group (order by thousand) from tenk1; -- ordered-set aggs can't use ungrouped vars in direct args: select rank(x) within group (order by x) from generate_series(1,5) x; -- outer-level agg can't use a grouped arg of a lower level, either: select array(select percentile_disc(a) within group (order by x) from (values (0.3),(0.7)) v(a) group by a) from generate_series(1,5) g(x); -- agg in the direct args is a grouping violation, too: select rank(sum(x)) within group (order by x) from generate_series(1,5) x; -- hypothetical-set type unification and argument-count failures: select rank(3) within group (order by x) from (values ('fred'),('jim')) v(x); select rank(3) within group (order by stringu1,stringu2) from tenk1; select rank('fred') within group (order by x) from generate_series(1,5) x; select rank('adam'::text collate "C") within group (order by x collate "POSIX") from (values ('fred'),('jim')) v(x); -- hypothetical-set type unification successes: select rank('adam'::varchar) within group (order by x) from (values ('fred'),('jim')) v(x); select rank('3') within group (order by x) from generate_series(1,5) x; -- divide by zero check select percent_rank(0) within group (order by x) from generate_series(1,0) x; -- deparse and multiple features: create view aggordview1 as select ten, percentile_disc(0.5) within group (order by thousand) as p50, percentile_disc(0.5) within group (order by thousand) filter (where hundred=1) as px, rank(5,'AZZZZ',50) within group (order by hundred, string4 desc, hundred) from tenk1 group by ten order by ten; select pg_get_viewdef('aggordview1'); select * from aggordview1 order by ten; drop view aggordview1; -- variadic aggregates select least_agg(q1,q2) from int8_tbl; select least_agg(variadic array[q1,q2]) from int8_tbl; -- test aggregates with common transition functions share the same states begin work; create type avg_state as (total bigint, count bigint); create or replace function avg_transfn(state avg_state, n int) returns avg_state as $$ declare new_state avg_state; begin raise notice 'avg_transfn called with %', n; if state is null then if n is not null then new_state.total = n; new_state.count = 1; return new_state; end if; return null; elsif n is not null then state.total = state.total + n; state.count = state.count + 1; return state; end if; return null; end $$ language plpgsql; create function avg_finalfn(state avg_state) returns int4 as $$ begin if state is null then return NULL; else return state.total / state.count; end if; end $$ language plpgsql; create function sum_finalfn(state avg_state) returns int4 as $$ begin if state is null then return NULL; else return state.total; end if; end $$ language plpgsql; create aggregate my_avg(int4) ( stype = avg_state, sfunc = avg_transfn, finalfunc = avg_finalfn ); create aggregate my_sum(int4) ( stype = avg_state, sfunc = avg_transfn, finalfunc = sum_finalfn ); -- aggregate state should be shared as aggs are the same. select my_avg(one),my_avg(one) from (values(1),(3)) t(one); -- aggregate state should be shared as transfn is the same for both aggs. select my_avg(one),my_sum(one) from (values(1),(3)) t(one); -- same as previous one, but with DISTINCT, which requires sorting the input. select my_avg(distinct one),my_sum(distinct one) from (values(1),(3),(1)) t(one); -- shouldn't share states due to the distinctness not matching. select my_avg(distinct one),my_sum(one) from (values(1),(3)) t(one); -- shouldn't share states due to the filter clause not matching. select my_avg(one) filter (where one > 1),my_sum(one) from (values(1),(3)) t(one); -- this should not share the state due to different input columns. select my_avg(one),my_sum(two) from (values(1,2),(3,4)) t(one,two); -- exercise cases where OSAs share state select percentile_cont(0.5) within group (order by a), percentile_disc(0.5) within group (order by a) from (values(1::float8),(3),(5),(7)) t(a); select percentile_cont(0.25) within group (order by a), percentile_disc(0.5) within group (order by a) from (values(1::float8),(3),(5),(7)) t(a); -- these can't share state currently select rank(4) within group (order by a), dense_rank(4) within group (order by a) from (values(1),(3),(5),(7)) t(a); -- test that aggs with the same sfunc and initcond share the same agg state create aggregate my_sum_init(int4) ( stype = avg_state, sfunc = avg_transfn, finalfunc = sum_finalfn, initcond = '(10,0)' ); create aggregate my_avg_init(int4) ( stype = avg_state, sfunc = avg_transfn, finalfunc = avg_finalfn, initcond = '(10,0)' ); create aggregate my_avg_init2(int4) ( stype = avg_state, sfunc = avg_transfn, finalfunc = avg_finalfn, initcond = '(4,0)' ); -- state should be shared if INITCONDs are matching select my_sum_init(one),my_avg_init(one) from (values(1),(3)) t(one); -- Varying INITCONDs should cause the states not to be shared. select my_sum_init(one),my_avg_init2(one) from (values(1),(3)) t(one); rollback; -- test aggregate state sharing to ensure it works if one aggregate has a -- finalfn and the other one has none. begin work; create or replace function sum_transfn(state int4, n int4) returns int4 as $$ declare new_state int4; begin raise notice 'sum_transfn called with %', n; if state is null then if n is not null then new_state = n; return new_state; end if; return null; elsif n is not null then state = state + n; return state; end if; return null; end $$ language plpgsql; create function halfsum_finalfn(state int4) returns int4 as $$ begin if state is null then return NULL; else return state / 2; end if; end $$ language plpgsql; create aggregate my_sum(int4) ( stype = int4, sfunc = sum_transfn ); create aggregate my_half_sum(int4) ( stype = int4, sfunc = sum_transfn, finalfunc = halfsum_finalfn ); -- Agg state should be shared even though my_sum has no finalfn select my_sum(one),my_half_sum(one) from (values(1),(2),(3),(4)) t(one); rollback; -- test that the aggregate transition logic correctly handles -- transition / combine functions returning NULL -- First test the case of a normal transition function returning NULL BEGIN; CREATE FUNCTION balkifnull(int8, int4) RETURNS int8 STRICT LANGUAGE plpgsql AS $$ BEGIN IF $1 IS NULL THEN RAISE 'erroneously called with NULL argument'; END IF; RETURN NULL; END$$; CREATE AGGREGATE balk(int4) ( SFUNC = balkifnull(int8, int4), STYPE = int8, PARALLEL = SAFE, INITCOND = '0' ); SELECT balk(hundred) FROM tenk1; ROLLBACK; -- Secondly test the case of a parallel aggregate combiner function -- returning NULL. For that use normal transition function, but a -- combiner function returning NULL. BEGIN ISOLATION LEVEL REPEATABLE READ; CREATE FUNCTION balkifnull(int8, int8) RETURNS int8 PARALLEL SAFE STRICT LANGUAGE plpgsql AS $$ BEGIN IF $1 IS NULL THEN RAISE 'erroneously called with NULL argument'; END IF; RETURN NULL; END$$; CREATE AGGREGATE balk(int4) ( SFUNC = int4_sum(int8, int4), STYPE = int8, COMBINEFUNC = balkifnull(int8, int8), PARALLEL = SAFE, INITCOND = '0' ); -- force use of parallelism --ALTER TABLE tenk1 set (parallel_workers = 4); SET LOCAL parallel_setup_cost=0; SET LOCAL max_parallel_workers_per_gather=4; EXPLAIN (COSTS OFF) SELECT balk(hundred) FROM tenk1; SELECT balk(hundred) FROM tenk1; ROLLBACK; -- test coverage for aggregate combine/serial/deserial functions BEGIN ISOLATION LEVEL REPEATABLE READ; SET parallel_setup_cost = 0; SET parallel_tuple_cost = 0; SET min_parallel_table_scan_size = 0; SET max_parallel_workers_per_gather = 4; SET enable_indexonlyscan = off; -- variance(int4) covers numeric_poly_combine -- sum(int8) covers int8_avg_combine -- regr_count(float8, float8) covers int8inc_float8_float8 and aggregates with > 1 arg EXPLAIN (COSTS OFF, VERBOSE) SELECT variance(unique1::int4), sum(unique1::int8), regr_count(unique1::float8, unique1::float8) FROM tenk1; SELECT variance(unique1::int4), sum(unique1::int8), regr_count(unique1::float8, unique1::float8) FROM tenk1; ROLLBACK; -- test coverage for dense_rank SELECT dense_rank(x) WITHIN GROUP (ORDER BY x) FROM (VALUES (1),(1),(2),(2),(3),(3)) v(x) GROUP BY (x) ORDER BY 1; -- Ensure that the STRICT checks for aggregates does not take NULLness -- of ORDER BY columns into account. See bug report around -- 2a505161-2727-2473-7c46-591ed108ac52@email.cz SELECT min(x ORDER BY y) FROM (VALUES(1, NULL)) AS d(x,y); SELECT min(x ORDER BY y) FROM (VALUES(1, 2)) AS d(x,y); -- check collation-sensitive matching between grouping expressions select v||'a', case v||'a' when 'aa' then 1 else 0 end, count(*) from unnest(array['a','b']) u(v) group by v||'a' order by 1; select v||'a', case when v||'a' = 'aa' then 1 else 0 end, count(*) from unnest(array['a','b']) u(v) group by v||'a' order by 1; -- Make sure that generation of HashAggregate for uniqification purposes -- does not lead to array overflow due to unexpected duplicate hash keys -- see CAFeeJoKKu0u+A_A9R9316djW-YW3-+Gtgvy3ju655qRHR3jtdA@mail.gmail.com explain (costs off) select 1 from tenk1 where (hundred, thousand) in (select twothousand, twothousand from onek);
the_stack
-- 2018-07-04T13:46:33.078 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table (AccessLevel,ACTriggerLength,AD_Client_ID,AD_Org_ID,AD_Table_ID,CopyColumnsFromTable,Created,CreatedBy,EntityType,ImportTable,IsActive,IsAutocomplete,IsChangeLog,IsDeleteable,IsDLM,IsHighVolume,IsSecurityEnabled,IsView,LoadSeq,Name,PersonalDataCategory,ReplicationType,TableName,Updated,UpdatedBy) VALUES ('3',0,0,0,541001,'N',TO_TIMESTAMP('2018-07-04 13:46:32','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.printing','N','Y','N','N','N','N','N','N','Y',0,'C_Order_MFGWarehouse_Report_PrintInfo_v','NP','L','C_Order_MFGWarehouse_Report_PrintInfo_v',TO_TIMESTAMP('2018-07-04 13:46:32','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-07-04T13:46:33.096 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=541001 AND NOT EXISTS (SELECT 1 FROM AD_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Table_ID=t.AD_Table_ID) ; -- 2018-07-04T13:50:06.259 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table SET IsView='N',Updated=TO_TIMESTAMP('2018-07-04 13:50:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=541001 ; -- 2018-07-04T13:51:39.168 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table SET IsView='Y',Updated=TO_TIMESTAMP('2018-07-04 13:51:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=541001 ; -- 2018-07-04T13:55:19.413 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560613,558,0,19,541001,'C_Order_ID',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,'Auftrag','de.metas.fresh',10,'The Order is a control document. The Order is complete when the quantity ordered is the same as the quantity shipped and invoiced. When you cloase an order, unshipped (backordered) quantities are cancelled.','Y','Y','N','N','N','N','N','N','N','N','N','Auftrag',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:19.417 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560613 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:19.505 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560614,542890,0,19,541001,'C_Order_MFGWarehouse_Report_ID',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Order / MFG Warehouse report',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:19.509 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560614 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:19.602 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560615,542007,0,19,541001,'AD_User_Responsible_ID',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Verantwortlicher Benutzer',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:19.607 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560615 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:19.702 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560616,113,0,19,541001,'AD_Org_ID',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,'Organisatorische Einheit des Mandanten','de.metas.fresh',10,'Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.','Y','Y','N','N','N','N','N','N','N','N','N','Sektion',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:19.707 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560616 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:19.788 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560617,102,0,19,541001,'AD_Client_ID',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,'Mandant für diese Installation.','de.metas.fresh',10,'Ein Mandant ist eine Firma oder eine juristische Person. Sie können keine Daten über Mandanten hinweg verwenden. .','Y','Y','N','N','N','N','N','N','N','N','N','Mandant',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:19.793 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560617 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:19.878 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,544157,0,'ad_session_printpackage_id',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y','ad_session_printpackage_id','ad_session_printpackage_id',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-07-04T13:55:19.884 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=544157 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2018-07-04T13:55:19.959 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560618,544157,0,19,541001,'ad_session_printpackage_id',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','ad_session_printpackage_id',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:19.960 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560618 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:20.039 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560619,1777,0,19,541001,'S_Resource_ID',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,'Ressource','de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Ressource',TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:20.042 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560619 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:20.121 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560620,459,0,19,541001,'M_Warehouse_ID',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,'Lager oder Ort für Dienstleistung','de.metas.fresh',10,'Das Lager identifiziert ein einzelnes Lager für Artikel oder einen Standort an dem Dienstleistungen geboten werden.','Y','Y','N','N','N','N','N','N','N','N','N','Lager',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:20.123 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560620 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:20.201 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560621,541906,0,19,541001,'C_Queue_Element_ID',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Element Queue',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:20.206 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560621 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:20.367 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560622,541904,0,19,541001,'C_Queue_WorkPackage_ID',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','WorkPackage Queue',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:20.369 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560622 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:20.560 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,544158,0,'wp_isprocessed',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y','wp_isprocessed','wp_isprocessed',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-07-04T13:55:20.563 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=544158 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2018-07-04T13:55:20.729 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560623,544158,0,20,541001,'wp_isprocessed',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',1,'Y','Y','N','N','N','N','N','N','N','N','N','wp_isprocessed',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:20.732 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560623 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:20.820 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,544159,0,'wp_iserror',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y','wp_iserror','wp_iserror',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-07-04T13:55:20.822 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=544159 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2018-07-04T13:55:20.894 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560624,544159,0,20,541001,'wp_iserror',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',1,'Y','Y','N','N','N','N','N','N','N','N','N','wp_iserror',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:20.898 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560624 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:20.980 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560625,2671,0,19,541001,'AD_Archive_ID',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,'Archiv für Belege und Berichte','de.metas.fresh',10,'In Abhängigkeit des Grades der Archivierungsautomatik des Mandanten werden Dokumente und Berichte archiviert und stehen zur Ansicht zur Verfügung.','Y','Y','N','N','N','N','N','N','N','N','N','Archiv',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:20.984 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560625 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:21.068 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560626,541927,0,19,541001,'C_Printing_Queue_ID',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Druck-Warteschlangendatensatz',TO_TIMESTAMP('2018-07-04 13:55:20','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:21.071 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560626 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:21.155 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560627,542012,0,19,541001,'C_Print_Job_Instructions_ID',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Druck-Job Anweisung',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:21.157 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560627 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:21.240 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,544160,0,'status_print_job_instructions',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y','status_print_job_instructions','status_print_job_instructions',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-07-04T13:55:21.243 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=544160 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2018-07-04T13:55:21.332 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560628,544160,0,20,541001,'status_print_job_instructions',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',1,'Y','Y','N','N','N','N','N','N','N','N','N','status_print_job_instructions',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:21.334 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560628 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:21.412 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560629,541955,0,19,541001,'C_Print_Package_ID',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Druckpaket',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:21.414 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560629 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:21.496 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560630,541959,0,19,541001,'C_Print_PackageInfo_ID',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,'Contains details for the print package, like printer, tray, pages from/to and print service name.','de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Druckpaket-Info',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:21.500 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560630 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:21.581 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560631,541930,0,19,541001,'AD_PrinterHW_ID',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Hardware-Drucker',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:21.584 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560631 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:21.667 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560632,541932,0,19,541001,'AD_PrinterHW_MediaTray_ID',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Hardware-Schacht',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:21.670 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560632 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:21.820 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560633,541962,0,10,541001,'PrintServiceName',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',255,'Y','Y','N','N','N','N','N','N','N','N','N','Print service name',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:21.823 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560633 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:22.052 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560634,541933,0,11,541001,'TrayNumber',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',10,'Y','Y','N','N','N','N','N','N','N','N','N','Schachtnummer',TO_TIMESTAMP('2018-07-04 13:55:21','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:22.053 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560634 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:55:22.289 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,544161,0,'printservicetray',TO_TIMESTAMP('2018-07-04 13:55:22','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh','Y','printservicetray','printservicetray',TO_TIMESTAMP('2018-07-04 13:55:22','YYYY-MM-DD HH24:MI:SS'),100) ; -- 2018-07-04T13:55:22.290 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=544161 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) ; -- 2018-07-04T13:55:22.366 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsTranslated,IsUpdateable,Name,Updated,UpdatedBy,Version) VALUES (0,560635,544161,0,10,541001,'printservicetray',TO_TIMESTAMP('2018-07-04 13:55:22','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.fresh',255,'Y','Y','N','N','N','N','N','N','N','N','N','printservicetray',TO_TIMESTAMP('2018-07-04 13:55:22','YYYY-MM-DD HH24:MI:SS'),100,0) ; -- 2018-07-04T13:55:22.370 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=560635 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) ; -- 2018-07-04T13:59:35.863 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='AD_Session_Printpackage_ID', Name='AD_Session_Printpackage_ID', PrintName='AD_Session_Printpackage_ID',Updated=TO_TIMESTAMP('2018-07-04 13:59:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=544157 ; -- 2018-07-04T13:59:35.867 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='AD_Session_Printpackage_ID', Name='AD_Session_Printpackage_ID', Description=NULL, Help=NULL WHERE AD_Element_ID=544157 ; -- 2018-07-04T13:59:35.870 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='AD_Session_Printpackage_ID', Name='AD_Session_Printpackage_ID', Description=NULL, Help=NULL, AD_Element_ID=544157 WHERE UPPER(ColumnName)='AD_SESSION_PRINTPACKAGE_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2018-07-04T13:59:35.873 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='AD_Session_Printpackage_ID', Name='AD_Session_Printpackage_ID', Description=NULL, Help=NULL WHERE AD_Element_ID=544157 AND IsCentrallyMaintained='Y' ; -- 2018-07-04T13:59:35.875 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='AD_Session_Printpackage_ID', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=544157) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 544157) ; -- 2018-07-04T13:59:35.887 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='AD_Session_Printpackage_ID', Name='AD_Session_Printpackage_ID' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=544157) ; -- 2018-07-04T14:02:01.132 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='PrintServiceTray', Name='PrintServiceTray', PrintName='PrintServiceTray',Updated=TO_TIMESTAMP('2018-07-04 14:02:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=544161 ; -- 2018-07-04T14:02:01.134 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='PrintServiceTray', Name='PrintServiceTray', Description=NULL, Help=NULL WHERE AD_Element_ID=544161 ; -- 2018-07-04T14:02:01.137 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='PrintServiceTray', Name='PrintServiceTray', Description=NULL, Help=NULL, AD_Element_ID=544161 WHERE UPPER(ColumnName)='PRINTSERVICETRAY' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2018-07-04T14:02:01.139 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='PrintServiceTray', Name='PrintServiceTray', Description=NULL, Help=NULL WHERE AD_Element_ID=544161 AND IsCentrallyMaintained='Y' ; -- 2018-07-04T14:02:01.140 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='PrintServiceTray', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=544161) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 544161) ; -- 2018-07-04T14:02:01.148 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='PrintServiceTray', Name='PrintServiceTray' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=544161) ; -- 2018-07-04T14:03:59.154 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='Status_Print_Job_Instructions', Name='Status_Print_Job_Instructions', PrintName='Status_Print_Job_Instructions',Updated=TO_TIMESTAMP('2018-07-04 14:03:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=544160 ; -- 2018-07-04T14:03:59.157 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Status_Print_Job_Instructions', Name='Status_Print_Job_Instructions', Description=NULL, Help=NULL WHERE AD_Element_ID=544160 ; -- 2018-07-04T14:03:59.159 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Status_Print_Job_Instructions', Name='Status_Print_Job_Instructions', Description=NULL, Help=NULL, AD_Element_ID=544160 WHERE UPPER(ColumnName)='STATUS_PRINT_JOB_INSTRUCTIONS' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2018-07-04T14:03:59.161 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Status_Print_Job_Instructions', Name='Status_Print_Job_Instructions', Description=NULL, Help=NULL WHERE AD_Element_ID=544160 AND IsCentrallyMaintained='Y' ; -- 2018-07-04T14:03:59.163 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Status_Print_Job_Instructions', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=544160) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 544160) ; -- 2018-07-04T14:03:59.188 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Status_Print_Job_Instructions', Name='Status_Print_Job_Instructions' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=544160) ; -- 2018-07-04T14:04:37.730 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Name='Status Print Job Instructions', PrintName='Status Print Job Instructions',Updated=TO_TIMESTAMP('2018-07-04 14:04:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=544160 ; -- 2018-07-04T14:04:37.732 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='Status_Print_Job_Instructions', Name='Status Print Job Instructions', Description=NULL, Help=NULL WHERE AD_Element_ID=544160 ; -- 2018-07-04T14:04:37.735 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Status_Print_Job_Instructions', Name='Status Print Job Instructions', Description=NULL, Help=NULL, AD_Element_ID=544160 WHERE UPPER(ColumnName)='STATUS_PRINT_JOB_INSTRUCTIONS' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2018-07-04T14:04:37.737 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='Status_Print_Job_Instructions', Name='Status Print Job Instructions', Description=NULL, Help=NULL WHERE AD_Element_ID=544160 AND IsCentrallyMaintained='Y' ; -- 2018-07-04T14:04:37.739 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Status Print Job Instructions', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=544160) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 544160) ; -- 2018-07-04T14:04:37.748 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Status Print Job Instructions', Name='Status Print Job Instructions' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=544160) ; -- 2018-07-04T14:04:51.160 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Name='Print Service Tray', PrintName='Print Service Tray',Updated=TO_TIMESTAMP('2018-07-04 14:04:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=544161 ; -- 2018-07-04T14:04:51.163 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='PrintServiceTray', Name='Print Service Tray', Description=NULL, Help=NULL WHERE AD_Element_ID=544161 ; -- 2018-07-04T14:04:51.166 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='PrintServiceTray', Name='Print Service Tray', Description=NULL, Help=NULL, AD_Element_ID=544161 WHERE UPPER(ColumnName)='PRINTSERVICETRAY' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2018-07-04T14:04:51.168 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='PrintServiceTray', Name='Print Service Tray', Description=NULL, Help=NULL WHERE AD_Element_ID=544161 AND IsCentrallyMaintained='Y' ; -- 2018-07-04T14:04:51.170 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Print Service Tray', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=544161) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 544161) ; -- 2018-07-04T14:04:51.184 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Print Service Tray', Name='Print Service Tray' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=544161) ; -- 2018-07-04T14:05:26.490 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET Name='Session Printpackage ID', PrintName='Session Printpackage ID',Updated=TO_TIMESTAMP('2018-07-04 14:05:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=544157 ; -- 2018-07-04T14:05:26.496 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='AD_Session_Printpackage_ID', Name='Session Printpackage ID', Description=NULL, Help=NULL WHERE AD_Element_ID=544157 ; -- 2018-07-04T14:05:26.499 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='AD_Session_Printpackage_ID', Name='Session Printpackage ID', Description=NULL, Help=NULL, AD_Element_ID=544157 WHERE UPPER(ColumnName)='AD_SESSION_PRINTPACKAGE_ID' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2018-07-04T14:05:26.505 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='AD_Session_Printpackage_ID', Name='Session Printpackage ID', Description=NULL, Help=NULL WHERE AD_Element_ID=544157 AND IsCentrallyMaintained='Y' ; -- 2018-07-04T14:05:26.506 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='Session Printpackage ID', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=544157) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 544157) ; -- 2018-07-04T14:05:26.525 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='Session Printpackage ID', Name='Session Printpackage ID' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=544157) ; -- 2018-07-04T14:05:45.398 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET AD_Column_ID=560616, AD_Element_ID=113, AD_Reference_ID=19, ColumnName='AD_Org_ID', Created=TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'), Description='Organisatorische Einheit des Mandanten', EntityType='de.metas.printing', FieldLength=10, Help='Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.', Name='Sektion', Updated=TO_TIMESTAMP('2018-07-04 13:55:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560616 ; -- 2018-07-04T14:06:31.331 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='WP_IsError', Name='WP IsError', PrintName='WP IsError',Updated=TO_TIMESTAMP('2018-07-04 14:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=544159 ; -- 2018-07-04T14:06:31.334 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='WP_IsError', Name='WP IsError', Description=NULL, Help=NULL WHERE AD_Element_ID=544159 ; -- 2018-07-04T14:06:31.337 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='WP_IsError', Name='WP IsError', Description=NULL, Help=NULL, AD_Element_ID=544159 WHERE UPPER(ColumnName)='WP_ISERROR' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2018-07-04T14:06:31.341 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='WP_IsError', Name='WP IsError', Description=NULL, Help=NULL WHERE AD_Element_ID=544159 AND IsCentrallyMaintained='Y' ; -- 2018-07-04T14:06:31.343 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='WP IsError', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=544159) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 544159) ; -- 2018-07-04T14:06:31.357 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='WP IsError', Name='WP IsError' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=544159) ; -- 2018-07-04T14:09:15.052 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Element SET ColumnName='WP_IsProcessed', Name='WP IsProcessed', PrintName='WP IsProcessed',Updated=TO_TIMESTAMP('2018-07-04 14:09:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=544158 ; -- 2018-07-04T14:09:15.054 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET ColumnName='WP_IsProcessed', Name='WP IsProcessed', Description=NULL, Help=NULL WHERE AD_Element_ID=544158 ; -- 2018-07-04T14:09:15.056 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='WP_IsProcessed', Name='WP IsProcessed', Description=NULL, Help=NULL, AD_Element_ID=544158 WHERE UPPER(ColumnName)='WP_ISPROCESSED' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL ; -- 2018-07-04T14:09:15.059 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Process_Para SET ColumnName='WP_IsProcessed', Name='WP IsProcessed', Description=NULL, Help=NULL WHERE AD_Element_ID=544158 AND IsCentrallyMaintained='Y' ; -- 2018-07-04T14:09:15.059 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Field SET Name='WP IsProcessed', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=544158) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 544158) ; -- 2018-07-04T14:09:15.068 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_PrintFormatItem pi SET PrintName='WP IsProcessed', Name='WP IsProcessed' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=544158) ; -- 2018-07-04T14:12:56.855 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table SET EntityType='de.metas.fresh',Updated=TO_TIMESTAMP('2018-07-04 14:12:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=541001 ; -- 2018-07-04T14:41:19.203 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Table SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:41:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=541001 ; -- 2018-07-04T14:55:17.209 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560625 ; -- 2018-07-04T14:55:19.473 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560617 ; -- 2018-07-04T14:55:22.426 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560623 ; -- 2018-07-04T14:55:23.808 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560624 ; -- 2018-07-04T14:55:24.685 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560634 ; -- 2018-07-04T14:55:25.410 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560628 ; -- 2018-07-04T14:55:26.130 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560619 ; -- 2018-07-04T14:55:26.899 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560635 ; -- 2018-07-04T14:55:27.732 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560633 ; -- 2018-07-04T14:55:28.354 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560620 ; -- 2018-07-04T14:55:28.893 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560622 ; -- 2018-07-04T14:55:29.498 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560621 ; -- 2018-07-04T14:55:29.964 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560626 ; -- 2018-07-04T14:55:31.184 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560630 ; -- 2018-07-04T14:55:31.817 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560629 ; -- 2018-07-04T14:55:32.577 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560627 ; -- 2018-07-04T14:55:33.091 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560614 ; -- 2018-07-04T14:55:33.474 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560613 ; -- 2018-07-04T14:55:34.011 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560615 ; -- 2018-07-04T14:55:35.010 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560618 ; -- 2018-07-04T14:55:35.635 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560632 ; -- 2018-07-04T14:55:36.434 -- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator UPDATE AD_Column SET EntityType='de.metas.printing',Updated=TO_TIMESTAMP('2018-07-04 14:55:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=560631 ;
the_stack
--- configuration ------------------------------------------------------------------------------------------------------- -- plugin -- UPDATE configuration SET value = json_set(value, '$.plugin.default', 'OMF') WHERE json_extract(value, '$.plugin.value') = 'PI_Server_V2'; UPDATE configuration SET value = json_set(value, '$.plugin.value', 'OMF') WHERE json_extract(value, '$.plugin.value') = 'PI_Server_V2'; -- PIServerEndpoint -- UPDATE configuration SET value = json_set(value, '$.PIServerEndpoint.options', json_array('PI Web API','Connector Relay','OSIsoft Cloud Services','Edge Data Store') ) WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIServerEndpoint.description', 'Select the endpoint among PI Web API, Connector Relay, OSIsoft Cloud Services or Edge Data Store') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIServerEndpoint.order', '1') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIServerEndpoint.displayName', 'Endpoint') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIServerEndpoint.default', 'Connector Relay') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIServerEndpoint.value', 'Connector Relay') WHERE json_extract(value, '$.plugin.value') = 'OMF' AND json_extract(value, '$.PIServerEndpoint.value') = 'Auto Discovery'; UPDATE configuration SET value = json_set(value, '$.PIServerEndpoint.value', 'Connector Relay') WHERE json_extract(value, '$.plugin.value') = 'OMF' AND json_extract(value, '$.PIServerEndpoint.value') = 'cr'; UPDATE configuration SET value = json_set(value, '$.PIServerEndpoint.value', 'PI Web API') WHERE json_extract(value, '$.plugin.value') = 'OMF' AND json_extract(value, '$.PIServerEndpoint.value') = 'piwebapi'; -- ServerHostname -- Note: This is a new config item and its value extract from old URL config item -- UPDATE configuration SET value = json_set(value, '$.ServerHostname.description', 'Hostname of the server running the endpoint either PI Web API or Connector Relay or Edge Data Store') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerHostname.type', 'string') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerHostname.default', 'localhost') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerHostname.order', '2') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerHostname.displayName', 'Server hostname') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerHostname.validity', 'PIServerEndpoint != "OSIsoft Cloud Services"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set( value, '$.ServerHostname.value', substr(json_extract(value, '$.URL.value'), instr(json_extract(value, '$.URL.value'), '://') + 3, instr(REPLACE(json_extract(value, '$.URL.value'), '://', 'xxx'), ':') - instr(json_extract(value, '$.URL.value'), '://') - 3) ) WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- ServerPort -- Note: This is a new config item and its value extract from old URL config item -- UPDATE configuration SET value = json_set(value, '$.ServerPort.description', 'Port on which the endpoint either PI Web API or Connector Relay or Edge Data Store is listening, 0 will use the default one') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerPort.type', 'integer') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerPort.default', '0') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerPort.order', '3') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerPort.displayName', 'Server port, 0=use the default') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.ServerPort.validity', 'PIServerEndpoint != "OSIsoft Cloud Services"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set( value, '$.ServerPort.value', substr(json_extract(value, '$.URL.value'), instr(REPLACE(json_extract(value, '$.URL.value'), '://', 'xxx'), ':') + 1, instr(REPLACE(json_extract(value, '$.URL.value'), '://', 'xxx'), '/') - instr(REPLACE(json_extract(value, '$.URL.value'), '://', 'xxx'), ':') - 1 ) ) WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- URL -- Note: Removed URL config item as it is replaced by ServerHostname & ServerPort -- UPDATE configuration SET value = json_remove(value, '$.URL') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- producerToken -- UPDATE configuration SET value = json_set(value, '$.producerToken.order', '4') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.producerToken.validity', 'PIServerEndpoint == "Connector Relay"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- source -- UPDATE configuration SET value = json_set(value, '$.source.order', '5') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- StaticData -- UPDATE configuration SET value = json_set(value, '$.StaticData.order', '6') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- OMFRetrySleepTime -- UPDATE configuration SET value = json_set(value, '$.OMFRetrySleepTime.order', '7') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- OMFMaxRetry -- UPDATE configuration SET value = json_set(value, '$.OMFMaxRetry.order', '8') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- OMFHttpTimeout -- UPDATE configuration SET value = json_set(value, '$.OMFHttpTimeout.order', '9') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- formatInteger -- UPDATE configuration SET value = json_set(value, '$.formatInteger.order', '10') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- formatNumber -- UPDATE configuration SET value = json_set(value, '$.formatNumber.order', '11') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- compression -- UPDATE configuration SET value = json_set(value, '$.compression.order', '12') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- DefaultAFLocation -- Note: This is a new config item and its default & value extract from old AFHierarchy1Level config item -- UPDATE configuration SET value = json_set(value, '$.DefaultAFLocation.description', 'Defines the hierarchies tree in Asset Framework in which the assets will be created, each level is separated by /, PI Web API only.') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.DefaultAFLocation.type', 'string') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.DefaultAFLocation.default', json_extract(value, '$.AFHierarchy1Level.default')) WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.DefaultAFLocation.value', json_extract(value, '$.AFHierarchy1Level.value')) WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.DefaultAFLocation.order', '13') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.DefaultAFLocation.displayName', 'Asset Framework hierarchies tree') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.DefaultAFLocation.validity', 'PIServerEndpoint == "PI Web API"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- AFHierarchy1Level -- Note: Removed AFHierarchy1Level config item as it is replaced by new config item DefaultAFLocation -- UPDATE configuration SET value = json_remove(value, '$.AFHierarchy1Level') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- AFMap -- Note: This is a new config item -- UPDATE configuration SET value = json_set(value, '$.AFMap.description', 'Defines a SET of rules to address WHERE assets should be placed in the AF hierarchy.') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.AFMap.type', 'JSON') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.AFMap.default', '{}') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.AFMap.value', '{}') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.AFMap.order', '14') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.AFMap.displayName', 'Asset Framework hierarchies rules') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.AFMap.validity', 'PIServerEndpoint == "PI Web API"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- notBlockingErrors -- UPDATE configuration SET value = json_set(value, '$.notBlockingErrors.order', '15') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- streamId -- UPDATE configuration SET value = json_set(value, '$.streamId.order', '16') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- PIWebAPIAuthenticationMethod -- UPDATE configuration SET value = json_set(value, '$.PIWebAPIAuthenticationMethod.order', '17') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIWebAPIAuthenticationMethod.validity', 'PIServerEndpoint == "PI Web API"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- PIWebAPIUserId -- UPDATE configuration SET value = json_set(value, '$.PIWebAPIUserId.order', '18') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIWebAPIUserId.validity', 'PIServerEndpoint == "PI Web API"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- PIWebAPIPassword -- UPDATE configuration SET value = json_set(value, '$.PIWebAPIPassword.order', '19') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIWebAPIPassword.validity', 'PIServerEndpoint == "PI Web API"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- PIWebAPIKerberosKeytabFileName -- Note: This is a new config item -- UPDATE configuration SET value = json_set(value, '$.PIWebAPIKerberosKeytabFileName.description', 'Keytab file name used for Kerberos authentication in PI Web API.') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIWebAPIKerberosKeytabFileName.type', 'string') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIWebAPIKerberosKeytabFileName.default', 'piwebapi_kerberos_https.keytab') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIWebAPIKerberosKeytabFileName.value', 'piwebapi_kerberos_https.keytab') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIWebAPIKerberosKeytabFileName.displayName', 'PI Web API Kerberos keytab file') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIWebAPIKerberosKeytabFileName.order', '20') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.PIWebAPIKerberosKeytabFileName.validity', 'PIWebAPIAuthenticationMethod == "kerberos"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; --- --- OCS configuration --- NOTE- All config items are new one's for OCS -- OCSNamespace -- UPDATE configuration SET value = json_set(value, '$.OCSNamespace.description', 'Specifies the OCS namespace WHERE the information are stored and it is used for the interaction with the OCS API') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSNamespace.type', 'string') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSNamespace.default', 'name_space') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSNamespace.order', '21') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSNamespace.displayName', 'OCS Namespace') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSNamespace.validity', 'PIServerEndpoint == "OSIsoft Cloud Services"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSNamespace.value', 'name_space') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- OCSTenantId -- UPDATE configuration SET value = json_set(value, '$.OCSTenantId.description', 'Tenant id associated to the specific OCS account') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSTenantId.type', 'string') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSTenantId.default', 'ocs_tenant_id') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSTenantId.order', '22') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSTenantId.displayName', 'OCS Tenant ID') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSTenantId.validity', 'PIServerEndpoint == "OSIsoft Cloud Services"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSTenantId.value', 'ocs_tenant_id') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- OCSClientId -- UPDATE configuration SET value = json_set(value, '$.OCSClientId.description', 'Client id associated to the specific OCS account, it is used to authenticate the source for using the OCS API') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientId.type', 'string') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientId.default', 'ocs_client_id') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientId.order', '23') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientId.displayName', 'OCS Client ID') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientId.validity', 'PIServerEndpoint == "OSIsoft Cloud Services"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientId.value', 'ocs_client_id') WHERE json_extract(value, '$.plugin.value') = 'OMF'; -- OCSClientSecret -- UPDATE configuration SET value = json_set(value, '$.OCSClientSecret.description', 'Client secret associated to the specific OCS account, it is used to authenticate the source for using the OCS API') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientSecret.type', 'password') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientSecret.default', 'ocs_client_secret') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientSecret.order', '24') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientSecret.displayName', 'OCS Client Secret') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientSecret.validity', 'PIServerEndpoint == "OSIsoft Cloud Services"') WHERE json_extract(value, '$.plugin.value') = 'OMF'; UPDATE configuration SET value = json_set(value, '$.OCSClientSecret.value', 'ocs_client_secret') WHERE json_extract(value, '$.plugin.value') = 'OMF'; --- plugin_data ------------------------------------------------------------------------------------------------------- -- plugin_data -- UPDATE plugin_data SET key = REPLACE(key,'PI_Server_V2','OMF') WHERE instr(key, 'PI_Server_V2') > 0; --- asset_tracker ------------------------------------------------------------------------------------------------------- UPDATE asset_tracker SET plugin = 'OMF' WHERE plugin in ('PI_Server_V2', 'ocs_V2');
the_stack