• 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[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::CrAttribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::CrAttribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::CrAttribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::CrAttribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::CrAttribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::CrAttribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::Attribute[i], ::xo::db::CrAttribute[i]

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

Detailed information

Class ::xo::db::CrAttribute (public)

 ::xotcl::MetaSlot ::xo::db::CrAttribute[i]

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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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[i]> 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):
%3 ad_log_deprecated ad_log_deprecated (public) xo::db::has_hstore xo::db::has_hstore xo::db::has_hstore->ad_log_deprecated

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):
%3 ad_log_deprecated ad_log_deprecated (public) xo::db::has_ltree xo::db::has_ltree xo::db::has_ltree->ad_log_deprecated

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):
%3 test_test_misc_core test_misc_core (test xotcl-core) xo::db::list_to_values xo::db::list_to_values test_test_misc_core->xo::db::list_to_values

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):
%3 test_test_misc_core test_misc_core (test xotcl-core) xo::db::tcl_date xo::db::tcl_date test_test_misc_core->xo::db::tcl_date packages/xowiki/lib/portlets/weblog-mini-calendar.tcl packages/xowiki/ lib/portlets/weblog-mini-calendar.tcl packages/xowiki/lib/portlets/weblog-mini-calendar.tcl->xo::db::tcl_date xo::PackageMgr instproc require_site_wide_pages xo::PackageMgr instproc require_site_wide_pages (public) xo::PackageMgr instproc require_site_wide_pages->xo::db::tcl_date xowf::test_item::Answer_manager instproc get_duration xowf::test_item::Answer_manager instproc get_duration (public) xowf::test_item::Answer_manager instproc get_duration->xo::db::tcl_date xowf::test_item::Answer_manager instproc last_time_switched_to_state xowf::test_item::Answer_manager instproc last_time_switched_to_state (public) xowf::test_item::Answer_manager instproc last_time_switched_to_state->xo::db::tcl_date xowf::test_item::Answer_manager instproc runtime_panel xowf::test_item::Answer_manager instproc runtime_panel (public) xowf::test_item::Answer_manager instproc runtime_panel->xo::db::tcl_date

Testcases:
test_misc_core
[ show source ]