DatabasePropertyRemove
Removes a cached property from the database.
This removes a property that was cached by a call to DatabasePropertyAdd()
DatabasePropertySet
Sets one or more properties from one or more objects.
This sets one or more properties for one or more objects stored in the database.
If an object is checked out then DatabasePropertySet() will fail.
Changed properties will (eventually) be saved to disk. To save them immediately, call DatabaseSave().
Parameter Name
|
Description
|
DatabaseName
|
Name of the database. This cannot contain any spaces, and must be made up of letters, numbers (except the fist character), and underscores.
|
Objects
|
This is either a single object, or a list containing one or more objects.
|
Properties
|
This is either a string representing a public property, or a list containing one or more strings.
A property can also be:
"containedin" - Returns the object this is contained in, or NULL if not contained.
"dataischeckedout" - To see if the object is checked out.
"datadatecreated" - To find the date that the object was created.
"datadatemodified" - To find the date that the object was last modified.
"datadateaccessed" - To find the date that the object was last checked out.
(Note: The dates are returns as the number of days since Jan 1, 2001.)
|
Values
|
The format of values depends upon whether a single object is passed in, or a list of objects, and whether a single property is used or a list of properties.
Single object and single property - This is the value for the property.
Single object and list of properties - This is a list containing the new values, corresponding to the properties. For example: If Properties had ["Name", "Age", "Height"] passed in, this could be ["Mike", "20", "1.9m"]
List of objects and single property - The parameter is a list of the property value for each object. For example: If Objects had [Mike, Fred, George] passed in, with a Property of "Age", then this parameter could be [20, 43, 15].
List of objects and list of properties - This must be a list of lists. The top-level entries all correspond to the object. The secondary list corresponds to the properties. Thus, if Objects was [Mike, Fred, George] and Properties was ["Name", "Age", "Height"], then this could be [["Mike", 20, "1.9m"], ["Fred", 43, "1.8m"], ["George", 15, "1.7m"]]
|
Return value description
|
Returns TRUE if success, FALSE if there's an error (such as one of the objects being checked out).
|
DatabaseQuery
Queries the database for objects meeting the given conditions.
This searches through the database for all objects meeting the given conditions. The objects are returned in a list.
NOTE: The conditions should rely on attributes that are cached in the database (See DatabasePropertyAdd()) since un-cached attributes will be slower.
NOTE: If a property is not cached, and it's a default value for the object, then DatabasePropertyGet() will return Undefined for the value. (Example: If the object is a "cLantern", the default "Weight" for a cLantern is 10, and this lantern's weight is 10, then DatabasePropertyGet() will return Undefined if the property is not cached.) This happens because when an object is saved any properties that are the same as the object's default aren't written out (to save disk space).
Parameter Name
|
Description
|
DatabaseName
|
Name of the database. This cannot contain any spaces, and must be made up of letters, numbers (except the fist character), and underscores.
|
Conditions
|
This defines the condiitons that must be met for an object to be returned. (You could also think of them as a filter.) If this NULL then all objects are returned. Otherwise, it is a list with the following format:
The first element in the conditions list is an operator string indicating what kind of condition is requires. The next parameters depend upon the operators.
For example: {"<", "|Age", 32} will return all entries where the "Age" Property is less than 32. {"containsc", "|Name", "Mike"} will return all objects where the "Name" property contains the text "Mike".
The following operators are supported:
Single operand: 2nd item in the list is either an attribute string or another list.
"-" - Negation.
"~" - Bitwise not.
"!" - Loglical not.
Two operands:
"%" - Modulo.
"<<" - Bitwise left
">>" - Bitwise right
"<" - Less than
"<=" - Less than equals
">" - Greater than
">=" - Greater than equals
"==" - Equality
"!=" - Not equal
"===" - Strict equality
"!==" - Not equal, strict equality
"==c" - Case insentative equals
"!=c" - Case insentative not-equals
"contains" - See if the 2nd item's string is contained in the first item's string.
"containsc" - Case insensative contains.
Any number of operands: Any number of elements.
"*" - Multiplication.
"/" - Division
"+" - Addition
"-" - Subtraction
"&" - Bitwise and
"^" - BItwise xor
"|" - Bitwise or
"&&" - Logical and
"||" - Logical or
The operands (list values other than the first element) can be a value, a property name, or another list of conditions.
Property name - To indicate that a string is the name of a property, as opposed to a string, prefix the property with a '|' character (or whatever is passed into PropDisambig). For example "|Name" refers to the property "Name", while "Name" is just a string.
Sub-conditions - A condition can have sub-conditions. For example: To find all people whose name is "Mike" or "Fred", then pass in ["||", ["==c", "|Name", "Mike"], ["==c", "|Name", "Fred"]].
A property can also be:
"containedin" - Returns the object this is contained in, or NULL if not contained.
"dataischeckedout" - To see if the object is checked out.
"datadatecreated" - To find the date that the object was created.
"datadatemodified" - To find the date that the object was last modified.
"datadateaccessed" - To find the date that the object was last checked out.
(Note: The dates are returns as the number of days since Jan 1, 2001.)
|
PropDisambig
|
This is the character that is placed at the beginning of a string to indicate that the string represents a property. '|' is usually used, but any character is possible.
If 0 is passed in, then all strings are assumed to be properties.
|
Return value description
|
Returns FALSE if there was an error enumerating the objects.
If successful, it returns a list with all the objects (in the database) which pass the conditions.
|
Share with your friends: |