Changeset: c91ef600a483 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c91ef600a483 Branch: Jul2021 Log Message:
merged diffs (217 lines): diff --git a/misc/python/create_include_object.py.in b/misc/python/create_include_object.py.in --- a/misc/python/create_include_object.py.in +++ b/misc/python/create_include_object.py.in @@ -81,15 +81,13 @@ def mal2c(content): def sql2c(content): comment_or_empty = re.compile('^[ \t]*(--|#|$)') comment = re.compile(r'/\*.*?\*/|--.*') - space = re.compile('[ \t]+') c_array = [] length = 0 for line in content.split('\n'): if comment_or_empty.match(line): continue line = comment.sub('', line) - line = space.sub(' ', line) - line = line.strip() + line = line.rstrip() if line.startswith('include '): continue if not line: @@ -112,7 +110,6 @@ def create_c_sourcefile(srcfile, lang, m def copy2c(content): return ",".join(str(ord(c)) for c in content) + "," - def txt2c(content, sql): buffer = bytearray() @@ -183,7 +180,6 @@ def txt2c(content, sql): #return buffer return buffer_as_string - def main(): parser = argparse.ArgumentParser() parser.add_argument("name", help="The name of the module to convert") diff --git a/sql/scripts/23_skyserver.sql b/sql/scripts/23_skyserver.sql --- a/sql/scripts/23_skyserver.sql +++ b/sql/scripts/23_skyserver.sql @@ -10,15 +10,15 @@ BEGIN DECLARE res varchar(32), aux varchar(32); DECLARE ofset int; - IF ( st < 0 or st > LENGTH(s1)) - THEN RETURN ''; - END IF; + IF ( st < 0 or st > LENGTH(s1)) + THEN RETURN ''; + END IF; - SET ofset = 1; - SET res = SUBSTRING(s1,ofset,st-1); - SET res = res || s3; - SET ofset = st + len; - SET aux = SUBSTRING(s1,ofset,LENGTH(s1)-ofset+1); + SET ofset = 1; + SET res = SUBSTRING(s1,ofset,st-1); + SET res = res || s3; + SET ofset = st + len; + SET aux = SUBSTRING(s1,ofset,LENGTH(s1)-ofset+1); SET res = res || aux; RETURN res; END; @@ -45,7 +45,7 @@ grant execute on function MS_ROUND to pu CREATE FUNCTION MS_STR(num float, prc int, truncat int) RETURNS string BEGIN - RETURN CAST(num as string); + RETURN CAST(num as string); END; grant execute on function MS_STR to public; diff --git a/sql/scripts/52_describe.sql b/sql/scripts/52_describe.sql --- a/sql/scripts/52_describe.sql +++ b/sql/scripts/52_describe.sql @@ -537,11 +537,11 @@ END; CREATE FUNCTION sys.describe_function(schemaName string, functionName string) RETURNS TABLE(id integer, name string, type string, language string, remark string) BEGIN - RETURN SELECT f.id, f.name, ft.function_type_keyword, fl.language_keyword, c.remark - FROM sys.functions f - JOIN sys.schemas s ON f.schema_id = s.id - JOIN sys.function_types ft ON f.type = ft.function_type_id - LEFT OUTER JOIN sys.function_languages fl ON f.language = fl.language_id - LEFT OUTER JOIN sys.comments c ON f.id = c.id - WHERE f.name=functionName AND s.name = schemaName; + RETURN SELECT f.id, f.name, ft.function_type_keyword, fl.language_keyword, c.remark + FROM sys.functions f + JOIN sys.schemas s ON f.schema_id = s.id + JOIN sys.function_types ft ON f.type = ft.function_type_id + LEFT OUTER JOIN sys.function_languages fl ON f.language = fl.language_id + LEFT OUTER JOIN sys.comments c ON f.id = c.id + WHERE f.name=functionName AND s.name = schemaName; END; diff --git a/sql/scripts/76_dump.sql b/sql/scripts/76_dump.sql --- a/sql/scripts/76_dump.sql +++ b/sql/scripts/76_dump.sql @@ -145,13 +145,13 @@ CREATE FUNCTION sys.esc(s STRING) RETURN CREATE FUNCTION sys.prepare_esc(s STRING, t STRING) RETURNS STRING BEGIN - RETURN - CASE - WHEN (t = 'varchar' OR t ='char' OR t = 'clob' OR t = 'json' OR t = 'geometry' OR t = 'url') THEN - 'CASE WHEN ' || sys.DQ(s) || ' IS NULL THEN ''null'' ELSE ' || 'sys.esc(' || sys.DQ(s) || ')' || ' END' - ELSE - 'CASE WHEN ' || sys.DQ(s) || ' IS NULL THEN ''null'' ELSE CAST(' || sys.DQ(s) || ' AS STRING) END' - END; +RETURN + CASE + WHEN (t = 'varchar' OR t ='char' OR t = 'clob' OR t = 'json' OR t = 'geometry' OR t = 'url') THEN + 'CASE WHEN ' || sys.DQ(s) || ' IS NULL THEN ''null'' ELSE ' || 'sys.esc(' || sys.DQ(s) || ')' || ' END' + ELSE + 'CASE WHEN ' || sys.DQ(s) || ' IS NULL THEN ''null'' ELSE CAST(' || sys.DQ(s) || ' AS STRING) END' + END; END; --The dump statement should normally have an auto-incremented column representing the creation order. @@ -163,8 +163,8 @@ CREATE TABLE sys.dump_statements(o INT, CREATE PROCEDURE sys._dump_table_data(sch STRING, tbl STRING) BEGIN - DECLARE k INT; - SET k = (SELECT MIN(c.id) FROM sys.columns c, sys.tables t WHERE c.table_id = t.id AND t.name = tbl); + DECLARE k INT; + SET k = (SELECT MIN(c.id) FROM sys.columns c, sys.tables t WHERE c.table_id = t.id AND t.name = tbl); IF k IS NOT NULL THEN DECLARE cname STRING; @@ -206,7 +206,7 @@ END; CREATE PROCEDURE sys.dump_table_data() BEGIN DECLARE i INT; - SET i = (SELECT MIN(t.id) FROM sys.tables t, sys.table_types ts WHERE t.type = ts.table_type_id AND ts.table_type_name = 'TABLE' AND NOT t.system); + SET i = (SELECT MIN(t.id) FROM sys.tables t, sys.table_types ts WHERE t.type = ts.table_type_id AND ts.table_type_name = 'TABLE' AND NOT t.system); IF i IS NOT NULL THEN DECLARE M INT; diff --git a/sql/scripts/81_tracer.sql b/sql/scripts/81_tracer.sql --- a/sql/scripts/81_tracer.sql +++ b/sql/scripts/81_tracer.sql @@ -8,39 +8,39 @@ CREATE SCHEMA logging; -- Flush the buffer CREATE PROCEDURE logging.flush() - EXTERNAL NAME logging.flush; + EXTERNAL NAME logging.flush; -- Sets the log level for a specific component CREATE PROCEDURE logging.setcomplevel(comp_id STRING, lvl_id STRING) - EXTERNAL NAME logging.setcomplevel; + EXTERNAL NAME logging.setcomplevel; -- Resets the log level for a specific component back to the default CREATE PROCEDURE logging.resetcomplevel(comp_id STRING) - EXTERNAL NAME logging.resetcomplevel; + EXTERNAL NAME logging.resetcomplevel; -- Sets the log level for a specific layer CREATE PROCEDURE logging.setlayerlevel(layer_id STRING, lvl_id STRING) - EXTERNAL NAME logging.setlayerlevel; + EXTERNAL NAME logging.setlayerlevel; -- Resets the log level for a specific layer back to the default CREATE PROCEDURE logging.resetlayerlevel(layer_id STRING) - EXTERNAL NAME logging.resetlayerlevel; + EXTERNAL NAME logging.resetlayerlevel; -- Sets the flush level CREATE PROCEDURE logging.setflushlevel(lvl_id STRING) - EXTERNAL NAME logging.setflushlevel; + EXTERNAL NAME logging.setflushlevel; -- Resets the flush level back to the default CREATE PROCEDURE logging.resetflushlevel() - EXTERNAL NAME logging.resetflushlevel; + EXTERNAL NAME logging.resetflushlevel; -- Sets the adapter CREATE PROCEDURE logging.setadapter(adapter_id STRING) - EXTERNAL NAME logging.setadapter; + EXTERNAL NAME logging.setadapter; -- Resets the adapter back to the default CREATE PROCEDURE logging.resetadapter() - EXTERNAL NAME logging.resetadapter; + EXTERNAL NAME logging.resetadapter; -- Returns in the form of a SQL result-set all the -- components along with their ID and their current diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -1121,9 +1121,8 @@ cs_update_bat( sql_trans *tr, column_sto else { BATsetcount(ins, ucnt); /* all full updates */ msk = (int*)Tloc(ins, 0); - int end = (int) ((ucnt+31)/32); - for (int i=0; i<end; i++) - msk[i] = 0; + BUN end = (ucnt+31)/32; + memset(msk, 0, end * sizeof(int)); } } for (oid i = 0, rid = start; rid < lend && res == LOG_OK; rid++, i++) { @@ -1165,9 +1164,8 @@ cs_update_bat( sql_trans *tr, column_sto } else { BATsetcount(ins, ucnt); /* all full updates */ msk = (int*)Tloc(ins, 0); - int end = (int) ((ucnt+31)/32); - for (int i=0; i<end; i++) - msk[i] = 0; + BUN end = (ucnt+31)/32; + memset(msk, 0, end * sizeof(int)); } } ptr upd = BUNtail(upi, i); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list