- TCL/TK ver. 8.3 or hight
- Metakit <www.equi4.com>
- Itcl <dev.scriptics.com> ( or activetcl <www.activestate.com> )
View :
db.data
db.data properties :
id | Store objects names.
The name needs be structured in the format : - Id is unique. - name is alpha-numeric ( no spaces ). |
title | Store a short title. |
details | Store details about the id. |
validate | Store a procedure that will validate data linked to
id.
Use this to validate the values that will be stored in the value property. |
default | Store a script ( procedure ) to eval a default value
Default values are applied in children paths. |
format | Store a variable that represents the value format.
The db uses a Built-in namespace called dbVars to store variables. If variables don't exists, then a error is generate. Before the value is stored, the system evaluate and format it. |
value | Store the object's value. |
db.data sub-views :
flag - Store flags that will be evaluate when
objects are created, accessed, etc.
Flag properties :
attrib | Store attrib's description.
The built-in attribes : Read, Scan, Delete, Rename, Move Usable, Lock and Folder. |
flag | Store flag for handle object's access.
The built-in flags : Read -> Ro ( read only ) / Rw ( read write ) Scan -> Si ( scan inhibit ) / Sc ( scan ) Delete -> Di ( Delete Inhibit ) / De ( delete ) Rename -> Ri ( rename inhibit ) / Re ( rename ) Move -> Mi ( move inhibit ) / Mv ( move ) Usable -> Ui ( use inhibit ) / Us ( usable ) Lock -> Lk ( lock ) / Uk ( unlock ) Folder -> Fo ( is Folder ) / Le ( is Leaf ) |
value | Store a optional value for evaluate thinks about the flag. |
events
- Store events that will be evaluate when
objects are created, accessed, etc.
Events properties :
event | Store the event name
The Built-in events : OnCreateEach event is bind to the procedure dbControl::MainReturn. The default return is 1 ( true ). |
value | Store the procedure that will be evaluate
The default procedure is dbControl::MainReturn. |
First, you need create the database using the procedure dbControl::Create base and then open it with the command mk::file open tag database. Then you create a new object bind it to a tag's database : dbase object tag. The object is used to handle the database. You may create any number of objects. The syntax is : object Method ?args?.
Create a new object with name path and flag Fo ( is Folder ). The path is unique ( no duplicate ) and the father needs exists. The scan, delete, folder and lock flags for the father affect the method. If scan = Si or delete = Di or folder = Le or lock = Lk for the father the Md fail and return null. Else, Md returns path.
See Set method to know about args.
Create | Create a new metakit database with the structure required for the system.
Syntax : dbControl::Create database |
Refresh | Because the metakit database not delete the records into the database
when required, we need refresh the database to remove them. Refresh make
a new copy of the database without the deleted records. The database needs
closed.
syntax : dbControl::Refresh database |
Commit | Commit the data into the database after x milli-seconds. X is controlled by the variable dbVars::saveEach. The default value is 300000. |
MainReturn | It is the default procedure bind to the system events. Return 1 as
the default. The dbase class have a method called EventExec that
call the event procedure. The system call the procedure using the syntax
:
dbControl::MainReturn path event database-tag |
Format | Format evaluate the property value of the object and returns the value
formatted. After the property value is set, the system looks the property
format. The arg format is a variable containing the format string.
Syntax : dbControl::Format format value |
Default | Default evaluate the procedure stored into the property defaultand
returns the value . The system uses this procedure to set the property
value for the children's path.
Syntax : dbControl::Default procedure |
CheckValue | It is used to validate the property value of the path. CheckValue evaluate
the procedure stored into the property validate using value
and return 0 ( false ) or 1 ( true ).
Syntax : dbControl::CheckValue validate value |
SetAtualPath | Set the variable atualpath. |
GetResolvedPath | Resolve the name's path. |
Checkpath | Verify if the path name is correct. |
Findpath | Find the path for 4 ways. |
GetNodefather | Get the node father for the path. |
GetLastname | Get the last name for the path. |
InsertFlags | Set the initial flag for the path. |
GetFlags | Return a list with the flags of the path. |
InsertEvents | Set the initial events for the path. |
Event | Set a event to the path. |
GetEvents | Return a list with the events of the path. |
EventExec | Executes a procedure of a event of the path. |
% package require db
0.1
(tests) 2 % mk::file
open db system.db
db
(tests) 3 % dbase sys
db
sys
(tests) 4 % sys Ls
.users
(tests) 5 % sys Ls users
.users.access
.users.mauro
(tests) 6 % sys Ls users.mauro
.users.mauro.identification
.users.mauro.login .users.mauro.allowAccess
(tests) 7 % sys Cd users.mauro.login
.users.mauro.login
(tests) 8 % sys Ls
.users.mauro.login.alias
sers.mauro.login.pwdLength
.users.mauro.login.pwdChangeAfterLogin
.users.mauro.login.pwdChangeEachDays
.users.mauro.login.pwdDayToChange
.users.mauro.login.pwdNeverExpire .users.mauro.login.pwd
(tests) 9 % sys Set
pwd -value password
.users.mauro.login.pwd
{title {User's password} detail {} validate {} default {} format {} value
password}
(tests)
10 % sys Md .test
.test
(tests)
11 % sys Ls .
.users
.test
(tests)
12 % sys Rd .test
.test
(tests)
13 % sys Ls .
.users