[tarantool-patches] Re: [PATCH v7 5/7] sql: change sqlite3AddCheckConstraint signature
Kirill Shcherbatov
kshcherbatov at tarantool.org
Fri May 25 14:53:57 MSK 2018
> 1. Renamed refactored?
sql: change sqlite3AddCheckConstraint signature
As we would store Check source expr in MsgPack we need
span instead of parsed Expr in sqlite3AddCheckConstraint.
Part of #3272.↵
> 2. This macro is not defined. You can remove it.
> 3. != 0
> 4. If 'if' body is in {}, then else must be too.
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index afb1128..50e4985 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -1022,19 +1022,19 @@ sqlite3AddPrimaryKey(Parse * pParse, /* Parsing context */
void
sql_add_check_constraint(Parse *parser, ExprSpan *span)
{
-#ifndef SQLITE_OMIT_CHECK
struct Expr *expr = span->pExpr;
Table *table = parser->pNewTable;
if (table != NULL) {
table->pCheck =
sqlite3ExprListAppend(parser, table->pCheck, expr);
- if (parser->constraintName.n) {
+ if (parser->constraintName.n != 0) {
sqlite3ExprListSetName(parser, table->pCheck,
&parser->constraintName, 1);
}
- } else
-#endif
+ } else {
sql_expr_delete(parser->db, expr, false);
+
+ }
}
/*
> 5. span parser? And the span is not parsed. You said it in the commit message:
> "we need span instead of parsed Expr".
- * @param span parser parsed expression object..
+ * @param check expression span object.
> 6. Wrap line after return type declaration.
-void sql_add_check_constraint(Parse *parser, ExprSpan *span);
+void
+sql_add_check_constraint(Parse *parser, ExprSpan *span);
More information about the Tarantool-patches
mailing list