HI!
I just made a post in forum, maybe shoud've post it here, sorry.
Please take a look at

multi query for postgresql

Bye the way, almost finish with support for Postgresql so, I'll post it soon!

Bye &Tnx!

CommentFileSizeAuthor
#5 webform.inc.diff1.22 KBigrcic
#4 webform.module.diff1.98 KBigrcic

Comments

ullgren’s picture

I'm aware of this issue.
One way to do it is to break it up into seperate insert statements.

Maybe it would be good to do this depending on what database beeing used ?
Currently I'm doing some work with re-designing the database structure. I can put this in.

Is ALTER TABLE table1 RENAME .... valid SQL in Postgre ?

Thanks for your work.

igrcic’s picture

yes, thats a valid sql syntax :)

ALTER TABLE table_name RENAME old_column_name TO new_column_name

I got it working on Postgre, Ill submit it this evening!

ullgren’s picture

Assigned: Unassigned » ullgren

Greate!
Maybe it's time for me to install postresql on my test machine.

igrcic’s picture

StatusFileSize
new1.98 KB

Ok here they are.

I didnt test them properly but I think everything works fine. So i can create webform with any of types, then I can fill it without problems. There is only one error when viewing as table, but I know its because of query. When i clik on table i get lots of columns because i had to add more columns in GROUP BY syntax (because of postgres). Will fix it up... have to rewrite query a bit...

igrcic’s picture

StatusFileSize
new1.22 KB

And .inc file.

following query is not yet final because it gives many columns , but at lest it doesnt throw errors!

  // Get all the submitted values for the node
  $query = 'SELECT sd.sid as sid, c.cid as cid, sd.name as name, sd.data as data'.
    ' FROM '.
    ' {webform_submitted_data} sd, {webform_component} c '.
    ' WHERE sd.nid = c.nid '.
    ' AND sd.nid = %d '.
    ' GROUP BY sd.sid, sd.name , c.cid, sd.data'.
    ' ORDER BY sd.sid, c.cid ';
igrcic’s picture

To explain module.diff a bit:
even if I wrote function for that imploded query i used one from http://drupal.org/node/18134. It seems to do its job. There was one missing t in submitted :)

   db_query("INSERT INTO {webform_submitted_data} (nid, sid, name, data) ".
-           "VALUES ".implode(', ', $sqlstring), $values);
+             "VALUES (%d, %d, '%s', '%s')", $node->nid, $sid, $key, $value);
+    }
+
 

following query gives names of columns in table:

-  $result = db_query("SHOW FIELDS FROM {webform}");

for postgresql didn't find better solution than this one:

+$result = db_query("SELECT attname as \"Field\" FROM pg_class a INNER JOIN pg_attribute b ON a.relfilenode=b.attrelid WHERE a.relname='webform' AND NOT b.attisdropped AND b.attnum>0");

Tnx to my friend dodobas for that one:)

ullgren’s picture

Changing to patch (so I remember to add it).
I'm working on changes in the database structure (http://drupal.org/node/16853) so I will add these patches after this work is done.

igrcic’s picture

and how are you going to solve that select column name query? theyre pretty different :)

ullgren’s picture

For this problem I have a patent and very secret solution, that I can not share with the open source community.

Weeeeeell ok ... if you really want to know. But I warn you ..... it's not gone be pretty when the patent office comes barging in on you.

The solution : I'll remove them and put the creation of the columns into the "updgrade webform" thingy ;-P

ullgren’s picture

Status: Needs review » Closed (fixed)

The 4.7 release should be postgresql compatible.