Results 1 to 8 of 8

Thread: QSSqlQuery CREATE TRIGGER not working

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2016
    Posts
    21
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default QSSqlQuery CREATE TRIGGER not working

    Hallo

    I found some questions about it, but no realy solution.

    I try

    Qt Code:
    1. query.exec("CREATE TRIGGER UpdateCategoriesLastModifiedTime UPDATE OF categories_description, categories_title, categories_status ON categories BEGIN UPDATE categories SET last_modified=CURRENT_TIMESTAMP WHERE categories_id=categories_id END")
    To copy to clipboard, switch view to plain text mode 
    and get the Error:

    Qt Code:
    1. incomplete input Der Befehl konnte nicht ausgeführt werden"
    2. Function Name: static bool Database::open(bool) "cannot commit - no transaction is active Der Datensatz konnte nicht abgeholt werden"
    3. Function Name: static bool Database::open(bool) "END"
    4. Function Name: static bool Database::open(bool) "near \"END\": syntax error Der Befehl konnte nicht ausgeführt werden"
    To copy to clipboard, switch view to plain text mode 

    Can anyone help me?

    lg Chris

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSSqlQuery CREATE TRIGGER not working

    I think that before END You have to put char ;
    Qt Code:
    1. query.exec("CREATE TRIGGER UpdateCategoriesLastModifiedTime UPDATE OF categories_description, categories_title, categories_status ON categories "
    2. "BEGIN "
    3. " UPDATE categories SET last_modified=CURRENT_TIMESTAMP WHERE categories_id=categories_id; "
    4. "END")
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 0
    Last Post: 13th February 2016, 07:51
  2. Replies: 3
    Last Post: 2nd March 2015, 20:11
  3. Replies: 3
    Last Post: 27th December 2013, 14:43
  4. how to send sqlite query CREATE TRIGGER in qt application
    By abdul_moiz in forum Qt Programming
    Replies: 2
    Last Post: 10th June 2011, 06:07
  5. QComboBox as a trigger
    By ape in forum Newbie
    Replies: 8
    Last Post: 4th February 2008, 08:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.