I've found the error actually the syntax has to be like this :
        env = self.env
        @with_transaction(env)
        def do_something(db):
            cursor = db.cursor()
            cursor.execute("delete from ticket where id>1")
you've guessed it :)

Thanks for your help !




2012/9/25 Cooke, Mark <[email protected]>

> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of Cybernium
> > Sent: 25 September 2012 12:48
> > To: [email protected]
> > Subject: [Trac] Accessing and editing SQlite database
> >
> > Hi everybody,
> > I'm trying to develop a plugin ...which access al the defined
> > databases in my trac such as ticket, ticket_custom and a lot
> > of other tables !
> > I can access them ...and do all the query stuff of sql but I
> > can't edit them ! I was trying this code as example :
> >
> >         env = self.env
> >         @with_transaction(env)
> >         def do_something(db):
> >             cursor = db.cursor()
> >             cursor.execute("delete description from ticket
> > with id='162' ;")
> >             # I've tried "delete * from ticket ;"
> >
> > I get this error :
> >
> >      Trac detected an internal error:
> >    OperationalError: near "description": syntax error
> >
> > Any idea ?
>
> Lots but you do not explain exactly what you are trying to do.  `Delete`
> is to remove a whole row (record).  It should probably be `where` instead
> of `with`.
>
> However, first I suggest you look at the docs (assuming you are writing a
> plugin for current trac):-
>
> http://trac.edgewall.org/wiki/TracDev/DataModels#Ticket
>
> http://trac.edgewall.org/wiki/TracDev/DatabaseSchema/TicketSystem
>
> ~ mark c
>
> --
> You received this message because you are subscribed to the Google Groups
> "Trac Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/trac-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

Reply via email to