root / tags / v1_0_2_Build_908 / libraries / libIverUtiles / src / com / iver / utiles / NumberUtilities.java @ 11054
History | View | Annotate | Download (717 Bytes)
1 |
package com.iver.utiles; |
---|---|
2 |
|
3 |
import java.sql.Types; |
4 |
|
5 |
|
6 |
public class NumberUtilities { |
7 |
/**
|
8 |
* Useful to know how you have to compose a SQL insert or update
|
9 |
* for example.
|
10 |
* @param sqlType Ssee java.sql.Types
|
11 |
* @return
|
12 |
*/
|
13 |
public static boolean isNumeric(int sqlType) { |
14 |
|
15 |
switch (sqlType) {
|
16 |
case Types.DOUBLE: |
17 |
case Types.FLOAT: |
18 |
case Types.INTEGER: |
19 |
case Types.SMALLINT: |
20 |
case Types.BIGINT: |
21 |
case Types.NUMERIC: |
22 |
case Types.REAL: |
23 |
case Types.TINYINT: |
24 |
return true; |
25 |
} |
26 |
|
27 |
return false; |
28 |
} |
29 |
public static boolean isNumericInteger(int sqlType) { |
30 |
|
31 |
switch (sqlType) {
|
32 |
|
33 |
case Types.INTEGER: |
34 |
case Types.SMALLINT: |
35 |
case Types.BIGINT: |
36 |
case Types.TINYINT: |
37 |
return true; |
38 |
} |
39 |
|
40 |
return false; |
41 |
} |
42 |
|
43 |
} |