Changeset: 77d51e19c7e3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/77d51e19c7e3
Modified Files:
        clients/odbc/driver/SQLConnect.c
        sql/server/sql_semantic.c
Branch: Dec2025
Log Message:

Don't convert a pointer to bool.


diffs (96 lines):

diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c
--- a/clients/odbc/driver/SQLConnect.c
+++ b/clients/odbc/driver/SQLConnect.c
@@ -134,7 +134,7 @@ makeNulTerminated(const SQLCHAR **argume
                *scratch = value;
        }
 
-       return value;
+       return value != NULL;
 }
 
 char*
diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c
--- a/sql/server/sql_semantic.c
+++ b/sql/server/sql_semantic.c
@@ -116,44 +116,48 @@ tmp_schema(mvc *sql)
 
 /* as we don't have OOP in C, I prefer a single macro with the search path 
algorithm to passing function pointers */
 #define search_object_on_path(CALL, EXTRA_CONDITION, EXTRA, ERROR_CODE, 
show_error) \
-       do { \
-               sql_schema *next = NULL; \
- \
+       do {                                                                    
                                                        \
+               sql_schema *next = NULL;                                        
                                        \
+                                                                               
                                                                \
                if (sname) { /* user has explicitly typed the schema, so either 
the object is there or we return error */ \
-                       if (!(next = mvc_bind_schema(sql, sname))) \
-                               return sql_error(sql, ERR_NOTFOUND, 
SQLSTATE(3F000) "%s: no such schema '%s'", error, sname); \
+                       if (!(next = mvc_bind_schema(sql, sname))) {            
                \
+                               sql_error(sql, ERR_NOTFOUND, SQLSTATE(3F000) 
"%s: no such schema '%s'", error, sname); \
+                               return 0;                                       
                                                        \
+                       }                                                       
                                                                \
                        EXTRA_CONDITION(EXTRA); /* for functions without 
schema, 'sys' is a valid schema to bind them */ \
-                       if (!res) { \
-                               CALL; \
-                       } \
-               } else { \
-                       sql_schema *cur = cur_schema(sql); \
-                       char *session_schema = cur->base.name; \
- \
-                       EXTRA; \
+                       if (!res) {                                             
                                                        \
+                               CALL;                                           
                                                        \
+                       }                                                       
                                                                \
+               } else {                                                        
                                                        \
+                       sql_schema *cur = cur_schema(sql);                      
                                \
+                       char *session_schema = cur->base.name;                  
                        \
+                                                                               
                                                                \
+                       EXTRA;                                                  
                                                        \
                        if (!res && !sql->schema_path_has_tmp && 
strcmp(session_schema, "tmp") != 0) { /* if 'tmp' is not in the search path, 
search it before all others */ \
-                               next = tmp_schema(sql); \
-                               CALL; \
-                       } \
-                       if (!res) { /* then current session's schema */ \
-                               next = cur; \
-                               CALL; \
-                       } \
-                       if (!res) { \
-                               /* object not found yet, look inside search 
path */ \
+                               next = tmp_schema(sql);                         
                                        \
+                               CALL;                                           
                                                        \
+                       }                                                       
                                                                \
+                       if (!res) { /* then current session's schema */         
                \
+                               next = cur;                                     
                                                        \
+                               CALL;                                           
                                                        \
+                       }                                                       
                                                                \
+                       if (!res) {                                             
                                                        \
+                               /* object not found yet, look inside search 
path */             \
                                for (node *n = sql->schema_path->h ; n && !res 
; n = n->next) { \
-                                       str p = (str) n->data; \
+                                       str p = (str) n->data;                  
                                        \
                                        if (strcmp(session_schema, p) != 0 && 
(next = mvc_bind_schema(sql, p))) \
-                                               CALL; \
-                               } \
-                       } \
+                                               CALL;                           
                                                        \
+                               }                                               
                                                                \
+                       }                                                       
                                                                \
                        if (!res && !sql->schema_path_has_sys && 
strcmp(session_schema, "sys") != 0) { /* if 'sys' is not in the current path 
search it next */ \
-                               next = mvc_bind_schema(sql, "sys"); \
-                               CALL; \
-                       } \
-               } \
-               if (!res && show_error) \
-                       return sql_error(sql, ERR_NOTFOUND, ERROR_CODE "%s: no 
such %s %s%s%s'%s'", error, objstr, sname ? "'":"", sname ? sname : "", sname ? 
"'.":"", name); \
+                               next = mvc_bind_schema(sql, "sys");             
                                \
+                               CALL;                                           
                                                        \
+                       }                                                       
                                                                \
+               }                                                               
                                                                \
+               if (!res && show_error) {                                       
                                        \
+                       sql_error(sql, ERR_NOTFOUND, ERROR_CODE "%s: no such %s 
%s%s%s'%s'", error, objstr, sname ? "'":"", sname ? sname : "", sname ? 
"'.":"", name); \
+                       return 0;                                               
                                                        \
+               }                                                               
                                                                \
        } while (0)
 
 #define table_extra \
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to