]> review.fuel-infra Code Review - packages/trusty/mysql-wsrep-5.6.git/blob
1617ac06a324659a2c4e8d38d2d6527ee95da363
[packages/trusty/mysql-wsrep-5.6.git] /
1 /*
2    Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; version 2 of the License.
7
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
16 */
17
18 package com.mysql.clusterj.core.store;
19
20 import com.mysql.clusterj.ColumnType;
21
22 /** Column metadata for ndb columns.
23  *
24  */
25 public interface Column {
26
27     /** Get the name of the column.
28      * @return the name
29      */
30     public String getName();
31
32     /** Get the store type of the column.
33      * 
34      * @return the store type
35      */
36     public ColumnType getType();
37
38     /** Is this column a primary key column?
39      * @return true if this column is a primary key column
40      */
41     public boolean isPrimaryKey();
42
43     /** Is this column a partition key column?
44      * @return true if this column is a partition key column
45      */
46     public boolean isPartitionKey();
47
48     /** Get the Charset name of the column. This is the value of the 
49      * CHARACTER SET parameter in the column definition, or if not specified,
50      * the value of the DEFAULT CHARACTER SET parameter in the table definition.
51      * 
52      * @return the Charset name
53      */
54     public String getCharsetName();
55
56     /** The charset number.
57      * 
58      * @return the Charset number
59      */
60     public int getCharsetNumber();
61
62     /** For character columns, get the maximum length in bytes that can be stored
63      * in the column, excluding the prefix, after conversion via the charset.
64      */
65     public int getLength();
66
67     /** For variable size columns, get the length of the prefix (one or two bytes) 
68      * that specifies the length of the column data.
69      * @return the prefix length, either one or two bytes for variable sized columns, zero otherwise
70      */
71     public int getPrefixLength();
72
73     /** The column ID, used for scans to compare column values.
74      * 
75      * @return the column id
76      */
77     public int getColumnId();
78
79     /** The space needed to retrieve the value into memory, 
80      * including the length byte or bytes at the beginning of the field.
81      * 
82      * @return the space required by the column
83      */
84     public int getColumnSpace();
85
86     /** The precision of a decimal column (number of decimal digits before plus after
87      * the decimal point).
88      * 
89      * @return the precision
90      */
91     public int getPrecision();
92
93     /** The scale of a decimal column (the number of decimal digits after the decimal point).
94      * 
95      * @return the scale
96      */
97     public int getScale();
98
99     /** Decode a byte[] into a String using this column's charset.
100      * 
101      * @param bytes the byte[] from the database
102      * @return the decoded String
103      */
104     public String decode(byte[] bytes);
105
106     /** Encode a String into a byte[] for storage or comparison.
107      * 
108      * @param string the String
109      * @return the encoded byte[]
110      */
111     public byte[] encode(String string);
112
113     /** Is this column nullable?
114      * 
115      * @return true if the column is nullable
116      */
117     public boolean getNullable();
118
119 }