|
-
May 19th, 2014, 11:47 AM
#5
Thread Starter
Frenzied Member
Re: Μ2000 Interpreter with Greek and English commands
I start to write the english version of help (also I do some changes so the same mdb help file with one memo produce two separate views, one for greek and other for english readers). This is about how M2000 has access to DAO system. Maybe an old one, but ypu can do a lot of SQL querys...if you like. At the end I have some words about the language and how works.
1. You can make a database easy
First you must define the name
BASE "mine" ' SECOND TIME DELETE THE DATABASE AND CREATE IT AGAIN
2.You need a table definition
A name for the table and a list of field triplet...name, kind and size
These arte the kinds of fields
BOOLEAN, BYTE, INTEGER, LONG, CURRENCY, SINGLE, DOUBLE, DATEFIELD, BINARY, TEXT, MEMO
' 0 for length means..the database define only (we can do otherway)
TABLE "mine" , "firstTable", "field1", long, 0, "title1", text, 40, "memo1", memo, 0
3. And you can set the order for simple reading DESCEDING or ASCENDING
ORDER "mine", "firstTable", "title1", ascending
You can put as many tables as you wish.
You can put directory and the ".mdb" in the name of base (DAO, old but good database).
The base is pasword protected (no a srtrong one) for a reason...To know if this is "our" base. If isn't "our" base then we can't delete it
You can delete the database using DELETE. This command finds the key and then if is right then delete it. Using this way we don't perform any reading with our password to find that is invalid. We read the password and then we know.
DELETE "mine"
We can read the structure from any BASE, with STRUCTURE command
Use RETRIEVE το get a row of fields (using SQL if you like)
Use RETURN to uddate row with new value
Use APPEND to push new row to any table
Use DELETE to throw a row with a specific value in a specific field
Use VIEW to fill a selection list (a drop down menu, basically) using a "SELECT DISTINCT field1 FROM table1" to get a table for one list
You can COMPRESS the base (to throw deleted rows)
About Language M2000 and how the interpreter can get values and send back to a database
M2000 has a structure as a stack of values (all modules calling other modules in the same stack, but threads and functions has own stack), so when we want a list of data, commands place there the data, and in the top the number of data that follows. So if we have a module and a command for a base retrieve field data, that data fill the stack and module can call an other module, as a routine, without passing "exclusive" parammeters (like in other languages). This cannot be done with functions, but inside function we can call modules, and that modules can use the function stack as own stack.
Stack can hold reference to arrays or variables but for stack these are Strings...Only the READ command knows if that "String" is a reference to a value. Before 6.2 version stack was only a string. Now is a collection of stack items. In version 6 stack became an array of srings. From 6.2 stack is a part of a major class, the Basetask. Our code lives in a standby status. When a block of code must executed, then a Basetask get a copy and do the job. If a thread released from the code, then a new basetask with code copied to it generated and being a member to two things...one is the TaskMaster (with two list, the running threads and the standby) and the other the creator of thread. The rule is...the creator kill the thread at end of his life, if thread is still alive.
In version 7 I change DAO to ADO but without breaking the compatibility with old versions..(I add an EXECUTION command)
Last edited by georgekar; Dec 18th, 2014 at 08:17 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|