MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / bindPropertyDefinitions

Method bindPropertyDefinitions

src/binder/bind/bind_ddl.cpp:80–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80std::vector<PropertyDefinition> Binder::bindPropertyDefinitions(
81 const std::vector<ParsedPropertyDefinition>& parsedDefinitions, const std::string& tableName) {
82 std::vector<PropertyDefinition> definitions;
83 for (auto& def : parsedDefinitions) {
84 auto type = LogicalType::convertFromString(def.getType(), clientContext);
85 auto defaultExpr =
86 resolvePropertyDefault(def.defaultExpr.get(), type, tableName, def.getName());
87 auto boundExpr = expressionBinder.bindExpression(*defaultExpr);
88 if (boundExpr->dataType != type) {
89 expressionBinder.implicitCast(boundExpr, type);
90 }
91 auto columnDefinition = ColumnDefinition(def.getName(), std::move(type));
92 definitions.emplace_back(std::move(columnDefinition), std::move(defaultExpr));
93 }
94 validatePropertyName(definitions);
95 return definitions;
96}
97
98std::unique_ptr<ParsedExpression> Binder::resolvePropertyDefault(ParsedExpression* parsedDefault,
99 const LogicalType& type, const std::string& tableName, const std::string& propertyName) {

Callers

nothing calls this directly

Calls 8

ColumnDefinitionFunction · 0.85
validatePropertyNameFunction · 0.85
bindExpressionMethod · 0.80
implicitCastMethod · 0.80
emplace_backMethod · 0.80
getTypeMethod · 0.45
getMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected