ESQL 是否在工业中使用?
我正在学习数据库课程,我必须编写一个命令行应用程序。教授希望我们编写一个 ESQL(嵌入 SQL)应用程序。
我有一种感觉,这种技术已经贬值了。
我们必须使用oracle预编译器将esql代码翻译成c++。这种应用程序看起来很难维护。
php 应用程序也可以很好地工作,但他们可能希望命令行应用程序能够更快地进行评分(使用输入提要进行单元测试)。你们觉得,业界使用Embed SQL,值得请教授做一个java应用程序吗?还有其他技术更合适吗?
I'm taking a database course and I have to write a command line application. The prof wants us to write an ESQL (embed SQL) application.
I have a feeling that this kind of technology is depreciated.
We have to use oracle precompiler to translate a esql code in c++. This kind of applications look terrible to maintain.
A php application would also work well, but they probably want a command line application to do the grading faster (unit test with input feed). What you guys think, is Embed SQL used in the industry, does it worth to ask the prof to do a java application ? Is there another technology more appropriate ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
嵌入式 SQL 是“过去”(C++ 尚未发明)用 C 语言执行 SQL 的最流行方法之一。
现在我们主要使用 ORM 库。不建议再使用嵌入式 SQL,因为正如您所说,它依赖于专有的预处理器,并使代码难以调试、管理和维护。它还会将您与一个数据库供应商挂钩,并且您的代码将很难移动到另一个数据库后端。一般来说,我们在“现实生活”中不会这样做。
但由于这只是一门课程,您的教授可能有兴趣教您 SQL 和数据库概念。嵌入式SQL只是一个工具。你应该学习 SQL 和数据库,而不是 C++ 中的嵌入式 SQL。
然而,我认为您询问 PHP 和 Java 的问题并没有抓住重点。更不用说 PHP 是一种脚本语言,而 Java 是另一种可以(可能)为嵌入式 SQL 编写处理器的语言。
因此,您关于嵌入式 SQL 的观点实际上与语言选择无关。它与 (1) 带有预处理器的专有嵌入式系统、(2) 使用 ORM 库或数据访问库(例如 ODBC)之间的权衡和平衡有关。
题外话:
我第一次使用嵌入式 SQL 是在大学的时候(大约 30 年前!)。事实上,从大学毕业后就得到了编程工作,并且仍然使用它,但显然它正在消失。自 1990 年左右以来从未见过它被使用过。
Embedded SQL was one of the the most popular way to do SQL in C during the "old days" (C++ was not yet invented).
These days mostly we'll be using an ORM library. It is not recommended to do embedded SQL any more because, as you put it well, it depends on a proprietary pre-processor and makes code difficult to debug, manage, and maintain. It also hooks you to one single database vendor and your code will be extremely difficult to move to another database backend. Generally, we don't do it in "real life".
But as it is only a class, your prof is probably interested in teaching you SQL and database concepts. Embedded SQL is only a tool. You're supposed to learn SQL and databases, not embedded SQL in C++.
However, I believe that you're missing the point by asking about PHP and Java. Not to mention that PHP is a scripting language, and Java is another language that you can (potentially) write a processor for embedded SQL.
So your point about embedded SQL really has nothing with language choices. It has to do with the tradeoffs and balance between (1) proprietary embedded system with preprocessor, (2) using an ORM library, or a data-access library (e.g. ODBC).
Off-Topic:
I first started using embedded SQL when I was in College (that was about 30 years ago!). Actually got programming jobs out of College and still used it, but obviously it was on the way out. Never seen it used ever since 1990 or so.
是的,但不是。在我从事该领域的 10 年里,我还没有遇到过一行嵌入式 SQL。我想说(并希望)这项技术只存在于(某些)遗留系统中。
如今,业界与数据库相关的开发将涉及:
恕我直言,自制的解决方案应该被根除,但它们比你想象的更常见。部分原因肯定与学生在学校只尝试过过时和不适应的工具有关...
ORM(和数据访问层)相关问题可能非常复杂,我想说看看非常有趣。特别是如果您是学生。我建议深入研究 Martin Fowler 的 EAA 的 P。
在 C++ 中,我会看看 SOCI。
Yes, but no. I have not met a single line of Embedded SQL in my 10 years in the field. I would say (and hope) this technology only exists in (some) legacy systems.
Nowadays, database related development in the industry would involve:
IMHO, home made solutions should be eradicated but they are more common than you would think. Part of this would certainly have to do with students having only experimented with outdated and inadapted tools at school...
ORM (and data access layers) related problems can be very complex and I would say very interesting to have a look at. Especially if you are a student. I would recommend delving into Martin Fowler's P of EAA.
In C++, I would have a look at SOCI.
我们必须维持这里的旧系统(20 年及以上)。
这里大量使用了ESQL。我们在将软件迁移到新操作系统(这是一个 15 年前的 hpux)时遇到的大部分问题都与 ESQL 代码有关。
我们正在编写的新软件都使用了C++库。这为我们提供了更具可读性的代码+我们的 IDE 不会一直显示“无效语法”。 ETC..
一般来说,C++ 库与我在 .NET 或 Java 中连接数据库的方式非常相同。
使用 C++ 库可以提高速度(如果使用得当)并且错误更少。
我认为 ESQL 已被弃用。但由于我们已经进入了一个很多编写的软件都是为了更新/升级或维护现有系统的时代,因此掌握旧技术的基本知识是非常方便的!
We have to maintain on an old system here (20 years and older).
ESQL is used massively in here. The most of the problems we had while moving the software to a new OS (it was an 15 year old hpux) where with the ESQL code.
The new software we are writing are all making use of the C++ library. This gives us more readable code + our IDE doesn't say 'invalid syntax' all the time. etc..
The C++ library is in general terms very equal as how I connect to a database in .NET or Java.
Using the C++ library whe have an improvement of speed (if used wisely) and much less errors.
ESQL is deprecated by my point of view. But since we have entered an time where a lot of the written software is to update/upgrade or maintain existing systems, it is very handy to have basic knowledge of old techniques!
我已经有 10 年没有在应用程序中看到嵌入式 SQL 了。我最后一次看到它是在一个用 COBOL 编写的遗留大型机应用程序中。是的,电力公司仍在使用。
我现在做的一些 C++ 编程并不涉及 SQL。如今,我遇到的大多数关系数据库编程都是以下之一:
I haven't seen embedded SQL in an application for 10 years. The last time I saw it was in a legacy mainframe app written in COBOL. Yes, still being used at electrical utility company.
The little C++ programming I do these days doesn't involve SQL. These days most relational DB programming I encounter is one of these:
虽然这可能已经过时了(大约 15-20 年前我也做过 ESQL),但它仍然可以作为如何处理事物的一个很好的例子 - 即使它只是为了让您以后更喜欢 ORM。
另外,根据我的理解,.NET 中的 LINQ 与在宿主语言中嵌入 SQL 的想法有些相似 - 并且 LINQ 似乎相当流行。
从这里提取到更广泛的 CS,嵌入式 DSL 似乎是当前的研究主题,因此 ESQL 作为早期版本的示例对于当今世界来说并不是太牵强。
While this is probably outdated ( I also did ESQL ~15-20 years ago), it still may serve as a good example on how to also approach things - even if it is only for you to more enjoy ORM afterwards.
Also from my understanding LINQ in .NET is somewhat similar from the idea of embedding SQL in the host language - and LINQ seems to be quite popular.
Extracting from this to broader CS, embedded DSLs seem to be a current topic of research, so the example of ESQL as an early version my not be too far fetched from todays world.
ESQL 是 IBM 中间件产品大力推广的主要语言。它不是面向对象的语言,而是过程语言。它在某些地方广泛用于在 XML(XSLT 的别名)之间进行映射。
ESQL is the prime language being heavily propagated for IBM Middleware products . Its not an Object Oriented Language but a Procedural language . Its extensively used in some places to do mapping between XMLs (alias for XSLTs) .
截至目前,我正在旧版 C++ 应用程序代码中的 Informix 9.x 数据库上使用 ESql,这是我工作的一部分。
虽然我同意每个人都认为这是一种古老的技术,并且有更好的选择,但我仍然会说这是一种非常巧妙的技术。好的部分是 SQL 作为 C/C++ 代码流的一部分嵌入,无论是语法还是逻辑。 ESql 带来的语法变化很小,很容易学习,因此我说使用它很有趣。
正如 Heiko 提到的,LINQ 在思想上与 ESql 很接近。
I am using ESql as of date on a Informix 9.x database in the legacy C++ application code that I work on as a part of my job.
While I agree to everyone that it is an old technique, and there are better options out there, I would still say it is a very neat technique. The good part is the SQL is embedded as a part of the C/C++ code flow, syntax wise and logic wise. The little syntax change that ESql carries is easy to learn, and hence I say its fun to use it.
Like Heiko mentioned, LINQ is close in the idea to ESql.