Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/create
diff options
context:
space:
mode:
authorJurijs Klopovskis <jurijs.klopovskis@zabbix.com>2021-11-11 23:21:58 +0300
committerJurijs Klopovskis <jurijs.klopovskis@zabbix.com>2021-11-11 23:46:46 +0300
commitc544d4dff606bf85fb3abcd006382b43589e1727 (patch)
tree3c991e16d5be2c7ffe7602e92bac5d7129a0e1eb /create
parent5288d696f61fe1d7d645d3d753755f957f8fc12a (diff)
.......... [ZBXNEXT-3706] exporting default empty text field values into data.tmpl if ZBX_NODATA flag is set
Diffstat (limited to 'create')
-rwxr-xr-xcreate/bin/export_data.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/create/bin/export_data.sh b/create/bin/export_data.sh
index b10c7d4e052..b9ebc878c90 100755
--- a/create/bin/export_data.sh
+++ b/create/bin/export_data.sh
@@ -47,20 +47,30 @@ for tbl_line in `grep "^TABLE.*${dbflag}" "${schema}"`; do
refs=()
depth=()
- for fld_line in `sed -n "/^TABLE|${table}|/,/^$/ p" "${schema}" | grep "^FIELD" | grep -v "ZBX_NODATA" | sed 's/[ \t]//g'`; do
+ for fld_line in `sed -n "/^TABLE|${table}|/,/^$/ p" "${schema}" | grep "^FIELD" | sed 's/[ \t]//g'`; do
fld_line=${fld_line#*|} # FIELD
field=${fld_line%%|*}
fld_line=${fld_line#*|} # <field_name>
+ field_type=${fld_line%%|*}
fld_line=${fld_line#*|} # <field_type>
fld_line=${fld_line#*|} # <default>
fld_line=${fld_line#*|} # <not_null>
+ flags=${fld_line%%|*}
fld_line=${fld_line#*|} # <flags>
fld_line=${fld_line#*|} # <index #>
ref_table=${fld_line%%|*}
fld_line=${fld_line#*|} # <ref_table>
ref_field=${fld_line%%|*}
- fields="${fields}${delim}replace(replace(replace(${field},'|','&pipe;'),'\r\n','&eol;'),'\n','&bsn;') as ${field}"
+ if [[ "$flags" =~ ZBX_NODATA ]]; then
+ if [[ "$field_type" =~ ^t_(shorttext|text|longtext)$ ]]; then
+ fields="${fields}${delim} '' as ${field}"
+ else
+ continue
+ fi
+ else
+ fields="${fields}${delim}replace(replace(replace(${field},'|','&pipe;'),'\r\n','&eol;'),'\n','&bsn;') as ${field}"
+ fi
delim=','
if [[ ${ref_table} == ${table} ]]; then