首页 \ 问答 \ HSQL触发意外令牌NEW(HSQL Trigger unexpected token NEW)

HSQL触发意外令牌NEW(HSQL Trigger unexpected token NEW)

我有以下触发器,它来自正在运行的Oracle:

create trigger D_DOCUMENT before delete on DOCUMENT
REFERENCING NEW AS newrow OLD AS oldrow
FOR EACH ROW
BEGIN ATOMIC
    -- Further SQL
END;

现在正在HSQLDB框架中运行。 我需要添加关键字ATOMIC,但真正的关键点是这条REFERENCING NEW系列。 当我运行它时,我得到以下异常:

Caused by: org.hsqldb.HsqlException: unexpected token: NEW

看看文档我真的不明白为什么这个令牌是意外的,所以我很困惑为什么这是抱怨“新”。 注释掉该行确实会导致错误“移动”,但是语法似乎有问题,或者是我偶然发现的一些错误。

有没有人有这种类型的触发器工作? 您可以发布样本删除触发器来尝试吗?


I have the following trigger, that has been taken from an Oracle one that is working:

create trigger D_DOCUMENT before delete on DOCUMENT
REFERENCING NEW AS newrow OLD AS oldrow
FOR EACH ROW
BEGIN ATOMIC
    -- Further SQL
END;

This now being run in a HSQLDB framework. I needed to add keyword ATOMIC, however the real sticking point is this REFERENCING NEW line. When I run this I get the following exception:

Caused by: org.hsqldb.HsqlException: unexpected token: NEW

Looking at the documentation I really can't understand why this token is unexpected, so I'm confused as to why this is complaining about "NEW". Commenting out the line does get the error to 'move along', however there seems to be something wrong with either the syntax, or it's some bug I've stumbled across.

Has anyone got this type of trigger working? Can you post a sample delete trigger to try?


原文:https://stackoverflow.com/questions/36445900
更新时间:2023-12-26 22:12

最满意答案

以下演示了如何禁用/启用tagit字段。

更新了David的优化代码。

    $('#disable').click(function(){
        $('.ui-autocomplete-input').prop('disabled', true).val('');
        $('.tagit-choice').remove();
        $('.ui-widget-content').css('opacity','.2'); 
    });
    $('#enable').click(function(){
        $('.ui-widget-content').css('opacity','1');
        $('.ui-autocomplete-input').prop('disabled', false);    
    });

http://jsfiddle.net/davidThomas/j8Eg4/1/

因为您希望该字段看起来像禁用的下拉列表,所以我选择了此解决方案。 tagit支持的另一个解决方案是,如果要阻止添加标记,可以使用beforeTagAdded (function, Callback)函数。 并返回false以阻止创建新标记...

这是一个例子。

http://jsfiddle.net/j8Eg4/2/


The following demonstrates how you could disable/enable a tagit field.

Updated with David's optimized code.

    $('#disable').click(function(){
        $('.ui-autocomplete-input').prop('disabled', true).val('');
        $('.tagit-choice').remove();
        $('.ui-widget-content').css('opacity','.2'); 
    });
    $('#enable').click(function(){
        $('.ui-widget-content').css('opacity','1');
        $('.ui-autocomplete-input').prop('disabled', false);    
    });

Example

http://jsfiddle.net/davidThomas/j8Eg4/1/

Because you want the field to look like a disabled dropdown I opted for this solution. Another solution that tagit supports is if you want to stop tags from being added you can utilize the beforeTagAdded (function, Callback) function. And return false in order to stop new tags from being created...

Here is an example of that.

http://jsfiddle.net/j8Eg4/2/

相关问答

更多
  • 当列表中没有选项隐藏选择全部: $(function() { $("#select3").multipleSelect({ isopen: true, multipleWidth: 55 }); // selectAll console.log(!$('#select3 option').length); ...
  • 你想要做的是将涉及很多开销,并且实际上根本不可扩展。 无论如何,您可以使用jquery将事件绑定到输入 http://api.jquery.com/keyup/ 然后有一个ajax查询[ http://api.jquery.com/jquery.ajax/ ]这将是一个单独的服务器端脚本,从您的数据库中获取关键字。 获得ajax响应后,您将不得不将其导入tagit。 看起来链接中的文档向您展示了如何执行此操作...我之前没有使用过此脚本....看起来调用add动作就是您要查找的内容。 您需要确保当然没有重复 ...
  • 将onmousedown函数绑定到tagit-close类,该类在删除标记之前将所讨论的tagBox的ID存储到变量中。 tagsChanged-event使用onclick/onmouseup ,这意味着只有在释放鼠标按钮后才会调用它。 因此,如果您将onmousedown函数附加到标记上的“x”( x ),则可以确保在删除标记之前捕获事件。 脚本(样机) var deletedTagsBox = ""; //global variable $(". ...
  • 试一试,直到您在文档中找到“禁用”或“禁用” var cityOptions = { token: '51dfe5d42fb2b43e3300006e', key: '86a2c2a06f1b2451a87d05512cc2c3edfdf41969', type: $.ui.kladrObjectType.CITY } $function() { $("#country").on("change",function() { if ($(this).val()=="Russ ...
  • 这似乎工作正常(基本上是从网站上得到它),可能需要一些样式来得到它你想要它。 也不确定你的数据来自哪里,但他们也有一些ajax例子。 无论如何,将以下内容另存为.html文档作为示例。