Index: openacs-4/packages/acs-subsite/tcl/package-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/package-procs-oracle.xql,v
diff -u -r1.8 -r1.8.2.1
--- openacs-4/packages/acs-subsite/tcl/package-procs-oracle.xql 15 Jan 2004 02:42:33 -0000 1.8
+++ openacs-4/packages/acs-subsite/tcl/package-procs-oracle.xql 25 Dec 2004 21:33:40 -0000 1.8.2.1
@@ -6,12 +6,12 @@
- select case when exists (select 1
+ select case when exists (select 1
from acs_object_types t
where t.dynamic_p = 't'
and t.object_type = :object_type)
- then 1 else 0 end
- from dual
+ then 1 else 0 end
+ from dual
@@ -20,14 +20,14 @@
- select upper(nvl(attr.table_name,t.table_name)) as attr_table_name,
- upper(nvl(attr.column_name, attr.attribute_name)) as attr_column_name,
- attr.ancestor_type, attr.min_n_values, attr.default_value
- from acs_object_type_attributes attr,
- (select t.object_type, t.table_name, level as type_level
- from acs_object_types t
- start with t.object_type = :object_type
- connect by prior t.supertype = t.object_type) t
+ select upper(nvl(attr.table_name,t.table_name)) as attr_table_name,
+ upper(nvl(attr.column_name, attr.attribute_name)) as attr_column_name,
+ attr.ancestor_type, attr.min_n_values, attr.default_value
+ from acs_object_type_attributes attr,
+ (select t.object_type, t.table_name, level as type_level
+ from acs_object_types t
+ start with t.object_type = :object_type
+ connect by prior t.supertype = t.object_type) t
where attr.ancestor_type = t.object_type
and attr.object_type = :object_type
order by t.type_level
@@ -39,10 +39,10 @@
- select t.object_type
- from acs_object_types t
- where t.dynamic_p = 't'
- start with t.object_type = :object_type
+ select t.object_type
+ from acs_object_types t
+ where t.dynamic_p = 't'
+ start with t.object_type = :object_type
connect by prior t.object_type = t.supertype
@@ -52,24 +52,24 @@
- select case when exists (select 1
+ select case when exists (select 1
from user_objects
where status = 'INVALID'
and object_name = upper(:package_name)
and object_type = upper(:type))
then 0 else 1 end
- from dual
-
+ from dual
+
- select t.object_type as ancestor_type
- from acs_object_types t
- start with t.object_type = :object_type
+ select t.object_type as ancestor_type
+ from acs_object_types t
+ start with t.object_type = :object_type
connect by prior t.supertype = t.object_type
@@ -79,9 +79,9 @@
- select t.object_type as sub_type
- from acs_object_types t
- start with t.object_type = :object_type
+ select t.object_type as sub_type
+ from acs_object_types t
+ start with t.object_type = :object_type
connect by prior t.object_type = t.supertype
@@ -91,34 +91,34 @@
- select acs_object.name(:user_id) as author,
- sysdate as creation_date
- from dual
-
+ select acs_object.name(:user_id) as author,
+ sysdate as creation_date
+ from dual
+
- select acs_object.name(:user_id) as author,
- sysdate as creation_date
- from dual
-
+ select acs_object.name(:user_id) as author,
+ sysdate as creation_date
+ from dual
+
- select a.attribute_id,
- nvl(a.table_name, t.table_name) as table_name,
- nvl(a.column_name, a.attribute_name) as attribute_name,
- a.pretty_name,
- a.datatype,
- case when a.min_n_values = 0 then 'f' else 't' end as required_p,
+ select a.attribute_id,
+ nvl(a.table_name, t.table_name) as table_name,
+ nvl(a.column_name, a.attribute_name) as attribute_name,
+ a.pretty_name,
+ a.datatype,
+ case when a.min_n_values = 0 then 'f' else 't' end as required_p,
a.default_value,
t.table_name as object_type_table_name,
t.id_column as object_type_id_column
@@ -137,11 +137,11 @@
- select args.argument_name
+ select args.argument_name
from user_arguments args
where args.position > 0
- and args.object_name = upper(:function_name)
- and args.package_name = upper(:package_name)
+ and args.object_name = upper(:function_name)
+ and args.package_name = upper(:package_name)
@@ -150,19 +150,19 @@
- select cols.table_name, cols.column_name
- from user_tab_columns cols,
- (select upper(t.table_name) as table_name
- from acs_object_types t
+ select cols.table_name, cols.column_name
+ from user_tab_columns cols,
+ (select upper(t.table_name) as table_name
+ from acs_object_types t
start with t.object_type = :object_type
connect by prior t.supertype = t.object_type) t
- where cols.column_name in
- (select args.argument_name
+ where cols.column_name in
+ (select args.argument_name
from user_arguments args
where args.position > 0
- and args.object_name = upper(:object_name)
- and args.package_name = upper(:package_name))
- and cols.table_name = t.table_name
+ and args.object_name = upper(:object_name)
+ and args.package_name = upper(:package_name))
+ and cols.table_name = t.table_name
@@ -173,9 +173,9 @@
BEGIN
:1 := ${package_name}.new([plsql_utility::generate_attribute_parameter_call \
- -prepend ":" \
- -indent [expr [string length $package_name] + 29] \
- $pieces]
+ -prepend ":" \
+ -indent [expr [string length $package_name] + 29] \
+ $pieces]
);
END;
@@ -198,9 +198,9 @@
v_$id_column := ${supertype_package_name}.new (
[plsql_utility::generate_attribute_parameter_call_from_attributes \
- -prepend "new." \
- -indent 21 \
- $supertype_attr_list]
+ -prepend "new." \
+ -indent 21 \
+ $supertype_attr_list]
);
insert into ${table_name}
@@ -235,11 +235,11 @@
[package_insert_default_comment]
function new (
[plsql_utility::generate_attribute_parameters [package_create_attribute_list \
- -supertype $supertype \
- -object_name "NEW" \
- -table $table_name \
- -column $id_column \
- $object_type]]
+ -supertype $supertype \
+ -object_name "NEW" \
+ -table $table_name \
+ -column $id_column \
+ $object_type]]
) return ${table_name}.${id_column}%TYPE;
procedure del (
@@ -259,14 +259,40 @@
sysdate
-
+
+
+ select count(*)
+ from user_arguments
+ where package_name = upper(:package_name)
+ and object_name = upper(:function_name)
+ and position = 0
+
+
+
+
+
BEGIN
+ ${package_name}.${function_name}([plsql_utility::generate_attribute_parameter_call \
+ -prepend ":" \
+ -indent [expr [string length $package_name] + 29] \
+ $pieces]
+ );
+ END;
+
+
+
+
+
+
+
+
+ BEGIN
:1 := ${package_name}.${function_name}([plsql_utility::generate_attribute_parameter_call \
- -prepend ":" \
- -indent [expr [string length $package_name] + 29] \
- $pieces]
+ -prepend ":" \
+ -indent [expr [string length $package_name] + 29] \
+ $pieces]
);
END;
Index: openacs-4/packages/acs-subsite/tcl/package-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/package-procs-postgresql.xql,v
diff -u -r1.12 -r1.12.2.1
--- openacs-4/packages/acs-subsite/tcl/package-procs-postgresql.xql 15 Jan 2004 02:42:33 -0000 1.12
+++ openacs-4/packages/acs-subsite/tcl/package-procs-postgresql.xql 25 Dec 2004 21:33:40 -0000 1.12.2.1
@@ -260,9 +260,15 @@
now()
-
+
+ select 1 from dual
+
+
+
+
+
select ${package_name}__${function_name}([plpgsql_utility::generate_attribute_parameter_call \
-prepend ":" \
${package_name}__${function_name} \
Index: openacs-4/packages/acs-subsite/tcl/package-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/package-procs.tcl,v
diff -u -r1.14 -r1.14.2.1
--- openacs-4/packages/acs-subsite/tcl/package-procs.tcl 11 Feb 2004 18:29:07 -0000 1.14
+++ openacs-4/packages/acs-subsite/tcl/package-procs.tcl 25 Dec 2004 21:33:40 -0000 1.14.2.1
@@ -898,6 +898,18 @@
return $object_id
}
+
+ad_proc -public package_function_p {
+ package_name
+ function_name
+} {
+ Returns 0 if the given function is a procedure, 1 if a function. Always
+ returns 1 in the Postgres version. Broken out into its own function so we
+ can util_memoize it.
+} {
+ return [db_string function_p {}]
+}
+
ad_proc -public package_exec_plsql {
{ -var_list "" }
package_name
@@ -958,7 +970,11 @@
set $__key $__value
}
- return [db_exec_plsql exec_plsql {}]
+ if { [util_memoize "package_function_p $package_name $function_name"] } {
+ return [db_exec_plsql exec_plsql_func {}]
+ } else {
+ db_exec_plsql exec_plsql_proc {}
+ }
}