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 -r1.42 -r1.43 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 21 Oct 2003 22:35:24 -0000 1.42 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 31 Oct 2003 16:11:25 -0000 1.43 @@ -2457,15 +2457,19 @@ } set fd [open $file r] - set copy_command [subst [read $fd]] + set copy_command [subst -nobackslashes [read $fd]] close $fd - + set copy_file [ns_mktemp /tmp/psql-copyfile-XXXXXX] + set fd [open $copy_file "CREAT EXCL WRONLY" 0600] + puts $fd $copy_command + close $fd + if { $tcl_platform(platform) == "windows" } { - set fp [open "|[file join [db_get_pgbin] psql] -c \"$copy_command\" -h [ns_info hostname] $pgport $pguser [db_get_database]" "r"] + set fp [open "|[file join [db_get_pgbin] psql] -f $copy_file -h [ns_info hostname] $pgport $pguser [db_get_database]" "r"] } else { - set fp [open "|[file join [db_get_pgbin] psql] -c \"$copy_command\" $pghost $pgport $pguser [db_get_database] $pgpass" "r"] + set fp [open "|[file join [db_get_pgbin] psql] -f $copy_file $pghost $pgport $pguser [db_get_database] $pgpass" "r"] } - + while { [gets $fp line] >= 0 } { # Don't bother writing out lines which are purely whitespace. if { ![string is space $line] } { @@ -2481,6 +2485,9 @@ close $fp } error] + # remove the copy file. + file delete -force $copy_file + if { $errno == 2 } { return $error } @@ -2911,7 +2918,7 @@ } } - ns_log Notice "$proc_name: atp: $which_proc -ulevel [expr {$ulevel +1}] $type $db $statement_name $pre_sql $file" + ns_log Debug "$proc_name: $which_proc -ulevel [expr {$ulevel +1}] $type $db $statement_name $pre_sql $file" return [$which_proc -ulevel [expr {$ulevel +1}] $type $db $statement_name $pre_sql $file] }