| 91 | } |
| 92 | |
| 93 | void RawValue::PrintValue(const void* value, const ColumnType& type, int scale, |
| 94 | string* str) { |
| 95 | if (value == NULL) { |
| 96 | *str = NullLiteral(true); |
| 97 | return; |
| 98 | } |
| 99 | |
| 100 | const StringValue* string_val = NULL; |
| 101 | bool val; |
| 102 | string tmp; |
| 103 | |
| 104 | // Special case types that we can print more efficiently without using a stringstream |
| 105 | switch (type.type) { |
| 106 | case TYPE_BOOLEAN: |
| 107 | val = *reinterpret_cast<const bool*>(value); |
| 108 | *str = (val ? "true" : "false"); |
| 109 | return; |
| 110 | case TYPE_STRING: |
| 111 | case TYPE_VARCHAR: |
| 112 | string_val = reinterpret_cast<const StringValue*>(value); |
| 113 | tmp.assign(string_val->Ptr(), string_val->Len()); |
| 114 | str->swap(tmp); |
| 115 | return; |
| 116 | case TYPE_CHAR: |
| 117 | *str = string(reinterpret_cast<const char*>(value), type.len); |
| 118 | return; |
| 119 | case TYPE_TIMESTAMP: |
| 120 | *str = reinterpret_cast<const TimestampValue*>(value)->ToString(); |
| 121 | return; |
| 122 | case TYPE_DATE: |
| 123 | *str = reinterpret_cast<const DateValue*>(value)->ToString(); |
| 124 | return; |
| 125 | default: |
| 126 | break; |
| 127 | } |
| 128 | |
| 129 | stringstream out; |
| 130 | out.precision(ASCII_PRECISION); |
| 131 | |
| 132 | PrintValue(value, type, scale, &out); |
| 133 | |
| 134 | *str = out.str(); |
| 135 | } |
| 136 | |
| 137 | void RawValue::WriteNonNullPrimitive(const void* value, void* dst, const ColumnType& type, |
| 138 | MemPool* pool) { |
nothing calls this directly
no test coverage detected