Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Basic4ppc Wishlist
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Basic4ppc Wishlist Missing any feature?


ReadLineNumber


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-24-2008, 03:11 AM
Junior Member
 
Join Date: May 2007
Posts: 37
Awards Showcase
Beta Tester 
Total Awards: 1
Default ReadLineNumber

Hi,
I know using SQL is great but it requires the additional SQL components and .NET Framework 2 to work. On some devices, this requires installation of .net framework to be installed which may be cumbersome for end-customers. I also observed that it affects the initial loading time as well.

Using CSV is the current workaround for me. But this requires using the TABLES control to load the whole chunk of data to it.. and in a way, utilising memory space.

Is there a way where I can simply retrieve a specific line in a text file (consisting of standard CSV or whatever data strings) without using Tables? I wrote a simple ReadLine sometime back.. but this requires reading all the lines from first line to the 'n' line. This is fast if the number of lines are small. But if it grows bigger, it becomes slower.

Does anyone has any workaround for this? if not, perhaps can Erel add that into say, v6.06 as it'd be much much faster..


Rgds
WZSun

Last edited by WZSun : 02-24-2008 at 03:13 AM.
Reply With Quote
  #2 (permalink)  
Old 02-24-2008, 09:52 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,706
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by WZSun View Post
I wrote a simple ReadLine sometime back.. but this requires reading all the lines from first line to the 'n' line. This is fast if the number of lines are small. But if it grows bigger, it becomes slower.
That is the only way of doing it with a CSV file as each line is of unknown length so you need to start at the beginning and count.

Quote:
perhaps can Erel add that into say, v6.06 as it'd be much much faster.
Unlikely to be much/any faster than using FileRead and counting lines yourself as reading a line is a low level .NET stream function.
Reply With Quote
  #3 (permalink)  
Old 02-24-2008, 11:24 PM
LineCutter's Avatar
Senior Member
 
Join Date: May 2007
Location: Daarsit
Posts: 117
Awards Showcase
Beta Tester 
Total Awards: 1
Default

You could index the locations of the lines for subsequent revisits, even if you dump the file from memory.

If the CSV has fixed line sizes then you could calculate the offset quite easily.

If the CSV has an index variable then you could binary search to it (read from your search point forwards until you reach a CRLF, then read & parse the index variable. Jump whichever way it suggests)
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 12:45 PM
Junior Member
 
Join Date: May 2007
Posts: 37
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi,
Thanks for all the suggestions. Looks like I have to stick to the CSV for now.

Meanwhile, I hope Erel can provide some kind of basic db functions without loading them to the tables first.

Thanks again!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:34 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0