Class ::xo::db::Class

::xo::db::Class[i] 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

  • class: ::xotcl::Class[i]
  • superclass: ::xotcl::Class[i]
  • subclass: ::xo::db::CrClass[i], ::xo::PackageMgr[i]

Methods (to be applied on the object)

Methods (to be applied on instances)

  • check_table_atts (scripted, public)

     <instance of xo::db::Class[i]> check_table_atts

    Check table_name and id_column and set meaningful defaults, if these attributes are not provided.

    Testcases:
    xotcl_core_tutorial_2, xotcl_core_tutorial_3, xotcl_core_tutorial_4
  • create_object_type (scripted, public)

     <instance of xo::db::Class[i]> create_object_type

    Create an acs object_type for the current XOTcl class

    Testcases:
    xotcl_core_tutorial_2
  • drop_object_type (scripted, public)

     <instance of xo::db::Class[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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