Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delphi example better be changed #98

Open
the-Arioch opened this issue Oct 11, 2018 · 1 comment
Open

Delphi example better be changed #98

the-Arioch opened this issue Oct 11, 2018 · 1 comment

Comments

@the-Arioch
Copy link

from .Prepare; to .Prepared := True;

The original line comes from Delphi 1995 and the library underlying is long dead.
http://docwiki.embarcadero.com/Libraries/Tokyo/en/Bde.DBTables.TQuery.Prepare
https://en.wikipedia.org/wiki/Borland_Database_Engine

The root abstract class has neither .Prepare; method nor .Prepared property, so here is no preference.
http://docwiki.embarcadero.com/Libraries/Tokyo/en/Data.DB.TDataSet ( see also the list of only out-of-the-box descending libraries ).

However the libraries that followed the initial BDE wrapper has quite different approaches toward the method. For example http://docwiki.embarcadero.com/Libraries/Tokyo/en/Data.SqlExpr.TCustomSQLDataSet.PrepareStatement - the method has different name.
Yet see: http://docwiki.embarcadero.com/Libraries/Tokyo/en/Data.DBXCommon.TDBXCommand.Prepare
Those are classes of the same library by the way.

Some libraries seem to implement that method as a no-op stub for source-level compatibility.
http://docwiki.embarcadero.com/Libraries/Tokyo/en/IBX.IBQuery.TIBQuery.Prepare

I even believe I remember I saw an arcane notice that a method only prepared the query for one time execution, not for repeated ones, though can not find it.

Conversely, libraries seem to made a de facto consensus about the property, that it has the same name, the same datatype, and that it works persistently.
Example: http://docwiki.embarcadero.com/Libraries/Tokyo/en/Data.SqlExpr.TCustomSQLDataSet.Prepared

Again, it is kind of fuzzy and arcane, but the property way seems to apply more consistently with many more libraries than the current method way

@the-Arioch
Copy link
Author

BTW, just tested the very .PrepareStatement - while the method is public, thus implies generic usage, at least in Delphi XE2 it does not populate list of query fields and not only ubiquitous .FieldByName fails to work, but even mere .Open throws an exception...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant