- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::db::DB-postgresql
::xo::db::DB-postgresql create ...
Defined in
Class Relations
::xotcl::Class create ::xo::db::DB-postgresql \ -superclass {::xo::db::DB ::xo::db::postgresql}Methods (to be applied on instances)
0or1row (scripted)
<instance of xo::db::DB-postgresql> 0or1row
- Testcases:
- test_xo_db_object, xotcl-core, test_cr_items, xowiki_test_cases
if {$sql eq ""} {set sql [:get_sql $qn]} set prepOpt [expr {[info exists prepare] ? [list -prepare $prepare] : ""}] set answers [uplevel [list [self] exec_0or1row -dbn $dbn {*}$prepOpt -bind $bind $sql]] if {$answers ne ""} { foreach {att val} [ns_set array $answers] { uplevel [list set $att $val] } ns_set free $answers return 1 } return 01row (scripted)
<instance of xo::db::DB-postgresql> 1row
- Testcases:
- xotcl_core_tutorial_3, xotcl-core, test_xo_db_object, test_cr_items
if {$sql eq ""} {set sql [:get_sql $qn]} set prepOpt [expr {[info exists prepare] ? [list -prepare $prepare] : ""}] set answers [uplevel [list [self] exec_0or1row -dbn $dbn {*}$prepOpt -bind $bind $sql]] if {$answers ne ""} { foreach {att val} [ns_set array $answers] { uplevel [list set $att $val] } ns_set free $answers return 1 } error "query $sql did not return an answer"dml (scripted)
<instance of xo::db::DB-postgresql> dmlif {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} set bind $bindOpt db_with_handle -dbn [:map_default_dbn $dbn] db { if {[info exists prepare]} {set sql [:prepare -handle $db -argtypes $prepare $sql]} ::db_exec dml $db [uplevel [list [self] qn $qn]] $sql 2 } return [db_resultrows]generate_psql (scripted)
<instance of xo::db::DB-postgresql> generate_psql
- Testcases:
- xotcl_core_tutorial_2, xotcl-core
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}] set sql [subst { select ${package_name}__${object_name}([dict get $sql_info psql_args]) $sql_suffix }] set sql_cmd {ns_set value [ns_pg_bind 0or1row $db $sql] 0} dict set sql_info body [subst { #function_args: $function_args foreach var \[list [dict get $sql_info arg_order]\] { set varname \[string tolower \$var\] if {\[info exists \$varname\]} { set \$var \[set \$varname\] set _\$var :\$var } else { set _\$var null } } set sql "$sql" db_with_handle -dbn \$dbn db { #ns_log notice "--sql=\$sql" return \[ $sql_cmd \] } }] return $sql_infoget_value (scripted)
<instance of xo::db::DB-postgresql> get_valueif {$sql eq ""} {set sql [:get_sql $qn]} set prepOpt [expr {[info exists prepare] ? [list -prepare $prepare] : ""}] set answers [uplevel [list [self] exec_0or1row -dbn $dbn {*}$prepOpt -bind $bind $sql]] if {$answers ne ""} { set result [ns_set value $answers 0] ns_set free $answers return $result } return $defaultinsert-view-operation (scripted)
<instance of xo::db::DB-postgresql> insert-view-operation
- Testcases:
- xotcl_core_tutorial_4, xotcl-core, test_cr_items
return 0or1rowlist (scripted)
<instance of xo::db::DB-postgresql> list
- Testcases:
- xotcl_core_tutorial_2, xotcl-core, xowiki_test_cases
if {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} db_with_handle -dbn [:map_default_dbn $dbn] db { if {[info exists prepare]} {set sql [:prepare -handle $db -argtypes $prepare $sql]} set result {} set answers [uplevel [list ns_pg_bind select $db {*}$bindOpt $sql]] while { [::db_getrow $db $answers] } { lappend result [ns_set value $answers 0] } ns_set free $answers } return $resultlist_of_lists (scripted)
<instance of xo::db::DB-postgresql> list_of_lists
- Testcases:
- xotcl_core_tutorial_2, xotcl-core, xotcl_core_tutorial_3
if {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} db_with_handle -dbn [:map_default_dbn $dbn] db { if {[info exists prepare]} {set sql [:prepare -handle $db -argtypes $prepare $sql]} set result {} set answers [uplevel [list ns_pg_bind select $db {*}$bindOpt $sql]] if {$with_headers} { if {[acs::icanuse "ns_set keys"]} { set headers [ns_set keys $answers] } else { set headers [dict keys [ns_set array $answers]] } set result [list $headers] } while { [db_getrow $db $answers] } { set row [list] foreach {att value} [ns_set array $answers] {lappend row $value} lappend result $row } ns_set free $answers } return $resultrow_lock (scripted)
<instance of xo::db::DB-postgresql> row_lock
- Testcases:
- xotcl_core_tutorial_4, xotcl-core, test_cr_items
set prepareOpt [expr {[info exists prepare] ? [list -prepare $prepare] : ""}] :uplevel [list ::xo::dc list -dbn $dbn -bind $bind {*}$prepareOpt $qn "$sql FOR $for"]
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables