From b7a01ce02ea4c04af6c0822eff266ca04c46f32f Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Thu, 23 Mar 2017 14:04:14 +0000 Subject: [PATCH] MCOL-267 Add blob support for INSERT_SELECT * Note there is a 1MB buffer limit, rows longer than 512KB will fail (2x due to hex of blob data) * cpimport needs to use hex of blob data --- dbcon/mysql/ha_calpont_dml.cpp | 43 ++++++++++++++++++++++++++++++ writeengine/bulk/we_columninfo.cpp | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/dbcon/mysql/ha_calpont_dml.cpp b/dbcon/mysql/ha_calpont_dml.cpp index e92a76e09..d95a6b053 100755 --- a/dbcon/mysql/ha_calpont_dml.cpp +++ b/dbcon/mysql/ha_calpont_dml.cpp @@ -1585,6 +1585,49 @@ int ha_calpont_impl_write_batch_row_(uchar *buf, TABLE* table, cal_impl_if::cal_ buf += ci.columnTypes[colpos].colWidth; break; } + case CalpontSystemCatalog::BLOB: + { + int dataLength = 0; + uintptr_t *dataptr; + uchar *ucharptr; + + if (ci.columnTypes[colpos].colWidth < 256) + { + dataLength = *(int8_t*) buf; + buf++; + } + else if (ci.columnTypes[colpos].colWidth < 65535) + { + dataLength = *(int16_t*) buf; + buf = buf + 2 ; + } + else if (ci.columnTypes[colpos].colWidth < 16777216) + { + dataLength = *(int32_t*) buf; + buf = buf + 3 ; + } + else + { + dataLength = *(int32_t*) buf; + buf = buf + 4 ; + } + + // buf contains pointer to blob, for example: + // (gdb) p (char*)*(uintptr_t*)buf + // $43 = 0x7f68500c58f8 "hello world" + + dataptr = (uintptr_t*)buf; + ucharptr = (uchar*)*dataptr; + buf+= sizeof(uintptr_t); + for (int32_t i=0; igetImportDataMode() == IMPORT_DATA_TEXT)) { #ifdef PROFILE