The SQL query is:

INSERT INTO codereviews (url, time, name, message, rid) values ('url',
'752125', 'mike', 'Log message', '31')

The PostgreSQL table is:

CREATE TABLE codereviews
(
  url text,
  id serial NOT NULL,
  "time" integer,
  "name" text,
  message text,
  rid integer,
  CONSTRAINT codereviews_pkey PRIMARY KEY (id)
)



On Feb 26, 2:31 pm, Stodge <[email protected]> wrote:
> I'm trying to load a Trac environment from a subversion plugin
> (python) and insert a record into its database. The query completes
> successfully but no new records are created. There are no errors in
> any log, including Apache, PostgreSQL or Trac. Any ideas why query
> isn't creating a new record? Thanks
>
> The code is:
>
>         env = open_environment("/srv/trac/test")
>
>         # Create the entry in the Trac environment.
>         # Generate the query.
>         query = "INSERT INTO codereviews (url, time, name, message, rid)
> values ('%s', '%s', '%s', '%s', '%s')" % \
>                                 ('url',
>                                 str(datetime.datetime.now(utc).microsecond),
>                                 author,
>                                 'Log message',
>                                 review_id)
>
>         syslog.syslog("Query = <%s>" % query)
>
>         # Perform the DB operation.
>         try:
>                 db = env.get_db_cnx()
>                 cursor = db.cursor()
>
>                 # Perform the insert.
>                 cursor.execute(query)
>
>                 syslog.syslog("Review request added to Trac")

-- 
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