Here is the way to perform the first three step:
% eyedboql -U bill -P {bill password, i.e. 'thekid'} -d foo -w
Welcome to eyedboql.
Type `\help' to display the command list.
Type `\copyright' to display the copyright.
? john := Person(firstname : "john", lastname : "wayne", age : 72);
46382.3.1979263:oid
? mary := Person(firstname : "mary", lastname : "poppins", age : 68);
46386.3.643071:oid
? john.spouse := mary;
46386.3.643071:oid
As you see, this is a very intuitive way to perform such operations.
A few comments: - ? is the eyedboql prompt: of course, do not type this string! - := is the affectation operator. - each time you create an object, its identifier (oid) is displayed on your terminal. - because of the relationship integrity constraint on the spouse attribute, the operation john.spouse := mary is equivalent to mary.spouse := john.
To create the three ``john wayne'' children:
? add Person(firstname : "baby1", age : 2) to john->children; 46390.3.3985535:oid ? add Person(firstname : "baby2", age : 3) to john->children; 46394.3.360831:oid ? add Person(firstname : "baby3", age : 4) to john->children; 46398.3.1380607:oidOnce again, this is very intuitive and simple.
To query all persons in the database:
? select Person; = bag(2580.2.955941:oid, 2576.2.881020:oid, 2578.2.821166:oid, 2588.2.382585:oid, 2586.2.500653:oid)To query all persons whose firstname is ``john'':
? select Person.firstname = "john";
= bag(2576.2.881020:oid)
? \print
Person {2576.2.881020:oid} = {
firstname = "john";
lastname = "wayne";
age = 72;
addr Address = {
num = NULL;
street = NULL;
town = NULL;
country = NULL;
};
*spouse = {2578.2.821166:oid};
children set<Person*> = set {
name = "";
count = 3;
};
};
Note that the !print command allows to display the contains of the
last objects returned on your terminal.
To query all persons whose firstname contains a y:
? select Person.firstname ~ "y"; = bag(2580.2.955941:oid, 2578.2.821166:oid, 2588.2.382585:oid, 2586.2.500653:oid)
At this stage, it is interesting to perform the following operation: in another terminal opens an eyedboql session on the database foo and query all persons, as follows:
% eyedboql -U bill -P {bill password, i.e. 'thekid'} -d foo -w
? select Person;
= bag()
It will perharps surprise you that no person instances will be returned.
But this is quite normal as you have not committed the transaction in your first eyedboql session.
To commit the transaction, type !commit in your first eyedboql session:
? \commitif you query once more the person instances in your second eyedboql session, the five person instances will be returned.