upgradeSql.xml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <ns:hibernate xmlns:ns="http://www.primedata.com/xml/ns/j2ee/hibernate"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://www.primedata.com/xml/ns/j2ee/hibernate LTHibernateSchema.xsd">
  5. <statement id="findDataSourcePassword">
  6. SELECT DATASOURCE_ID,PARAM_CODE,PARAM_VALUE FROM T_HARVEST_DATASOURCE_PARAM WHERE PARAM_CODE=#password#
  7. </statement>
  8. <statement id="updateDataSourcePassword">
  9. UPDATE T_HARVEST_DATASOURCE_PARAM SET PARAM_VALUE=#paramValue# WHERE DATASOURCE_ID=#dataSourceId# AND
  10. PARAM_CODE='password'
  11. </statement>
  12. <statement id="findSingleServ">
  13. SELECT a.ENTITY_ID, a.ENTITY_CODE, a.ENTITY_NAME, a.PARENT_CATEGORY_ID, a.ENTITY_TYPE,
  14. a.PATH, a.SERVICE_CODE, b.SERVICE_NAME, b.SERVICE_URI
  15. from dsp_business_entity a join sam_service b on(a.SERVICE_CODE = b.SERVICE_CODE)
  16. where a.ENTITY_TYPE = 'T' and a.DB_TABLE_COUNT_RELATION = 1 and a.SERVICE_CODE is not null
  17. </statement>
  18. <statement id="findMutilTableServ">
  19. SELECT a.ENTITY_ID, a.ENTITY_CODE, a.ENTITY_NAME, a.PARENT_CATEGORY_ID, a.ENTITY_TYPE,
  20. a.PATH, a.SERVICE_CODE, b.SERVICE_NAME, b.SERVICE_URI
  21. from dsp_business_entity a join sam_service b on(a.SERVICE_CODE = b.SERVICE_CODE)
  22. where a.ENTITY_TYPE = 'RS' and a.DB_TABLE_COUNT_RELATION > 1 and a.SERVICE_CODE is not null
  23. </statement>
  24. <statement id="findDBEntity">
  25. SELECT ELEMENT_ID, PARENT_ENTITY_ID, PARENT_RESOURCE_ID,RESOURCE_TYPE,ELEMENT_NAME,ELEMENT_DESC,
  26. d.DATASOURCE_TYPE_CODE, d.DATASOURCE_NAME, d.DATA_PATH
  27. from dsp_business_element e join t_harvest_datasource d on(e.PARENT_RESOURCE_ID = d.DATASOURCE_ID)
  28. where e.PARENT_ENTITY_ID = ? and e.RESOURCE_TYPE != '3'
  29. </statement>
  30. <statement id="findResourceInstance">
  31. SELECT INSTANCE_ID, INSTANCE_CODE, INSTANCE_NAME,
  32. CLASSIFIER_ID, PARENT_ID, STRING_8 FROM T_MD_INSTANCE WHERE PARENT_ID = ? AND CLASSIFIER_ID = 'Column'
  33. </statement>
  34. <statement id="findSingleServiceInfo">
  35. SELECT a.ID as SERVICEID, a.`NAME`, a.`CODE`,
  36. a.URI, a.TYPE, a.queryField, b.ID as SIID, b.MODELID, c.DSID, c.TABLENAME
  37. FROM DSP_SERVICEINFO a JOIN dsp_si_table b on(a.ID = b.SERVICEID)
  38. JOIN dsp_modelinfo c on(b.MODELID = c.ID)
  39. where a.TYPE = 'T' and a.CODE = ?
  40. </statement>
  41. <statement id="findServiceInfo">
  42. SELECT a.ID as SERVICEID, a.`NAME`, a.`CODE`,
  43. a.URI, a.TYPE, a.queryField, b.ID as SIID, b.ID, b.DSID, b.RSSQL
  44. FROM DSP_SERVICEINFO a JOIN dsp_si_rs b on(a.ID = b.SERVICEID)
  45. where a.TYPE = 'RS' and a.CODE = ?
  46. </statement>
  47. <statement id="findUpgradeJoinResources">
  48. select b.ELEMENT_ID, b.PARENT_ENTITY_ID, b.PARENT_RESOURCE_ID, b.RESOURCE_TYPE, b.ELEMENT_NAME, b.ELEMENT_DESC,
  49. c.NEW_INSTANCE_ID, c.INSTANCE_NAME
  50. from dsp_business_element b join t_md_upgrade c on(b.ELEMENT_ID = c.old_instance_id)
  51. where b.RESOURCE_TYPE != '3'
  52. </statement>
  53. <statement id="upgradeJoinResources">
  54. alter table dsp_business_element
  55. add column NELEMENT_ID varchar(32);
  56. UPDATE dsp_business_element EL
  57. JOIN T_MD_UPGRADE MG ON (
  58. EL.ELEMENT_ID = MG.OLD_INSTANCE_ID
  59. )
  60. SET EL.NELEMENT_ID = MG.NEW_INSTANCE_ID
  61. where EL.RESOURCE_TYPE != '3';
  62. UPDATE dsp_business_element SET ELEMENT_ID = NELEMENT_ID WHERE NELEMENT_ID IS NOT NULL;
  63. alter table dsp_business_element
  64. drop column NELEMENT_ID;
  65. </statement>
  66. <statement id="upgradeJoinOnlineItems">
  67. alter table di_online_dataitem
  68. add column NRESOURCE_ITEM_ID varchar(32);
  69. UPDATE di_online_dataitem EL
  70. JOIN T_MD_UPGRADE MG ON (
  71. EL.RESOURCE_ITEM_ID = MG.OLD_INSTANCE_ID
  72. )
  73. SET EL.NRESOURCE_ITEM_ID = MG.NEW_INSTANCE_ID;
  74. UPDATE di_online_dataitem SET RESOURCE_ITEM_ID = NRESOURCE_ITEM_ID WHERE NRESOURCE_ITEM_ID IS NOT NULL;
  75. alter table di_online_dataitem
  76. drop column NRESOURCE_ITEM_ID;
  77. </statement>
  78. </ns:hibernate>