Delete() function

This commit is contained in:
Vincent Riquer 2013-02-26 11:43:21 +01:00
parent 0ce73ac805
commit 48716f3251

23
atom
View File

@ -458,6 +458,28 @@ InsertOrUpdate() {
results="${results#* = }" results="${results#* = }"
echo "$results" echo "$results"
} }
Delete() {
#Delete table < where_key where_value
# [where_key where_value
# […]]
local \
table="$1" \
key \
value \
where_statement \
results
while read key value
do
(( ${#where_statement} )) && where_statement+=( "AND" )
if [[ $value == NULL ]]
then
where_statement+=( "$key is NULL" )
else
where_statement+=( "$key="'"'"${value//\"/\\\"}"'"' )
fi
done
echo "DELETE from $table WHERE ${where_statement[@]};" >&3
}
createDestinations() { createDestinations() {
for destination in ${!destinationpath[@]} for destination in ${!destinationpath[@]}
@ -496,6 +518,7 @@ getFiles() {
find "$sourcepath" -type f -printf "%T@ %s %P\n" find "$sourcepath" -type f -printf "%T@ %s %P\n"
) )
echo 'COMMIT;' >&3 echo 'COMMIT;' >&3
echo
} }
getType() { getType() {