• Print

Author Topic: QBDbase v1.4  (Read 2214 times)

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
QBDbase v1.4
« on: October 01, 2012, 12:00:27 PM »
My little version of a data manager for QB64.

File is here, and I'll use an extra post or two after this to illustrate how to use it.  It's not complicated.  (Or I tried to not make it complicated.)  ;)

The download includes the following in the DataLibrary.rar file:

airport.txt -- text file to use with CSV2QBD for demo purposes.  I've proofed the formatting, so it shouldn't error out anywhere.
CSV2QBD (bas) -- program to import CSV text files automatically to QBD format.
DataLibraryH.BI and DataLibraryF.BM -- the include library which you insert an '$INCLUDE: link to in your code for all our subs and functions to work.
MakeQBD (bas) -- program to quickly make a database and get it up and running for QB64.
Password.bas -- an example encryption/decryption routine for your code.
QBDbase Library Guide and Tutorial.docx -- the documentation of how and what everything is.  Has information on internal routines, functions, variables and all.  Much more detailed than what is posted on the boards here, and is set up for easy formatting in any program capable of working with Word 2010 documents.

Read the included Guide and Tutorial, or the few posts here to help explain how to use it all, as well.  :)

v1.4 has now added several new database type fields for us:  QBDdate, QBDtime, QBDheight, QBDweight, and Custom Sub-type support.

* also added a new command (aren't we getting a lot of those?) -- ClearTypeMem

ClearTypeMem clears our TypeMem variable and resets it back to a blank state.  Details over on page 8.  :)
« Last Edit: October 31, 2012, 10:13:40 PM by SMcNeill »
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #1 on: October 01, 2012, 12:33:19 PM »
For starters, how to make a database:

First, start QB64.    (Phew!  The hard part is done!) ;)

Then tell QB64 to work with our  data library.

Code: [Select]
'$Include:'DataLibraryH.bi'



'$Include:'DataLibraryF.bm'

Now, if you notice, you've already did something wrong!  It's giving an error!  Go give up programming, and become a farmer...

Just kidding!  ;)

It's supposed to be like that.    What it's wanting from you now is for you to give it your custom password encryption routines.

Either copy the Password.bas and insert the code there in between the 2 includes, or else copy this set of code for now:
Code: [Select]
SUB DeCryptPassword (password$)

END SUB

SUB EnCryptPassword (password$)

END SUB

It should now say OK down at the Status prompt.   Congratulations, you've now added the code to your own program!

Wasn't that hard? 
« Last Edit: November 04, 2012, 08:04:54 AM by SMcNeill »
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #2 on: October 01, 2012, 12:45:10 PM »
Now an introduction to some important things:

First, YOUR data type.   Go ahead and make one.  Name it anything you want, and put the elements you want in it.   This goes between '$INCLUDE:'DataLibraryH.bi'   and Sub EncryptPassword  (or DeCryptPassword if you placed it first).

For mine, I'll just use something simple:

Code: [Select]
TYPE MyType
    Name AS STRING * 20
    Age AS _UNSIGNED _BYTE
    Sex AS STRING * 1
END TYPE

Got yours?   Does it look similar?   Good, but it won't work.   :(

There's one important thing that ALL QBD databases need to have -- a byte reserved for a delete code.  Go in and right below the TYPE add (whatever name you want) AS _BYTE.

It should now look like:
Code: [Select]
TYPE MyType
    Invalid AS _BYTE
    Name AS STRING * 20
    Age AS _UNSIGNED _BYTE
    Sex AS STRING * 1
END TYPE

Congratulations, you've now defined your data structure.  Now Dim a variable to work as your type.   Just be certain to dim it SHARED so this variable will be available to you for any subs you might call later.

Code: [Select]
DIM SHARED MyData AS MyType

Your code should now look like the following, more or less:
Code: [Select]
'$Include:'DataLibraryH.bi'

TYPE MyType
    Invalid AS _BYTE
    Name AS STRING * 20
    Age AS _UNSIGNED _BYTE
    Sex AS STRING * 1
END TYPE
DIM SHARED MyData AS MyType


SUB DeCryptPassword (password$)
END SUB

SUB EnCryptPassword (password$)
END SUB

'$Include:'DataLibraryF.bm'

You've now set up QB64 to work with your code, and now defined your data.  You're almost done.  :)
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #3 on: October 01, 2012, 01:05:09 PM »
Now let's tell our Library Subs where the data is, OK?

Code: [Select]
TypeMem(1) = _MEM(Mydata) 

Typemem is an array our subs use.  It HAS to be in here for our program to work.  It's what tells our subs which section of memory to use for our custom data type.   Start with #1, and increase the number (up to 100), if you need to add more than 1 database to a program.   For now, let's just use the 1.

Now, since we're making a database for the first time, we need to tell the program what types of data we're using, and how long they are.  YOU have the information with the TYPE MyType, but the subroutines need to be told what you have.

Dim an array to the number of elements in your TYPE.   (Start counting at ZERO.)   For MyType, there's 3 of them.   We're going to tell the program how many there are, what type they are, and how long they are (if needed).

Code: [Select]
Dim AnyArray(3) AS DataStructure
AnyArray(1).DT = "C": AnyArray(1).DL = 20
AnyArray(2).DT = "UB"
AnyArray(3).DT = "C": AnyArray(3).DL = 1

DataStructure is a reserved type, and it's what we have to dim our array as.  Don't worry about that 0 element I told you to add to your type -- the program automatically assumes it's in there.   In fact, it'll fuss at you if you DO include it.

DT is our type of Data.    (Integer, Byte, Single)   DL is the length of our Data.

All of our DT codes can be gotten by simply taking the first letter of our type and using it, with the exception of STRINGs and Integer64.  S is the code for single, so C is the code for our Characters (Strings).  I is Integer, so 6 is the code for Integer 64.

B = _BYTE
I = INTEGER
L = LONG
6 = INTEGER 64
S = SINGLE
D = DOUBLE
F = FLOAT
O = OFFSET
M = MEM  (Doubt this one will get much use, as I have no clue how a dbase would use it.  It's here if needed though, and someone is more creative than me.
C = CHARACTER (STRING)
U = UNSIGNED (Add U in front of the previous examples to make a type unsigned.  UI = unsigned integer, U6 = unsigned integer 64...)


Think about it for just a little bit, and you'll see how easy it is to understand and use the system.   

Plug in what you need to work with your type you made earlier.   I'll wait.

_DELAY 5

Took you long enough!!

Now, let's make that database!!

(Optional)Set the max limit to the number of files you want. 
Give it a file.  Give it a password.   Make it!

Code: [Select]
QBDMaxRecords = 1000   'QBD normally reserves a VERY large limit for us, so if we want something smaller it'll save memory usage
file$ = "MyFile.QBD"
password$ = ""   ' I don't need no stinking password!
MakeQBDbase AnyArray(), password$, file$

QBDMaxRecords is the name of a global variable which we use to pass along the limit when we make our database.  If set to 0, we make a database with a very large initial limit.  (I'd have to check again, but I think it's 100,000 records as the starting limit.)   Reduce the number here to conserve memory if you know your database won't have that many entries.   (Like say an address book with a 100 person limit.)

Run it.   Congratulations, you just made a QBD database!!

Run it again.    It even comes with  it own pop-up!
« Last Edit: October 06, 2012, 08:42:54 AM by SMcNeill »
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #4 on: October 01, 2012, 01:21:42 PM »
Now let's DO something with that database.

First, let's go in and clear out all the junk we used to make it.   It's made -- we have the file structure we want.  No need to keep re-making it over and over....

Delete the data array, password, and  MakeQBDbase command.   What you have now should look like the following:

Code: [Select]
'$Include:'DataLibraryH.bi'

TYPE MyType
    Invalid AS _BYTE
    Name AS STRING * 20
    Age AS _UNSIGNED _BYTE
    Sex AS STRING * 1
END TYPE
DIM SHARED MyData AS MyType
TypeMem(1) = _MEM(Mydata) 
file$ = "MyFile.QBD"


SUB DeCryptPassword (password$)
END SUB

SUB EnCryptPassword (password$)
END SUB

'$Include:'DataLibraryF.bm'

For starters, let's open the database for use.  We're going to give it a variable, and it's going to give us a reference number to access our database.   Think of it like f = FREEFILE:  Open file$ for input as #f...

Code: [Select]
x = OpenData(file$, 1)

Notice, file$ is the name of our database on the hard drive.  The 1 is the reference to what we used back with TypeMem.   (Remember TypeMem(1)?  If this was our second database, we'd use :  y = OpenData(file$,2) )


Now, let's add some data to our QBD file.

Code: [Select]
MyData.Name = "Bob"
MyData.Age = 12
MyData.Sex = "M"
Writedata x, 0
MyData.Name = "Sue"
MyData.Age = 16
MyData.Sex = "F"
Writedata x, 0
MyData.Name = "Agatha"
MyData.Age = 22
MyData.Sex = "F"
Writedata x, 0

Notice the structure of WriteData.    It writes our variable  (MyData in this case), to the file number we want to put it at.   filenumber 0 is an automatic addition to the end of our records...   So we just wrote 3 data entries into our database.   Wasn't that simple??
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #5 on: October 01, 2012, 01:28:04 PM »
Let's now get that data back from memory.   Care to guess how we do that?

ReadData!

Code: [Select]
FOR i = 1 to 3
    ReadData x, i
    PRINT i;")"; MyData.Name, MyData.Age, MyData.Sex
NEXT

FOR i = 3 to 1 STEP -1
    ReadData x, i
    PRINT i;")"; MyData.Name, MyData.Age, MyData.Sex
NEXT

We read data from the database our variable refrences (x), and we read the filenumber we specify.

Easy.  :)
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #6 on: October 01, 2012, 01:31:39 PM »
Now let's do something even better.  Let's delete some data!   DeleteData is our friend here.

Code: [Select]
DeleteData x, 2

That's it!    We just told record #2 that it's been deleted.   PHEW, that was hard!

Want proof?   Read it and print the results again.

Code: [Select]
FOR i = 1 to 3
    ReadData x, i
    PRINT i;")"; MyData.Name, MyData.Age, MyData.Sex
NEXT

What's record #2 look like??   :D
« Last Edit: October 01, 2012, 03:20:30 PM by SMcNeill »
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #7 on: October 01, 2012, 01:41:57 PM »
Now, if we wanted to bring it back, how do you think we'd do that?

Code: [Select]
UnDeleteData x, 2

Read it, print it, see for yourself. 

Now, isn't that neat and EASY?

**************************

Want to do something hard?   How about sorting our data?   It's got to be difficult.  Right?

Wrong!

Code: [Select]
SortData x, 1, 0
There ya go!   We just sorted by name.   Read it, Print it.  Check it out for yourself. ;)

SortData needs 3 things from us.   The database, the element, and the sort method.

I told it to sort database x, element 1 (name), by ascending alphabit.

We can sort by 4 different sort methods. (EDIT:  2 new modes added, for a total of 6 ways.)
0 -- alphabet, ascending
1 -- alphabet, descending
2 -- number, ascending
3 -- number descending
5 -- alphabet, ascending, non-case sensitive
6 -- alphabet, descending, non-case sensitive

So it's SortData (database reference #), element  (LOOK AT YOUR TYPE.  START COUNTING AT ZERO.), method

So...   Sortdata x, 1, 2    would list name in a descending alphabetical order...
Sortdata x,2,3   would list age in a descending numerical order...
Sortdata x,3,1  would sort by sex in ascending order...


Play around some.  See how complicated it is?  ;)
« Last Edit: November 01, 2012, 07:16:26 AM by SMcNeill »
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #8 on: October 01, 2012, 01:44:21 PM »
Now that we've played around a bit with the basics, lets take a break and explain a few expanded concepts later.

For now, don't forget to close your database to put the data back down from memory to your hard drive.

Code: [Select]
CloseData x


****************


Hasn't it all been terribly difficult to learn, use, and work with so far?
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

Galleon

  • Administrator
  • Hero Member
  • *****
  • Posts: 4664
  • QB Forever
    • Email
Re: QBDbase v1.0
« Reply #9 on: October 01, 2012, 05:18:10 PM »
Great explanation! I will be sure to try this out soon. Assuming there are no serious bugs I'm sure that in time this will become the QB64 standalone replacement to MySQL, because not everyone wants to ship MySQL with their program.
Something old... Something new... Something borrowed... Something blue...

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #10 on: October 01, 2012, 05:48:59 PM »
Quote from: Galleon on October 01, 2012, 05:18:10 PM
Great explanation! I will be sure to try this out soon. Assuming there are no serious bugs I'm sure that in time this will become the QB64 standalone replacement to MySQL, because not everyone wants to ship MySQL with their program.

Thank you.  :)   I'm much better at writing code than I am at explaining it and documenting it.  Now that I've had a break for some family time, and had supper with the wife and daughter, let me see if I can get some of the other features explained.  :)

*******************************

THESE ARE ALL OPTIONAL THINGS YOU CAN DO, AND ARE IN NO WAY NECESSARY FOR USE.

*******************************

Remember when we got that error at the beginning, right after we put the 2 includes into our program?   Waaaay back, in step 1, even before we'd made our database successfully....

It errored out, because it was looking for 2 routines which I didn't package inside the library.   EnCryptPassword and DeCryptPassword.  Well what the heck are those, and why did we toss blank subs into our program??

Good questions!

EncryptPassword and DeCryptPassword are only used IF we decide to use a password, and IF we set a global variable  (QBDEncrypted) to true, before we issue the MakeQBDbase command.

SO, if QBDEncrypted is true, and password is not blank, then we call the EncryptPassword routine before we write our password to disk.

The actual code, inside the DataLibraryF.BM is this one:
Code: [Select]
IF LTRIM$(Password) <> "" AND QBDEncrypted THEN CALL EncryptPassword(Password) and
Code: [Select]
IF QBDEncrypted THEN CALL DeCryptPassword(H.password)
If you never want to encrypt your password, go into the DataLibraryF.BM file and remark out those lines, and you won't even have to put the subs into your code.

"Well that's all well and good, but what the heck does it do?" 

Simple:  It let's each user write their own little routines to jumble up the file password however they want.   The Password.Bas file I put up is an example of  an encryption/decryption method.

Say the password for your file is "Password".   Now, you worked hard to come up with a name like that.  You don't want someone to use Notepad, open your file, and then see "Password"  written there plain as day do you??

Of course not!   So you write an EncryptPassword routine (think like a cryptoquote:  A = Z, B = T: C = M).   Then you set QBDEncrypted = 1 (or -1, or anything but 0 which is default uncrypted.)   Then when you make your QBD database, it won't read "Password" if someone snoops in the file.  It'll read "Dxffiert"...

Of course, if you make an EncryptPassword routine to encrypt it, you'll need to make the DeCryptPassword routine as well.   (So that it'll retranslate it back from Z = A, T = B, M = C.... and so on.)

The 2 routines I provided do a very simple encryption.   They don't print the ASC values of our password.   They print 255 - ASC values for our password.   And then unscramble them as needed....

So to recap:

Code: [Select]
QBDEncrypted = -1
MakeQBDbase  Array(), "password", file$

Sub EncryptPassword
.... your stuff here, so it doesn't have to be the same as someone elses
End Sub

Sub DeCryptPassword
....  your stuff here to decode the secret decoder ring message
End Sub
« Last Edit: October 02, 2012, 06:03:11 AM by SMcNeill »
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #11 on: October 01, 2012, 06:08:38 PM »
Another command that I've got up and going, which people might find very useful is ExportData.

What use is a database that keeps data in a format that you can't use anywhere else??  It'd be junk in my opinion...   

But, never fear!!   ExportData is here!

ExportData is another one of those amazingly complicated processes.  It takes a lot of prep work to set it up to work properly, so pay attention:

Code: [Select]
ExportData x, 1, file$

PHEW!!  I never thought I'd be able to show an example of that...   ;)

The format is very simple:
ExportData   DatabaseReference#, ExportMode, ExportFile$

If you haven't gotten used to the idea by now, the DatabaseReference# is what we got when we used the variable = OpenData...  back in the beginning of our program.  It's the same one we've used for everything else...

'ExportModes are:
'0) QBD file.  Use this to write our data to disk without closing the program.
'1) CSV file using WRITE/INPUT style format (*.txt)
'2) CSV file using WRITE/LINE INPUT style format (*.txt)
'3) CSV file using PRINT/INPUT style format   (*.txt)
'4) CSV file using PRINT/LINE INPUT style format   (*.txt)
'5) Export data and type for RANDOM/BINARY GET/PUT access, with a QB64 TYPE code for quick insertion into other programs. (*.bin)
'6) Export data into Dbase format data  (*.dbf)  --- TO BE ADDED LATER
'7) Export data to a user defined format --- TO BE ADDED LATER

file$ is the name and path of what we want to export.

Play around with it.   See for yourself the different examples of how it'll spit out your data.   Surely one of those methods will work with whatever other program you have that you want to import things back into.

Method 0 is what we'd use to manually save our database.    Remember, QBDbase **ONLY** accesses our datafile once when we open it, and once when we close it.  That's it.   Add the adding of files, deleteing files, sorting files.... everything else is done from memory!!

So be WARNED:  Leaving a database open for 3 months, then losing power, means you lost all your work!!    Unless of course, you made certain to use Method 0 to write the data back to the disk when you wanted to.   Set it up as an auto-save if you want...

ExportData -- it's for more than just converting your QBD file into something else.  It's your buddy.  ;)
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

TerryRitchie

  • Hero Member
  • *****
  • Posts: 2264
  • FORMAT C:\ /Q /U /AUTOTEST (How to repair Win8)
    • Email
Re: QBDbase v1.0
« Reply #12 on: October 01, 2012, 06:11:37 PM »
Excellent! Thank you for this!

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #13 on: October 01, 2012, 06:22:10 PM »
Now DeleteData is all well and good, but if you use it a lot, you'll end up with a lot of files just sitting there and taking up space.  Isn't that a bummer?

Not at all!   We have a solution for that:  PackData.

Same complicated usage we've grown to hate:
Code: [Select]
PackData x
This will take our database, and simply pack it down to get rid of all those deleted records.   NOTE:  Think of this like the Recycle Bin on your computer.  Once deleted from there, the records are gone for good!

**********************************

Another alternative to DeleteData is our ResetData command.

DeleteData sets the flag to say the record is gone (but it's not -- at least not until it's packed).   ResetData simply takes the record we want, and replaces all the fields in it with blank ones.   It's not deleted -- there's no way to undelete it -- it's just a BLANK record.

Code: [Select]
ResetData x,2
Usage is simple:   ResetData  DatabaseReference#, record#.

You can use this if there's something sensitive that you need to get rid of from the database immediately, but don't want to be bothered packing it.

Think of the difference of the two like this:

Data(1) = 1
Data(2) = 2
Data(3) = 3

DeleteData x, 2, and you have
Data(1) = 1
Data(2) = 0
Data(3) = 3

UndeleteData x, 2, and it's back to:
Data(1) = 1
Data(2) = 2
Data(3) = 3

DeleteData x, 2  and then PackData x and you have:
Data(1) = 1
Data(2) = 3

***************

Now instead, if we do the same with ResetData:

Data(1) = 1
Data(2) = 2
Data(3) = 3

ResetData x, 2, and you have
Data(1) = 1
Data(2) = 0
Data(3) = 3

UndeleteData x, 2, and it's back to:
Data(1) = 1
Data(2) = 0
Data(3) = 3

ResetData x, 2  and then PackData x and you have:
Data(1) = 1
Data(2) = 0
Data(3) = 3

****************

See the difference in the 2 behaviors?    DeleteData sets a flag saying the data is ready for deletion and to not use it.   ResetData says the data is fine, use it all you want, but it's blank...
« Last Edit: October 02, 2012, 06:09:04 AM by SMcNeill »
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

SMcNeill

  • Hero Member
  • *****
  • Posts: 2414
    • Email
Re: QBDbase v1.0
« Reply #14 on: October 01, 2012, 06:36:39 PM »
**************************
*
*          External Programs!!
*
**************************

Phew!  I think that covers what our QBDbase can do, and I hope everyone can follow the walk-thru.  If not, let me know and I'll do what I can to explain better and answer any questions.  :)

Now to go over a few of our external programs.   (I hope you noticed them in the RAR file I uploaded.)

MakeQBD.exe and MakeQBD.bas   --- this is a stripped down version of our database routines, and all it does is simply MAKE the database.   Best way to explain it is just to say try it.

NOTE:  It doesn't support EncryptPassword or DeCryptPassword.   Those are routines you should write for yourself before you make the database, and this simply wouldn't have your code in it.  Ergo, no password encryption by default.   Password protection, YES.   Password encryption, NO.

I think it turned out to be an intuitively simple program to use, and it's nice enough to not just make you a QBD database, but to also spit out the QB64 CODE you'll need to run it.  Honest!  It does.  It writes half your program for you!  ;)

*******************

The other file is a CSV2QBD program which still needs some debugging and tinkering.  What it does is try to auto-read a comma-separated file and then convert it over to QBDbase and QB64 CODE.  If your file has a Header, it works lovely.   If not --- well, I'd suggest opening the file in Notepad and giving it one.

For example, say this is your data:
"Joe", 18, "M", "Sue", 22, "F", .... (and so on)

Open notepad and add a line to the top for the header:
"Name", "Age", "Sex"
"Joe", 18, "M", "Sue", 22, "F", .... (and so on)
Then save it (with another name if you want), and import it.

Trust me:  CSV2QBD works much, much better if it has a header to help identify things with.   :)
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.
http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.

http://bit.ly/DataToDrive - A set of routines to quickly and easily get data to and from the disk.  BI and BM files

  • Print