| 47 | } |
| 48 | |
| 49 | static bool requireQuotes(const ExportCSVBindData& exportCSVBindData, const uint8_t* str, |
| 50 | uint64_t len, std::atomic<bool>& parallelFlag) { |
| 51 | // Check if the string is equal to the null string. |
| 52 | if (len == strlen(ExportCSVConstants::DEFAULT_NULL_STR) && |
| 53 | memcmp(str, ExportCSVConstants::DEFAULT_NULL_STR, len) == 0) { |
| 54 | return true; |
| 55 | } |
| 56 | for (auto i = 0u; i < len; i++) { |
| 57 | if (str[i] == ExportCSVConstants::DEFAULT_CSV_NEWLINE[0] || |
| 58 | str[i] == ExportCSVConstants::DEFAULT_CSV_NEWLINE[1]) { |
| 59 | parallelFlag.store(false, std::memory_order_relaxed); |
| 60 | return true; |
| 61 | } |
| 62 | if (str[i] == exportCSVBindData.exportOption.quoteChar || |
| 63 | str[i] == exportCSVBindData.exportOption.delimiter) { |
| 64 | return true; |
| 65 | } |
| 66 | } |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | static void writeString(BufferWriter* serializer, const ExportFuncBindData& bindData, |
| 71 | const uint8_t* strData, uint64_t strLen, bool forceQuote, std::atomic<bool>& parallelFlag) { |