aboutsummaryrefslogtreecommitdiff
path: root/exif.install
blob: 75bf5d2b178083feea74ba9650efffac70c85c8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
// $Id: exif.install,v 1.4 2008/04/05 23:22:05 davidlesieur Exp $

/**
 * Implementation of hook_install().
 */
function exif_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {exif_tags} (
          ifd int(10) unsigned NOT NULL default '0',
          tag int(10) unsigned NOT NULL default '0',
          status int(10) unsigned NOT NULL default '0',
          weight int(11) NOT NULL default '0',
          PRIMARY KEY (ifd, tag)
        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
      );
      db_query("CREATE TABLE {exif} (
          fid int(10) unsigned NOT NULL default '0',
          ifd int(10) unsigned NOT NULL default '0',
          tag int(10) unsigned NOT NULL default '0',
          value varchar(255) NOT NULL default '',
          PRIMARY KEY (fid, ifd, tag)
        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
      );
      break;
    case 'pgsql':
      db_query("CREATE TABLE {exif_tags} (
          ifd integer NOT NULL default '0',
          tag integer NOT NULL default '0',
          status integer NOT NULL default '0',
          weight integer NOT NULL default '0',
          PRIMARY KEY (ifd, tag)
        );"
      );
      db_query("CREATE TABLE {exif} (
          fid int(10) unsigned NOT NULL default '0',
          ifd int(10) unsigned NOT NULL default '0',
          tag int(10) unsigned NOT NULL default '0',
          value varchar(255) NOT NULL default '',
          PRIMARY KEY (fid, ifd, tag)
        );"
      );
      break;
  }
}

function exif_update_1() {
  // Works for postgres??
  $ret[] = update_sql('ALTER TABLE {exif} RENAME TO {exif_tags}');
  // make new table for caching and tracking exif data.
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("CREATE TABLE {exif} (
          fid int(10) unsigned NOT NULL default '0',
          ifd int(10) unsigned NOT NULL default '0',
          tag int(10) unsigned NOT NULL default '0',
          value varchar(255) NOT NULL default '',
          PRIMARY KEY (fid, ifd, tag)
        ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
      );
      break;
    case 'pgsql':
      $ret[] = update_sql("CREATE TABLE {exif} (
          fid int(10) unsigned NOT NULL default '0',
          ifd int(10) unsigned NOT NULL default '0',
          tag int(10) unsigned NOT NULL default '0',
          value varchar(255) NOT NULL default '',
          PRIMARY KEY (fid, ifd, tag)
        );"
      );
      break;
  }
  return $ret;
}

/**
 * Implementation of hook_uninstall().
 */
function exif_uninstall() {
  db_query('DROP TABLE {exif_tags}');
  db_query('DROP TABLE {exif}');
}