Mercurial > hg > monetdb-perl
comparison DBD/monetdb/TypeInfo.pm @ 0:cedccb7e0143
Copy of clients/perl directory without Tests from MonetDB changeset 4d2d4532228a.
author | Sjoerd Mullender <sjoerd@acm.org> |
---|---|
date | Mon, 19 Sep 2016 15:15:52 +0200 (2016-09-19) |
parents | |
children | a0ec9e080a5b |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cedccb7e0143 |
---|---|
1 # This Source Code Form is subject to the terms of the Mozilla Public | |
2 # License, v. 2.0. If a copy of the MPL was not distributed with this | |
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
4 # | |
5 # Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V. | |
6 | |
7 package DBD::monetdb::TypeInfo; | |
8 | |
9 use DBI qw(:sql_types); | |
10 | |
11 my %index = | |
12 ( | |
13 TYPE_NAME => 0 | |
14 , DATA_TYPE => 1 | |
15 , COLUMN_SIZE => 2 | |
16 , LITERAL_PREFIX => 3 | |
17 , LITERAL_SUFFIX => 4 | |
18 , CREATE_PARAMS => 5 | |
19 , NULLABLE => 6 | |
20 , CASE_SENSITIVE => 7 | |
21 , SEARCHABLE => 8 | |
22 , UNSIGNED_ATTRIBUTE => 9 | |
23 , FIXED_PREC_SCALE => 10 | |
24 , AUTO_UNIQUE_VALUE => 11 | |
25 , LOCAL_TYPE_NAME => 12 | |
26 , MINIMUM_SCALE => 13 | |
27 , MAXIMUM_SCALE => 14 | |
28 , SQL_DATA_TYPE => 15 | |
29 , SQL_DATETIME_SUB => 16 | |
30 , NUM_PREC_RADIX => 17 | |
31 , INTERVAL_PRECISION => 18 | |
32 ); | |
33 | |
34 my @data = | |
35 ( | |
36 # NAME TYPE SIZE PREFIX SUFFIX PARAMS N C S U F A NAME MIN MAX TYPE SUB RADIX IV_P | |
37 ['char' , SQL_CHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, 0, undef, undef, undef, SQL_CHAR , undef, undef, undef ] | |
38 , ['character' , SQL_CHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, 0, undef, undef, undef, SQL_CHAR , undef, undef, undef ] | |
39 , ['decimal' , SQL_DECIMAL , 19, undef, undef,'precision,scale', 1, 0, 2, 0, 0, 0, undef, 0, 19, SQL_DECIMAL , undef, 10, undef ] | |
40 , ['dec' , SQL_DECIMAL , 19, undef, undef,'precision,scale', 1, 0, 2, 0, 0, 0, undef, 0, 19, SQL_DECIMAL , undef, 10, undef ] | |
41 , ['numeric' , SQL_DECIMAL , 19, undef, undef,'precision,scale', 1, 0, 2, 0, 0, 0, undef, 0, 19, SQL_DECIMAL , undef, 10, undef ] | |
42 , ['int' , SQL_INTEGER , 9, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_INTEGER , undef, 10, undef ] | |
43 , ['integer' , SQL_INTEGER , 9, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_INTEGER , undef, 10, undef ] | |
44 , ['mediumint' , SQL_INTEGER , 9, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_INTEGER , undef, 10, undef ] | |
45 , ['smallint' , SQL_SMALLINT , 4, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_SMALLINT, undef, 10, undef ] | |
46 , ['tinyint' , SQL_SMALLINT , 4, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_SMALLINT, undef, 10, undef ] | |
47 , ['float' , SQL_FLOAT , 24, undef, undef,'precision,scale', 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_FLOAT , undef, 2, undef ] | |
48 , ['real' , SQL_REAL , 24, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_REAL , undef, 2, undef ] | |
49 , ['double' , SQL_DOUBLE , 53, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_DOUBLE , undef, 2, undef ] | |
50 , ['double precision' , SQL_DOUBLE , 53, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_DOUBLE , undef, 2, undef ] | |
51 , ['varchar' , SQL_VARCHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_VARCHAR , undef, undef, undef ] | |
52 , ['character varying' , SQL_VARCHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_VARCHAR , undef, undef, undef ] | |
53 , ['char varying' , SQL_VARCHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_VARCHAR , undef, undef, undef ] | |
54 , ['boolean' , SQL_BOOLEAN , 1, undef, undef, undef , 1, 0, 2, 0, 1, 0, undef, undef, undef, SQL_BOOLEAN , undef, undef, undef ] | |
55 , ['bool' , SQL_BOOLEAN , 1, undef, undef, undef , 1, 0, 2, 0, 1, 0, undef, undef, undef, SQL_BOOLEAN , undef, undef, undef ] | |
56 , ['bigint' , 25 , 19, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, 25 , undef, 10, undef ] | |
57 , ['blob' , SQL_BLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_BLOB , undef, undef, undef ] | |
58 , ['binary large object' , SQL_BLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_BLOB , undef, undef, undef ] | |
59 , ['clob' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | |
60 , ['character large object' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | |
61 , ['char large object' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | |
62 , ['string' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | |
63 , ['text' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | |
64 , ['tinytext' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | |
65 , ['date' , SQL_TYPE_DATE , 10, "date '", "'" , undef , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 1, undef, undef ] | |
66 , ['time' , SQL_TYPE_TIME , 12, "time '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 2, undef, undef ] | |
67 , ['timestamp' , SQL_TYPE_TIMESTAMP , 23, "timestamp '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 3, undef, undef ] | |
68 , ['timetz' , SQL_TYPE_TIME_WITH_TIMEZONE , 18, "time '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 4, undef, undef ] | |
69 , ['time with time zone' , SQL_TYPE_TIME_WITH_TIMEZONE , 18, "time '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 4, undef, undef ] | |
70 , ['timestamptz' , SQL_TYPE_TIMESTAMP_WITH_TIMEZONE, 29, "timestamp '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 5, undef, undef ] | |
71 , ['timestamp with time zone' , SQL_TYPE_TIMESTAMP_WITH_TIMEZONE, 29, "timestamp '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 5, undef, undef ] | |
72 , ['interval year' , SQL_INTERVAL_YEAR , 9, "interval '", "' year" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 1, undef, 9 ] | |
73 , ['interval month' , SQL_INTERVAL_MONTH , 10, "interval '", "' month" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 2, undef, 10 ] | |
74 , ['month_interval' , SQL_INTERVAL_MONTH , 10, "interval '", "' month" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 2, undef, 10 ] | |
75 , ['interval day' , SQL_INTERVAL_DAY , 5, "interval '", "' day" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 3, undef, 5 ] | |
76 , ['interval hour' , SQL_INTERVAL_HOUR , 6, "interval '", "' hour" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 4, undef, 6 ] | |
77 , ['interval minute' , SQL_INTERVAL_MINUTE , 8, "interval '", "' minute" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 5, undef, 8 ] | |
78 , ['interval second' , SQL_INTERVAL_SECOND , 10, "interval '", "' second" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 6, undef, 10 ] | |
79 , ['sec_interval' , SQL_INTERVAL_SECOND , 10, "interval '", "' second" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 6, undef, 10 ] | |
80 , ['interval year to month' , SQL_INTERVAL_YEAR_TO_MONTH , 12, "interval '", "' year to month" , undef , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 7, undef, 9 ] | |
81 , ['interval day to hour' , SQL_INTERVAL_DAY_TO_HOUR , 8, "interval '", "' day to hour" , undef , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 8, undef, 5 ] | |
82 , ['interval day to minute' , SQL_INTERVAL_DAY_TO_MINUTE , 11, "interval '", "' day to minute" , undef , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 9, undef, 5 ] | |
83 , ['interval day to second' , SQL_INTERVAL_DAY_TO_SECOND , 14, "interval '", "' day to second" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 10, undef, 5 ] | |
84 , ['interval hour to minute' , SQL_INTERVAL_HOUR_TO_MINUTE , 9, "interval '", "' hour to minute" , undef , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 11, undef, 6 ] | |
85 , ['interval hour to second' , SQL_INTERVAL_HOUR_TO_SECOND , 12, "interval '", "' hour to second" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 12, undef, 6 ] | |
86 , ['interval minute to second', SQL_INTERVAL_MINUTE_TO_SECOND , 13, "interval '", "' minute to second",'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 13, undef, 10 ] | |
87 ); | |
88 | |
89 sub type_info_all { [ \%index, @data ] } | |
90 | |
91 %typeinfo = (); | |
92 %prefixes = (); | |
93 %suffixes = (); | |
94 | |
95 for ( @data ) { | |
96 $typeinfo{$_->[0]} = $_; | |
97 $prefixes{$_->[1]} = $_->[3]; | |
98 $suffixes{$_->[1]} = $_->[4]; | |
99 } | |
100 | |
101 1; |