| 1 |
<?php
|
| 2 |
// $Id: $
|
| 3 |
|
| 4 |
/*
|
| 5 |
Copyright (c) 2006, CommerceNet and University of California, Berkeley
|
| 6 |
All rights reserved.
|
| 7 |
Redistribution and use in source and binary forms, with or without
|
| 8 |
modification, are permitted provided that the following conditions
|
| 9 |
are met:
|
| 10 |
* Redistributions of source code must retain the above copyright
|
| 11 |
notice, this list of conditions and the following disclaimer.
|
| 12 |
* Redistributions in binary form must reproduce the above copyright
|
| 13 |
notice, this list of conditions and the following disclaimer in the
|
| 14 |
documentation and/or other materials provided with the distribution.
|
| 15 |
* Neither the name of the copyright holders nor the names of their
|
| 16 |
contributors may be used to endorse or promote products derived
|
| 17 |
from this software without specific prior written permission.
|
| 18 |
|
| 19 |
THIS SOFTWARE IS PROVIDED BY COMMERCENET, THE UC REGENTS, AND
|
| 20 |
CONTRIBUTORS``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
| 21 |
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
| 22 |
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COMMERCENET, THE UC
|
| 23 |
REGENTS, AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 24 |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
| 25 |
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
| 26 |
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
| 27 |
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
| 28 |
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
| 29 |
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 30 |
*/
|
| 31 |
|
| 32 |
function calnet_install() {
|
| 33 |
$result = array();
|
| 34 |
|
| 35 |
switch ($GLOBALS['db_type']) {
|
| 36 |
case 'mysqli':
|
| 37 |
case 'mysql':
|
| 38 |
$result[] = db_query(
|
| 39 |
<<<QUERY
|
| 40 |
CREATE TABLE {calnet} (
|
| 41 |
drupal_uid int(10) unsigned NOT NULL default '0',
|
| 42 |
calnet_uid int(10) unsigned NOT NULL default '0',
|
| 43 |
PRIMARY KEY (drupal_uid)
|
| 44 |
) /*!40100 DEFAULT CHARACTER SET utf8 */;
|
| 45 |
QUERY
|
| 46 |
);
|
| 47 |
break;
|
| 48 |
|
| 49 |
case 'pgsql':
|
| 50 |
$result[] = db_query(
|
| 51 |
<<<QUERY
|
| 52 |
CREATE TABLE {calnet} (
|
| 53 |
drupal_uid integer NOT NULL default '0',
|
| 54 |
calnet_uid integer NOT NULL default '0',
|
| 55 |
PRIMARY KEY (drupal_uid)
|
| 56 |
);
|
| 57 |
QUERY
|
| 58 |
);
|
| 59 |
break;
|
| 60 |
}
|
| 61 |
|
| 62 |
if (count($result) != count(array_filter($result))) {
|
| 63 |
drupal_set_message(t('Creation of database tables for CalNet module was unsuccessful.'), 'error');
|
| 64 |
}
|
| 65 |
}
|