- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::db::DBI
::xo::db::DBI create ...
Class Relations
::xotcl::Class create ::xo::db::DBI \ -superclass ::xo::db::DriverMethods (to be applied on instances)
0or1row (scripted)
if {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} return [:uplevel [list ::dbi_0or1row {*}$bindOpt $sql]]1row (scripted)
if {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} return [:uplevel [list ::dbi_1row {*}$bindOpt $sql]]dml (scripted)
if {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} return [:uplevel [list ::dbi_dml {*}$bindOpt -- $sql]]foreach (scripted)
#if {$sql eq ""} {set sql [:get_sql $qn]} if {$sql eq ""} {set qn [uplevel [list [self] qn $qn]]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} set avlists [:uplevel [list dbi_rows -result avlists {*}$bindOpt -- $sql]] foreach avlist $avlists { foreach {a v} $avlist {:uplevel [list set $a $v]} :uplevel $body }generate_psql (scripted)
set function_args [:get_function_args $package_name $object_name] set function_args [:fix_function_args $function_args $package_name $object_name] set sql_info [:sql_arg_info $function_args $package_name $object_name] #ns_log notice "-- select ${package_name}__${object_name}($psql_args)" set sql_suffix [:psql_statement_suffix ${package_name} ${object_name}] dict set sql_info sql [subst { select ${package_name}__${object_name}([dict get $sql_info psql_args]) $sql_suffix}] dict set sql_info sql_cmd [subst {dbi_1row -autonull {[dict get $sql_info sql] as result}}] dict set sql_info body [subst { #function_args: $function_args [dict get [set sql_info] sql_cmd] return \$result }] return $sql_infoget_value (scripted)
if {$sql eq ""} {set sql [:get_sql $qn]} set answers [:uplevel [list ::dbi_rows -result sets -max 1 $sql]] if {$answers ne ""} { set result [ns_set value $answers 0] ns_set free $answers return $result } return $defaultlist (scripted)
if {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} set flat [:uplevel [list ::dbi_rows -columns __columns {*}$bindOpt -- $sql]] if {[:uplevel {llength $__columns}] > 1} {error "query is returning more than one column"} return $flatlist_of_lists (scripted)
if {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} return [:uplevel [list ::dbi_rows -result lists -max 1000000 {*}$bindOpt -- $sql]]prepare (scripted)
return $sqlprofile (scripted)
if {$onOff} { :mixin ::xo::db::DBI::Profile } else { if {[:info mixin] ne ""} {:mixin ""} }sets (scripted)
if {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} return [:uplevel [list dbi_rows -result sets {*}$bindOpt -- $sql]]sql_arg_info (scripted)
set defined {} set psql_args [list] set arg_order [list] # TODO function args not needed in dict foreach arg $function_args { lassign $arg arg_name default_value lappend psql_args :[string tolower $arg_name] lappend arg_order $arg_name lappend defined $arg_name $default_value } return [list psql_args [join $psql_args ", "] arg_order $arg_order defined $defined function_args $function_args]transaction (scripted)
if {$args ne ""} { lassign $args op on_error_code set result "" if {$op ne "on_error"} { error "only 'on_error' as argument after script allowed" } try { set result [:uplevel [list ::dbi_eval -transaction committed $script]] } on error {$errorMsg} { :uplevel $on_error_code } return $result } else { return [:uplevel [list ::dbi_eval -transaction committed $script]] }
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables