Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: Trying to implement custom sqlite function. What is TSQLiteInputs?


This question is answered.


Permlink Replies: 2 - Last Post: Jul 18, 2015 2:48 AM Last Post By: Tom Roberts
Tom Roberts

Posts: 102
Registered: 6/21/05
Trying to implement custom sqlite function. What is TSQLiteInputs?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 17, 2015 10:38 AM
I can't see it defined anywhere. In Delphi examples the input parameters are accessed like e.g. AInputs[0].AsInteger * AInputs[1].AsInteger.

Attempting the same code in c++ builder gives the error E2316 'AsInteger' is not a member of 'TSQLiteInputs'.

Seems to be some sort of List (AInputs->Count returns the number of arguments) but no idea how the list items are accessed.

Edit: Have since discovered they're accessed using AInputs->Inputs[i].

Edited by: Tom Roberts on Jul 17, 2015 12:10 PM
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Trying to implement custom sqlite function. What is TSQLiteInputs? [Edit]
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 17, 2015 12:08 PM   in response to: Tom Roberts in response to: Tom Roberts
Tom Roberts wrote:
I can't see it defined anywhere. In Delphi examples the input parameters are accessed like e.g. AInputs[0].AsInteger * AInputs[1].AsInteger.

Attempting the same code in c++ builder gives the error E2316 'AsInteger' is not a member of 'TSQLiteInputs'.

Seems to be some sort of List (AInputs->Count returns the number of arguments) but no idea how the list items are accessed.

Edited by: Tom Roberts on Jul 17, 2015 11:39 AM

AInputs[0] returns a pointer so it should be in C++. Also C++ doesn't have the
default index concept that Delphi has. So that example code in C++ would be

void __fastcall TForm2::FDSQLiteFunction1Calculate(TSQLiteFunctionInstance
*AFunc, TSQLiteInputs *AInputs, TSQLiteOutput *AOutput, TObject *&AUserData)

{
AOutput->AsInteger =
AInputs->Inputs[0]->AsInteger * AInputs->Inputs[1]->AsInteger;
}

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted corridors of Whitehall.
(Fish)

Tom Roberts

Posts: 102
Registered: 6/21/05
Re: Trying to implement custom sqlite function. What is TSQLiteInputs? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 17, 2015 12:17 PM   in response to: Jeff Overcash (... in response to: Jeff Overcash (...
Thanks Jeff, I was just editing my first post to say I had discovered that even as you typed.

I can't seem to assign my result to AOutput though so maybe you could help with that.

AOutput->AsString="X";

doesn't seem to work and, although no exception results, the query that calls the function doesn't return any result and hovering the cursor over AOutput->AsString in the debugger yields "function call terminated by unhandled exception oxeedfade .....

I can't even get AOutput->AsInteger=5;
to work.

Edited by: Tom Roberts on Jul 17, 2015 12:34 PM

Edited by: Tom Roberts on Jul 18, 2015 2:46 AM

The rason I wasn't getting a result set was because I had the grid data source pointing to the wrong query. AOutput->AsString etc. works fine.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02