LB Booster
« RANDOM ACCESS LIBRARY? »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:05am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: RANDOM ACCESS LIBRARY?  (Read 547 times)
joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx RANDOM ACCESS LIBRARY?
« Thread started on: Oct 20th, 2015, 10:48am »

Being new to LBB and LB, but not new to BASIC I am reluctant to reinvent random access file routines. "In the old days" I had a library of "generic" routines for opening, closing, indexing, get record, put record, delete record, recovering space, etc. Are routines like that available that I can use?

I had thought to try SQLite, but seems like so much overkill for my simple program, because there won't be thousands of records.
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: RANDOM ACCESS LIBRARY?
« Reply #1 on: Oct 20th, 2015, 11:54am »

open / close / get / put are JB/LB/LBB operators.
There is a program sometimes mentioned on JB forum, so I've seen it work
Simple Database Framework
http://justbasic.wikispaces.com/Simple_Database_Framework
and on page near it
http://justbasic.wikispaces.com/Just+Basic+Shared+Code
some set of routines (I did not tried it)
Random access I/O functions library
http://justbasic.wikispaces.com/Random+access+files+with+arrays
Have a look.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: RANDOM ACCESS LIBRARY?
« Reply #2 on: Oct 20th, 2015, 11:59am »

on Oct 20th, 2015, 10:48am, pnlawrence wrote:
Being new to LBB and LB, but not new to BASIC I am reluctant to reinvent random access file routines. "In the old days" I had a library of "generic" routines for opening, closing, indexing, get record, put record, delete record, recovering space, etc. Are routines like that available that I can use?

LB/LBB natively supports Random Access Files with open, close, get record and put record statements. What you don't get 'built in' is full database functionality such as the ability to delete a record and recover the space.

It may be that a library for that already exists, but I don't personally know of one (of course only LBB supports 'true' libraries; with LB the routines would need to be appended to your own program).

If you do decide to use an off-the-shelf database package SQLite is not necessarily the best choice. LB/LBB can easily interface with ODBC (it's a standard component of Windows) which has the advantage of not tying you to one particular database manager.

Richard.
User IP Logged

joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Re: RANDOM ACCESS LIBRARY?
« Reply #3 on: Oct 20th, 2015, 12:13pm »

I should have used the words "stored procedure" in my post.

A "stored procedure" being a little higher level function/sub/gosub encapsulation of database functions.

What I like to do in my programs is "insulate" myself from myself! smiley

Quote:
LB/LBB can easily interface with ODBC


I hadn't thought of ODBC. I'll do some searching there.
User IP Logged

joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Re: RANDOM ACCESS LIBRARY?
« Reply #4 on: Oct 20th, 2015, 12:33pm »

Searching ...

Damn! Everything about BASIC is frustratingly OLD like me! Seems like every solution I run across is from 10 years ago.

I think RAF will be plenty robust enough for my program. tsh73, I have looked at all the resource links you provided and am studying how to make my own procedures.

Perhaps its time for a project to define a library of "stored procedures" for RAF.
User IP Logged

Mystic
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 53
xx Re: RANDOM ACCESS LIBRARY?
« Reply #5 on: Oct 23rd, 2015, 12:33am »

I would love to see some functions made that perform some simple SQL-like functions using the native RAF system...

Thought about trying to write some of my own but time is lacking.
User IP Logged

- Rick
joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Re: RANDOM ACCESS LIBRARY?
« Reply #6 on: Oct 23rd, 2015, 11:09am »

I'm starting to believe that it can be done, but only with a lot of "low level" routines serving as some sort of "interpreter" between the "SQL-like" statements and LB/LBB.

There doesn't seem to be much benefit for spending all the time involved.
« Last Edit: Oct 23rd, 2015, 11:10am by joker » User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: RANDOM ACCESS LIBRARY?
« Reply #7 on: Oct 24th, 2015, 5:34pm »

I don't use Random Access Files because you can't access them randomly - unless you know the record number - which means a separate index file - which means more work keeping the index and main file in synch.

I think the simplest thing to do is use one-record files and access them (randomly !) with the file dialog statement.

r.m.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: RANDOM ACCESS LIBRARY?
« Reply #8 on: Oct 24th, 2015, 7:25pm »

on Oct 24th, 2015, 5:34pm, Alincon wrote:
which means more work keeping the index and main file in synch.

There's not much effort involved in keeping them 'in sync' because the only way they can ever lose synchronisation is when you rebuild the data file to recover the space occupied by deleted records. Typically you would perform that operation only infrequently.

Quote:
I think the simplest thing to do is use one-record files and access them (randomly !) with the file dialog statement.

That's likely to be very wasteful of disk space. Consider the classic example of a database - an address list. A record might need to be something like 200 bytes long to contain (for example) a name, address, telephone number and email. But the minimum amount of disk space occupied by a file (however small) is typically 4 Kbytes - and that doesn't take into account the size of the directory itself - so you could easily end up using more than 20 times the amount of disk space than your database should occupy!

Richard.

User IP Logged

joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Re: RANDOM ACCESS LIBRARY?
« Reply #9 on: Oct 24th, 2015, 7:33pm »

Can you explain what application uses a "randomly" accessed file system?

on Oct 24th, 2015, 5:34pm, Alincon wrote:
I think the simplest thing to do is use one-record files and access them (randomly !) with the file dialog statement.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls