1 | /* |
2 | |
3 | Derby - Class org.apache.derby.iapi.sql.StatementUtil |
4 | |
5 | Copyright 2000, 2004 The Apache Software Foundation or its licensors, as applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | |
21 | package org.apache.derby.iapi.sql; |
22 | |
23 | import org.apache.derby.iapi.error.StandardException; |
24 | import org.apache.derby.iapi.services.i18n.MessageService; |
25 | import org.apache.derby.iapi.reference.SQLState; |
26 | |
27 | /** |
28 | * Utilities for dealing with statements. |
29 | * |
30 | * @author jeff |
31 | */ |
32 | public class StatementUtil |
33 | { |
34 | private StatementUtil(){}; // Do not instantiate |
35 | |
36 | public static String typeName(int typeNumber) |
37 | { |
38 | String retval; |
39 | |
40 | switch (typeNumber) |
41 | { |
42 | case StatementType.INSERT: |
43 | case StatementType.BULK_INSERT_REPLACE: |
44 | case StatementType.UPDATE: |
45 | case StatementType.DELETE: |
46 | case StatementType.ENABLED: |
47 | case StatementType.DISABLED: |
48 | retval = TypeNames[typeNumber]; |
49 | break; |
50 | |
51 | default: |
52 | retval = MessageService.getTextMessage(SQLState.LANG_UNKNOWN); |
53 | break; |
54 | } |
55 | |
56 | return retval; |
57 | } |
58 | |
59 | private static final String[] TypeNames = |
60 | { |
61 | "", |
62 | "INSERT", |
63 | "INSERT", |
64 | "UPDATE", |
65 | "DELETE", |
66 | "ENABLED", |
67 | "DISABLED" |
68 | }; |
69 | } |