Index: openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl,v diff -u -r1.103.2.13 -r1.103.2.14 --- openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 20 Dec 2016 12:40:54 -0000 1.103.2.13 +++ openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 20 Dec 2016 18:49:04 -0000 1.103.2.14 @@ -1521,38 +1521,38 @@ # Installations with acs-kernel prior to 5.8.1a6 (or later, before running upgrade script) # won't have these procs. We define them here if missing to avoid breaking running instances during transition. if {![::xotcl::Class isobject "::xo::db::sql::util"]} { - ::xotcl::Class create ::xo::db::sql::util - } - if {[::xo::db::sql::util info commands table_exists] eq ""} { - ::xo::db::sql::util ad_proc table_exists {-name:required} {Transitional method} { - set query [expr {[db_driverkey ""] eq "oracle" ? - {select 1 from user_tables where table_name = :name} : - {select 1 from pg_class where relname = :name and pg_table_is_visible(oid)}}] - ::xo::dc 0or1row query $query + ::xotcl::Class create ::xo::db::sql::util + if {[::xo::db::sql::util info commands table_exists] eq ""} { + ::xo::db::sql::util ad_proc table_exists {-name:required} {Transitional method} { + set query [expr {[db_driverkey ""] eq "oracle" ? + {select 1 from user_tables where table_name = :name} : + {select 1 from pg_class where relname = :name and pg_table_is_visible(oid)}}] + ::xo::dc 0or1row query $query + } } - } - if {[::xo::db::sql::util info commands view_exists] eq ""} { - ::xo::db::sql::util ad_proc view_exists {-name:required} {Transitional method} { - set query [expr {[db_driverkey ""] eq "oracle" ? - {select 1 from user_views where view_name = :name} : - {select 1 from pg_views where viewname = :name}}] - ::xo::dc 0or1row query $query + if {[::xo::db::sql::util info commands view_exists] eq ""} { + ::xo::db::sql::util ad_proc view_exists {-name:required} {Transitional method} { + set query [expr {[db_driverkey ""] eq "oracle" ? + {select 1 from user_views where view_name = :name} : + {select 1 from pg_views where viewname = :name}}] + ::xo::dc 0or1row query $query + } } - } - if {[::xo::db::sql::util info commands index_exists] eq ""} { - ::xo::db::sql::util ad_proc index_exists {-name:required} {Transitional method} { - set query [expr {[db_driverkey ""] eq "oracle" ? - {select 1 from user_indexes where index_name = :name} : - {select 1 from pg_indexes where indexname = :name}}] - ::xo::dc 0or1row query $query + if {[::xo::db::sql::util info commands index_exists] eq ""} { + ::xo::db::sql::util ad_proc index_exists {-name:required} {Transitional method} { + set query [expr {[db_driverkey ""] eq "oracle" ? + {select 1 from user_indexes where index_name = :name} : + {select 1 from pg_indexes where indexname = :name}}] + ::xo::dc 0or1row query $query + } } - } - if {[::xo::db::sql::util info commands table_column_exists] eq ""} { - ::xo::db::sql::util ad_proc table_column_exists {-t_name:required -c_name:required} {Transitional method} { - set query [expr {[db_driverkey ""] eq "oracle" ? - {select 1 from user_tab_columns where table_name = :t_name and column_name = :c_name} : - {select 1 from information_schema.columns where table_name = :t_name and column_name = :c_name}}] - ::xo::dc 0or1row query $query + if {[::xo::db::sql::util info commands table_column_exists] eq ""} { + ::xo::db::sql::util ad_proc table_column_exists {-t_name:required -c_name:required} {Transitional method} { + set query [expr {[db_driverkey ""] eq "oracle" ? + {select 1 from user_tab_columns where table_name = :t_name and column_name = :c_name} : + {select 1 from information_schema.columns where table_name = :t_name and column_name = :c_name}}] + ::xo::dc 0or1row query $query + } } } ###