You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Merge branch 'develop-1.2' into develop-merge-up-20190514
This commit is contained in:
@ -88,103 +88,6 @@ inline uint32_t tid2sid(const uint32_t tid)
|
||||
}
|
||||
|
||||
//StopWatch timer;
|
||||
int buildBuffer(uchar* buf, string& buffer, int& columns, TABLE* table)
|
||||
{
|
||||
char attribute_buffer[1024];
|
||||
String attribute(attribute_buffer, sizeof(attribute_buffer),
|
||||
&my_charset_bin);
|
||||
|
||||
std::string cols = " (";
|
||||
std::string vals = " values (";
|
||||
columns = 0;
|
||||
|
||||
for (Field** field = table->field; *field; field++)
|
||||
{
|
||||
const char* ptr;
|
||||
const char* end_ptr;
|
||||
|
||||
if ((*field)->is_null())
|
||||
ptr = end_ptr = 0;
|
||||
else
|
||||
{
|
||||
bitmap_set_bit(table->read_set, (*field)->field_index);
|
||||
(*field)->val_str(&attribute, &attribute);
|
||||
ptr = attribute.ptr();
|
||||
end_ptr = attribute.length() + ptr;
|
||||
}
|
||||
|
||||
if (columns > 0)
|
||||
{
|
||||
cols.append(",");
|
||||
vals.append(",");
|
||||
}
|
||||
|
||||
columns++;
|
||||
|
||||
cols.append((*field)->field_name.str);
|
||||
|
||||
if (ptr == end_ptr)
|
||||
{
|
||||
vals.append ("NULL");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ( (*field)->type() == MYSQL_TYPE_VARCHAR ||
|
||||
/*FIXME: (*field)->type() == MYSQL_TYPE_VARBINARY || */
|
||||
(*field)->type() == MYSQL_TYPE_VAR_STRING ||
|
||||
(*field)->type() == MYSQL_TYPE_STRING ||
|
||||
(*field)->type() == MYSQL_TYPE_DATE ||
|
||||
(*field)->type() == MYSQL_TYPE_DATETIME ||
|
||||
(*field)->type() == MYSQL_TYPE_DATETIME2 ||
|
||||
(*field)->type() == MYSQL_TYPE_TIME )
|
||||
vals.append("'");
|
||||
|
||||
while (ptr < end_ptr)
|
||||
{
|
||||
|
||||
if (*ptr == '\r')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
else if (*ptr == '\n')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
else if (*ptr == '\'' )
|
||||
{
|
||||
//@Bug 1820. Replace apostrophe with strange character to pass parser.
|
||||
vals += '\252';
|
||||
ptr++;
|
||||
}
|
||||
else
|
||||
vals += *ptr++;
|
||||
}
|
||||
|
||||
if ( (*field)->type() == MYSQL_TYPE_VARCHAR ||
|
||||
/*FIXME: (*field)->type() == MYSQL_TYPE_VARBINARY || */
|
||||
(*field)->type() == MYSQL_TYPE_VAR_STRING ||
|
||||
(*field)->type() == MYSQL_TYPE_STRING ||
|
||||
(*field)->type() == MYSQL_TYPE_DATE ||
|
||||
(*field)->type() == MYSQL_TYPE_DATETIME ||
|
||||
(*field)->type() == MYSQL_TYPE_DATETIME2 ||
|
||||
(*field)->type() == MYSQL_TYPE_TIME )
|
||||
vals.append("'");
|
||||
}
|
||||
}
|
||||
|
||||
if (columns)
|
||||
{
|
||||
cols.append(") ");
|
||||
vals.append(") ");
|
||||
buffer = "INSERT INTO ";
|
||||
buffer.append(table->s->table_name.str);
|
||||
buffer.append(cols);
|
||||
buffer.append(vals);
|
||||
}
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
uint32_t buildValueList (TABLE* table, cal_connection_info& ci )
|
||||
{
|
||||
|
Reference in New Issue
Block a user