File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\result\ResultColumn.java.html

1 /*
2 * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,
3 * Version 1.0, and under the Eclipse Public License, Version 1.0
4 * (http://h2database.com/html/license.html).
5 * Initial Developer: H2 Group
6 */
7 package org.h2.result;
8
9 import java.io.IOException;
10
11 import org.h2.value.Transfer;
12
13 /**
14 * A result set column of a remote result.
15 */
16 public class ResultColumn {
17
18 /**
19 * The column alias.
20 */
21 final String alias;
22
23 /**
24 * The schema name or null.
25 */
26 final String schemaName;
27
28 /**
29 * The table name or null.
30 */
31 final String tableName;
32
33 /**
34 * The column name or null.
35 */
36 final String columnName;
37
38 /**
39 * The value type of this column.
40 */
41 final int columnType;
42
43 /**
44 * The precision.
45 */
46 final long precision;
47
48 /**
49 * The scale.
50 */
51 final int scale;
52
53 /**
54 * The expected display size.
55 */
56 final int displaySize;
57
58 /**
59 * True if this is an autoincrement column.
60 */
61 final boolean autoIncrement;
62
63 /**
64 * True if this column is nullable.
65 */
66 final int nullable;
67
68 /**
69 * Read an object from the given transfer object.
70 *
71 * @param in the object from where to read the data
72 */
73 ResultColumn(Transfer in) throws IOException {
74 alias = in.readString();
75 schemaName = in.readString();
76 tableName = in.readString();
77 columnName = in.readString();
78 columnType = in.readInt();
79 precision = in.readLong();
80 scale = in.readInt();
81 displaySize = in.readInt();
82 autoIncrement = in.readBoolean();
83 nullable = in.readInt();
84 }
85
86 /**
87 * Write a result column to the given output.
88 *
89 * @param out the object to where to write the data
90 * @param result the result
91 * @param i the column index
92 */
93 public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException {
94 out.writeString(result.getAlias(i));
95 out.writeString(result.getSchemaName(i));
96 out.writeString(result.getTableName(i));
97 out.writeString(result.getColumnName(i));
98 out.writeInt(result.getColumnType(i));
99 out.writeLong(result.getColumnPrecision(i));
100 out.writeInt(result.getColumnScale(i));
101 out.writeInt(result.getDisplaySize(i));
102 out.writeBoolean(result.isAutoIncrement(i));
103 out.writeInt(result.getNullable(i));
104 }
105
106 }
107