Попытка создать дерево каталогов / файлов в SQLite с Java,
Я пытался адаптировать эту статью:
http://www.developerfusion.com/article/4633/tree-structures-in-aspnet-and-sql-server/2/
в jdbc и sqlite.
Я создал эту таблицу так, как предлагает статья:
CREATE TABLE IF NOT EXISTS dfTree (id INTEGER,
parentId INTEGER, name VARCHAR(20),
depth INTEGER, lineage VARCHAR(100))
Однако, когда я пытаюсь создать следующий триггер:
CREATE TRIGGER dfTree_InsertTrigger ON dfTree
FOR INSERT AS
UPDATE child
-- set the depth of this "child" to be the
-- depth of the parent, plus one.
SET depth = ISNULL(parent.depth + 1,0),
-- the lineage is simply the lineage of the parent,
-- plus the child's ID (and appropriate '/' characters
lineage = ISNULL(parent.lineage,'/') + LTrim(Str(child.id)) + '/'
-- we can't update the "inserted" table directly,
-- so we find the corresponding child in the
-- "real" table
FROM dfTree child INNER JOIN inserted i ON i.id=child.id
-- now, we attempt to find the parent of this
-- "child" - but it might not exist, so these
-- values may well be NULL
LEFT OUTER JOIN dfTree parent ON child.parentId=parent.id
Я получаю исключение sql.
Этот триггер не совместим с sqlite?