检查字符串是否是Sql命令 [英] Checking if a string is a Sql command

查看:125
本文介绍了检查字符串是否是Sql命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何查找字符串是否为SQL语法而又不查看命令是否可以使用?

How would I find out if a string is in SQL syntax with out seeing if the command would work?

推荐答案

您有两个选择.

针对编写的引擎执行SQL statemet,或者编写自己的SQL语法解析器.

当然,您将必须编写可插拔"解析器以支持现有的各种SQL方言. SQL Server不了解Oracle,反之亦然.然后是第4维,Adabas,Alpha五,Cassandra,Derby,Altibase,BlackRay,CA-Datacom,Clarion,Clustrix,CSSQL,CUBRID,Daffodil,DataEase,Dataphor,dBase,EnterpriseDB,FileMaker Pro,FireMaker,H2, IBM DB2,Lotus Approach,Ingres,Informix,InterBase,Linter,MaxDB,Access,FoxPro,Openbase,Virtuoso,Panorama,PostgreSQL,SQLBase,RDM,SmallSQL,SQLlite,...这些都是我能记住的东西我的头.可能还有几十个.

祝你好运!
You have two options.

Either execute the SQL statemet against the engine that it''s written for or write your own SQL Syntax Parser.

You would, of course, have to write a "pluggable" parser to support the various dialects of SQL that are out there. SQL Server does not understand Oracle, nor is the reverse true. Then there''s 4th Dimension, Adabas, Alpha Five, Cassandra, Derby, Altibase, BlackRay, CA-Datacom, Clarion, Clustrix, CSSQL, CUBRID, Daffodil, DataEase, Dataphor, dBase, EnterpriseDB, FileMaker Pro, Firebird, H2, IBM DB2, Lotus Approach, Ingres, Informix, InterBase, Linter, MaxDB, Access, FoxPro, Openbase, Virtuoso, Panorama, PostgreSQL, SQLBase, RDM, SmallSQL, SQLlite, ... Those are just the ones I can remember off the top of my head. There''s probably dozens more.

Good luck with that!


这篇关于检查字符串是否是Sql命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆