xo::db::postgresql instproc nextval
<instance of xo::db::postgresql> nextval
Defined in
- 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)]} {
set sequenceName t_$sequence
set nextval [::xo::dc get_value nextval "select nextval(:sequenceName)"]
} elseif {[info exists ::db::sequences($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'
}]} {
} else {
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 ]