Index: openacs-4/packages/acs-admin/acs-admin.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/acs-admin.info,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/acs-admin/acs-admin.info 29 May 2001 01:46:29 -0000 1.9 +++ openacs-4/packages/acs-admin/acs-admin.info 19 Aug 2001 21:26:05 -0000 1.10 @@ -88,6 +88,7 @@ + Index: openacs-4/packages/acs-admin/www/apm/packages-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-admin/www/apm/packages-install.tcl 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-admin/www/apm/packages-install.tcl 19 Aug 2001 21:26:05 -0000 1.2 @@ -29,13 +29,15 @@ set version_name $version(name) set package_name $version(package-name) set package_key $version(package.key) - if { [apm_package_registered_p $package_key] } { - if { [apm_higher_version_installed_p $package_key $version_name] } { - lappend spec_files $spec_file - } - } else { - lappend spec_files $spec_file - } + if { [db_package_supports_rdbms_p $version(database_support)] } { + if { [apm_package_registered_p $package_key] } { + if { [apm_higher_version_installed_p $package_key $version_name] } { + lappend spec_files $spec_file + } + } else { + lappend spec_files $spec_file + } + } } } else { ad_set_client_property apm copy_files_p 1 Index: openacs-4/packages/acs-admin/www/apm/version-files.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/version-files.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-admin/www/apm/version-files.tcl 29 May 2001 01:46:29 -0000 1.3 +++ openacs-4/packages/acs-admin/www/apm/version-files.tcl 19 Aug 2001 21:26:05 -0000 1.4 @@ -91,7 +91,7 @@ doc_body_append "" } else { if { $installed_p == "t" } { - if { $file_type == "tcl_procs" || $file_type == "query_file" } { + if { $file_type == "tcl_procs" || ($file_type == "query_file" && [db_compatible_rdbms_p $db_type]) } { if { [nsv_exists apm_reload_watch "packages/$package_key/$path"] } { # This procs file is already being watched. doc_body_append " watch " Index: openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 29 Jul 2001 23:16:50 -0000 1.5 +++ openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 19 Aug 2001 21:26:05 -0000 1.6 @@ -149,8 +149,11 @@ file used to create the APM datamodel. If the path contains a string matching "sql/common" the file is assumed to be - compatible with all supported RDBMS's and a db_type of "common" is returned. + compatible with all supported RDBMS's and a blank db_type is returned. + Otherwise "oracle" is returned. This is a hardwired kludge to allow us to + handle legacy ACS 4 packages. + 2. Other files. If the file name contains a dash and database type, the file is assumed to be @@ -166,16 +169,13 @@ set sql_index [lsearch $components "sql"] if { $sql_index >= 0 } { set db_dir [lindex $components [expr $sql_index + 1]] - if { [string equal db_dir "common"] } { - return "common" - } foreach known_database_type [db_known_database_types] { if { [string equal [lindex $known_database_type 0] $db_dir] } { return $db_dir } } } - return "" + return "oracle" } set file_name [file tail $path] @@ -184,6 +184,7 @@ return [lindex $known_database_type 0] } } + return "" } Index: openacs-4/packages/acs-mail/sql/oracle/acs-mail-nt-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail/sql/oracle/acs-mail-nt-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-mail/sql/oracle/acs-mail-nt-create.sql 13 Aug 2001 17:20:06 -0000 1.1 +++ openacs-4/packages/acs-mail/sql/oracle/acs-mail-nt-create.sql 19 Aug 2001 21:26:05 -0000 1.2 @@ -117,8 +117,8 @@ is cursor c_expanded_cur is select email from parties p - where party_id in (select member_id from group_approved_member_map - where group_id = p_party_to); + where p.party_id in (select member_id from group_approved_member_map + where group_id = party_to); c_request_row c_expanded_cur%ROWTYPE; v_header_from acs_mail_bodies.header_from%TYPE; v_header_to acs_mail_bodies.header_to%TYPE; @@ -136,21 +136,10 @@ -- create a mail body with empty content v_body_id := acs_mail_body.new ( - null, -- p_body_id - null, -- p_body_reply_to - party_from, -- p_body_from - sysdate, -- p_body_date - null, -- p_header_message_id - null, -- p_header_reply_to - subject, -- p_header_subject - null, -- p_header_from - null, -- p_header_to - null, -- p_content_item_id - 'acs_mail_body', -- p_object_type - sysdate, -- p_creation_date - party_from, -- p_creation_user - null, -- p_creation_ip - null -- p_context_id + body_from => party_from, + body_date => sysdate, + header_subject => subject, + creation_user => party_from ); -- create a CR item to stick message into Index: openacs-4/packages/acs-tcl/tcl/00-database-procs-oracle.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/00-database-procs-oracle.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/acs-tcl/tcl/00-database-procs-oracle.tcl 3 Aug 2001 13:18:14 -0000 1.11 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs-oracle.tcl 19 Aug 2001 21:26:05 -0000 1.12 @@ -7,15 +7,6 @@ @cvs-id $Id$ } -ad_proc db_compatible_rdbms_p { db_type } { - Returns 1 if the given db_type is compatible with the current RDBMS. If db_type - is blank we assume this is a legacy Oracle package that's not been moved to - the OpenACS multidb framework. -} { - return [expr { [empty_string_p $db_type] || [string equal [db_type] $db_type] || \ - [string equal $db_type "common"] }] -} - ad_proc -public db_nullify_empty_string { string } { A convenience function that returns [db_null] if $string is the empty string. } { Index: openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl,v diff -u -N -r1.20 -r1.21 --- openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl 29 Jul 2001 23:16:50 -0000 1.20 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl 19 Aug 2001 21:26:05 -0000 1.21 @@ -7,13 +7,6 @@ @cvs-id $Id$ } -ad_proc db_compatible_rdbms_p { db_type } { - Returns 1 if the given db_type is compatible with the current RDBMS. If db_type - is blank we assume this is a legacy Oracle package that's not been ported to - PostgreSQL so don't return 1 as we do when running in Oracle mode. -} { - return [expr { [string equal [db_type] $db_type] || [string equal $db_type "common"] }] -} proc_doc db_nextval { sequence } { Returns the next value for a sequence. This can utilize a pool of sequence values to save hits to the database. } { return [db_string nextval "select ${sequence}.nextval"] } Index: openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 8 May 2001 11:20:32 -0000 1.4 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 19 Aug 2001 21:26:05 -0000 1.5 @@ -14,6 +14,23 @@ return [nsv_get ad_database_type .] } +ad_proc db_compatible_rdbms_p { db_type } { + Returns 1 if the given db_type is compatible with the current RDBMS. +} { + return [expr { [empty_string_p $db_type] || [string equal [db_type] $db_type] }] +} + +ad_proc db_package_supports_rdbms_p { db_type_list } { + Returns 1 if db_type_list is empty (needs no database support) or + contains the current RDBMS type. The list is typically built from + the XML database-support node in a packages .info file. +} { + if { [llength $db_type_list] == 0 || [lsearch $db_type_list [db_type]] != -1 } { + return 1 + } + return 0 +} + proc_doc db_version { } { Returns the RDBMS version (i.e. 8.1.6 is a recent Oracle version; 7.1 a recent PostgreSQL version. Index: openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl 29 Jul 2001 23:16:50 -0000 1.7 +++ openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl 19 Aug 2001 21:26:05 -0000 1.8 @@ -381,6 +381,20 @@ # Build a list of the files contained in the package. + #DRB: we accept info files with no database-support section for legacy reasons. They + # should work with Oracle, Postgres users load them at their peril but the installer won't + # try to load the datamodel anyway. + + set database_support_sections [xml_node_get_children_by_name $version "database-support"] + set properties(database_support) [list] + if { [llength $database_support_sections] > 1 } { + error "Package must contain exactly one node" + } elseif { [llength $database_support_sections] != 0 } { + foreach database [xml_node_get_children_by_name [lindex $database_support_sections 0] "database"] { + lappend properties(database_support) [xml_node_get_content [lindex $database 0]] + } + } + set properties(files) [list] # set nodes [dom::element getElementsByTagName $version "files"]