diff options
author | Andrejs Kozlovs <andrejs.kozlovs@zabbix.com> | 2020-11-02 18:29:56 +0300 |
---|---|---|
committer | Andrejs Kozlovs <andrejs.kozlovs@zabbix.com> | 2021-01-13 18:04:33 +0300 |
commit | d11e920cd7733444e962320ae236df85a5e65f47 (patch) | |
tree | 5cb02cab77fa66cb2c29342d103f98c3c49b2174 /misc | |
parent | 91237050885d4da50fe516a96e9e4a4be43d4cd8 (diff) |
....I..... [ZBXNEXT-6285] minor change
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/images/png_to_sql.sh | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/misc/images/png_to_sql.sh b/misc/images/png_to_sql.sh index 08ca657cd2f..ddaa239a91f 100755 --- a/misc/images/png_to_sql.sh +++ b/misc/images/png_to_sql.sh @@ -15,6 +15,7 @@ imagefile_oracle="$sqlbasedir/oracle/$imagefile" oracle_sring_max=2048 oracle_line_max=15 +base64tmp=tmp_b64 for imagefile in "$imagefile_mysql" "$imagefile_pgsql" "$imagefile_sqlite3" "$imagefile_oracle"; do [[ -s "$imagefile" ]] && { @@ -35,9 +36,9 @@ for imagefile in $pngdir/*.png; do ((imagesdone++)) imagename="$(basename "${imagefile%.png}")" image_data=$(hexdump -ve '"" 1/1 "%02X"' "$imagefile") - base64 -w$oracle_sring_max "$imagefile" > tmp_b64 - split -l$oracle_line_max tmp_b64 tmp_b64 - rm -rf tmp_b64 + base64 -w$oracle_sring_max "$imagefile" > $base64tmp + split -l$oracle_line_max $base64tmp $base64tmp + rm -rf $base64tmp # ----- MySQL echo "INSERT INTO \`images\` (\`imageid\`,\`imagetype\`,\`name\`,\`image\`) VALUES ($imagesdone,1,'$imagename',0x$image_data);" >> "$imagefile_mysql" @@ -45,7 +46,7 @@ for imagefile in $pngdir/*.png; do echo "INSERT INTO images (imageid,imagetype,name,image) VALUES ($imagesdone,1,'$imagename',decode('$image_data','hex'));" >> "$imagefile_pgsql" # ----- Oracle echo -e "\tl_clob := EMPTY_CLOB();" >> "$imagefile_oracle" - for oracle_imagefile in tmp_b64*; do + for oracle_imagefile in $base64tmp*; do image_data_oracle=$(cat "$oracle_imagefile") echo -e "\tl_clob := l_clob || '$image_data_oracle';" >> "$imagefile_oracle" rm -rf $oracle_imagefile |