sql: rework sqlExpr to set diag
Refactored sqlExpr routine as sql_expr_new and reworked it to set diag message in case of memory allocation error. Also performed some additional name refactoring in adjacent places. This change is necessary because the sqlExpr body has a sqlNormalizeName call that will be changed in subsequent patches. After that patch there are basically 2 ways of errors processing and forwarding: - Use diag only. It works for all the places out of src/box/sql, and for some functions inside it. For example, sql_expr_new(); - Use global flags Parse.is_aborted, sql.mallocFailed. It is easy to see, that some places use both of them implicitly. For example, sql_expr_new() and every other place which uses SQLite memory allocators + diag. But it is ok until the former is removed. What is more important, is that at least one of these two methods should be consistent and finished in every functions. And match a declared behaviour. For example, it is incorrect to declare a function as setting flags on an error, but in fact set diag only. Or vice versa, that it throws a diag, but factually sets flags only. Part of #3931
Showing
- src/box/sql/build.c 26 additions, 17 deletionssrc/box/sql/build.c
- src/box/sql/expr.c 96 additions, 148 deletionssrc/box/sql/expr.c
- src/box/sql/fk_constraint.c 101 additions, 89 deletionssrc/box/sql/fk_constraint.c
- src/box/sql/parse.y 41 additions, 10 deletionssrc/box/sql/parse.y
- src/box/sql/resolve.c 22 additions, 24 deletionssrc/box/sql/resolve.c
- src/box/sql/select.c 53 additions, 30 deletionssrc/box/sql/select.c
- src/box/sql/sqlInt.h 86 additions, 5 deletionssrc/box/sql/sqlInt.h
- src/box/sql/wherecode.c 4 additions, 1 deletionsrc/box/sql/wherecode.c
- src/box/sql/whereexpr.c 13 additions, 8 deletionssrc/box/sql/whereexpr.c
Loading
Please register or sign in to comment