tp: migrate all SQL to use CREATE PERFETTO FUNCTION syntax

Also ban any further uses of CREATE_FUNCTION in metrics/stdlib.

Change-Id: I4bc40babafbf5f805a47edeacef988b77534e504
diff --git a/tools/check_sql_modules.py b/tools/check_sql_modules.py
index f50fdbd..a576311 100755
--- a/tools/check_sql_modules.py
+++ b/tools/check_sql_modules.py
@@ -43,6 +43,28 @@
 
       res = parse_file_to_dict(path, sql)
       errors += res if isinstance(res, list) else []
+
+      # Ban the use of LIKE in non-comment lines.
+      lines = [l.strip() for l in f.readlines()]
+      for line in lines:
+        if line.startswith('--'):
+          continue
+
+        if 'like' in line.casefold():
+          errors.append('LIKE is banned in trace processor metrics. '
+                        'Prefer GLOB instead.')
+          errors.append('Offending file: %s' % path)
+
+      # Ban the use of CREATE_FUNCTION.
+      for line in lines:
+        if line.startswith('--'):
+          continue
+
+        if 'create_function' in line.casefold():
+          errors.append('CREATE_FUNCTION is deprecated in trace processor. '
+                        'Prefer CREATE PERFETTO FUNCTION instead.')
+          errors.append('Offending file: %s' % path)
+
   sys.stderr.write("\n".join(errors))
   sys.stderr.write("\n")
   return 0 if not errors else 1