Compare commits

...

4 Commits

Author SHA1 Message Date
Vincent Riquer
eb45983613 toys: use NULL in reads from db 2025-11-10 15:44:17 +01:00
Vincent Riquer
12da4f5259 tags: use NULL in reads from db 2025-11-10 15:39:16 +01:00
Vincent Riquer
0cf8ee09b4 tasks & workers: use NULL in reads from db 2025-11-10 15:36:26 +01:00
Vincent Riquer
c5815669e2 copy: use NULL in reads from db 2025-11-10 15:33:55 +01:00
11 changed files with 26 additions and 26 deletions

View File

@ -22,11 +22,11 @@ copyFiles_action() {
AND mime_type_actions.action = 2;
SELECT "AtOM:NoMoreFiles";' >&3
read -u4 line
read -u4 -d$'\0' line
while ! [[ $line = AtOM:NoMoreFiles ]]
do
copyfiles+=("$line")
read -u4 line
read -u4 -d$'\0' line
done
echo 'BEGIN TRANSACTION;' >&3

View File

@ -21,7 +21,7 @@ guessPath() {
LIMIT 1
),"0.0");
'>&3
read -u4 timestamp
read -u4 -d$'\0' timestamp
if (( ${timestamp/./} == 0 ))
then
return 2
@ -46,7 +46,7 @@ guessPath() {
LIMIT 1
),"AtOM:NotFound");
'>&3
read -u4 filename
read -u4 -d$'\0' filename
if [[ $filename != AtOM:NotFound ]]
then
echo "${filename%/*}"

View File

@ -52,12 +52,12 @@ echo '
;
SELECT "AtOM:NoMoreFiles";' >&3
read -u4 line
read -u4 -d$'\0' line
while ! [[ $line = AtOM:NoMoreFiles ]]
do
tagfiles+=("$line")
(( filecount++ ))
read -u4 line
read -u4 -d$'\0' line
done
echo 'BEGIN TRANSACTION;' >&3
for line in "${tagfiles[@]}"

View File

@ -10,7 +10,7 @@ gettaskinfos() {
FROM tasks
WHERE id='$1';
' >&3
read -u4 line
read -u4 -d$'\0' line
taskid=${line%%::AtOM:SQL:Sep::*}
rest="${line#*::AtOM:SQL:Sep::}::AtOM:SQL:Sep::"
sourcefileid=${rest%%::AtOM:SQL:Sep::*}

View File

@ -2,7 +2,7 @@
createworker() {
(( ++active ))
read -u4 line
read -u4 -d$'\0' line
taskid=${line%%::AtOM:SQL:Sep::*}
rest="${line#*::AtOM:SQL:Sep::}::AtOM:SQL:Sep::"
sourcefileid=${rest%%::AtOM:SQL:Sep::*}

View File

@ -10,7 +10,7 @@ master() {
WHERE status = 0;
'>&3
read -u4 remaining
read -u4 -d$'\0' remaining
if (( remaining == 0 ))
then
sleep 0.1
@ -108,7 +108,7 @@ master() {
LIMIT 1;
'>&3
read -u4 ready
read -u4 -d$'\0' ready
if (( ready > 0 ))
then
createworker
@ -194,7 +194,7 @@ master() {
LIMIT 1;
' >&3
read -u4 ready
read -u4 -d$'\0' ready
if (( active == 0 && ready == 0 ))
then
@ -234,7 +234,7 @@ master() {
WHERE status = 0;
'>&3
read -u4 remaining
read -u4 -d$'\0' remaining
done
fi
}

View File

@ -121,7 +121,7 @@ getdstfiles() {
;
SELECT "AtOM:NoMoreFiles";
'>&3
while read -u4 line
while read -u4 -d$'\0' line
do
if [[ $line == AtOM:NoMoreFiles ]]
then
@ -159,7 +159,7 @@ renameFile() {
fi
}
while read -u4 line
while read -u4 -d$'\0' line
do
if [[ $line == AtOM:NoMoreFiles ]]
then

View File

@ -79,7 +79,7 @@ echo 'SELECT "AtOM:NoMoreFiles";' >&3
declare -a \
destination_names \
files
read -u4 line
read -u4 -d$'\0' line
until [[ $line == AtOM:NoMoreFiles ]]
do
id=${line%%::AtOM:SQL:Sep::*}

View File

@ -274,7 +274,7 @@ fi
echo 'SELECT IFNULL(
(SELECT last_seen FROM source_files ORDER BY last_seen DESC LIMIT 1),
0);' >&3
read -u4 lastupdate
read -u4 -d$'\0' lastupdate
if ! [[ "$output" == - ]]
then
@ -369,11 +369,11 @@ COLLATE NOCASE;
SELECT "AtOM:NoMoreFiles";' >&3
read -u4 line
read -u4 -d$'\0' line
until [[ $line == AtOM:NoMoreFiles ]]
do
files+=("$line")
read -u4 line
read -u4 -d$'\0' line
done
for line in "${files[@]}"
@ -675,7 +675,7 @@ echo '
SELECT "AtOM:NoMoreFiles";' >&3
read -u4 line
read -u4 -d$'\0' line
until [[ $line == AtOM:NoMoreFiles ]]
do
artist="${line%%::AtOM:SQL:Sep::*}"
@ -685,7 +685,7 @@ do
artists+=( "$artist" )
maxcountlen=$(( ${#count} > maxcountlen ? ${#count} : maxcountlen ))
maxartistlen=$(( ${#artist} > maxartistlen ? ${#artist} : maxartistlen ))
read -u4 line
read -u4 -d$'\0' line
done
head=$(
printf "| # | %'${maxcoutlen}s | %-${maxartistlen}s |" \
@ -714,7 +714,7 @@ echo '
FROM source_files
INNER JOIN mime_types
ON source_files.mime_type=mime_types.id;' >&3
read -u4 line
read -u4 -d$'\0' line
totalcount="${line%%::AtOM:SQL:Sep::*}"
maxcountlen=$(printf "%'i" $totalcount)
maxcountlen=${#maxcountlen}
@ -743,7 +743,7 @@ do
INNER JOIN mime_types
ON source_files.mime_type=mime_types.id
WHERE mime_text LIKE "'"$format"'";' >&3
read -u4 line
read -u4 -d$'\0' line
count="${line%%::AtOM:SQL:Sep::*}"
rest="${line#*::AtOM:SQL:Sep::}::AtOM:SQL:Sep::"
size="${rest%%::AtOM:SQL:Sep::*}"

View File

@ -131,11 +131,11 @@ echo ') ORDER BY bitrate;' >&3
echo 'SELECT "AtOM:NoMoreFiles";' >&3
read -u4 line
read -u4 -d$'\0' line
until [[ $line == AtOM:NoMoreFiles ]]
do
echo "${line//::AtOM:SQL:Sep::/$'\t'}"
read -u4 line
read -u4 -d$'\0' line
done
closeDatabase

View File

@ -149,11 +149,11 @@ cat >&3 <<-EOSelect
SELECT "AtOM:NoMoreFiles";
EOSelect
read -u4 line
read -u4 -d$'\0' line
until [[ $line == AtOM:NoMoreFiles ]]
do
lines+=( "$line" )
read -u4 line
read -u4 -d$'\0' line
done
for line in "${lines[@]}"