dbTalk Databases Forums  

SelectList and dynamic array - which is more efficient?

comp.databases.pick comp.databases.pick


Discuss SelectList and dynamic array - which is more efficient? in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Terry
 
Posts: n/a

Default SelectList and dynamic array - which is more efficient? - 10-02-2006 , 08:25 PM






Hi,

Environment: VB.net, WebServices, Universe 10.1
In VB.net I create a function that returns a SelectList:
Function getUVselectList(ByVal SelectStatement As String, ByVal
iSelectListNum As Integer ) As IBMU2.UODOTNET.UniSelectList
Dim cmd As UniCommand = Nothing 'UNIOBJECTSLib.UnioaifCtrl
Dim uniSelectList As UniSelectList
cmd = UniSession.CreateUniCommand()
cmd.Command = "CLEARSELECT"
cmd.Execute()
cmd.Command = SelectStatement
cmd.Execute()
uniSelectList = UniSession.CreateUniSelectList(iSelectListNum )
Return uniSelectList
end function

I call the function elsewhere:
Dim MySelectList As UniSelectList
MySelectList = getUVselectList("SELECT PATIENTS WITH STATUS>5", 0)
and iterate through the MySelectList. (Note the param iSelectListNum=0)

This is working OK.

2 questions:
Q1: if I call the getUVSelectList function and assign the resulting select
list to another UniSelectList var - call it MySelectList2.
That is:
Dim MySelectList2 As UniSelectList
MySelectList2 = getUVselectList("SELECT VISITS WITH PTID=1", 1)

while iterating through the original MySelectList then I get the
MySelectList select list screwed up. I thought that passing a new value
(iSelectListNum=1) param in the function would allow for 2 (or more)
SelectLists to be resident in memory simultaneously?
But it appears not - or have I done something wrong?

Q2: (flows from the above)
To fix the above problem, I return a DynamicArray rather than a Selectlist.
Thus my function now becomes:

Function getUVselectList(ByVal SelectStatement As String, ByVal
iSelectListNum As Integer ) As IBMU2.UODOTNET.UniSelectList
Dim cmd As UniCommand = Nothing ' UNIOBJECTSLib.UnioaifCtrl
Dim uniSelectList As UniSelectList
cmd = UniSession.CreateUniCommand()
cmd.Command = "CLEARSELECT"
cmd.Execute()
cmd.Command = SelectStatement
cmd.Execute()
uniSelectList = UniSession.CreateUniSelectList(iSelectListNum )

Dim dynArr As UniDynArray
dynArr = UniSession.CreateUniSelectList(iSelectListNum).Rea dList
uniSelectList = Nothing
Return dynArr
end function

As I understand it, the
UniSession.CreateUniSelectList(iSelectListNum).Rea dList is a "singleton" -
thast is it is processed by U2 once and returns a dynamic array. Then I can
iterate through the dyn array to get to each value.
The alternative is to return a SelectList. However, the select list
(appears) to be something of a pointer (or a row set cursor from SQL) and
means that the app is tieing up the U2 processor.
Thus I would assume that the return of a dyn array is more efficient than a
select list - correct?

Thanks for your patience and assistance.

cheers
Terry




(function getUVSelectList)
I have been creating a



Reply With Quote
  #2  
Old   
Bruce Nichol
 
Posts: n/a

Default Re: SelectList and dynamic array - which is more efficient? - 10-02-2006 , 11:32 PM






Goo'day, Terry,

For a query of this magnitude I'd advocate your joining the U2 list...

http://www.u2ug.org and follow the link to "Join U2ug"

and posting your query there....There's many a helpful U2 guru there
that don't come within a bull's roar of cdp...

On Tue, 03 Oct 2006 01:25:17 GMT, "Terry"
<tDOTcallaghan (AT) bigpondDOT (DOT) com> wrote:

Quote:
Hi,

Environment: VB.net, WebServices, Universe 10.1

Regards,

Bruce Nichol
Talon Computer Services
ALBURY NSW Australia

http://www.taloncs.com.au

If it ain't broke, fix it until it is....


Reply With Quote
  #3  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: SelectList and dynamic array - which is more efficient? - 10-03-2006 , 12:57 AM



Terry, the exact situation you describe is addressed in mv.NET through
the use of server-side lists, and the ability to fetch data on demand.

First, you can have as many active mvItemList objects as you want,
which are roughly the equivalent of UniSelectLists.

Second, with mv.NET we don't retrieve an entire list if we don't want
to. We can page the data from the server just by setting a couple
properties. There are in fact two cursors. One that keeps track of
the number of records fetched (data can be retrieved in blocks and
then processed on the client asynchronously rather than getting one at
a time), and one that keeps track of the current position in the
record set. This second cursor can be moved forward or back, and if
more data is needed from the server the fetch is done automatically.
When we retrieve data we can also retrieve individual attributes by
number or name - we don't need to get the ID from the list and then do
separate Reads for the data.

Using these mechanisms, we don't need to tie up a DBMS license during
the entire time that that a long list is streaming from server to
client, and multiple users can access the same session license in
between page fetch operations.

The latest version of mv.NET (v3.2.1.C) will be available for download
from our website on your Wednesday morning. I've spent some time with
the latest cut and I'm very pleased with this release.

Regards,
T


"Terry" wrote:

Quote:
Hi,

Environment: VB.net, WebServices, Universe 10.1
In VB.net I create a function that returns a SelectList:
Function getUVselectList(ByVal SelectStatement As String, ByVal
iSelectListNum As Integer ) As IBMU2.UODOTNET.UniSelectList
Dim cmd As UniCommand = Nothing 'UNIOBJECTSLib.UnioaifCtrl
Dim uniSelectList As UniSelectList
cmd = UniSession.CreateUniCommand()
cmd.Command = "CLEARSELECT"
cmd.Execute()
cmd.Command = SelectStatement
cmd.Execute()
uniSelectList = UniSession.CreateUniSelectList(iSelectListNum )
Return uniSelectList
end function

I call the function elsewhere:
Dim MySelectList As UniSelectList
MySelectList = getUVselectList("SELECT PATIENTS WITH STATUS>5", 0)
and iterate through the MySelectList. (Note the param iSelectListNum=0)

This is working OK.

2 questions:
Q1: if I call the getUVSelectList function and assign the resulting select
list to another UniSelectList var - call it MySelectList2.
That is:
Dim MySelectList2 As UniSelectList
MySelectList2 = getUVselectList("SELECT VISITS WITH PTID=1", 1)

while iterating through the original MySelectList then I get the
MySelectList select list screwed up. I thought that passing a new value
(iSelectListNum=1) param in the function would allow for 2 (or more)
SelectLists to be resident in memory simultaneously?
But it appears not - or have I done something wrong?

Q2: (flows from the above)
To fix the above problem, I return a DynamicArray rather than a Selectlist.
Thus my function now becomes:

Function getUVselectList(ByVal SelectStatement As String, ByVal
iSelectListNum As Integer ) As IBMU2.UODOTNET.UniSelectList
Dim cmd As UniCommand = Nothing ' UNIOBJECTSLib.UnioaifCtrl
Dim uniSelectList As UniSelectList
cmd = UniSession.CreateUniCommand()
cmd.Command = "CLEARSELECT"
cmd.Execute()
cmd.Command = SelectStatement
cmd.Execute()
uniSelectList = UniSession.CreateUniSelectList(iSelectListNum )

Dim dynArr As UniDynArray
dynArr = UniSession.CreateUniSelectList(iSelectListNum).Rea dList
uniSelectList = Nothing
Return dynArr
end function

As I understand it, the
UniSession.CreateUniSelectList(iSelectListNum).Rea dList is a "singleton" -
thast is it is processed by U2 once and returns a dynamic array. Then I can
iterate through the dyn array to get to each value.
The alternative is to return a SelectList. However, the select list
(appears) to be something of a pointer (or a row set cursor from SQL) and
means that the app is tieing up the U2 processor.
Thus I would assume that the return of a dyn array is more efficient than a
select list - correct?

Thanks for your patience and assistance.

cheers
Terry


Reply With Quote
  #4  
Old   
Symeon
 
Posts: n/a

Default Re: SelectList and dynamic array - which is more efficient? - 10-03-2006 , 07:40 AM



Terry -

The reason it appears not to work is because you also need to tell the
select command which select list it is going to. you need to append on
the end of the command TO selectlistno, so that the command becomes say
'SELECT VOC TO 2'
e.g. cmd.Command = SelectStatement & " TO " & iSelectListNum



Rgds
Symeon.


Reply With Quote
  #5  
Old   
Terry
 
Posts: n/a

Default Re: SelectList and dynamic array - which is more efficient? - 10-03-2006 , 04:41 PM



thanks :-)

"Symeon" <symeonb (AT) gmail (DOT) com> wrote

Quote:
Terry -

The reason it appears not to work is because you also need to tell the
select command which select list it is going to. you need to append on
the end of the command TO selectlistno, so that the command becomes say
'SELECT VOC TO 2'
e.g. cmd.Command = SelectStatement & " TO " & iSelectListNum



Rgds
Symeon.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.