xo::db::postgresql instproc nextval

 <instance of xo::db::postgresql[i]> nextval

Defined in

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_cr_items test_cr_items (test xotcl-core) xo::db::postgresql instproc nextval xo::db::postgresql instproc nextval test_test_cr_items->xo::db::postgresql instproc nextval test_xotcl-core xotcl-core (test ) test_xotcl-core->xo::db::postgresql instproc nextval test_xotcl_core_tutorial_4 xotcl_core_tutorial_4 (test ) test_xotcl_core_tutorial_4->xo::db::postgresql instproc nextval

Testcases:
xotcl_core_tutorial_4, xotcl-core, test_cr_items
Source code:
if {![info exists ::db::sequences]} {
  ns_log notice "-- creating per thread sequence table"
  foreach s [::xo::dc list relnames "select relname from pg_class where relkind = 'S'"] {
    set ::db::sequences($s) 1
  }
}
if {[info exists ::db::sequences(t_$sequence)]} {
  #ns_log notice "-- found t_$sequence"
  set sequenceName t_$sequence
  set nextval [::xo::dc get_value nextval "select nextval(:sequenceName)"]
} elseif {[info exists ::db::sequences($sequence)]} {
  #ns_log notice "-- found $sequence"
  set sequenceName $sequence
  set nextval [::xo::dc get_value nextval "select nextval(:sequenceName)"]
} elseif { [::xo::dc 0or1row nextval_sequence {
  select nextval(:sequence) as nextval
  where (select relkind
         from pg_class
         where relname = :sequence) = 'S'
}]} {
  #
  # We do not have an according sequence-table. Use the system catalog to check
  # for the sequence
  #
  # ... the query sets nextval if it succeeds
  #
} else {
  #
  # finally, there might be a view with a nextval
  #
  ns_log debug "db_nextval: sequence($sequence) is not a real sequence.  Perhaps it uses the view hack."
  set nextval [::xo::dc get_value nextval "select nextval from :sequence"]
}
return $nextval
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: