Qinnn / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

SQL highlighter : Inbuilt functions are not highlighted #323

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Add 
https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?lang=sql&
skin=default reference
2. write pre tag and SQL procedure code, which uses functions like MAX(), ADD() 
etc.

(Please include HTML, not just your source code)
<?prettify lang="sql" ?>

            <pre class="prettyprint lang-sql linenums">

            USE AdventureWorks2008R2;
                GO
                IF OBJECT_ID ( 'Production.uspGetList', 'P' ) IS NOT NULL 
                    DROP PROCEDURE Production.uspGetList;
                GO
                CREATE PROCEDURE Production.uspGetList @Product varchar(40) 
                    , @MaxPrice money 
                    , @ComparePrice money OUTPUT
                    , @ListPrice money OUT
                AS
                    SET NOCOUNT ON;
                    SELECT p.[Name] AS Product, p.ListPrice AS 'List Price'
                    FROM Production.Product AS p
                    JOIN Production.ProductSubcategory AS s 
                      ON p.ProductSubcategoryID = s.ProductSubcategoryID
                    WHERE s.[Name] LIKE @Product AND p.ListPrice < @MaxPrice;
                -- Populate the output variable @ListPprice.
                SET @ListPrice = (SELECT MAX(p.ListPrice)
                        FROM Production.Product AS p
                        JOIN  Production.ProductSubcategory AS s 
                          ON p.ProductSubcategoryID = s.ProductSubcategoryID
                        WHERE s.[Name] LIKE @Product AND p.ListPrice < @MaxPrice);
                -- Populate the output variable @compareprice.
                SET @ComparePrice = @MaxPrice;
GO

            </pre>

What is the expected output?  What do you see instead?
After the page is rendered, the SQL functions along with its key words gets 
highligheted

What version are you using?  On what browser?
I'm using firefox 25.0.1

Please provide any additional information below.

Original issue reported on code.google.com by titans.s...@gmail.com on 23 Dec 2013 at 4:16

GoogleCodeExporter commented 8 years ago
I'm running into the same issue with my SQL. It's not picking up keywords or 
some column types:

For example, CREATE TABLE foo (new_col int, new_new_col varchar(100));

CREATE TABLE isn't treated like a keyword, it is formatted as plaintext. 
varchar is also overlooked. It is also tagged as plaintext. I've confirmed this 
by playing with the CSS.

I've attached my output. Also, I'm serving my own via css.

Original comment by cxstar...@gmail.com on 17 Feb 2015 at 10:55

Attachments: