- Publicity: Public Only All
05-db-procs.tcl
XOTcl API for low-level db abstraction
This file defines the following Objects and Classes: ::xo::db::CrAttribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::CrAttribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::CrAttribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::CrAttribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::CrAttribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::CrAttribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::CrAttribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::Attribute, ::xo::db::CrAttribute
- Location:
- packages/xotcl-core/tcl/05-db-procs.tcl
- Created:
- 2006-12-28
- Author:
- Gustaf Neumann
- CVS Identification:
$Id: 05-db-procs.tcl,v 1.153 2024/10/23 13:14:05 gustafn Exp $
Procedures in this file
- Class ::xo::db::CrAttribute (public)
- xo::db::Attribute instproc attribute_reference (public)
- xo::db::Attribute instproc column_spec (public)
- xo::db::Attribute instproc create_attribute (public)
- xo::db::Attribute instproc db_attribute_defined (public)
- xo::db::Attribute instproc init (public)
- xo::db::CrAttribute instproc create_attribute (public)
- xo::db::has_hstore (public, deprecated)
- xo::db::has_ltree (public, deprecated)
- xo::db::list_to_values (public)
- xo::db::tcl_date (public)
Detailed information
Class ::xo::db::CrAttribute (public)
::xotcl::MetaSlot ::xo::db::CrAttribute
ORM class representing an acs_attribute for a content_type in the Content Repository.
- Testcases:
- No testcase defined.
xo::db::Attribute method attribute_reference (public)
<instance of xo::db::Attribute> attribute_reference tn
- Parameters:
- tn (required)
- Returns:
- the name of a DB attribute, potentially with an alias name.
- Testcases:
- No testcase defined.
xo::db::Attribute method column_spec (public)
<instance of xo::db::Attribute> column_spec \ [ -id_column id_column ]
- Switches:
- -id_column (optional, defaults to
"false"
)- Returns:
- the full SQL spec for a DB attribute, potentially containing defaults, primary key, constraints, etc.
- Testcases:
- No testcase defined.
xo::db::Attribute method create_attribute (public)
<instance of xo::db::Attribute> create_attribute
Create an OpenACS attribute, if not already defined (or attribute creation is turned off for this xo::db::Attribute)
- Testcases:
- No testcase defined.
xo::db::Attribute method db_attribute_defined (public)
<instance of xo::db::Attribute> db_attribute_defined \ [ -object_type object_type ] [ -attribute_name attribute_name ]
One could try caching this, but be aware that this also requires proper flushing, this value cannot be considered immutable, not even per request. ns_log notice "GN: db_attribute_defined name $attribute_name type $object_type" ::xo::dc 0or1row -prepare text,text check_att { select 1 from acs_attributes where attribute_name = :attribute_name and object_type = :object_type }
- Switches:
- -object_type (optional)
- -attribute_name (optional)
- Testcases:
- No testcase defined.
xo::db::Attribute method init (public)
<instance of xo::db::Attribute> init
Constructor of ::xo::db::Attribute. It provides defaults and creates the ACS attribute if necessary.
- Testcases:
- No testcase defined.
xo::db::CrAttribute method create_attribute (public)
<instance of xo::db::CrAttribute> create_attribute
Create an OpenACS content repository attribute, if not already defined (or attribute creation is turned off for this xo::db::CrAttribute)
- Testcases:
- No testcase defined.
xo::db::has_hstore (public, deprecated)
xo::db::has_hstore
Deprecated. Invoking this procedure generates a warning.
Check, whether hstore is available (postgres only)
- See Also:
- xo::dc has_hstore
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xo::db::has_ltree (public, deprecated)
xo::db::has_ltree
Deprecated. Invoking this procedure generates a warning.
Check, whether ltree is available (postgres only)
- See Also:
- xo::dc has_ltree
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xo::db::list_to_values (public)
xo::db::list_to_values list [ type ]
Convert a Tcl list into a quoted SQL VALUES expression Example:
% list_to_values {1 2 3 4 5} (VALUES (1), (2), (3), (4), (5))
- Parameters:
- list (required)
- type (optional, defaults to
"text"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- test_misc_core
xo::db::tcl_date (public)
xo::db::tcl_date timestamp tz_var [ secfrac_var ]
Convert the timestamp (coming from the database) into a format, which can be passed to Tcl's "clock scan".
- Parameters:
- timestamp (required)
- tz_var (required)
- secfrac_var (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- test_misc_core