Class ::xo::db::DB (public)
::xotcl::Class ::xo::db::DB
Defined in
- Testcases:
-
No testcase defined.
Source code:
namespace eval ::xo::db {}
::nsf::object::alloc ::xotcl::Class ::xo::db::DB {set :__default_metaclass ::xotcl::Class
set :__default_superclass ::xotcl::Object}
::xo::db::DB instproc psql_statement_suffix {package_name object_name} {
set key ::xo::db::sql_suffix(${:dialect},$package_name,$object_name)
return [expr {[info exists $key] ? [set $key] : ""}]
}
::xo::db::DB instproc row_lock {{-dbn ""} {-bind ""} {-for "UPDATE"} -prepare qn sql} {
:uplevel [list ::xo::dc list -dbn $dbn -bind $bind $qn "$sql FOR UPDATE"]
}
::xo::db::DB instproc foreach {{-dbn ""} {-bind ""} -prepare qn sql body} {
if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
set qn [uplevel [list [self] qn $qn]]
uplevel [list ::db_foreach -dbn $dbn $qn $sql $body {*}$bindOpt]
}
::xo::db::DB instproc profile onOff {
}
::xo::db::DB instproc 0or1row {{-dbn ""} {-bind ""} -prepare qn sql} {
if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
uplevel [list ::db_0or1row [uplevel [list [self] qn $qn]] $sql {*}$bindOpt]
}
::xo::db::DB instproc list {{-dbn ""} {-bind ""} -prepare qn sql} {
if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
uplevel [list ::db_list -dbn $dbn [uplevel [list [self] qn $qn]] $sql {*}$bindOpt]
}
::xo::db::DB instproc dml {{-dbn ""} {-bind ""} -prepare qn sql {-clobs ""} {-blobs ""}} {
if {$sql eq ""} {set sql [:get_sql $qn]}
if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
if {$blobs ne ""} {lappend bindOpt -blobs $blobs}
if {$clobs ne ""} {lappend bindOpt -clobs $clobs}
uplevel [list ::db_dml [uplevel [list [self] qn $qn]] $sql {*}$bindOpt]
return [db_resultrows]
}
::xo::db::DB instproc transaction {{-dbn ""} script args} {
return [:uplevel [list ::db_transaction -dbn $dbn $script {*}$args]]
}
::xo::db::DB instproc 1row {{-dbn ""} {-bind ""} -prepare qn sql} {
if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
uplevel [list ::db_1row [uplevel [list [self] qn $qn]] $sql {*}$bindOpt]
}
::xo::db::DB instproc multirow {{-dbn ""} {-bind ""} {-local false} {-upvar_level 1} {-extend {}} -prepare var_name qn sql {body ""}} {
if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
set qn [uplevel [list [self] qn $qn]]
set local [expr {$local ? "-local" : ""}]
uplevel [list ::db_multirow -dbn $dbn {*}$local -append -upvar_level $upvar_level -extend $extend $var_name $qn $sql $body {*}$bindOpt]
}
::xo::db::DB instproc get_value {{-dbn ""} {-bind ""} -prepare qn sql {default ""}} {
if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
uplevel [list ::db_string -dbn $dbn [uplevel [list [self] qn $qn]] $sql -default $default {*}$bindOpt]
}
::xo::db::DB instproc list_of_lists {{-dbn ""} {-bind ""} {-with_headers false} -prepare qn sql} {
if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
set with_headers [expr {$with_headers ? "-with_headers" : ""}]
uplevel [list ::db_list_of_lists -dbn $dbn {*}$with_headers [uplevel [list [self] qn $qn]] $sql {*}$bindOpt]
}
::xo::db::DB instproc exec_0or1row {{-dbn ""} -prepare {-bind ""} sql} {
if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
::db_with_handle -dbn [:map_default_dbn $dbn] h {
if {[info exists prepare]} {set sql [:prepare -handle $h -argtypes $prepare $sql]}
return [uplevel [list ns_pg_bind 0or1row $h {*}$bindOpt $sql]]
}
}
::xo::db::DB instproc prepare {-handle {-argtypes ""} sql} {
return $sql
}
::nsf::relation::set ::xo::db::DB superclass ::xo::db::Driver
XQL Not present:Generic, PostgreSQL, Oracle
[
hide source ]
| [
make this the default ]