lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

syntax_test_sql.sql (2796B)


      1 -- SYNTAX TEST "Packages/SQL/SQL.sublime-syntax"
      2 
      3 SELECT 'Foo '' Bar';
      4 --           ^ constant.character.escape.sql
      5 
      6 SELECT "My "" Crazy Column Name" FROM my_table;
      7 --         ^ constant.character.escape.sql
      8 
      9 ;CREATE TABLE foo (id INTEGER PRIMARY KEY);
     10  -- <- keyword.other.create
     11 --^^^^^ keyword.other.create
     12 --      ^^^^^ keyword.other
     13 --            ^^^ entity.name.function
     14 --               ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - entity.name.function
     15 
     16 create table some_schema.test2( id serial );
     17 --^^^^ meta.create keyword.other.create
     18 --     ^^^^^ meta.create keyword.other
     19 --           ^^^^^^^^^^^^ - entity.name.function
     20 --                      ^ punctuation.accessor.dot
     21 --                       ^^^^^ entity.name.function
     22 --                            ^^^^^^^^^^^^^^ - entity.name.function
     23 
     24 create table some_schema . test2 ( id serial );
     25 --^^^^ meta.create keyword.other.create
     26 --     ^^^^^ meta.create keyword.other
     27 --           ^^^^^^^^^^^^^^ - entity.name
     28 --                       ^ punctuation.accessor.dot
     29 --                         ^^^^^ entity.name.function
     30 --                              ^^^^^^^^^^^^^^^ - entity.name.function
     31 
     32 create table "testing123" (id integer);
     33 --^^^^ meta.create keyword.other.create
     34 --     ^^^^^ meta.create keyword.other
     35 --           ^ - entity.name.function
     36 --            ^^^^^^^^^^ entity.name.function
     37 --                      ^^^^^^^^^^^^^^^^ - entity.name.function
     38 
     39 create table `dbo`."testing123" (id integer);
     40 --^^^^ meta.create keyword.other.create
     41 --     ^^^^^ meta.create keyword.other
     42 --           ^^^^^^^ - entity.name.function
     43 --                ^ punctuation.accessor.dot
     44 --                  ^^^^^^^^^^ entity.name.function
     45 --                            ^^^^^^^^^^^^^^^^ - entity.name.function
     46 
     47 select *
     48 from some_table
     49 where exists(select * from other_table where id = some_table.id)
     50 --    ^^^^^^ keyword.operator.logical
     51 
     52 SELECT
     53 (
     54 SELECT CASE field
     55 USING a
     56 -- <- keyword.other.DML
     57     WHEN 1
     58     THEN -- comment's say that
     59 --                    ^ comment.line.double-dash
     60         EXISTS(
     61         select 1)
     62     ELSE NULL
     63     END
     64 ) as result
     65 
     66 
     67 /*
     68 This is a
     69 multiline comment
     70 -- ^ source.sql comment.block.c
     71 */
     72 
     73 /**
     74     *
     75 --  ^ punctuation.definition.comment.sql
     76 */
     77 
     78 select
     79 
     80 
     81    <=>  
     82 -- ^^^ keyword.operator.comparison.sql
     83 
     84 SELECT  *,
     85 -- ^^^ keyword.other.DML.sql
     86 --      ^ variable.language.star.sql
     87         f.id AS database_id
     88 --           ^^ keyword.operator.assignment.alias.sql
     89 FROM    foo
     90 WHERE   f.a IS NULL
     91 -- ^^ keyword.other.DML.sql
     92 --          ^^ keyword.operator.logical.sql
     93 --             ^^^^ constant.language.sql
     94         AND f.b IS NOT NULL
     95 --      ^^^ keyword.operator.logical.sql
     96 --              ^^ keyword.operator.logical.sql
     97 --                 ^^^ keyword.operator.logical.sql
     98 --                     ^^^^ constant.language.sql