By cjm on
i'm running postgres for the db and want to use the webform module.
unfortunately it seems to be using some mysql specific calls, ie:
$result = db_query("SHOW FIELDS FROM {webform}");
can anyone help me to get this compatible with postgres?
if put the whole function below for reference:
/**
* _webform_database_lazy_update - Lazy field adder for extra email fields
* The lazy update function adds any columns in the database that are not
* listed in its internal magic array.
* It was purpose constructed to add fields 'email_from' and 'email_subject' as part of the
* enhanced email patch.
* The function does not add or delete any data and the upgraded database is backwardly
* compatible with previous versions of webform.module
*/
function _webform_database_lazy_update() {
$lazy_update_output = '';
$field_list = '';
$table_altered = false;
// {webform}
$required_fields = array('nid' => false,'confirmation' => false,'email' => false,'email_from' => false,'email_subject' => false);
$result = db_query("SHOW FIELDS FROM {webform}");
// Mark fields that exist in table as true
while ($record = db_fetch_object($result)){
$required_fields[$record->Field] = true;
}
foreach($required_fields as $field_name => $required_field){
if(!$required_field){
// Field does not exist so we need to create it.
switch($field_name){
case 'email_subject': // Contains the component name of the source field for the email subject
case 'email_from': // Contains the component name of the source field for the email from address.
db_query("ALTER TABLE {webform} ADD COLUMN %s varchar(255)",$field_name);
$table_altered = true;
$field_list .= " $field_name ";
break;
default:
}
}
}
if($table_altered){
$lazy_update_output = 'Database {webform} updated. Fields added: ' . $field_list;
watchdog('webform',$lazy_update_output, WATCHDOG_NOTICE);
}
return $lazy_update_output;
}
Comments
other stuff
sorry, it looks like this module is incompatible with postgres in other ways too.
no one wants to rewrite it do they?? :)