Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Webservices returning different datasets

2 posts in QAnywhere Last posting was on 2007-10-02 15:39:45.0Z
c.c.reddy Posted on 2007-10-02 13:08:53.0Z
Sender: 117c.47023772.1804289383@sybase.com
From: c.c.reddy
Newsgroups: ianywhere.public.sqlanywhere.qanywhere
Subject: Webservices returning different datasets
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <470242e5.1280.1681692777@sybase.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 2 Oct 2007 06:08:53 -0700
X-Trace: forums-1-dub 1191330533 10.22.241.41 (2 Oct 2007 06:08:53 -0700)
X-Original-Trace: 2 Oct 2007 06:08:53 -0700, 10.22.241.41
Lines: 110
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.sqlanywhere.qanywhere:250
Article PK: 10482

Description: We have been working on creating web services
to obtain data from our database. In this sequence of
research, we had to go through creation of stored procedures
where it could return different datasets, based on whether
the testing condition has been met or not. This situation
can be solved using if-else block in our stored procedures
for the web services, if condition1 has been met then we
would return data from one select statement else we would
return data from a different select statement. These select
statements can return data and columns from same table or a
different table.



Illustration:

Stored
procedure (parameters)

Begin


…………………………………


…………………………………


If (condition-a)

Begin

……………………………

……………………………

Select column1, column2, column3,
…………………….., column

FROM table1

End

Else

Begin

……………………………

……………………………

Select
columna,columnb,columnc,columnd,………………..,columnz

FROM table2

End





End



When the above stored procedure is called by the web service
and based on the parameters if condition-a is met, then the
stored procedure returns correct data i.e. it has column1,
column2, column3, …………………….., column in the
dataset returned from the table1 otherwise if the
condition-a in the if loop fails then the wrong data is
returned by the web service to the front end i.e. it returns
column1, column2, column3, ……………………..,
column as the column names in the dataset and the data is
obtained from the table2. This is a pretty weird behavior.
We are not sure if the Sybase web services were designed to
do so or it is a bug. We tried it on the latest build as
well, but it doesn’t do any good for our EIS. This is the
same case with the usage of Execute statements as well, if
the execute statements with other stored procedures or
dynamically created select statements are used, they don’t
return the desired dataset. We tried all the possible
permutations and combinations of the control flow statements
and the stored procedures but the result seems to be the
same.



Consequences:

As you all know how
important control flow statements are for the stored
procedures, if they don’t function properly, the if-else
blocks had to be split up into two different stored
procedures each and every time we want to evaluate any
condition and it is obvious that this code for checking the
conditions and others will have to shifted to the front end,
this makes the front end and the back end pretty much
dependent on each other and will be difficult to maintain.

If all the select statements have the same returning
columns. then there is no problem.

I have been workign on this for a pretty longtime. i need
some inputs on this. i don't know why it is not working, i
felt it was pretty weird.

Thanks,
c.c.reddy


Jeff Albion (iAnywhere Solutions) Posted on 2007-10-02 15:39:45.0Z
From: "Jeff Albion (iAnywhere Solutions)" <firstname.lastname@ianywhere.com>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Newsgroups: ianywhere.public.sqlanywhere.qanywhere
Subject: Re: Webservices returning different datasets
References: <470242e5.1280.1681692777@sybase.com>
In-Reply-To: <470242e5.1280.1681692777@sybase.com>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: jalbion-xp.sybase.com
X-Original-NNTP-Posting-Host: jalbion-xp.sybase.com
Message-ID: <47026641$1@forums-1-dub>
Date: 2 Oct 2007 08:39:45 -0700
X-Trace: forums-1-dub 1191339585 10.25.98.200 (2 Oct 2007 08:39:45 -0700)
X-Original-Trace: 2 Oct 2007 08:39:45 -0700, jalbion-xp.sybase.com
Lines: 127
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.sqlanywhere.qanywhere:251
Article PK: 18780

Your thread in the sybase.public.sqlanywhere.general newsgroup will most
likely have a better response. This newsgroup is focused on our
QAnywhere product.

Regards,

c.c.reddy wrote:
> Description: We have been working on creating web services
> to obtain data from our database. In this sequence of
> research, we had to go through creation of stored procedures
> where it could return different datasets, based on whether
> the testing condition has been met or not. This situation
> can be solved using if-else block in our stored procedures
> for the web services, if condition1 has been met then we
> would return data from one select statement else we would
> return data from a different select statement. These select
> statements can return data and columns from same table or a
> different table.
>
>
>
> Illustration:
>
> Stored
> procedure (parameters)
>
> Begin
>
>
> Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…
>
>
> Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…
>
>
> If (condition-a)
>
> Begin
>
> Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…
>
> Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…
>
> Select column1, column2, column3,
> Â…Â…Â…Â…Â…Â…Â…Â….., column
>
> FROM table1
>
> End
>
> Else
>
> Begin
>
> Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…
>
> Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…Â…
>
> Select
> columna,columnb,columnc,columnd,Â…Â…Â…Â…Â…Â…..,columnz
>
> FROM table2
>
> End
>
>
>
>
>
> End
>
>
>
> When the above stored procedure is called by the web service
> and based on the parameters if condition-a is met, then the
> stored procedure returns correct data i.e. it has column1,
> column2, column3, Â…Â…Â…Â…Â…Â…Â…Â….., column in the
> dataset returned from the table1 otherwise if the
> condition-a in the if loop fails then the wrong data is
> returned by the web service to the front end i.e. it returns
> column1, column2, column3, Â…Â…Â…Â…Â…Â…Â…Â…..,
> column as the column names in the dataset and the data is
> obtained from the table2. This is a pretty weird behavior.
> We are not sure if the Sybase web services were designed to
> do so or it is a bug. We tried it on the latest build as
> well, but it doesnÂ’t do any good for our EIS. This is the
> same case with the usage of Execute statements as well, if
> the execute statements with other stored procedures or
> dynamically created select statements are used, they donÂ’t
> return the desired dataset. We tried all the possible
> permutations and combinations of the control flow statements
> and the stored procedures but the result seems to be the
> same.
>
>
>
> Consequences:
>
> As you all know how
> important control flow statements are for the stored
> procedures, if they donÂ’t function properly, the if-else
> blocks had to be split up into two different stored
> procedures each and every time we want to evaluate any
> condition and it is obvious that this code for checking the
> conditions and others will have to shifted to the front end,
> this makes the front end and the back end pretty much
> dependent on each other and will be difficult to maintain.
>
> If all the select statements have the same returning
> columns. then there is no problem.
>
> I have been workign on this for a pretty longtime. i need
> some inputs on this. i don't know why it is not working, i
> felt it was pretty weird.
>
> Thanks,
> c.c.reddy

--
Jeff Albion, Product Support Analyst
iAnywhere Solutions

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summary.do?baseprod=144&client=ianywhere&timeframe=0