Databaseic - Easy and space saving database tip

Discuss anything related to the VIC
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Databaseic - Easy and space saving database tip

Post by Boray »

You know my "TextWalker"... Using the basic editor as a text editor. Now it's time to use the basic editor as a database.

You need a "find"-command, for example a Vic-20 with Programmer's Aid or Buti, or a C64 with The Final Cartridge.

Now let's say you have a video collection with cassettes labeled 1,2,3,4 and so on and you want to do a register over them. Turn on your computer. Ready. Now let's input the data. For example on cassette 1 you have two James Bond films. Then write the following to the screen:
1"james bond - goldfinger + the spy who loved me
and then press return. Note that the "-sign at the start of the line is needed, or you won't be able to search the database.

On the next cassette is your Star Trek collection, then write:
2"star trek, episode 1-4
and then press return and continue in the same manner with all your films.

To save the database, do as you normally save a program:
save"videos",8

Then when you want to find a film, just start the computer, load your database file and use the find command:
find "goldfinger"
.. and that line will be displayed:
1 "james bond - goldfinger + the spy who loved me

Aha, tape number 1. Or if I want to find all james bond films:
find "bond"


There are many advantages with this database:

1. You don't have to load any database program, you only have to load one single file.
2. You don't have to learn a database program.
3. As there is no database program in memory, you can use all of the available memory for the actual data.
4. Your database is compatible with all 8-bit Commodore computers and can export to petascii and ascii (see post below)

I think a C64+TheFinalCart would be the ultimate for this. Then you will have loads of memory, a find command, and both fast disk and tape turbos. It will just take a couple of seconds to load a big database. If you compare to a PC, the time it will take to start the computer and load the database will be just amazing. And for a video film register, you could connect your c64 or vic to the VCR itself and you won't need a monitor.

If you have a lot of information to enter for every title, then you could add a zero to the line number throughout the database. So that title 1 starts on 10 and title 2 starts on 20. The lines in between is additional information for the title above. Like this:

20 "star trek episodes 1-4
21 "1: the black hole, 2: warf the robot
22 "3: bla bla bla 4: blabalbla
30 "the next tape (=tape nr 3)

If you like you can start in the first manner, with lines 1,2,3 and then if you see that you can't fit all the info on a single line, you can just do a RENUMBER10,10 to convert the database to the second manner.

Now, why haven't I thought of this before???? :roll:

/Anders
Last edited by Boray on Thu Feb 02, 2006 4:46 pm, edited 2 times in total.
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Clever idea :)

But how about filtering and sorting, two of the most used and needed features of a database?
And there are some problems with more complex search functions with combined conditions like "all Bond films with 'gold' in the title", I think.
(Is there any other Bond film beside Goldfinger with Gold in the title anyway?)

But to put this into the right context, I'm maybe not your target audience for this as I have to program with databases on a daily basis in my job :wink:


I think it must be possible by some simple redirects or so to disable the tokenizer, so one has not to worry about the basic key words and could input the data without quotes. With this and some preconditions one could even have sort of recordsets delimited by special characters, me thinks...

See what happens? Can't resist to try to make a database program out of this :twisted:

Björg
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

The "-sign is for the FIND command to understand that it's a string.

Another benefit: The database will be compatible with all Commodore 8-bit computers.


How to export the database to petascii:

open 1,8,1,"file"
cmd 1
list
print#1
close 1


How to export the database to ascii:

Convert the file above with for example lc2ascii:
http://user.tninet.se/~pug510w/datormus ... ascii.html


How to print a list of all bond films on the printer:

open 1,4
cmd 1
find "bond"
print#1
close1
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Sorting, well, they are always sorted by film number ;) But it would of course be possible to write a more complex search algorithm in ML if one really likes. But I don't think it's worth the effort for the kind of applications this would be used for...
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

So you just invented a 'databasic' 8)

Björg
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Schlowski wrote: (Is there any other Bond film beside Goldfinger with Gold in the title anyway?)
The man with the golden gun :wink:
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Schlowski wrote:So you just invented a 'databasic' 8)

Björg
:lol: Or.... Databaseic! :lol:
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

SELECT COUNT(id) FROM databaseic WHERE title LIKE "%gold%"

The FIND command would show all the lines, but you would want a mechanism to count how many lines of output you got.
Anders Carlsson

Image Image Image Image Image
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

carlsson wrote:SELECT COUNT(id) FROM databaseic WHERE title LIKE "%gold%"

The FIND command would show all the lines, but you would want a mechanism to count how many lines of output you got.
Now, that seems so increadibly important to me :roll:
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

The LIST command is of course also essential to Databaseic. If you for example have recorded a new film at the end of, let's say tape 43. Then do the following:

list 43

Which would bring up, for example:

43 "Indiana Jones and the last crusade

Like normal basic editing, just go up with the cursor to add the new information.

43 "Indiana Jones and the last crusade, Toy Story 2

and press return...


To save and replace an existing file on the disk, there is a special trick:

save "@0:file",8

(The 0 is a zero)
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Well, those of us who have worked with databases and in particular SQL, have an idea which kind of queries are essential, useful and nice to have if you want to pretend it is a real database. However, I don't expect even the dedicated database programs for VIC/64 or even Amiga always have as much functionality.
Anders Carlsson

Image Image Image Image Image
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Wasn't there a DBase version for the C=64? I have some vague memories about that, but it also might be an error on my side...

Björg

PS: Wouldn't it be enough to save "@file",8? "0:" is only for drive number in dual disk drives. And wasn't there an error with the scratch and save function with "@"? I remember reading about this and that it won't work...
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

carlsson wrote:Well, those of us who have worked with databases and in particular SQL, have an idea which kind of queries are essential, useful and nice to have if you want to pretend it is a real database. However, I don't expect even the dedicated database programs for VIC/64 or even Amiga always have as much functionality.
Now, I think you are being silly. Instead of admiting that my idea was a rater good one, you argue over what the word "database" means, as if that would be your own property... Like if Basic 2.0 wouldn't be a programming language just because there are more advanced programming languages today... Well, let's say my idea is a register or a record keeper instead then. Does that make you happy? :roll:
carlsson wrote:SELECT COUNT(id) FROM databaseic WHERE title LIKE "%gold%"
Well, it's just to use this very simple databaseic command:

open 1,8,1,"file"
cmd 1
find "gold"
print#1
close 1

1000 open1,8,0,"file"
1010 get#1,a$:if st<>0then close 1: print x : end
1020 if a$=chr$(13) then x=x+1
1030 goto 1010
goto1000

...or you could use this amiga program:
http://user.tninet.se/~hlw771b/sel_count.html

and use:
count FILE file TEXT ASCII 13


...As if it would be likely that you wouldn't be able to count the records yourself as they appear on the screen with the amount of data (I couldn't say database could I) that would fit into the memory of a vic-20 or c64...

(Btw, I have used SQL too, and I still think you are being silly!)

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
CurtisP
Vic 20 Dabbler
Posts: 99
Joined: Tue Mar 08, 2005 8:24 pm

Post by CurtisP »

Schlowski wrote:Wasn't there a DBase version for the C=64? I have Wouldn't it be enough to save "@file",8? "0:" is only for drive number in dual disk drives. And wasn't there an error with the scratch and save function with "@"? I remember reading about this and that it won't work...
There is a bug with the @ command on the 1541, due to the DOS being a patched version of a two drive DOS. By always using @0: you prevent this bug from ocurring.
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Good to know, thanks for pointing out this one! I was always a little bit afraid of this bug and used to use new filenames and eventually scratch the unused older ones...

Björg
Post Reply