| 39 | } |
| 40 | |
| 41 | static DataTypePtr create(const ASTPtr & arguments) |
| 42 | { |
| 43 | if (arguments && !arguments->children.empty()) |
| 44 | { |
| 45 | if (arguments->children.size() > 1) |
| 46 | { |
| 47 | throw Exception( |
| 48 | ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, |
| 49 | "String data type family mustn't have more than one argument - size in characters"); |
| 50 | } |
| 51 | |
| 52 | const auto * argument = arguments->children[0]->as<ASTLiteral>(); |
| 53 | if (!argument || argument->value.getType() != Field::Types::UInt64) |
| 54 | { |
| 55 | throw Exception( |
| 56 | ErrorCodes::UNEXPECTED_AST_STRUCTURE, "String data type family may have only a number (positive integer) as its argument"); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | return std::make_shared<DataTypeString>(); |
| 61 | } |
| 62 | |
| 63 | void registerDataTypeString(DataTypeFactory & factory) |
| 64 | { |
no test coverage detected