- 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 ... \::xo::db::Class is a meta class for interfacing with acs_object_types. acs_object_types are instances of this meta class. The meta class defines the behavior common to all acs_object_types. The behavior common to all acs_objects is defined by the class ::xo::db::Object.
[ -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 packages/xotcl-core/tcl/05-db-procs.tcl
- See Also:
- xo::db::Object
Class Relations
Methods (to be applied on the object)
class_to_object_type (scripted)
xo::db::Class class_to_object_type
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xotcl_core_tutorial_2, xotcl-core
delete (scripted, public)
xo::db::Class delete -id idDelete the object from the database
- Switches:
- -id
(required)- Partial Call Graph (max 5 caller/called nodes):
- 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)- Partial Call Graph (max 5 caller/called nodes):
- 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
(defaults to"f"
) (optional)- -cascade_p
(defaults to"t"
) (optional)- Partial Call Graph (max 5 caller/called nodes):
- 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
- Partial Call Graph (max 5 caller/called nodes):
- 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
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xotcl_core_tutorial_3
get_instance_from_db (scripted, public)
xo::db::Class get_instance_from_db [ -id id ]Create 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
(optional)- Returns:
- fully qualified object
- Partial Call Graph (max 5 caller/called nodes):
- 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 id ]Return the object type for the give id.
- Switches:
- -id
(optional)- Returns:
- object_type, typically an XOTcl class
- Partial Call Graph (max 5 caller/called nodes):
- 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
- Partial Call Graph (max 5 caller/called nodes):
- 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
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xotcl_core_tutorial_2, xotcl_core_tutorial_4
object_type_to_class (scripted)
xo::db::Class object_type_to_class
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xotcl_core_tutorial_1, xotcl-core, xotcl_core_tutorial_2, test_xo_db_object, test_cr_items, xowiki_test_cases, link_tests, slot_interactions, path_resolve
Methods (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.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xotcl_core_tutorial_2, xotcl_core_tutorial_3, xotcl_core_tutorial_4
create_object_type (scripted, public)
<instance of xo::db::Class> create_object_typeCreate an acs object_type for the current XOTcl class
- Partial Call Graph (max 5 caller/called nodes):
- 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
(defaults to"true"
) (optional)- Partial Call Graph (max 5 caller/called nodes):
- 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
(defaults to"20"
) (optional)- -page_number
(optional)- -initialize
(defaults to"true"
) (optional)- Returns:
- ordered composite
- Partial Call Graph (max 5 caller/called nodes):
- 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
(boolean) (defaults to"false"
) (optional)- return the query for counting the solutions
- -page_size
(defaults to"20"
) (optional)- -page_number
(optional)- Returns:
- SQL query
- Partial Call Graph (max 5 caller/called nodes):
- 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
(boolean) (defaults to"true"
) (optional)- 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
(defaults to"::xotcl::Object"
) (optional)- specifies the XOTcl class, for which instances are created.
- -named_objects
(boolean) (defaults to"false"
) (optional)- 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
(boolean) (defaults to"true"
) (optional)- 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
(boolean) (defaults to"false"
) (optional)- -ignore_missing_package_ids
(boolean) (defaults to"false"
) (optional)- -initialize
(defaults to"true"
) (optional)- 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
- Partial Call Graph (max 5 caller/called nodes):
- 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
- Returns:
- fully qualified object
- Partial Call Graph (max 5 caller/called nodes):
- 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
(boolean) (defaults to"false"
) (optional)- Returns:
- list of object_types
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xotcl_core_tutorial_2, xotcl_core_tutorial_4
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables