Delete() function
This commit is contained in:
parent
0ce73ac805
commit
48716f3251
23
atom
23
atom
@ -458,6 +458,28 @@ InsertOrUpdate() {
|
||||
results="${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() {
|
||||
for destination in ${!destinationpath[@]}
|
||||
@ -496,6 +518,7 @@ getFiles() {
|
||||
find "$sourcepath" -type f -printf "%T@ %s %P\n"
|
||||
)
|
||||
echo 'COMMIT;' >&3
|
||||
echo
|
||||
}
|
||||
|
||||
getType() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user