yangzhongke / cownewsql

Sql dialect translator
GNU General Public License v3.0
22 stars 10 forks source link

Do you still need a SQL dialect translator #1

Open yangzhongke opened 5 years ago

yangzhongke commented 5 years ago

CownewSQL was launched in 2006, which is a SQL dialect translator. It can translate SQL into different SQL dialects on different DBMS. It consists of two parts: SQLParser and SQLTranslator. The development of SQLParser requires lots of knowledge on the Compiler Principle, but I just taught myself about Compiler Principle, so I don't have the ability to build an SQLParser. The SQLParser of CowNewSQL was developed by King Chou, who is one of the open-source team members. What I do is to translate the AST into SQL dialect. I found an open-soure SQLParser: Druid, which is developed by WenShao. I am considering to replace the SQLParser in CownewSQL with that of Druid. If you are interested in CowNewSQL, please let me know.

yangzhongke commented 5 years ago

Druid SQLPaser: https://github.com/alibaba/druid/wiki/SQL-Parser

zhengxr21 commented 5 years ago

代码在编译时报错 image image image

yangzhongke commented 5 years ago

This project employs ANTLR to compile the grammar definition files sqlparser.g and sqltreeparser.g (under the folder com\cownew\cownewsql\ast\grammar) into SQLTreeParser.java, SQLLexer.java and other files. So this project depends on antlr and antlr studio, which is an Eclipse plugin. Please install antlr studio plugin(https://www.antlr.org/tools.html) on your Eclipse.

zhengxr21 commented 5 years ago

Can I develop with idea?

yangzhongke commented 5 years ago

On the page I mentioned, there is a 'Intellij Plugin for ANTLR 4', please check that page.

zhengxr21 commented 5 years ago

Hi , I am using the plugin to compile the sqltreeparser.g file and found that I can't use the plugin to compile. Considering that it may be a version problem, the file suffix is changed to sqltreeparser.g4, which can be compiled, but the following error is reported . Please take a look,thank you very much ! image

yangzhongke commented 5 years ago

Hi , I am using the plugin to compile the sqltreeparser.g file and found that I can't use the plugin to compile. Considering that it may be a version problem, the file suffix is changed to sqltreeparser.g4, which can be compiled, but the following error is reported . Please take a look,thank you very much

I am sorry, the project was developed ten years ago, and the grammar files were developed by another guy who has not been as a developer for ages. So you should try to solve this problem by yourself.

yangzhongke commented 5 years ago

This is the build version, you can use it in your project directly.

zhengxr21 commented 5 years ago

I used this version at the beginning, but one problem is that t. cannot be recognized when I convert (select t., a.id from table a left join tables t on...)

yangzhongke commented 5 years ago

I used this version at the beginning, but one problem is that t. cannot be recognized when I convert (select t., a.id from table a left join tables t on...)

I am sorry, but I'm not deep into Antlr, so I couldn't help you. You should try to learn Antlr and fix bugs by yourself. Welcome to pull request.

zhengxr21 commented 5 years ago

ok,thank you very much!

zhangchengk commented 4 years ago

有没有考虑调整成maven项目或者gradle

yangzhongke commented 4 years ago

有没有考虑调整成maven项目或者gradle

Sorry, this is a legacy project., so I have no plan to maintain it. If I would rewrite it using Druid, I will use maven to organise this project

zhangchengk commented 4 years ago

OK Thanks!