Written by Takashi Ikebe(iktaka@gmail.com) --- multiping.install.org 2008-08-21 15:33:20.000000000 +0900 +++ multiping.install 2008-08-21 16:29:54.000000000 +0900 @@ -1,27 +1,53 @@ array( - 'id' => array('type'=>'serial', 'unsigned'=>TRUE, 'not null'=>TRUE), - 'name' => array('type'=>'varchar', 'length'=>100, 'not null'=>TRUE), - 'url' => array('type'=>'varchar', 'length'=>255, 'not null'=>TRUE), - 'method' => array('type'=>'varchar', 'length'=>50), - 'lastping' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>0), - 'whentoping' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>1), - 'submitmainrss' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>0), - 'voc' => array('type'=>'text', 'length'=>4000), - 'nodetypes' => array('type'=>'text', 'length'=>4000), - 'failcount' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>0), - ), - 'primary key' => array('id'), - ); + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $schema['multiping'] = array( + 'fields' => array( + 'id' => array('type'=>'serial', 'unsigned'=>TRUE, 'not null'=>TRUE), + 'name' => array('type'=>'varchar', 'length'=>100, 'not null'=>TRUE), + 'url' => array('type'=>'varchar', 'length'=>255, 'not null'=>TRUE), + 'method' => array('type'=>'varchar', 'length'=>50), + 'lastping' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>0), + 'whentoping' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>1), + 'submitmainrss' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>0), + 'voc' => array('type'=>'text', 'length'=>4000), + 'nodetypes' => array('type'=>'text', 'length'=>4000), + 'failcount' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>0), + ), + 'primary key' => array('id'), + ); + case 'pgsql': + $schema['multiping'] = array( + 'fields' => array( + 'id' => array('type'=>'serial', 'unsigned'=>TRUE, 'not null'=>TRUE), + 'name' => array('type'=>'varchar', 'length'=>100, 'not null'=>TRUE), + 'url' => array('type'=>'varchar', 'length'=>255, 'not null'=>TRUE), + 'method' => array('type'=>'varchar', 'length'=>50), + 'lastping' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>0), + 'whentoping' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>1), + 'submitmainrss' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>0), + 'voc' => array('type'=>'text'), + 'nodetypes' => array('type'=>'text'), + 'failcount' => array('type'=>'int', 'unsigned'=>TRUE, 'default'=>0), + ), + 'primary key' => array('id'), + ); + } return $schema; } function multiping_install() { drupal_install_schema('multiping'); - db_query("INSERT INTO {multiping} (id,name,url,method,lastping,whentoping,submitmainrss,voc,nodetypes,failcount) VALUES (1, 'Ping-o-matic', 'http://rpc.pingomatic.com', 'weblogUpdates.ping', 0, 9, 1, 'N;', 'N;', 0);"); + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + db_query("INSERT INTO {multiping} (id,name,url,method,lastping,whentoping,submitmainrss,voc,nodetypes,failcount) VALUES (1, 'Ping-o-matic', 'http://rpc.pingomatic.com', 'weblogUpdates.ping', 0, 9, 1, 'N;', 'N;', 0);"); + case 'pgsql': + db_query("INSERT INTO {multiping} (name,url,method,lastping,whentoping,submitmainrss,voc,nodetypes,failcount) VALUES ('Ping-o-matic', 'http://rpc.pingomatic.com', 'weblogUpdates.ping', 0, 9, 1, 'N;', 'N;', 0);"); + } } function multiping_uninstall() {