| 149 | var CONCATENATIONPATTERN = "\\|\\|" |
| 150 | |
| 151 | func columnsValueConverter(value string) interface{} { |
| 152 | value = strings.ReplaceAll(value, `\\`, `\`) |
| 153 | switch { |
| 154 | case value == "": |
| 155 | return nil |
| 156 | case value == NullValue: |
| 157 | return nil |
| 158 | case value == EmptyCLOBFunction: |
| 159 | return "" |
| 160 | case value == EmptyBLOBFunction: |
| 161 | return "" |
| 162 | case strings.HasPrefix(value, FunctionHEXTORAWStart) && strings.HasSuffix(value, CommonFunctionEnd): |
| 163 | hexval, err := hex.DecodeString(value[9 : len(value)-1]) |
| 164 | if err != nil { |
| 165 | return "" |
| 166 | } |
| 167 | return hexval |
| 168 | case strings.HasPrefix(value, ToDSintervalStart) && strings.HasSuffix(value, CommonFunctionEnd): |
| 169 | return value[14 : len(value)-1] |
| 170 | case strings.HasPrefix(value, ToYMintervalStart) && strings.HasSuffix(value, CommonFunctionEnd): |
| 171 | return value[14 : len(value)-1] |
| 172 | case isUnistrFunction(value): |
| 173 | return UnitstrConvert(value) |
| 174 | case strings.HasPrefix(value, ToDateFuncStart) && strings.HasSuffix(value, ToDateFuncEnd): |
| 175 | return value[8 : len(value)-25] |
| 176 | case strings.HasPrefix(value, ToTimestampFuncStart) && strings.HasSuffix(value, CommonFunctionEnd): |
| 177 | return value[13 : len(value)-1] |
| 178 | case strings.HasPrefix(value, ToTimestampTzFuncStart) && strings.HasSuffix(value, CommonFunctionEnd): |
| 179 | return value[16 : len(value)-2] |
| 180 | // mysql no support (inf -inf nan) |
| 181 | case value == InfValue: |
| 182 | return nil |
| 183 | case value == NInfValue: |
| 184 | return nil |
| 185 | case value == NInfValue: |
| 186 | return nil |
| 187 | case value == NanValue: |
| 188 | return nil |
| 189 | } |
| 190 | |
| 191 | return value |
| 192 | } |
| 193 | |
| 194 | func isUnistrFunction(data string) bool { |
| 195 | return strings.HasPrefix(data, FunctionUNITSTRStart) && strings.HasSuffix(data, CommonFunctionEnd) |