Closed (fixed)
Project:
SMS Gateway
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Oct 2006 at 17:22 UTC
Updated:
1 Nov 2006 at 15:00 UTC
Greetings,
First of all thanks a lot for smsgateway.module. I have found that there is no PostgreSQL support and MySQL installation is not included into install file. I propose you the following source code to add PostgreSQL support and move MySQL installation (to get rid of smsgateway.mysql script).
function smsgateway_install()
{
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret1 = db_query('
CREATE TABLE {smslog} (
sid int(10) NOT NULL auto_increment,
direction varchar(3) NOT NULL,
number varchar(20) NOT NULL,
message text default NULL,
response varchar(128) default NULL,
`timestamp` int(11) unsigned NOT NULL default 0,
KEY smslog_timestamp (timestamp),
PRIMARY KEY (sid)) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
');
$ret2 = $ret1;
break;
case 'pgsql':
$ret1 = db_query('
CREATE TABLE {smslog} (
sid serial NOT NULL,
direction varchar(3) NOT NULL,
number varchar(20) NOT NULL,
message text default NULL,
response varchar(128) default NULL,
timestamp integer NOT NULL default 0,
PRIMARY KEY (sid));
');
$ret2 = db_query('CREATE INDEX smslog_timestamp ON {smslog} (timestamp);');
break;
}
if ($ret1 && $ret2) {
drupal_set_message(t('SMS Gateway module installed succesfully.'));
} else {
drupal_set_message(t('SMS Gateway module installation was unsuccesfull. Necessary database tables should be created by hand.', 'error'));
}
}
function smsgateway_update_1() {
return _system_update_utf8( array('smslog'));
}
Please, consider using this code for install file for both CVS version and 4.7 branch.
Thanks a lot.
Comments
Comment #1
therave commentedHi Duke,
Many thanks - I only recently became aware of the install file's potential, but hadn't had a chance to implement it. Thanks also for the PostgreSQL addition, which is really valuable. The change should be in the tarballs in the morning.
Note that I have tested the MyQSL installation, but not the PostgreSQL, so please report any issues.
Thanks
David
Comment #2
ardas commentedNo problems :)
This is a power of community. I myself am very new to Postgre, but I need to use it in my project, so I began to test all necessary modules for PostgreSQL compatibility.
Comment #3
(not verified) commented