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.148.2.48 -r1.148.2.49 --- openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 17 Feb 2022 10:37:58 -0000 1.148.2.48 +++ openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 20 Feb 2022 17:24:10 -0000 1.148.2.49 @@ -248,14 +248,11 @@ set where_clause [expr {$where ne "" ? "WHERE $where" : ""}] set order_clause [expr {$orderby ne "" ? "ORDER BY $orderby" : ""}] set group_clause [expr {$groupby ne "" ? "GROUP BY $groupby" : ""}] + set offset_clause [expr {$offset ne "" ? "OFFSET $offset ROWS" : ""}] + set limit_clause [expr {$limit ne "" ? "FETCH NEXT $limit ROWS ONLY" : ""}] if {$map_function_names} {set vars [:map_function_name $vars]} - set sql "SELECT $vars FROM $from $where_clause $group_clause" - if {$limit ne "" || $offset ne ""} { - set sql [:limit_clause -sql "$sql $order_clause" -limit $limit -offset $offset] - } else { - append sql " " $order_clause - } - :log "--returned sql = $sql" + set sql "SELECT $vars FROM $from $where_clause $group_clause $order_clause $offset_clause $limit_clause" + #:log "--returned sql = $sql" return $sql } ::xo::db::oracle instproc date_trunc {field date} { @@ -548,23 +545,26 @@ if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} uplevel [list ::db_1row [uplevel [list [self] qn $qn]] $sql {*}$bindOpt] } - ::xo::db::DB instproc dml {{-dbn ""} {-bind ""} -prepare qn sql} { + ::xo::db::DB instproc dml {{-dbn ""} {-bind ""} -prepare qn sql {-clobs ""} {-blobs ""}} { if {$sql eq ""} {set sql [:get_sql $qn]} if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} + if {$blobs ne ""} {lappend bindOpt -blobs $blobs} + if {$clobs ne ""} {lappend bindOpt -clobs $clobs} uplevel [list ::db_dml [uplevel [list [self] qn $qn]] $sql {*}$bindOpt] return [db_resultrows] } ::xo::db::DB instproc get_value {{-dbn ""} {-bind ""} -prepare qn sql {default ""}} { if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} - uplevel [list ::db_string [uplevel [list [self] qn $qn]] $sql -default $default {*}$bindOpt] + uplevel [list ::db_string -dbn $dbn [uplevel [list [self] qn $qn]] $sql -default $default {*}$bindOpt] } - ::xo::db::DB instproc list_of_lists {{-bind ""} -prepare qn sql} { + ::xo::db::DB instproc list_of_lists {{-dbn ""} {-bind ""} -prepare qn sql} { if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} - uplevel [list ::db_list_of_lists [uplevel [list [self] qn $qn]] $sql {*}$bindOpt] + uplevel [list ::db_list_of_lists -dbn $dbn [uplevel [list [self] qn $qn]] $sql {*}$bindOpt] } - ::xo::db::DB instproc list {{-bind ""} -prepare qn sql} { + + ::xo::db::DB instproc list {{-dbn ""} {-bind ""} -prepare qn sql} { if {$bind ne ""} {set bindOpt [list -bind $bind]} {set bindOpt ""} - uplevel [list ::db_list [uplevel [list [self] qn $qn]] $sql {*}$bindOpt] + uplevel [list ::db_list -dbn $dbn [uplevel [list [self] qn $qn]] $sql {*}$bindOpt] } ::xo::db::DB instproc row_lock {{-dbn ""} {-bind ""} {-for "UPDATE"} -prepare qn sql} { Index: openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl,v diff -u -r1.41.2.47 -r1.41.2.48 --- openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl 28 Jan 2022 22:46:19 -0000 1.41.2.47 +++ openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl 20 Feb 2022 17:24:10 -0000 1.41.2.48 @@ -60,7 +60,7 @@ from apm_packages, site_nodes s where package_key = :package_key and s.object_id = package_id - and acs_permission.permission_p(package_id, :party_id, :privilege) + and acs_permission.permission_p(package_id, :party_id, :privilege) = 't' } } Index: openacs-4/packages/xotcl-core/tcl/cr-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/cr-procs.tcl,v diff -u -r1.76.2.55 -r1.76.2.56 --- openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 9 Jan 2022 17:51:39 -0000 1.76.2.55 +++ openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 20 Feb 2022 17:24:10 -0000 1.76.2.56 @@ -106,7 +106,7 @@ {-initialize:boolean true} {-item_ids:required} } { - + Make sure, the objects all of the provided items_ids are instantiated (i.e. the same-named objects do exist as executable commands in the current thread). @@ -117,7 +117,7 @@ :get_instance_from_db -item_id $item_id -initialize $initialize } } - + CrClass ad_proc get_parent_id { -item_id:required } { @@ -909,9 +909,10 @@ set revision_id ${:revision_id} } set domain [$slot domain] - set sql "update [$domain table_name] \ - set [$slot column_name] = :value \ - where [$domain id_column] = $revision_id" + #set sql "update [$domain table_name] \ + # set [$slot column_name] = '$value' \ + # where [$domain id_column] = $revision_id" + #ns_log notice UPDATE-$sql ::xo::dc dml update_attribute_from_slot [subst { update [$domain table_name] set [$slot column_name] = :value @@ -928,7 +929,7 @@ # -modifying_ip ... ::xo::dc dml update_attribute_from_slot_last_modified { - update acs_objects set last_modified = now() + update acs_objects set last_modified = CURRENT_TIMESTAMP where object_id = :revision_id } } @@ -1011,9 +1012,9 @@ ::xo::dc dml $att $sql } ::xo::dc dml update_attribute_from_slot_last_modified { - update acs_objects set last_modified = now() + update acs_objects set last_modified = CURRENT_TIMESTAMP where object_id = :revision_id - } + } } } @@ -1404,7 +1405,7 @@ content_revision__get_number(r.revision_id) as version_number " \ -from "cr_items ci, cr_revisions r, acs_objects o" \ -where "ci.item_id = :page_id and r.item_id = ci.item_id and o.object_id = r.revision_id - and acs_permission.permission_p(r.revision_id, :user_id, 'read')" \ + and acs_permission.permission_p(r.revision_id, :user_id, 'read') = 't'" \ -orderby "r.revision_id desc"] ::xo::dc foreach revisions_select $sql { @@ -1795,7 +1796,7 @@ set serialized_object [::xo::xotcl_object_cache eval [string trimleft $object :] { # :log "--CACHE true fetch [self args], call shadowed method [self next]" set loaded_from_db 1 - # Call the showdowed method with initializing turned off. We + # Call the shadowed method with initializing turned off. We # want to store object before the after-load initialize in the # cache to save storage. set o [next -item_id $item_id -revision_id $revision_id -object $object -initialize 0]