$execdirect()

Doug Easterbrook doug at artsman.com
Sun Mar 12 16:29:26 UTC 2023


hi Franco.

just a small note: If you over ride the $insert and $update in a  table class, you DO have access to the @[$cinst.ColumnName] bind variables.



Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978

> On Mar 12, 2023, at 4:47 AM, Franco Maregotto <franco at hotelaqua.it> wrote:
> 
> The first thing I might say is that if you override the tableClass, you get nothing when issuing @[$cinst.ColumnName]
> 
> 
> What do you see if you put the mouse over any of the columns in the insert statement while debugging?
> 
> Anyway a good approach when you query the DB is to monitor the result with the following, at least until when you have good and fully tested code:
> Do tsk_StatemObj.$execdirect()
> Calculate ErrCode as tsk_StatemObj.$nativeerrorcode
> Calculate ErrText as tsk_StatemObj.$nativeerrortext
> Calculate ErrNative as tsk_StatemObj.$sqlstate()
> 
> HTH
> Franco
> 
>> Il giorno 8 mar 2023, alle ore 20:34, Daniel Sananes <daniel.s at kopparbergs.se> ha scritto:
>> 
>> Hi
>> 
>> I am overriding a table.
>> lStatementObj is an object derived from the taskobject tDatabase which have the session to Postgres.
>> 
>> #insert()
>> Calculate lInsertString as $cinst.$insertnames()
>> If len(lInsertString)>0
>>  Do tDataBase.$newstatement('now') Returns lStatementObj
>>  Do lStatementObj.$execdirect(lStatement) Returns #F
>> End If
>> Quit method
>> 
>> The execdirect gives #F as kFalse.
>> The string lStatement is:
>> insert into user ("user_id","user_name","user_psw","user_short") VALUES (@[$cinst.user_id],@[$cinst.user_name],@[$cinst.user_psw],@[$cinst.user_short])
>> If I change the string to explicit values I still get kFalse:
>> insert into user ("user_id","user_name","user_psw","user_short") VALUES ('200','name','password','short')
>> 
>> the exact textstring, with explicit values inserts correct in pgAdmin.
>> Have I not understood the $execdirect notation?
>> 
>> /Daniel
>> 0736 704070
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list