diff s4-funcs.sh @ 386:606404fbb3d3

Sort group list by posting time(wtime)
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 28 Nov 2016 12:07:18 +0859
parents 305381d205bb
children 2c928bb47c90
line wrap: on
line diff
--- a/s4-funcs.sh	Mon Nov 28 11:05:32 2016 +0859
+++ b/s4-funcs.sh	Mon Nov 28 12:07:18 2016 +0859
@@ -934,6 +934,7 @@
   # $1=tbl $2=id $3=col $4=val/filename - &optional - $5=content-type
   (t0=$1 t=$1 p=$2 c=$3
    tsc=$t/$c val=$4
+   quotedp=$(sqlquotestr "$p")
    unset primary update
    gettblconf
 #err tsc=$tsc, tconfs="$tconfs"
@@ -947,7 +948,7 @@
      s*)	t=${t}_s;;
    esac
 #err t=$t
-   type=text fn=""
+   type=string fn=""
    case $conf in
      */password)
        type=encoded ### val=`echo $val|encode`
@@ -965,12 +966,9 @@
      ###sq $db "replace into $t values(\"$val\"$nulls)"
      query "replace into $t values(\"$val\"$nulls);"
    elif [ "$update" ]; then
-     ###sq $db "update $1 set $c=\"$val\" where $pkey=\"$p\""
-     query "update $1 set $c=\"$val\" where $pkey=\"$p\";"
+     query "update $1 set $c=\"$val\" where $pkey=$quotedp;"
    else
-#err "replace into $t values(\"$p\", \"$c\", \"$type\", \"$val\", \"$bin\")"
-     ###sq $db "replace into $t values(\"$p\", \"$c\", \"$type\", \"$val\", \"$bin\")"
-     query "replace into $t values(\"$p\", \"$c\", \"$type\", \"$val\", \"$bin\");"
+     query "replace into $t values($quotedp, \"$c\", \"$type\", \"$val\", \"$bin\");"
    fi
   )
 }

yatex.org