~ubuntu-branches/ubuntu/hoary/moodle/hoary

« back to all changes in this revision

Viewing changes to lib/adodb/adodb-error.inc.php

  • Committer: Bazaar Package Importer
  • Author(s): Isaac Clerencia
  • Date: 2004-12-29 00:49:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041229004952-gliyqzpj2w3e7clx
Tags: 1.4.3-1
* Urgency high as upstream release fixes several security bugs
* New upstream release
* Write database creation errors and warn the user about it, 
closes: #285842, #285842

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/** 
3
 
 * @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
4
 
 * Released under both BSD license and Lesser GPL library license. 
5
 
 * Whenever there is any discrepancy between the two licenses, 
6
 
 * the BSD license will take precedence. 
7
 
 *
8
 
 * Set tabs to 4 for best viewing.
9
 
 * 
10
 
 * The following code is adapted from the PEAR DB error handling code.
11
 
 * Portions (c)1997-2002 The PHP Group.
12
 
 */
13
 
 
14
 
if (!defined("DB_ERROR")) define("DB_ERROR",-1);
15
 
 
16
 
if (!defined("DB_ERROR_SYNTAX")) {
17
 
        define("DB_ERROR_SYNTAX",              -2);
18
 
        define("DB_ERROR_CONSTRAINT",          -3);
19
 
        define("DB_ERROR_NOT_FOUND",           -4);
20
 
        define("DB_ERROR_ALREADY_EXISTS",      -5);
21
 
        define("DB_ERROR_UNSUPPORTED",         -6);
22
 
        define("DB_ERROR_MISMATCH",            -7);
23
 
        define("DB_ERROR_INVALID",             -8);
24
 
        define("DB_ERROR_NOT_CAPABLE",         -9);
25
 
        define("DB_ERROR_TRUNCATED",          -10);
26
 
        define("DB_ERROR_INVALID_NUMBER",     -11);
27
 
        define("DB_ERROR_INVALID_DATE",       -12);
28
 
        define("DB_ERROR_DIVZERO",            -13);
29
 
        define("DB_ERROR_NODBSELECTED",       -14);
30
 
        define("DB_ERROR_CANNOT_CREATE",      -15);
31
 
        define("DB_ERROR_CANNOT_DELETE",      -16);
32
 
        define("DB_ERROR_CANNOT_DROP",        -17);
33
 
        define("DB_ERROR_NOSUCHTABLE",        -18);
34
 
        define("DB_ERROR_NOSUCHFIELD",        -19);
35
 
        define("DB_ERROR_NEED_MORE_DATA",     -20);
36
 
        define("DB_ERROR_NOT_LOCKED",         -21);
37
 
        define("DB_ERROR_VALUE_COUNT_ON_ROW", -22);
38
 
        define("DB_ERROR_INVALID_DSN",        -23);
39
 
        define("DB_ERROR_CONNECT_FAILED",     -24);
40
 
        define("DB_ERROR_EXTENSION_NOT_FOUND",-25);
41
 
        define("DB_ERROR_NOSUCHDB",           -25);
42
 
        define("DB_ERROR_ACCESS_VIOLATION",   -26);
43
 
}
44
 
 
45
 
function adodb_errormsg($value)
46
 
{
47
 
global $ADODB_LANG,$ADODB_LANG_ARRAY;
48
 
 
49
 
        if (empty($ADODB_LANG)) $ADODB_LANG = 'en';
50
 
        if (isset($ADODB_LANG_ARRAY['LANG']) && $ADODB_LANG_ARRAY['LANG'] == $ADODB_LANG) ;
51
 
        else {
52
 
                include_once(ADODB_DIR."/lang/adodb-$ADODB_LANG.inc.php");
53
 
    }
54
 
        return isset($ADODB_LANG_ARRAY[$value]) ? $ADODB_LANG_ARRAY[$value] : $ADODB_LANG_ARRAY[DB_ERROR];
55
 
}
56
 
 
57
 
function adodb_error($provider,$dbType,$errno)
58
 
{
59
 
        //var_dump($errno);
60
 
        if (is_numeric($errno) && $errno == 0) return 0;
61
 
        switch($provider) { 
62
 
        case 'mysql': $map = adodb_error_mysql(); break;
63
 
        
64
 
        case 'oracle':
65
 
        case 'oci8': $map = adodb_error_oci8(); break;
66
 
        
67
 
        case 'ibase': $map = adodb_error_ibase(); break;
68
 
        
69
 
        case 'odbc': $map = adodb_error_odbc(); break;
70
 
        
71
 
        case 'mssql':
72
 
        case 'sybase': $map = adodb_error_mssql(); break;
73
 
        
74
 
        case 'informix': $map = adodb_error_ifx(); break;
75
 
        
76
 
        case 'postgres': return adodb_error_pg($errno); break;
77
 
        
78
 
        case 'sqlite': return $map = adodb_error_sqlite(); break;
79
 
        default:
80
 
                return DB_ERROR;
81
 
        }       
82
 
        //print_r($map);
83
 
        //var_dump($errno);
84
 
        if (isset($map[$errno])) return $map[$errno];
85
 
        return DB_ERROR;
86
 
}
87
 
 
88
 
//**************************************************************************************
89
 
 
90
 
function adodb_error_pg($errormsg)
91
 
{
92
 
    static $error_regexps = array(
93
 
            '/(Table does not exist\.|Relation [\"\'].*[\"\'] does not exist|sequence does not exist|class ".+" not found)$/' => DB_ERROR_NOSUCHTABLE,
94
 
            '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*/'      => DB_ERROR_ALREADY_EXISTS,
95
 
            '/divide by zero$/'                     => DB_ERROR_DIVZERO,
96
 
            '/pg_atoi: error in .*: can\'t parse /' => DB_ERROR_INVALID_NUMBER,
97
 
            '/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/' => DB_ERROR_NOSUCHFIELD,
98
 
            '/parser: parse error at or near \"/'   => DB_ERROR_SYNTAX,
99
 
            '/referential integrity violation/'     => DB_ERROR_CONSTRAINT
100
 
        );
101
 
        reset($error_regexps);
102
 
    while (list($regexp,$code) = each($error_regexps)) {
103
 
        if (preg_match($regexp, $errormsg)) {
104
 
            return $code;
105
 
        }
106
 
    }
107
 
    // Fall back to DB_ERROR if there was no mapping.
108
 
    return DB_ERROR;
109
 
}
110
 
        
111
 
function adodb_error_odbc()
112
 
{
113
 
static $MAP = array(
114
 
            '01004' => DB_ERROR_TRUNCATED,
115
 
            '07001' => DB_ERROR_MISMATCH,
116
 
            '21S01' => DB_ERROR_MISMATCH,
117
 
            '21S02' => DB_ERROR_MISMATCH,
118
 
            '22003' => DB_ERROR_INVALID_NUMBER,
119
 
            '22008' => DB_ERROR_INVALID_DATE,
120
 
            '22012' => DB_ERROR_DIVZERO,
121
 
            '23000' => DB_ERROR_CONSTRAINT,
122
 
            '24000' => DB_ERROR_INVALID,
123
 
            '34000' => DB_ERROR_INVALID,
124
 
            '37000' => DB_ERROR_SYNTAX,
125
 
            '42000' => DB_ERROR_SYNTAX,
126
 
            'IM001' => DB_ERROR_UNSUPPORTED,
127
 
            'S0000' => DB_ERROR_NOSUCHTABLE,
128
 
            'S0001' => DB_ERROR_NOT_FOUND,
129
 
            'S0002' => DB_ERROR_NOSUCHTABLE,
130
 
            'S0011' => DB_ERROR_ALREADY_EXISTS,
131
 
            'S0012' => DB_ERROR_NOT_FOUND,
132
 
            'S0021' => DB_ERROR_ALREADY_EXISTS,
133
 
            'S0022' => DB_ERROR_NOT_FOUND,
134
 
                        'S1000' => DB_ERROR_NOSUCHTABLE,
135
 
            'S1009' => DB_ERROR_INVALID,
136
 
            'S1090' => DB_ERROR_INVALID,
137
 
            'S1C00' => DB_ERROR_NOT_CAPABLE
138
 
        );
139
 
                return $MAP;
140
 
}
141
 
 
142
 
function adodb_error_ibase()
143
 
{
144
 
static $MAP = array(
145
 
            -104 => DB_ERROR_SYNTAX,
146
 
            -150 => DB_ERROR_ACCESS_VIOLATION,
147
 
            -151 => DB_ERROR_ACCESS_VIOLATION,
148
 
            -155 => DB_ERROR_NOSUCHTABLE,
149
 
            -157 => DB_ERROR_NOSUCHFIELD,
150
 
            -158 => DB_ERROR_VALUE_COUNT_ON_ROW,
151
 
            -170 => DB_ERROR_MISMATCH,
152
 
            -171 => DB_ERROR_MISMATCH,
153
 
            -172 => DB_ERROR_INVALID,
154
 
            -204 => DB_ERROR_INVALID,
155
 
            -205 => DB_ERROR_NOSUCHFIELD,
156
 
            -206 => DB_ERROR_NOSUCHFIELD,
157
 
            -208 => DB_ERROR_INVALID,
158
 
            -219 => DB_ERROR_NOSUCHTABLE,
159
 
            -297 => DB_ERROR_CONSTRAINT,
160
 
            -530 => DB_ERROR_CONSTRAINT,
161
 
            -803 => DB_ERROR_CONSTRAINT,
162
 
            -551 => DB_ERROR_ACCESS_VIOLATION,
163
 
            -552 => DB_ERROR_ACCESS_VIOLATION,
164
 
            -922 => DB_ERROR_NOSUCHDB,
165
 
            -923 => DB_ERROR_CONNECT_FAILED,
166
 
            -924 => DB_ERROR_CONNECT_FAILED
167
 
        );
168
 
                
169
 
                return $MAP;
170
 
}
171
 
 
172
 
function adodb_error_ifx()
173
 
{
174
 
static $MAP = array(
175
 
            '-201'    => DB_ERROR_SYNTAX,
176
 
            '-206'    => DB_ERROR_NOSUCHTABLE,
177
 
            '-217'    => DB_ERROR_NOSUCHFIELD,
178
 
            '-329'    => DB_ERROR_NODBSELECTED,
179
 
            '-1204'   => DB_ERROR_INVALID_DATE,
180
 
            '-1205'   => DB_ERROR_INVALID_DATE,
181
 
            '-1206'   => DB_ERROR_INVALID_DATE,
182
 
            '-1209'   => DB_ERROR_INVALID_DATE,
183
 
            '-1210'   => DB_ERROR_INVALID_DATE,
184
 
            '-1212'   => DB_ERROR_INVALID_DATE
185
 
       );
186
 
           
187
 
           return $MAP;
188
 
}
189
 
 
190
 
function adodb_error_oci8()
191
 
{
192
 
static $MAP = array(
193
 
                         1 => DB_ERROR_ALREADY_EXISTS,
194
 
            900 => DB_ERROR_SYNTAX,
195
 
            904 => DB_ERROR_NOSUCHFIELD,
196
 
            923 => DB_ERROR_SYNTAX,
197
 
            942 => DB_ERROR_NOSUCHTABLE,
198
 
            955 => DB_ERROR_ALREADY_EXISTS,
199
 
            1476 => DB_ERROR_DIVZERO,
200
 
            1722 => DB_ERROR_INVALID_NUMBER,
201
 
            2289 => DB_ERROR_NOSUCHTABLE,
202
 
            2291 => DB_ERROR_CONSTRAINT,
203
 
            2449 => DB_ERROR_CONSTRAINT
204
 
        );
205
 
           
206
 
        return $MAP;
207
 
}
208
 
 
209
 
function adodb_error_mssql()
210
 
{
211
 
static $MAP = array(
212
 
                  208 => DB_ERROR_NOSUCHTABLE,
213
 
          2601 => DB_ERROR_ALREADY_EXISTS
214
 
       );
215
 
           
216
 
        return $MAP;
217
 
}
218
 
 
219
 
function adodb_error_sqlite()
220
 
{
221
 
static $MAP = array(
222
 
                  1 => DB_ERROR_SYNTAX
223
 
       );
224
 
           
225
 
        return $MAP;
226
 
}
227
 
 
228
 
function adodb_error_mysql()
229
 
{
230
 
static $MAP = array(
231
 
           1004 => DB_ERROR_CANNOT_CREATE,
232
 
           1005 => DB_ERROR_CANNOT_CREATE,
233
 
           1006 => DB_ERROR_CANNOT_CREATE,
234
 
           1007 => DB_ERROR_ALREADY_EXISTS,
235
 
           1008 => DB_ERROR_CANNOT_DROP,
236
 
                   1045 => DB_ERROR_ACCESS_VIOLATION,
237
 
           1046 => DB_ERROR_NODBSELECTED,
238
 
                   1049 => DB_ERROR_NOSUCHDB,
239
 
           1050 => DB_ERROR_ALREADY_EXISTS,
240
 
           1051 => DB_ERROR_NOSUCHTABLE,
241
 
           1054 => DB_ERROR_NOSUCHFIELD,
242
 
           1062 => DB_ERROR_ALREADY_EXISTS,
243
 
           1064 => DB_ERROR_SYNTAX,
244
 
           1100 => DB_ERROR_NOT_LOCKED,
245
 
           1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
246
 
           1146 => DB_ERROR_NOSUCHTABLE,
247
 
           1048 => DB_ERROR_CONSTRAINT,
248
 
                    2002 => DB_ERROR_CONNECT_FAILED
249
 
       );
250
 
           
251
 
        return $MAP;
252
 
}
 
1
<?php
 
2
/** 
 
3
 * @version V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
 
4
 * Released under both BSD license and Lesser GPL library license. 
 
5
 * Whenever there is any discrepancy between the two licenses, 
 
6
 * the BSD license will take precedence. 
 
7
 *
 
8
 * Set tabs to 4 for best viewing.
 
9
 * 
 
10
 * The following code is adapted from the PEAR DB error handling code.
 
11
 * Portions (c)1997-2002 The PHP Group.
 
12
 */
 
13
 
 
14
 
 
15
if (!defined("DB_ERROR")) define("DB_ERROR",-1);
 
16
 
 
17
if (!defined("DB_ERROR_SYNTAX")) {
 
18
        define("DB_ERROR_SYNTAX",              -2);
 
19
        define("DB_ERROR_CONSTRAINT",          -3);
 
20
        define("DB_ERROR_NOT_FOUND",           -4);
 
21
        define("DB_ERROR_ALREADY_EXISTS",      -5);
 
22
        define("DB_ERROR_UNSUPPORTED",         -6);
 
23
        define("DB_ERROR_MISMATCH",            -7);
 
24
        define("DB_ERROR_INVALID",             -8);
 
25
        define("DB_ERROR_NOT_CAPABLE",         -9);
 
26
        define("DB_ERROR_TRUNCATED",          -10);
 
27
        define("DB_ERROR_INVALID_NUMBER",     -11);
 
28
        define("DB_ERROR_INVALID_DATE",       -12);
 
29
        define("DB_ERROR_DIVZERO",            -13);
 
30
        define("DB_ERROR_NODBSELECTED",       -14);
 
31
        define("DB_ERROR_CANNOT_CREATE",      -15);
 
32
        define("DB_ERROR_CANNOT_DELETE",      -16);
 
33
        define("DB_ERROR_CANNOT_DROP",        -17);
 
34
        define("DB_ERROR_NOSUCHTABLE",        -18);
 
35
        define("DB_ERROR_NOSUCHFIELD",        -19);
 
36
        define("DB_ERROR_NEED_MORE_DATA",     -20);
 
37
        define("DB_ERROR_NOT_LOCKED",         -21);
 
38
        define("DB_ERROR_VALUE_COUNT_ON_ROW", -22);
 
39
        define("DB_ERROR_INVALID_DSN",        -23);
 
40
        define("DB_ERROR_CONNECT_FAILED",     -24);
 
41
        define("DB_ERROR_EXTENSION_NOT_FOUND",-25);
 
42
        define("DB_ERROR_NOSUCHDB",           -25);
 
43
        define("DB_ERROR_ACCESS_VIOLATION",   -26);
 
44
}
 
45
 
 
46
function adodb_errormsg($value)
 
47
{
 
48
global $ADODB_LANG,$ADODB_LANG_ARRAY;
 
49
 
 
50
        if (empty($ADODB_LANG)) $ADODB_LANG = 'en';
 
51
        if (isset($ADODB_LANG_ARRAY['LANG']) && $ADODB_LANG_ARRAY['LANG'] == $ADODB_LANG) ;
 
52
        else {
 
53
                include_once(ADODB_DIR."/lang/adodb-$ADODB_LANG.inc.php");
 
54
    }
 
55
        return isset($ADODB_LANG_ARRAY[$value]) ? $ADODB_LANG_ARRAY[$value] : $ADODB_LANG_ARRAY[DB_ERROR];
 
56
}
 
57
 
 
58
function adodb_error($provider,$dbType,$errno)
 
59
{
 
60
        //var_dump($errno);
 
61
        if (is_numeric($errno) && $errno == 0) return 0;
 
62
        switch($provider) { 
 
63
        case 'mysql': $map = adodb_error_mysql(); break;
 
64
        
 
65
        case 'oracle':
 
66
        case 'oci8': $map = adodb_error_oci8(); break;
 
67
        
 
68
        case 'ibase': $map = adodb_error_ibase(); break;
 
69
        
 
70
        case 'odbc': $map = adodb_error_odbc(); break;
 
71
        
 
72
        case 'mssql':
 
73
        case 'sybase': $map = adodb_error_mssql(); break;
 
74
        
 
75
        case 'informix': $map = adodb_error_ifx(); break;
 
76
        
 
77
        case 'postgres': return adodb_error_pg($errno); break;
 
78
        
 
79
        case 'sqlite': return $map = adodb_error_sqlite(); break;
 
80
        default:
 
81
                return DB_ERROR;
 
82
        }       
 
83
        //print_r($map);
 
84
        //var_dump($errno);
 
85
        if (isset($map[$errno])) return $map[$errno];
 
86
        return DB_ERROR;
 
87
}
 
88
 
 
89
//**************************************************************************************
 
90
 
 
91
function adodb_error_pg($errormsg)
 
92
{
 
93
        if (is_numeric($errormsg)) return (integer) $errormsg;
 
94
    static $error_regexps = array(
 
95
            '/(Table does not exist\.|Relation [\"\'].*[\"\'] does not exist|sequence does not exist|class ".+" not found)$/' => DB_ERROR_NOSUCHTABLE,
 
96
            '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*/'      => DB_ERROR_ALREADY_EXISTS,
 
97
            '/divide by zero$/'                     => DB_ERROR_DIVZERO,
 
98
            '/pg_atoi: error in .*: can\'t parse /' => DB_ERROR_INVALID_NUMBER,
 
99
            '/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/' => DB_ERROR_NOSUCHFIELD,
 
100
            '/parser: parse error at or near \"/'   => DB_ERROR_SYNTAX,
 
101
            '/referential integrity violation/'     => DB_ERROR_CONSTRAINT,
 
102
                        '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/'     
 
103
                                 => DB_ERROR_ALREADY_EXISTS
 
104
        );
 
105
        reset($error_regexps);
 
106
    while (list($regexp,$code) = each($error_regexps)) {
 
107
        if (preg_match($regexp, $errormsg)) {
 
108
            return $code;
 
109
        }
 
110
    }
 
111
    // Fall back to DB_ERROR if there was no mapping.
 
112
    return DB_ERROR;
 
113
}
 
114
        
 
115
function adodb_error_odbc()
 
116
{
 
117
static $MAP = array(
 
118
            '01004' => DB_ERROR_TRUNCATED,
 
119
            '07001' => DB_ERROR_MISMATCH,
 
120
            '21S01' => DB_ERROR_MISMATCH,
 
121
            '21S02' => DB_ERROR_MISMATCH,
 
122
            '22003' => DB_ERROR_INVALID_NUMBER,
 
123
            '22008' => DB_ERROR_INVALID_DATE,
 
124
            '22012' => DB_ERROR_DIVZERO,
 
125
            '23000' => DB_ERROR_CONSTRAINT,
 
126
            '24000' => DB_ERROR_INVALID,
 
127
            '34000' => DB_ERROR_INVALID,
 
128
            '37000' => DB_ERROR_SYNTAX,
 
129
            '42000' => DB_ERROR_SYNTAX,
 
130
            'IM001' => DB_ERROR_UNSUPPORTED,
 
131
            'S0000' => DB_ERROR_NOSUCHTABLE,
 
132
            'S0001' => DB_ERROR_NOT_FOUND,
 
133
            'S0002' => DB_ERROR_NOSUCHTABLE,
 
134
            'S0011' => DB_ERROR_ALREADY_EXISTS,
 
135
            'S0012' => DB_ERROR_NOT_FOUND,
 
136
            'S0021' => DB_ERROR_ALREADY_EXISTS,
 
137
            'S0022' => DB_ERROR_NOT_FOUND,
 
138
                        'S1000' => DB_ERROR_NOSUCHTABLE,
 
139
            'S1009' => DB_ERROR_INVALID,
 
140
            'S1090' => DB_ERROR_INVALID,
 
141
            'S1C00' => DB_ERROR_NOT_CAPABLE
 
142
        );
 
143
                return $MAP;
 
144
}
 
145
 
 
146
function adodb_error_ibase()
 
147
{
 
148
static $MAP = array(
 
149
            -104 => DB_ERROR_SYNTAX,
 
150
            -150 => DB_ERROR_ACCESS_VIOLATION,
 
151
            -151 => DB_ERROR_ACCESS_VIOLATION,
 
152
            -155 => DB_ERROR_NOSUCHTABLE,
 
153
            -157 => DB_ERROR_NOSUCHFIELD,
 
154
            -158 => DB_ERROR_VALUE_COUNT_ON_ROW,
 
155
            -170 => DB_ERROR_MISMATCH,
 
156
            -171 => DB_ERROR_MISMATCH,
 
157
            -172 => DB_ERROR_INVALID,
 
158
            -204 => DB_ERROR_INVALID,
 
159
            -205 => DB_ERROR_NOSUCHFIELD,
 
160
            -206 => DB_ERROR_NOSUCHFIELD,
 
161
            -208 => DB_ERROR_INVALID,
 
162
            -219 => DB_ERROR_NOSUCHTABLE,
 
163
            -297 => DB_ERROR_CONSTRAINT,
 
164
            -530 => DB_ERROR_CONSTRAINT,
 
165
            -803 => DB_ERROR_CONSTRAINT,
 
166
            -551 => DB_ERROR_ACCESS_VIOLATION,
 
167
            -552 => DB_ERROR_ACCESS_VIOLATION,
 
168
            -922 => DB_ERROR_NOSUCHDB,
 
169
            -923 => DB_ERROR_CONNECT_FAILED,
 
170
            -924 => DB_ERROR_CONNECT_FAILED
 
171
        );
 
172
                
 
173
                return $MAP;
 
174
}
 
175
 
 
176
function adodb_error_ifx()
 
177
{
 
178
static $MAP = array(
 
179
            '-201'    => DB_ERROR_SYNTAX,
 
180
            '-206'    => DB_ERROR_NOSUCHTABLE,
 
181
            '-217'    => DB_ERROR_NOSUCHFIELD,
 
182
            '-329'    => DB_ERROR_NODBSELECTED,
 
183
            '-1204'   => DB_ERROR_INVALID_DATE,
 
184
            '-1205'   => DB_ERROR_INVALID_DATE,
 
185
            '-1206'   => DB_ERROR_INVALID_DATE,
 
186
            '-1209'   => DB_ERROR_INVALID_DATE,
 
187
            '-1210'   => DB_ERROR_INVALID_DATE,
 
188
            '-1212'   => DB_ERROR_INVALID_DATE
 
189
       );
 
190
           
 
191
           return $MAP;
 
192
}
 
193
 
 
194
function adodb_error_oci8()
 
195
{
 
196
static $MAP = array(
 
197
                         1 => DB_ERROR_ALREADY_EXISTS,
 
198
            900 => DB_ERROR_SYNTAX,
 
199
            904 => DB_ERROR_NOSUCHFIELD,
 
200
            923 => DB_ERROR_SYNTAX,
 
201
            942 => DB_ERROR_NOSUCHTABLE,
 
202
            955 => DB_ERROR_ALREADY_EXISTS,
 
203
            1476 => DB_ERROR_DIVZERO,
 
204
            1722 => DB_ERROR_INVALID_NUMBER,
 
205
            2289 => DB_ERROR_NOSUCHTABLE,
 
206
            2291 => DB_ERROR_CONSTRAINT,
 
207
            2449 => DB_ERROR_CONSTRAINT
 
208
        );
 
209
           
 
210
        return $MAP;
 
211
}
 
212
 
 
213
function adodb_error_mssql()
 
214
{
 
215
static $MAP = array(
 
216
                  208 => DB_ERROR_NOSUCHTABLE,
 
217
          2601 => DB_ERROR_ALREADY_EXISTS
 
218
       );
 
219
           
 
220
        return $MAP;
 
221
}
 
222
 
 
223
function adodb_error_sqlite()
 
224
{
 
225
static $MAP = array(
 
226
                  1 => DB_ERROR_SYNTAX
 
227
       );
 
228
           
 
229
        return $MAP;
 
230
}
 
231
 
 
232
function adodb_error_mysql()
 
233
{
 
234
static $MAP = array(
 
235
           1004 => DB_ERROR_CANNOT_CREATE,
 
236
           1005 => DB_ERROR_CANNOT_CREATE,
 
237
           1006 => DB_ERROR_CANNOT_CREATE,
 
238
           1007 => DB_ERROR_ALREADY_EXISTS,
 
239
           1008 => DB_ERROR_CANNOT_DROP,
 
240
                   1045 => DB_ERROR_ACCESS_VIOLATION,
 
241
           1046 => DB_ERROR_NODBSELECTED,
 
242
                   1049 => DB_ERROR_NOSUCHDB,
 
243
           1050 => DB_ERROR_ALREADY_EXISTS,
 
244
           1051 => DB_ERROR_NOSUCHTABLE,
 
245
           1054 => DB_ERROR_NOSUCHFIELD,
 
246
           1062 => DB_ERROR_ALREADY_EXISTS,
 
247
           1064 => DB_ERROR_SYNTAX,
 
248
           1100 => DB_ERROR_NOT_LOCKED,
 
249
           1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
 
250
           1146 => DB_ERROR_NOSUCHTABLE,
 
251
           1048 => DB_ERROR_CONSTRAINT,
 
252
                    2002 => DB_ERROR_CONNECT_FAILED
 
253
       );
 
254
           
 
255
        return $MAP;
 
256
}
253
257
?>
 
 
b'\\ No newline at end of file'