- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::db::Class
::xo::db::Class create ... \
[ -abstract_p (default "f") ] \
[ -auto_save (default "false") ] \
[ -id_column id_column ] \
[ -name_method (default "") ] \
[ -object_type (default "[self]") ] \
[ -pretty_name pretty_name ] \
[ -pretty_plural pretty_plural ] \
[ -security_inherit_p (default "t") ] \
[ -sql_package_name sql_package_name ] \
[ -supertype (default "acs_object") ] \
[ -table_name table_name ] \
[ -with_table (default "true") ]
Defined in
Class Relations
Methods (to be applied on the object)
class_to_object_type (scripted)
xo::db::Class class_to_object_type
- Testcases:
- xotcl_core_tutorial_2, xotcl-core
delete (scripted, public)
xo::db::Class delete -id idDelete the object from the database
- Switches:
- -id (required)
- Testcases:
- xotcl_core_tutorial_2
delete_all_acs_objects (scripted, public)
xo::db::Class delete_all_acs_objects -object_type object_typeDelete all acs_objects of the object_type from the database.
- Switches:
- -object_type (required)
- Testcases:
- No testcase defined.
drop_type (scripted, public)
xo::db::Class drop_type -object_type object_type \ [ -drop_table drop_table ] [ -cascade_p cascade_p ]Drop the object_type from the database and drop optionally the table. This method deletes as well all acs_objects of the object_type from the database.
- Switches:
- -object_type (required)
- -drop_table (optional, defaults to
"f"
)- -cascade_p (optional, defaults to
"t"
)- Testcases:
- No testcase defined.
exists_in_db (scripted, public)
xo::db::Class exists_in_db -id idCheck, if an acs_object exists in the database.
- Switches:
- -id (required)
- Returns:
- 0 or 1
- Testcases:
- xotcl_core_tutorial_1, xotcl_core_tutorial_2, xotcl_core_tutorial_4, test_xo_db_object, test_cr_items
get_class_from_db (scripted, public)
xo::db::Class get_class_from_db [ -object_type object_type ]Fetch an acs_object_type from the database and create an XOTcl class from this information.
- Switches:
- -object_type (optional)
- Returns:
- class name of the created XOTcl class
- Testcases:
- xotcl_core_tutorial_3
get_instance_from_db (scripted, public)
xo::db::Class get_instance_from_db -id idCreate an XOTcl object from an acs_object_id. This method determines the type and initializes the object from the information stored in the database. The XOTcl object is destroyed automatically on cleanup (end of a connection request).
- Switches:
- -id (required, integer)
- Returns:
- fully qualified object
- Testcases:
- xotcl_core_tutorial_1, xotcl_core_tutorial_2, test_xo_db_object
get_object_type (scripted, public)
xo::db::Class get_object_type -id idReturn the object type for the give id.
- Switches:
- -id (required, integer)
- Returns:
- object_type, typically an XOTcl class
- Testcases:
- xotcl_core_tutorial_1, xotcl_core_tutorial_2
get_table_name (scripted, public)
xo::db::Class get_table_name -object_type object_typeGet the table_name of an object_type from the database. If the object_type does not exist, the return value is empty.
- Switches:
- -object_type (required)
- Returns:
- table_name
- Testcases:
- xotcl_core_tutorial_2
object_type_exists_in_db (scripted, public)
xo::db::Class object_type_exists_in_db [ -object_type object_type ]Check, if an object_type exists in the database.
- Switches:
- -object_type (optional)
- Returns:
- 0 or 1
- Testcases:
- xotcl_core_tutorial_2, xotcl_core_tutorial_4
object_type_to_class (scripted)
xo::db::Class object_type_to_classMethods (to be applied on instances)
check_table_atts (scripted, public)
<instance of xo::db::Class> check_table_attsCheck table_name and id_column and set meaningful defaults, if these attributes are not provided.
create_object_type (scripted, public)
<instance of xo::db::Class> create_object_typeCreate an acs object_type for the current XOTcl class
- Testcases:
- xotcl_core_tutorial_2
drop_object_type (scripted, public)
<instance of xo::db::Class> drop_object_type \ [ -cascade cascade ]Drop an acs object_type; cascde true means that the attributes are dropped as well.
- Switches:
- -cascade (optional, defaults to
"true"
)- Testcases:
- No testcase defined.
get_instances_from_db (scripted, public)
<instance of xo::db::Class> get_instances_from_db \ [ -select_attributes select_attributes ] \ [ -from_clause from_clause ] [ -where_clause where_clause ] \ [ -orderby orderby ] [ -page_size page_size ] \ [ -page_number page_number ] [ -initialize initialize ]Returns a set (ordered composite) of the answer tuples of an 'instance_select_query' with the same attributes. Note that the returned objects might by partially instantiated.
- Switches:
- -select_attributes (optional)
- -from_clause (optional)
- -where_clause (optional)
- -orderby (optional)
- -page_size (optional, defaults to
"20"
)- -page_number (optional)
- -initialize (optional, defaults to
"true"
)- Returns:
- ordered composite
- Testcases:
- No testcase defined.
instance_select_query (scripted, public)
<instance of xo::db::Class> instance_select_query \ [ -select_attributes select_attributes ] [ -orderby orderby ] \ [ -where_clause where_clause ] [ -from_clause from_clause ] \ [ -count on|off ] [ -page_size page_size ] \ [ -page_number page_number ]Returns the SQL-query to select ACS Objects of the object_type of the class.
- Switches:
- -select_attributes (optional)
- attributes for the SQL query to be retrieved. if no attributes are specified, all attributes are retrieved.
- -orderby (optional)
- for ordering the solution set
- -where_clause (optional)
- clause for restricting the answer set
- -from_clause (optional)
- -count (optional, boolean, defaults to
"false"
)- return the query for counting the solutions
- -page_size (optional, defaults to
"20"
)- -page_number (optional)
- Returns:
- SQL query
- Testcases:
- No testcase defined.
instantiate_objects (scripted, public)
<instance of xo::db::Class> instantiate_objects [ -dbn dbn ] \ [ -sql sql ] [ -full_statement_name full_statement_name ] \ [ -as_ordered_composite on|off ] [ -object_class object_class ] \ [ -named_objects on|off ] \ [ -object_named_after object_named_after ] \ [ -destroy_on_cleanup on|off ] [ -keep_existing_objects on|off ] \ [ -ignore_missing_package_ids on|off ] [ -initialize initialize ]Retrieve multiple objects from the database using the given SQL query and create XOTcl objects from the tuples.
- Switches:
- -dbn (optional)
- -sql (optional)
- The SQL query to retrieve tuples. Note that if the SQL query only returns a restricted set of attributes, the objects will be only partially instantiated.
- -full_statement_name (optional)
- -as_ordered_composite (optional, boolean, defaults to
"true"
)- return an ordered composite object preserving the order. If the flag is false, one has to use "info instances" to access the resulted objects.
- -object_class (optional, defaults to
"::xotcl::Object"
)- specifies the XOTcl class, for which instances are created.
- -named_objects (optional, boolean, defaults to
"false"
)- If this flag is true, the value of the id_column is used for the name of the created objects (object will be named e.g. ::13738). Otherwise, objects are created with the XOTcl "new" method to avoid object name clashes.
- -object_named_after (optional)
- -destroy_on_cleanup (optional, boolean, defaults to
"true"
)- If this flag is true, the objects (and ordered composite) will be automatically destroyed on cleanup (typically after the request was processed).
- -keep_existing_objects (optional, boolean, defaults to
"false"
)- -ignore_missing_package_ids (optional, boolean, defaults to
"false"
)- -initialize (optional, defaults to
"true"
)- can be used to avoid full initialization, when a large series of objects is loaded. Per default, these objects are initialized via initialize_loaded_object, when the are of type ::xo::db::Object
- Testcases:
- xowiki_test_cases
new_persistent_object (scripted, public)
<instance of xo::db::Class> new_persistent_object \ [ -package_id package_id ] [ -creation_user creation_user ] \ [ -creation_ip creation_ip ] args [ args... ]Create a new instance of the given class, configure it with the given arguments and insert it into the database. The XOTcl object is destroyed automatically on cleanup (end of a connection request).
- Switches:
- -package_id (optional)
- -creation_user (optional)
- -creation_ip (optional)
- Parameters:
- args (required)
- Returns:
- fully qualified object
- Testcases:
- xotcl_core_tutorial_1, xotcl_core_tutorial_2
object_types (scripted, public)
<instance of xo::db::Class> object_types \ [ -subtypes_first on|off ]Return the type and subtypes of the class, on which the method is called. If subtypes_first is specified, the subtypes are returned first.
- Switches:
- -subtypes_first (optional, boolean, defaults to
"false"
)- Returns:
- list of object_types
- Testcases:
- xotcl_core_tutorial_2, xotcl_core_tutorial_4
Variables
::xo::db::Class set __default_metaclass ::xotcl::Class ::xo::db::Class set __default_superclass ::xotcl::Object ::xo::db::Class array set exclude_attribute {persons,bio 1 persons,bio_mime_type 1}
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables