bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Error in SQL parsing?


From: Mickey Ferguson
Subject: Error in SQL parsing?
Date: Wed, 31 Oct 2001 09:44:48 -0800

I'm no SQL expert, but when I load the following into emacs (version 20.6 on
nt 4.0 sp6a), the highlighting is incorrect.  The problem appears to be the
'\' is treating the backslash (\) as an escape character, when in fact it is
not.  (From what I was told, and then going from memory on top of that, the
backslash is an escape character for error handling sections, for things
like \n to produce a newline, stuff like that.  But it's a perfectly valid
character inside a string.

If I were to change the '\' to a '\\', emacs parses it and highlights it
properly.

I looked at the date/time of sql.el, found in the lisp/progmodes folder, and
it is Jun 16  1999, and inside the file it says it is version 1.4.5.  Is
this problem fixed in a newer version?

========================================

create procedure msmq_create_device_6
    (@ISQLPath              varchar(255),
     @DeviceName            varchar(255),
     @DeviceDirectory       varchar(255),
     @DeviceSize            int,
     @CANNOT_CREATE_DEVICE  int,
     @DEVICE_EXISTS         int,
     @DEVICE_IN_USE         int,
     @FILE_EXISTS           int
     )
as

    declare @DeviceAlreadyUsed bit
    select @DeviceAlreadyUsed = 0
    select @DeviceAlreadyUsed = 1
        from sysusages
        where vstart between
            (select low from sysdevices where name = @DeviceName) and
            (select high from sysdevices where name = @DeviceName)
    if (@DeviceAlreadyUsed = 1)
    begin
        return(@DEVICE_IN_USE)
    end

    declare @DeviceExists bit
    select @DeviceExists = 0
    select @DeviceExists = 1
        from sysdevices
        where name = @DeviceName
    if (@DeviceExists = 1)
    begin
        return(@DEVICE_EXISTS)
    end

    declare @DevicePath varchar(255)
    select @DevicePath = @DeviceDirectory + '\' + @DeviceName + '.dat'
    declare @Command varchar(255)
    select @Command = 'dir ' + @DevicePath
    declare @DirectoryResult int
    execute @DirectoryResult = xp_cmdshell @Command, no_output
    if (@DirectoryResult = 0)
    begin
        return(@FILE_EXISTS)
    end

    declare @VirtualDeviceNum int
    select @VirtualDeviceNum = 0
    select @VirtualDeviceNum = (min(low)/0x01000000)+1
        from sysdevices SysDevices1
        where low/0x01000000 between 0 and 254
        and not exists
            (select * from sysdevices SysDevices2
                where SysDevices2.low/0x01000000 =
(SysDevices1.low/0x01000000)+1)
    if (@VirtualDeviceNum = 0)
    begin
        return(185)
    end

    select @Command =
        @ISQLPath + ' -E -d master -Q "EXIT(' +
            'disk init' +
                ' name = ' + @DeviceName +
                ', physname = ''' + @DevicePath + '''' +
                ', size = ' + convert(varchar(8), @DeviceSize * 512) +
                ', vdevno = ' + convert(varchar(3), @VirtualDeviceNum) +
')"'
    declare @DeviceCreated int
    execute @DeviceCreated = xp_cmdshell @Command, no_output

    if (@DeviceCreated <> 0)
    begin
        select @Command = 'del ' + @DevicePath
        execute xp_cmdshell @Command, no_output
        return(@CANNOT_CREATE_DEVICE)
    end

    return(1)
go




reply via email to

[Prev in Thread] Current Thread [Next in Thread]