| 1 | # The contents of this file are subject to the MonetDB Public License | ||
| 2 | # Version 1.1 (the "License"); you may not use this file except in | ||
| 3 | # compliance with the License. You may obtain a copy of the License at | ||
| 4 | # http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html | ||
| 5 | # | ||
| 6 | # Software distributed under the License is distributed on an "AS IS" | ||
| 7 | # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | ||
| 8 | # License for the specific language governing rights and limitations | ||
| 9 | # under the License. | ||
| 10 | # | ||
| 11 | # The Original Code is the MonetDB Database System. | ||
| 12 | # | ||
| 13 | # The Initial Developer of the Original Code is CWI. | ||
| 14 | # Portions created by CWI are Copyright (C) 1997-2006 CWI. | ||
| 15 | # All Rights Reserved. | ||
| 16 | |||
| 17 | package DBD::monetdb::TypeInfo; | ||
| 18 | |||
| 19 | 2 | ▶ | use DBI qw(:sql_types); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | 2 | my %index = | |
| 22 | ( | ||
| 23 | TYPE_NAME => 0 | ||
| 24 | , DATA_TYPE => 1 | ||
| 25 | , COLUMN_SIZE => 2 | ||
| 26 | , LITERAL_PREFIX => 3 | ||
| 27 | , LITERAL_SUFFIX => 4 | ||
| 28 | , CREATE_PARAMS => 5 | ||
| 29 | , NULLABLE => 6 | ||
| 30 | , CASE_SENSITIVE => 7 | ||
| 31 | , SEARCHABLE => 8 | ||
| 32 | , UNSIGNED_ATTRIBUTE => 9 | ||
| 33 | , FIXED_PREC_SCALE => 10 | ||
| 34 | , AUTO_UNIQUE_VALUE => 11 | ||
| 35 | , LOCAL_TYPE_NAME => 12 | ||
| 36 | , MINIMUM_SCALE => 13 | ||
| 37 | , MAXIMUM_SCALE => 14 | ||
| 38 | , SQL_DATA_TYPE => 15 | ||
| 39 | , SQL_DATETIME_SUB => 16 | ||
| 40 | , NUM_PREC_RADIX => 17 | ||
| 41 | , INTERVAL_PRECISION => 18 | ||
| 42 | ); | ||
| 43 | |||
| 44 | 2 | my @data = | |
| 45 | ( | ||
| 46 | # NAME TYPE SIZE PREFIX SUFFIX PARAMS N C S U F A NAME MIN MAX TYPE SUB RADIX IV_P | ||
| 47 | ['char' , SQL_CHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, 0, undef, undef, undef, SQL_CHAR , undef, undef, undef ] | ||
| 48 | , ['character' , SQL_CHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, 0, undef, undef, undef, SQL_CHAR , undef, undef, undef ] | ||
| 49 | , ['decimal' , SQL_DECIMAL , 19, undef, undef,'precision,scale', 1, 0, 2, 0, 0, 0, undef, 0, 19, SQL_DECIMAL , undef, 10, undef ] | ||
| 50 | , ['dec' , SQL_DECIMAL , 19, undef, undef,'precision,scale', 1, 0, 2, 0, 0, 0, undef, 0, 19, SQL_DECIMAL , undef, 10, undef ] | ||
| 51 | , ['numeric' , SQL_DECIMAL , 19, undef, undef,'precision,scale', 1, 0, 2, 0, 0, 0, undef, 0, 19, SQL_DECIMAL , undef, 10, undef ] | ||
| 52 | , ['int' , SQL_INTEGER , 9, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_INTEGER , undef, 10, undef ] | ||
| 53 | , ['integer' , SQL_INTEGER , 9, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_INTEGER , undef, 10, undef ] | ||
| 54 | , ['mediumint' , SQL_INTEGER , 9, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_INTEGER , undef, 10, undef ] | ||
| 55 | , ['smallint' , SQL_SMALLINT , 4, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_SMALLINT, undef, 10, undef ] | ||
| 56 | , ['tinyint' , SQL_SMALLINT , 4, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_SMALLINT, undef, 10, undef ] | ||
| 57 | , ['float' , SQL_FLOAT , 24, undef, undef,'precision,scale', 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_FLOAT , undef, 2, undef ] | ||
| 58 | , ['real' , SQL_REAL , 24, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_REAL , undef, 2, undef ] | ||
| 59 | , ['double' , SQL_DOUBLE , 53, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_DOUBLE , undef, 2, undef ] | ||
| 60 | , ['double precision' , SQL_DOUBLE , 53, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, SQL_DOUBLE , undef, 2, undef ] | ||
| 61 | , ['varchar' , SQL_VARCHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_VARCHAR , undef, undef, undef ] | ||
| 62 | , ['character varying' , SQL_VARCHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_VARCHAR , undef, undef, undef ] | ||
| 63 | , ['char varying' , SQL_VARCHAR , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_VARCHAR , undef, undef, undef ] | ||
| 64 | , ['boolean' , SQL_BOOLEAN , 1, undef, undef, undef , 1, 0, 2, 0, 1, 0, undef, undef, undef, SQL_BOOLEAN , undef, undef, undef ] | ||
| 65 | , ['bool' , SQL_BOOLEAN , 1, undef, undef, undef , 1, 0, 2, 0, 1, 0, undef, undef, undef, SQL_BOOLEAN , undef, undef, undef ] | ||
| 66 | , ['bigint' , 25 , 19, undef, undef, undef , 1, 0, 2, 0, 0, 0, undef, 0, 0, 25 , undef, 10, undef ] | ||
| 67 | , ['blob' , SQL_BLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_BLOB , undef, undef, undef ] | ||
| 68 | , ['binary large object' , SQL_BLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_BLOB , undef, undef, undef ] | ||
| 69 | , ['clob' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | ||
| 70 | , ['character large object' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | ||
| 71 | , ['char large object' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | ||
| 72 | , ['string' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | ||
| 73 | , ['text' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | ||
| 74 | , ['tinytext' , SQL_CLOB , 1000000, "'" , "'" ,'length' , 1, 1, 3, undef, 0, undef, undef, undef, undef, SQL_CLOB , undef, undef, undef ] | ||
| 75 | , ['date' , SQL_TYPE_DATE , 10, "date '", "'" , undef , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 1, undef, undef ] | ||
| 76 | , ['time' , SQL_TYPE_TIME , 12, "time '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 2, undef, undef ] | ||
| 77 | , ['timestamp' , SQL_TYPE_TIMESTAMP , 23, "timestamp '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 3, undef, undef ] | ||
| 78 | , ['timetz' , SQL_TYPE_TIME_WITH_TIMEZONE , 18, "time '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 4, undef, undef ] | ||
| 79 | , ['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 ] | ||
| 80 | , ['timestamptz' , SQL_TYPE_TIMESTAMP_WITH_TIMEZONE, 29, "timestamp '", "'" ,'precision' , 1, 0, 2, undef, 0, undef, undef, undef, undef, SQL_DATE , 5, undef, undef ] | ||
| 81 | , ['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 ] | ||
| 82 | , ['interval year' , SQL_INTERVAL_YEAR , 9, "interval '", "' year" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 1, undef, 9 ] | ||
| 83 | , ['interval month' , SQL_INTERVAL_MONTH , 10, "interval '", "' month" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 2, undef, 10 ] | ||
| 84 | , ['month_interval' , SQL_INTERVAL_MONTH , 10, "interval '", "' month" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 2, undef, 10 ] | ||
| 85 | , ['interval day' , SQL_INTERVAL_DAY , 5, "interval '", "' day" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 3, undef, 5 ] | ||
| 86 | , ['interval hour' , SQL_INTERVAL_HOUR , 6, "interval '", "' hour" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 4, undef, 6 ] | ||
| 87 | , ['interval minute' , SQL_INTERVAL_MINUTE , 8, "interval '", "' minute" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 5, undef, 8 ] | ||
| 88 | , ['interval second' , SQL_INTERVAL_SECOND , 10, "interval '", "' second" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 6, undef, 10 ] | ||
| 89 | , ['sec_interval' , SQL_INTERVAL_SECOND , 10, "interval '", "' second" ,'precision' , 1, 0, 2, undef, 0, undef, undef, 0, 0, SQL_TIME , 6, undef, 10 ] | ||
| 90 | , ['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 ] | ||
| 91 | , ['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 ] | ||
| 92 | , ['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 ] | ||
| 93 | , ['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 ] | ||
| 94 | , ['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 ] | ||
| 95 | , ['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 ] | ||
| 96 | , ['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 ] | ||
| 97 | ); | ||
| 98 | |||
| 99 | 0 | ▶ | sub type_info_all { [ \%index, @data ] } |
|
Subroutine
type_info_all: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 100 | |||
| 101 | 2 | %typeinfo = (); | |
| 102 | 2 | %prefixes = (); | |
| 103 | 2 | %suffixes = (); | |
| 104 | |||
| 105 | 2 | for ( @data ) { | |
| 106 | 100 | $typeinfo{$_->[0]} = $_; | |
| 107 | 100 | $prefixes{$_->[1]} = $_->[3]; | |
| 108 | 100 | $suffixes{$_->[1]} = $_->[4]; | |
| 109 | } | ||
| 110 | |||
| 111 | 2 | 1; | |