Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: FireDAC - SQLite - Type Casting of function results and subsequent use


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Miroslav BALAZ

Posts: 4
Registered: 3/16/00
FireDAC - SQLite - Type Casting of function results and subsequent use  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 27, 2017 6:34 AM
Hallo, I'm looking for a solution to the problem.
FireDAC SQLite - TypeCasting of function results with
AS Alias::<T>
.
When you call the SQL statement, SQLite does not return the defined function type, but only one of the basic types.
In my example, instead of the correct dtDate, dtReal returns.
For this purpose, FireDAC offers the option to use
AS [myDate::DATE]
.
As expected, the result is dtDate.
The problem is the use of the results of such a command.
For example, after creating VIEW or Temporary table.
Here are some complications.
I expected the construct
"alias::<T>"
to be used for the typecast only. That its full name will not be transferred to other commands. I would only expect the basic name of the AS field. Because it would have a bad effect on the next command (like VIEW). Well, in others and in others.
Internally, within the Delphi construction of
FDQuery1.Fields[0].FieldName

I get as expected "myDate", but VIEW sees the same field as
"[myDate::DATE]"

That's a little confusing.
For a quicker understanding of subsequent difficulties, please see the attached picture or better use a simple project. It is also enclosed.
The attached jpg image is intended for a better understanding.
The appendix also contains a simple verification project.
Best regards, Miro

PS
This post
"SELECT Alias FROM ( Select Field1 Alias::<T> FROM Table) - Error? "
is also from me and has the same theme. But that web address did not allow me to upload attachments.
[https://forums.embarcadero.com/forum.jspa?forumID=502&start=0]

Edited by: Miroslav BALAZ on Nov 28, 2017 12:35 AM

Edited by: Miroslav BALAZ on Nov 28, 2017 1:45 AM

Edited by: Miroslav BALAZ on Nov 28, 2017 1:49 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02