6 Quick Reference Manual
This OQL quick reference manual presents consise information about the builtin and library functions and methods, the special variables, and theeyedboqltool. The standard library source code is presented and it provides a quick reference card containing all the language constructs.
sorts the collection of collections according to the
#idxelement of the inner collection
risort(coll, idx) : same as previous function, but perform a reverse sort Collection Miscelleanous Functions
first(coll) : returns the first element of coll car(coll) : returns the first element of coll last(coll) : returns the last element of coll
cdr(coll) : returns all elements ofcollbut the first getn(coll, n) : returns at most n elements of coll count(coll) : returns the count of elements of coll
identical tocoll[!], but less efficient sum(coll) : returns the sum of the numbers of coll avg(coll) : returns the float average of the numberscoll distinct(coll) : eliminates duplicates of coll
flatten(coll) : recursive flattening of coll flatten1(coll) : one level flattening of coll
min(coll) : returns the minimal number of coll max(coll) : returns the maximal number of coll forone(coll, f, data) : if f(e, data)for one elemente
of coll, returnstrue;
otherwise returnsfalse;
forall(coll, f, data) : if f(e, data)for all elemente of coll, returnstrue;
otherwiser returnsfalse;
String Function Functions
tolower(str) : converts (and returns) stringstrinto lowercase toupper(str) : converts (and returns) stringstrinto uppercase tocap(str) : converts the first character and each character following
a of strinto an uppercase strlen(str) : returns the length of str;
same asstr[!], but less efficient substring(str, from, len): returns the sub-string of str
from the #fromto the from+lencharacters;
same asstr[from:from+len]but less efficient Query Functions
delete from(class) : deletes all the instances of a given class get from(class) : gets all the instances of a given class
Useful Functions
assert(cond) : throws an exception iscondis nottrue
assert msg(cond, msg) : throws the exception messagemsgifcondis nottrue interval(from, to) : returns alistcomposed of the number fromfromtoto Native Methods of the Classobject
The native methods of the classobjectallows us to perform a few action such as getting the oid of an instancegetOid(), getting the database of an instancegetDatabase()or converts the instance to its string representationtoString(). For instance, to apply this last method to the firstPersoninstance: first(select Person).toString().
All the native methods of the classobjectare instance methods.
oid getOid() : returns theoidof the object
string toString() : returns the string representation of the object database *getDatabase() : returns thedatabaseinstance of the object void setDatabase(in database *) : changes thedatabaseof the object
void store() : stores the object in the database object *clone() : clones the object; returns the clone
int getCTime() : returns the creation time of the object (seconds from1/1/1970) int getMTime() : returns the last modification time of the object
string getStringCTime() : returns the string representation of the creation time of the object string getStringMTime() : returns the string representation of the creation time of the object bool isRemoved() : returnstrueif the object is removed;falseotherwise
bool isModify() : returnstrueif the object is modified;falseotherwise
Native Methods of the Classconnection
All the native methods of the classconnectionare instance methods. an object obtained using thenewoperator, They can be applied on adatabaseobject that can be either the current connectionoql$db->getConnection()either an object obtained using thenewoperator, for instance: new <> connection().
void open() : opens a new connection with default host and port void open(in string host, in string port): opens a new connection usinghostandport void close() : closes the connection
Native Methods of the Classdatabase
The following methods are the instance methods of the classdatabase: They can be applied on adatabase object that can be eitheroql$dbeither an object obtained using the newoperator, for instance: new <> database(name : "foo").
void open(in connection *conn,
in int mode) : opens a new database using the connection connand the open flag modemode
void open(in connection *conn, in int mode,
in string userauth,
in string passwdauth) : opens a new database using the connectionconn, the open flag modemodeand the authentication userauth/passwdauth
void close() : closes the database
connection *getConnection() : returns the connection tied to the database int getOpenMode() : returns the open flag mode of the database int getVersionNumber() : returns the version number of the database string getVersion() : returns the string version of the database void removeObject(in oid) : removes the object whose oid is given void transactionBegin() : begins a new transaction
void transactionBegin(in string mode): begins a new transaction in modemode void transactionCommit() : commits the current transaction void transactionAbort() : abort the current transaction
bool isInTransaction() : returnstrueif a transaction is in progress;
falseotherwiser
Native Methods of the ClassEyeDB
All the native methods of the classEyeDBare class methods.
string getConfigValue(in string s): returns the string value of the configuration variables int getVersionNumber() : returns theEyeDBcurrent version number
string getVersion() : returns theEyeDBcurrent stringversion string getArchitecture() : returns the architecture of the current server
string getDefaultCompiler() : returns the C++ compiler used to compile the current server