Index: openacs-4/packages/ecommerce/www/admin/products/add-4-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/add-4-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ecommerce/www/admin/products/add-4-oracle.xql 18 Jul 2001 05:40:46 -0000 1.2 +++ openacs-4/packages/ecommerce/www/admin/products/add-4-oracle.xql 24 Aug 2001 22:21:51 -0000 1.3 @@ -3,7 +3,7 @@ oracle8.1.6 - + begin Index: openacs-4/packages/ecommerce/www/admin/products/add-4-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/add-4-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ecommerce/www/admin/products/add-4-postgresql.xql 18 Jul 2001 05:40:46 -0000 1.2 +++ openacs-4/packages/ecommerce/www/admin/products/add-4-postgresql.xql 24 Aug 2001 22:21:51 -0000 1.3 @@ -3,13 +3,10 @@ postgresql7.1 - + - declare - v_product_id integer; - begin - v_product_id := ec_product__new( + select ec_product__new( :product_id, :user_id, :context_id, @@ -27,26 +24,29 @@ :size_list, :peeraddr ); + + + - update ec_products set style_list = :style_list, - email_on_purchase_list = :email_on_purchase_list, - url = :url, - no_shipping_avail_p = :no_shipping_avail_p, - shipping = :shipping, - shipping_additional = :shipping_additional, - weight = :weight, - active_p = 't', - template_id = :template_id - where product_id = :product_id; - return v_product_id; + + - end; - + update ec_products set style_list = :style_list, + email_on_purchase_list = :email_on_purchase_list, + url = :url, + no_shipping_avail_p = :no_shipping_avail_p, + shipping = :shipping, + shipping_additional = :shipping_additional, + weight = :weight, + active_p = 't', + template_id = :template_id + where product_id = :product_id; + - + Index: openacs-4/packages/ecommerce/www/admin/products/add-4.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/add-4.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ecommerce/www/admin/products/add-4.tcl 18 Jul 2001 05:40:46 -0000 1.2 +++ openacs-4/packages/ecommerce/www/admin/products/add-4.tcl 24 Aug 2001 22:21:51 -0000 1.3 @@ -74,10 +74,16 @@ # we have to generate audit information set audit_fields "last_modified, last_modifying_user, modified_ip_address" + ### find out which database we are using + # for postgresql we need to run two queries for the insert + # for oracle, we only need to run the product_insert query + set db_type [db_type] # db_map this # set audit_info "sysdate, :user_id, :peeraddr" set audit_info [db_map audit_info_sql] - db_exec_plsql user_insert { + + if [string match $db_type "oracle"] { + db_exec_plsql product_insert { begin :1 := ec_product.new(product_id => :product_id, object_type => 'ec_product', @@ -109,7 +115,42 @@ ); end; } + } elseif [string match $db_type "postgresql"] { + set product_id [db_exec_plsql product_insert { + select ec_product__new( + :product_id, + :user_id, + :context_id, + :product_name, + :price, + :sku, + :one_line_description, + :detailed_description, + :search_keywords, + :present_p, + :stock_status, + :dirname, + to_date(:available_date, 'YYYY-MM-DD'), + :color_list, + :size_list, + :peeraddr + ); + }] + db_dml product_update { + update ec_products set style_list = :style_list, + email_on_purchase_list = :email_on_purchase_list, + url = :url, + no_shipping_avail_p = :no_shipping_avail_p, + shipping = :shipping, + shipping_additional = :shipping_additional, + weight = :weight, + active_p = 't', + template_id = :template_id + where product_id = :product_id; + } + } + # db_dml product_insert " # insert into ec_products # (product_id, product_name, sku, one_line_description, detailed_description, color_list, size_list, style_list, email_on_purchase_list, search_keywords, url, price, no_shipping_avail_p, present_p, available_date, shipping, shipping_additional, weight, template_id, dirname, active_p, stock_status, $audit_fields)