Home Download Buy Blog Forum Support

SQL syntax highlighting for /' in string

SQL syntax highlighting for /' in string

Postby hansin on Mon Jun 27, 2011 5:52 pm

I am seeing an issue where I am putting a Windows path in a single quote string and because it ends with a backslash, Sublime Text thinks I want to escape that closing single quote:

--> ELSE 'C:\AltiumLibraries\Footprints\' + Replace(mp.footprint_ref,'.','_') + '.PcbLib'

The problem is, this then screws up the syntax highlighting for the rest of the file. I have searched and it appears that the SQL standard for escaping a single quote is doing a double single quote ('') and not backslash quote (\'). From what I have read, MySQL does not follow the standard here; I am using SQL Server.

Does anyone know where in the SQL definition file I can change this and what I would change? I might just copy the original and then make a version for SQL Server. Would I change the file in the install directory or my user specific Application Data directory? Also, do I change the Prestine Packages file (I assume not) or the files just in Packages?

Thanks for any help or pointers.

H
hansin
 
Posts: 3
Joined: Mon Jun 27, 2011 5:42 pm

Re: SQL syntax highlighting for /' in string

Postby hansin on Mon Jun 27, 2011 5:58 pm

As a work around, I am current using this:

--> ELSE 'C:\AltiumLibraries\Footprints' + CHAR(92) + Replace(mp.footprint_ref,'.','_') + '.PcbLib'
hansin
 
Posts: 3
Joined: Mon Jun 27, 2011 5:42 pm

Re: SQL syntax highlighting for /' in string

Postby hansin on Mon Jun 27, 2011 7:06 pm

Yeah, from what I have read, MySQL operates differently than many others. Don't quote me on it, but what I have read seems to indicate that '' is the SQL standard vs. \', and MySQL goes its own way here. Of course, MySQL is probably used quite a bit by Sublime Text users, so I get the need to make it work for that. Your same select in SQL Server (using single quotes vs. double quotes, as double quotes are reserved for column names) gives me: C:\mofo\\

So yeah, there is a difference. No big deal I suppose; I created a work around. But thought it was worth mentioning what I found.
hansin
 
Posts: 3
Joined: Mon Jun 27, 2011 5:42 pm

Re: SQL syntax highlighting for /' in string

Postby tgkeul on Mon Jun 27, 2011 8:39 pm

I build my own SQL tmLanguage file for ST1 as I have to program in PL/SQL from Oracle. It now supports the requirements of my company.

I did it more verbose but simpler than the given SQl.tmLanguage file. It is fast enough on my 7 year old machine.
Code: Select all
      <key>strings</key>
      <dict>
        <key>patterns</key>
        <array>
          <dict>
            <key>name</key>
            <string>string.quoted.single.plsql</string>
            <key>begin</key>
            <string>'</string>
            <key>end</key>
            <string>'</string>
          </dict>
          <dict>
            <key>name</key>
            <string>string.quoted.double.plsql</string>
            <key>begin</key>
            <string>"</string>
            <key>end</key>
            <string>"</string>
          </dict>
          <dict>
            <key>name</key>
            <string>string.quoted.other.single.plsql</string>
            <key>begin</key>
            <string>(?i)N'</string>
            <key>end</key>
            <string>'</string>
          </dict>
          <dict>
            <key>name</key>
            <string>string.quoted.other.double.plsql</string>
            <key>begin</key>
            <string>(?i)N"</string>
            <key>end</key>
            <string>"</string>
          </dict>
        </array>
      </dict>
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm

Re: SQL syntax highlighting for /' in string

Postby jbjornson on Tue Jun 28, 2011 8:27 am

tgkeul wrote:I build my own SQL tmLanguage file ...


This is a bit off topic, but there are some existing resources available for Oracle PL SQL (including syntax highlighting) here: http://code.google.com/p/oracle-textmate-bundle/.

I personally only use the syntax highlighting (http://oracle-textmate-bundle.googlecode.com/svn/trunk/Oracle.tmbundle/Syntaxes/PL:SQL%20%28Oracle%29.tmLanguage), but the other resources might also be useful.
jbjornson
 
Posts: 353
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 23 guests