CowNew开源-sql解析引擎和cownewsql阶段成果汇报
生活随笔
收集整理的這篇文章主要介紹了
CowNew开源-sql解析引擎和cownewsql阶段成果汇报
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
很多關心CowNew的朋友紛紛給我發email或者qq留言,說看到最近CowNew開源項目沒有動靜了,問我是不是虎頭蛇尾死掉了。謝謝大家的關心,CowNew沒有停止進步的步伐,最近一段時間沒有動靜是因為我們在悶頭做產品的開發。經過一個多月的努力,在kingchou、紫龍等隊友的團結奮斗下,SQL解析引擎和JDBMonitor都已經取得了階段性的成果。
??????? SQL解析引擎已經可以生成完整的異構SQLAST,除有少數小bug之外已經基本達到了預期的目標。另外在SQL解析引擎基礎上開發的CowNewSQL翻譯器也可以實現了基本的功能??梢苑g大部分主流的sql語句,比如:
(1)可以將符合CowNewSQL語法的select now()翻譯成對應如下的特定平臺sql:
mssql:Select GETDATE()
mysql:Select NOW()
oracle8i:Select SYSDATE FROM DUAL
oracle9i:Select SYSDATE FROM DUAL
(2)可以將符合CowNewSQL語法的
update T2 set fid=t1.fid from (select * from t2
left join t3 on t3.fid=t2.fid union select * from t5)
翻譯成對應如下的特定平臺sql:
mssql:UPDATE T2 SET fid = t1.fid
FROM(
Select *
From t2 left join t3 on t3.fid = t2.fid
union Select *
From t5
)
mysql:UPDATE T2 SET fid = t1.fid
FROM(
Select *
From t2 left join t3 on t3.fid = t2.fid
union Select *
From t5
)
oracle8i:UPDATE T2 SET fid = t1.fid
FROM(
Select *
From t2,t3 WHERE t3.fid = t2.fid(+)
union Select *
From t5
)
oracle9i:UPDATE T2 SET fid = t1.fid
FROM(
Select *
From t2 left join t3 on t3.fid = t2.fid
union Select *
From t5
) (2)可以將符合CowNewSQL語法的
select top 20 ABS(-1),lcase(trim(name)),tochar(now()), ADD_SECONDS(now(),22),t2.name,DateAdd(Year,now(),3) from T_Table
,(select * from T_MD where FID=2222222222) as tmd
left join T_T4 on tmd.id>T_Table.id
left join T_T2 as t2 on T_T2.id=T_Table.id
right join T_T3 as t3 on t2.id=t3.id
翻譯成對應如下的特定平臺sql:
mssql:Select? top 20
?ABS(-1) , LOWER(LTRIM(RTRIM(name)) ,CONVERT(VARCHAR, GETDATE()),DATEADD(second,GETDATE(),22),t2.name,DATEADD(Year, GETDATE(), 3)
From T_Table,
Select *
From T_MD
Where FID = 2222222222 as tmd
?left join T_T4 on tmd.id > T_Table.id left join T_T2 as t2 on T_T2.id = T_Table.id right join T_T3 as t3 on t2.id = t3.id
mysql:Select? ABS(-1) , LOWER(LTRIM(RTRIM(name)) ,CONCAT('', NOW()),DATE_ADD(NOW(), INTERVAL 22 SECOND),t2.name,DATE_ADD(3, INTERVAL NOW() YEAR)
From T_Table,
Select *
From T_MD
Where FID = 2222222222 as tmd
?left join T_T4 on tmd.id > T_Table.id left join T_T2 as t2 on T_T2.id = T_Table.id right join T_T3 as t3 on t2.id = t3.id limit 0, 20 oracle8i:Select? ABS(-1) , LOWER(LTRIM(RTRIM(name)) , TO_CHAR(SYSDATE) ,(SYSDATE + 22/86400),t2.name,add_months(3, TRUNC(SYSDATE) * 12)
From T_Table,
Select *
From T_MD
Where FID = 2222222222 as tmd
,T_T4,T_T2 as t2,T_T3 as t3 WHERE ROWNUM <= 20
?AND tmd.id > T_Table.id(+) AND T_T2.id = T_Table.id(+) AND t2.id(+) = t3.id
oracle9i:Select? ABS(-1) , LOWER(LTRIM(RTRIM(name)) , TO_CHAR(SYSDATE) ,(SYSDATE + 22/86400),t2.name,add_months(3, TRUNC(SYSDATE) * 12)
From T_Table,
Select *
From T_MD
Where FID = 2222222222 as tmd
?left join T_T4 on tmd.id > T_Table.id left join T_T2 as t2 on T_T2.id = T_Table.id right join T_T3 as t3 on t2.id = t3.id WHERE ROWNUM <= 20 但是這些sql翻譯只是按照語法手冊進行的翻譯,還沒有經過正式數據庫環境的測試,還需要進一步的測試。
??????? 目前僅支持MSSQLSERVER,MYSQL,Oracle8i,Oracle9i,我們計劃進一步支持DB2UDB,FireBird、ACCESS等數據庫。而且SQL解析引擎是用JDK5開發的,我們將是用Retrotranslator將其轉換個以保證可以在JDK1.4上運行。 JDBMonitor的需求已經基本完成,但是新增的功能目前只能運行在MSSQLSERVER上,我們準備等COWNEWSQL翻譯器開發完畢后,將JDBMonitor涉及到數據庫操作的地方是用COWNEWSQL翻譯器來完成多數據庫支持,所以我們將會推遲JDBMonitor的原計劃的發版日期。
??????? 目前我們的項目還是很缺乏高手,比如CowNewSQL這塊就缺乏對各種數據庫比較熟悉的朋友,還有能對CowNewSQL進行全面測試的朋友,希望對這方面開發比較感興趣的能加入到我們的開發中來,共同打造優秀的開源產品??梢灾苯咏o我發送郵件about521 at 163.com
??????? SQL解析引擎已經可以生成完整的異構SQLAST,除有少數小bug之外已經基本達到了預期的目標。另外在SQL解析引擎基礎上開發的CowNewSQL翻譯器也可以實現了基本的功能??梢苑g大部分主流的sql語句,比如:
(1)可以將符合CowNewSQL語法的select now()翻譯成對應如下的特定平臺sql:
mssql:Select GETDATE()
mysql:Select NOW()
oracle8i:Select SYSDATE FROM DUAL
oracle9i:Select SYSDATE FROM DUAL
(2)可以將符合CowNewSQL語法的
update T2 set fid=t1.fid from (select * from t2
left join t3 on t3.fid=t2.fid union select * from t5)
翻譯成對應如下的特定平臺sql:
mssql:UPDATE T2 SET fid = t1.fid
FROM(
Select *
From t2 left join t3 on t3.fid = t2.fid
union Select *
From t5
)
mysql:UPDATE T2 SET fid = t1.fid
FROM(
Select *
From t2 left join t3 on t3.fid = t2.fid
union Select *
From t5
)
oracle8i:UPDATE T2 SET fid = t1.fid
FROM(
Select *
From t2,t3 WHERE t3.fid = t2.fid(+)
union Select *
From t5
)
oracle9i:UPDATE T2 SET fid = t1.fid
FROM(
Select *
From t2 left join t3 on t3.fid = t2.fid
union Select *
From t5
) (2)可以將符合CowNewSQL語法的
select top 20 ABS(-1),lcase(trim(name)),tochar(now()), ADD_SECONDS(now(),22),t2.name,DateAdd(Year,now(),3) from T_Table
,(select * from T_MD where FID=2222222222) as tmd
left join T_T4 on tmd.id>T_Table.id
left join T_T2 as t2 on T_T2.id=T_Table.id
right join T_T3 as t3 on t2.id=t3.id
翻譯成對應如下的特定平臺sql:
mssql:Select? top 20
?ABS(-1) , LOWER(LTRIM(RTRIM(name)) ,CONVERT(VARCHAR, GETDATE()),DATEADD(second,GETDATE(),22),t2.name,DATEADD(Year, GETDATE(), 3)
From T_Table,
Select *
From T_MD
Where FID = 2222222222 as tmd
?left join T_T4 on tmd.id > T_Table.id left join T_T2 as t2 on T_T2.id = T_Table.id right join T_T3 as t3 on t2.id = t3.id
mysql:Select? ABS(-1) , LOWER(LTRIM(RTRIM(name)) ,CONCAT('', NOW()),DATE_ADD(NOW(), INTERVAL 22 SECOND),t2.name,DATE_ADD(3, INTERVAL NOW() YEAR)
From T_Table,
Select *
From T_MD
Where FID = 2222222222 as tmd
?left join T_T4 on tmd.id > T_Table.id left join T_T2 as t2 on T_T2.id = T_Table.id right join T_T3 as t3 on t2.id = t3.id limit 0, 20 oracle8i:Select? ABS(-1) , LOWER(LTRIM(RTRIM(name)) , TO_CHAR(SYSDATE) ,(SYSDATE + 22/86400),t2.name,add_months(3, TRUNC(SYSDATE) * 12)
From T_Table,
Select *
From T_MD
Where FID = 2222222222 as tmd
,T_T4,T_T2 as t2,T_T3 as t3 WHERE ROWNUM <= 20
?AND tmd.id > T_Table.id(+) AND T_T2.id = T_Table.id(+) AND t2.id(+) = t3.id
oracle9i:Select? ABS(-1) , LOWER(LTRIM(RTRIM(name)) , TO_CHAR(SYSDATE) ,(SYSDATE + 22/86400),t2.name,add_months(3, TRUNC(SYSDATE) * 12)
From T_Table,
Select *
From T_MD
Where FID = 2222222222 as tmd
?left join T_T4 on tmd.id > T_Table.id left join T_T2 as t2 on T_T2.id = T_Table.id right join T_T3 as t3 on t2.id = t3.id WHERE ROWNUM <= 20 但是這些sql翻譯只是按照語法手冊進行的翻譯,還沒有經過正式數據庫環境的測試,還需要進一步的測試。
??????? 目前僅支持MSSQLSERVER,MYSQL,Oracle8i,Oracle9i,我們計劃進一步支持DB2UDB,FireBird、ACCESS等數據庫。而且SQL解析引擎是用JDK5開發的,我們將是用Retrotranslator將其轉換個以保證可以在JDK1.4上運行。 JDBMonitor的需求已經基本完成,但是新增的功能目前只能運行在MSSQLSERVER上,我們準備等COWNEWSQL翻譯器開發完畢后,將JDBMonitor涉及到數據庫操作的地方是用COWNEWSQL翻譯器來完成多數據庫支持,所以我們將會推遲JDBMonitor的原計劃的發版日期。
??????? 目前我們的項目還是很缺乏高手,比如CowNewSQL這塊就缺乏對各種數據庫比較熟悉的朋友,還有能對CowNewSQL進行全面測試的朋友,希望對這方面開發比較感興趣的能加入到我們的開發中來,共同打造優秀的開源產品??梢灾苯咏o我發送郵件about521 at 163.com
轉載于:https://blog.51cto.com/cownew/87178
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的CowNew开源-sql解析引擎和cownewsql阶段成果汇报的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jsp自定义标签(taglib)编写的原
- 下一篇: 数据搬运组件:基于Sqoop管理数据导入