Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

using transaction sqlpreview event to modify sql ?!

673 views
Skip to first unread message

Heino Hellmers

unread,
Jun 3, 2009, 3:41:21 AM6/3/09
to
Hi,

is it possible to modify SQL Statements from one central event ?
We want to modify the sql statement to support different databases (because
of different sql syntax)

We have the sqlpreview event in PB 11.5 so wie can see every SQL statment,
but it seems to be that we can't
use it to modify the sql just bevor it executes ?!

what's the best way to do ?


TIA
Heino Hellmers

Chris Pollach

unread,
Jun 3, 2009, 7:15:31 AM6/3/09
to
Hi Heino;

The only way I know of is if you use DW's for all your SQL interactions.
Then you have the Retrieve/Update Start events where you can do this. So if
you create a common DW Control ancestor that implements these events you
could attain your goal I believe.

HTH

--
Regards ... Chris
ISUG - NA RUG Director
http://chrispollach.pbdjmagazine.com


"Heino Hellmers" <hell...@sf-datentechnik.de> wrote in message
news:4a262921$1@forums-1-dub...

Aj

unread,
Jun 3, 2009, 10:27:00 AM6/3/09
to
One can definitely modify the sql using sqlpreview event.
Just make sure to do the following:
sqlsyntax = ls_syntax
this.setsqlpreview(sqlsyntax)
Here ls_syntax is the modified sql you will be supplying to
the db.
If you have window inherited, override the ancestor and call
ancestor event afterwards like the following:
CALL SUPER::sqlpreview

Hth

Bruce Armstrong

unread,
Jun 3, 2009, 10:44:46 AM6/3/09
to

I think you've forgotten that they've added a SQL Preview event for
the PowerBuilder transaction object. Though I haven't done it
personally, one of the reasons I'm told i was added is so that you
could specifically do this (modify all SQL going to the database).

The command being passed to the database come in on the SQLSyntax
argument. You can modify that, execute it within that event, and then
return a 1 to tell PB not to send the original statement.

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc00357_1150/html/newfeat/CFIGBGBC.htm

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc37781_1150/html/psref/CAIBCBBGTO.htm


On 3 Jun 2009 04:15:31 -0700, "Chris Pollach"
<cpol...@travel-net.com> wrote:

>Hi Heino;
>
> The only way I know of is if you use DW's for all your SQL interactions.
>Then you have the Retrieve/Update Start events where you can do this. So if
>you create a common DW Control ancestor that implements these events you
>could attain your goal I believe.
>
>HTH

-----------------------------------

My Web 2.0 Stuff

Blog: http://bruce.pbdjmagazine.com/
Facebook: http://www.facebook.com/people/Bruce-Armstrong/1600223798
Fotki: http://public.fotki.com/brucearmstrong/
LinkedIn: http://www.linkedin.com/in/bruceaarmstrong
Twitter: http://twitter.com/bruce_armstrong
YouTube: http://www.youtube.com/user/brucearmstrong

Chris Pollach

unread,
Jun 3, 2009, 12:45:44 PM6/3/09
to
Hi Bruce;

Yes .. I am in the same boat as you. I have the event coded in my latest
STD Foundation Classes for PB 11.5.x to capture the SQL for analysis - but,
I have not tried to modify it at the TO level.

Thanks for the other insight! :-)

--
Regards ... Chris
ISUG - NA RUG Director
http://chrispollach.pbdjmagazine.com


"Bruce Armstrong" <NOCANSPAM_br...@yahoo.com> wrote in message
news:do2d255ngu2isd2lk...@4ax.com...

Heino Hellmers

unread,
Jun 5, 2009, 12:04:55 PM6/5/09
to
Hi,

setsqlpreview only works for dw/ds
we need/want the sqlpreview event from the transaction object ...

how can we do set sqlpreview for example for embedded select statements ?

regards
Heino Hellmers


"Aj" schrieb im Newsbeitrag news:4a268834.314...@sybase.com...

Heino Hellmers

unread,
Jun 14, 2009, 8:01:37 AM6/14/09
to
Hi,

we need to modify not for a datawindow ...
we need to modify for a embbeded sql script ...
=> in the sqlpreview event from the transaction object ...

so how can we modify a select statement.
Seems to me, that we can do ... because we can't change it only stop it and
make another sql ...
We need something like setsqlpreview() or sqlsyntax per reference and not
per value :-(

we need the correct "returnvalue" from the orginal sql script and so we need
to MODIFY not to stop and make another sql script ...


seems to we can't profit from the new events :-(

TIA
Heino Hellmers


"Chris Pollach" <cpol...@travel-net.com> schrieb im Newsbeitrag
news:4a2d541c$1@forums-1-dub...
> Hi Heino;
>
> You can ...
>
> 1) Use a SetSQLPreview ( ) command in the SQLPreview event.
> - or -
> 1) Use a SetSQLSelect ( ) command in the RetrieveStart event (or any other
> DW event for that matter <g>).
>
> HTH


>
> --
> Regards ... Chris
> ISUG - NA RUG Director
> http://chrispollach.pbdjmagazine.com
>
>

> "Heino Hellmers" <hell...@sf-datentechnik.de> wrote in message

> news:4a2d51f9$1@forums-1-dub...
>> Hi,
>>
>> in our test it doesn't work like the dw events ...
>>
>> we know the sqlpreview event BUT we can't really modify or how can we do
>> ?
>>
>> for example:
>>
>> our sql statement: >>select
>> dbo.function1(abc) into :ll_max from xyz
>> so how can we modify the sql statement to >>select function1(abc) into
>> :ll_max from xyz
>>
>> AND RETURN ll_max with the modified sql to the original event and
>> continue
>> the script with the correct ll_max ?
>>
>> TIA
>> Heino Hellmers
>>
>>
>>
>> "Bruce Armstrong" <NOCANSPAM_br...@yahoo.com> schrieb im
>> Newsbeitrag news:lr5k255cck0aeu0s6...@4ax.com...
>>>
>>> The SQLPreview event was added to the transaction object in
>>> PowerBuilder 11.5. You would use it for embedded SQL the same way you
>>> used that same event on the datawindow:
>>>
>>> http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc00357_1150/html/newfeat/CFIGBGBC.htm
>>>
>>> On 5 Jun 2009 09:04:55 -0700, "Heino Hellmers"

0 new messages