惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Troy Hunt's Blog
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
T
Tenable Blog
L
LINUX DO - 热门话题
V
Visual Studio Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
Cisco Talos Blog
Cisco Talos Blog
A
Arctic Wolf
C
Cyber Attacks, Cyber Crime and Cyber Security
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
Know Your Adversary
Know Your Adversary
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
Netflix TechBlog - Medium
SecWiki News
SecWiki News
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Project Zero
Project Zero
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
Recorded Future
Recorded Future
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
S
Securelist
Spread Privacy
Spread Privacy
L
LangChain Blog
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The Last Watchdog
The Last Watchdog
Attack and Defense Labs
Attack and Defense Labs
博客园 - 司徒正美
Help Net Security
Help Net Security
L
Lohrmann on Cybersecurity
人人都是产品经理
人人都是产品经理
Forbes - Security
Forbes - Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
PCI Perspectives
PCI Perspectives
博客园 - 【当耐特】
T
Tor Project blog

博客园 - riccc

微服务、分库分表、分布式事务管理、APM链路跟踪性能分析演示项目 - riccc - 博客园 SQL Server用错关联方式 事务信息系统-并发控制与恢复的理论, 算法与实践-计算模型, 并发控制部分 数据库系统 - 面向应用的方法 Data Modeling Technologies - ER, IE, Barker, IDEF1X, EXPRES-G, ORM 计划清单 声明:***本博客停止更新维护*** Hibernate Shards 数据的水平、垂直切割(三)- Hibernate Shards结构 Hibernate Shards 数据的水平、垂直切割(二)- Hibernate Shards基本演示 Hibernate Shards 数据的水平、垂直切割(一)- Hibernate测试环境 IKVM - 0.42.0.3 .NET平台上的Java实现 NVelocity 1.1 vs StringTemplate 3.2 Castle NVelocity - 1.1 - riccc IoC - StructureMap 2.6.1 AOP - PostSharp 2.0 AOP - AspectSharp 2.1.1.0 IoC - Castle Windsor - 扩展container 2.1 IoC - Castle Windsor 2.1 Mono.Cecil - 0.6
ANTLR SQL解析器代码
riccc · 2010-05-23 · via 博客园 - riccc

博客里有一篇文章ANTLR实现的SQL解析器 - OQL,大概描述了一下用antlr实现的一个简单的sql解析器
有不少人对antlr感兴趣,希望提供这个项目的源代码作为参考,一直没有放出来,原因有以下几个方面:

1. antlr版本问题。
开发时使用的antlr版本不久之后就更新了,与之前的老版本(包括项目中使用的)不兼容,项目中的语法文件已经无法在目前的antlr版本下使用
这次上传的项目中包括当时使用的antlr runtime dll文件(应该是3.0.1版本吧),代码中有生成好的lexer和parser cs文件。但如果要从.g语法文件重新生成lexer和parser,得使用相应的antlr java package,我这边已经没有了,可以看看antlr网站是否还提供下载

2. 实现上很乱。
这是创业的几年里为做项目而写的,这个东西的开发本身不在项目计划之内,因此从了解antlr到这部分代码只用了一个星期的时间赶出来,后来也只是稍微改改bug,没有结构性的调整过,因此实在不具备什么参考作用
主要思路倒是非常简单,用antlr生成AST,然后用visitor模式遍历AST生成sql,visitor的接口也是为了便于实现ORM映射而设计的。但是因为时间仓促,对antlr也没有深入了解,代码实现和语法文件都只能用一个字形容:乱。原来打算好好研究一下antlr,把这个项目也整理一下,不过一直懒的动
前2个星期看nhibernate的HQL解析,他的结构就好多了,建议真正想了解用antlr做sql解析器的,可以好好参考一下nhibernate或者hibernate

因为经常有人发消息留言希望学习一下,请在这里下载:ANTLR SQL解析器代码
说明:
1. 输出类型设置成了windows application形式,里面有个form用来测试解析效果
2. 只支持标准的select查询语句