%3 ::xo::db::DB ::xo::db::DB 0or1row 1row dml exec_0or1row foreach get_value list list_of_lists multirow prepare profile psql_statement_suffix row_lock transaction ::xo::db::Driver ::xo::db::Driver 0or1row 1row dml ds foreach get_sql get_value insert-view-operation list list_of_lists prepare row_lock sets transaction ::xo::db::DB->::xo::db::Driver ::xo::db::DBI ::xo::db::DBI 0or1row 1row dml foreach generate_psql get_value list list_of_lists prepare profile sets sql_arg_info transaction ::xo::db::DBI->::xo::db::Driver ::xotcl::Object ::xotcl::Object ::xo::db::Driver->::xotcl::Object ::xo::db::DB-oracle ::xo::db::DB-oracle generate_psql get_all_package_functions get_function_args sets ::xo::db::DB-oracle->::xo::db::DB ::xo::db::oracle ::xo::db::oracle ::xo::db::DB-oracle->::xo::db::oracle ::xo::db::DB-postgresql ::xo::db::DB-postgresql 0or1row 1row dml foreach generate_psql get_value insert-view-operation list list_of_lists multirow prepare row_lock sets ::xo::db::DB-postgresql->::xo::db::DB ::xo::db::postgresql ::xo::db::postgresql ::xo::db::DB-postgresql->::xo::db::postgresql

Class ::xo::db::DB

::xo::db::DB[i] create ...

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xo::db::Driver[i]
  • subclass: ::xo::db::DB-oracle[i], ::xo::db::DB-postgresql[i]
::xotcl::Class create ::xo::db::DB \
     -superclass ::xo::db::Driver

Methods (to be applied on instances)

  • 0or1row (scripted)

    if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
    uplevel [list ::db_0or1row [uplevel [list [self] qn $qn]] $sql {*}$bindOpt]
  • 1row (scripted)

    if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
    uplevel [list ::db_1row [uplevel [list [self] qn $qn]] $sql {*}$bindOpt]
  • dml (scripted)

    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]
  • exec_0or1row (scripted)

    # Helper, used from several postgres-specific one-tuple queries
    if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
    ::db_with_handle h {
      if {[info exists prepare]} {set sql [:prepare -handle $h -argtypes $prepare $sql]}
      return [uplevel [list ns_pg_bind 0or1row $h {*}$bindOpt $sql]]
    }
  • foreach (scripted)

    #if {$sql eq ""} {set sql [:get_sql $qn]}
    if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
    set qn [uplevel [list [self] qn $qn]]
    #
    # The prepare statement in the next line works probably only with
    # inline SQL statements.
    #
    #if {[info exists prepare]} {set sql [:prepare -dbn $dbn -argtypes $prepare $sql]}
    #ns_log notice "### [list ::db_foreach -dbn $dbn $qn $sql $body {*}$bindOpt]"
    uplevel [list ::db_foreach -dbn $dbn $qn $sql $body {*}$bindOpt]
  • get_value (scripted)

    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]
  • list (scripted)

    if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""}
    uplevel [list ::db_list -dbn $dbn [uplevel [list [self] qn $qn]] $sql {*}$bindOpt]
  • list_of_lists (scripted)

    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]
  • multirow (scripted)

    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]
  • prepare (scripted)

    return $sql
  • profile (scripted)

    # built-in
  • psql_statement_suffix (scripted)

    set key ::xo::db::sql_suffix(${:dialect},$package_name,$object_name)
    return [expr {[info exists $key] ? [set $key] : ""}]
  • row_lock (scripted)

    #
    # PostgreSQL has several variants of row-level lock modes (the
    # "for" part), but other database systems just support only "FOR
    # UPDATE", which should work always. Therefore, ignore for other
    # DB-systems the specified value and use just "FOR UPDATE".
    #
    :uplevel [list ::xo::dc list -dbn $dbn -bind $bind $qn "$sql FOR UPDATE"]
  • transaction (scripted)

     <instance of xo::db::DB[i]> transaction

    Partial Call Graph (max 5 caller/called nodes):
    %3 test_test_cr_items test_cr_items (test xotcl-core) xo::db::DB instproc transaction xo::db::DB instproc transaction test_test_cr_items->xo::db::DB instproc transaction test_test_xo_db_object test_xo_db_object (test xotcl-core) test_test_xo_db_object->xo::db::DB instproc transaction test_xotcl-core xotcl-core (test ) test_xotcl-core->xo::db::DB instproc transaction test_xotcl_core_tutorial_1 xotcl_core_tutorial_1 (test ) test_xotcl_core_tutorial_1->xo::db::DB instproc transaction test_xotcl_core_tutorial_2 xotcl_core_tutorial_2 (test xotcl-core) test_xotcl_core_tutorial_2->xo::db::DB instproc transaction

    Testcases:
    xotcl_core_tutorial_1, xotcl-core, xotcl_core_tutorial_2, xotcl_core_tutorial_4, test_xo_db_object, test_cr_items
    return [:uplevel [list ::db_transaction -dbn $dbn $script {*}$args]]