Index: openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs-postgresql.xql 16 Jan 2003 13:38:14 -0000 1.2 +++ openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs-postgresql.xql 25 Jan 2019 23:49:04 -0000 1.3 @@ -12,13 +12,4 @@ - - - select data_type - from user_tab_columns - where table_name = upper(:table) - and column_name = upper(:column) - - - Index: openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs.tcl 11 Dec 2018 16:21:03 -0000 1.10 +++ openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs.tcl 25 Jan 2019 23:49:04 -0000 1.11 @@ -84,17 +84,19 @@ return [join $pieces ","] } - ad_proc -public table_column_type { + ad_proc -deprecated table_column_type { table column } { Returns the datatype for column in table + @see db_column_type + @author Steve Woodcock (swoodcock@scholastic.co.uk) @creation-date 07/2001 } { - return [db_string fetch_type {}] + return [db_column_type -complain $table $column] } ad_proc -public generate_attribute_parameters { @@ -132,7 +134,7 @@ foreach triple $attr_list { set table [string toupper [string trim [lindex $triple 0]]] set attr [string toupper [string trim [lindex $triple 1]]] - set datatype [table_column_type $table $attr] + set datatype [db_column_type -complain $table $attr] lappend pieces $datatype } return [join $pieces ","] Index: openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-database-procs.tcl,v diff -u -r1.117 -r1.118 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 22 Dec 2018 09:39:46 -0000 1.117 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 25 Jan 2019 23:49:04 -0000 1.118 @@ -3220,12 +3220,14 @@ } -ad_proc -public db_column_type {{-dbn ""} table_name column_name } { +ad_proc -public db_column_type {{-dbn ""} {-complain:boolean} table_name column_name } { @return the Oracle Data Type for the specified column. @return -1 if the table or column doesn't exist. + @return an error if table or column doesn't exist and -complain flag was specified @param dbn The database name to use. If empty_string, uses the default database. + @param complain throw an error when datatype is not found @author Yon Feldman (yon@arsdigita.com) @@ -3241,12 +3243,17 @@ } { # Works for both Oracle and PostgreSQL: - return [db_string -dbn $dbn column_type_select " + set datatype [db_string -dbn $dbn column_type_select " select data_type as data_type from user_tab_columns where upper(table_name) = upper(:table_name) and upper(column_name) = upper(:column_name) " -default "-1"] + if {$complain_p && $datatype == -1} { + error "Datatype for $table_name.$column_name not found." + } else { + return $datatype + } }