Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have had many people suggest that 1

Status
Not open for further replies.

kaht

Programmer
Aug 18, 2003
4,156
US
I have had many people suggest that I use getrows instead of movenext when accessing data from the database to improve speed and performance. I've seen no way to make this work with javascript due to the lack of support of multidimensional arrays (outside of scripting them yourself). Specifically for javascript I've also read articles suggesting to use getstring instead of getrows, and this seems to work okay, other than javascripts lack of useful tools to manipulate strings. I'm very new to javascript, but I've used java a lot in the past and I know there are tokenizer methods that would make this process a lot easier for me than what it is right now. I guess what I'm asking is if anybody knows of a tokenizer script that I could download from somewhere, or perhaps maybe an easier approach to this whole subject. This isn't a dire request as my project already works using the movenext method, but I would like to speed it up as much as possible. It's just that the research I've done so far indicates that it's gonna be a bigger headache than what it's worth.

Thanks

-kaht
 
>>I have had many people suggest that I use getrows instead of movenext when accessing data from the database to improve speed and performance.
sounds like you're talking about ASP? you'd be better off in the ASP forum333 but yes, getRows() is typically faster than rs.moveNext

>>I've seen no way to make this work with javascript due to the lack of support of multidimensional arrays (outside of scripting them yourself).
i've never used jscript for ASP, but if it's anything like javascript (which it should be for the most part), then it will have better support for multidimensional arrays than vbscript. in javascript a multidimensional array is simply myArray[x][y] or myArray[x][y][z] etc for each dimension desired.

>>other than javascripts lack of useful tools to manipulate strings
what? js has TONS of string functions. try substring(), slice(), indexOf(), lastIndexOf(), replace() just to name a few.










=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
>> js has TONS of string functions.

Sure, but they hide them in the documentation! Sneaky Bastages!

-pete
 
substring(), slice(), indexOf(), lastIndexOf(), and replace() don't tokenize a string. As I stated above, I could code a script to perform this method, but my project is kinda coming down to the wire and I really just don't have the time. Also, this is just a speed/performance issue. It already works the way it is now, I'm mostly just trying to speed it up a fraction, and I just can't see devoting a day to increase performance when other higher priority things need worked on. Just looking for an easy solution really......

-kaht
 
>> I'm mostly just trying to speed it up a fraction

Oh... So you have profiled the app and have the numbers that show that the most significant gain would be to change to getrows? If not, I recommend the first step in a application optimization task is to profile the application. Otherwise you are just making wild guesses at where the most significant gain can be made.

"But, that's just my opinion... I could be wrong."

-pete
 
split() tokenizes a string:

var s = "foo|bar|yada|yada";
var s_tokenized = s.split("|");

i googled and found here is how you work with getRows() with jscript:
Code:
var rs = conn.execute("select * from myTable order by myField");
var ar = rs.getRows();

for (var x = 0; x < ar.ubound(2); x++) {
	//  ar.getItem(field, row);
	var a = ar.getItem(0,x);
	var b = ar.getItem(1,x);
	var c = ar.getItem(2,x);
	//  etc...for as many fields as needed
}

in my testing i found getRows to be 2 - 10 times quicker than rs.moveNext


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top