3abc2b916c944d42f5483174e4342cfb8c1f8f1a
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / sql / SQLResults.java
1 package com.quantum.sql;
2
3 import java.util.ArrayList;
4 import java.util.Vector;
5
6 /**
7  * com.quantum project
8  * @author root
9  *
10 */
11 public class SQLResults {
12         private String query;
13         private String table;
14         private ArrayList rows = new ArrayList();
15         private Vector columns;
16         private Vector columnTypes;
17         private int[] columnSizes;
18         private int updateCount = 0;
19         private boolean resultSet = false;
20         private boolean hasMore = false;
21         private boolean isError = false;
22         private int maxSize = -1;
23         
24         public void setColumnNames(Vector columns) {
25                 this.columns = columns;
26         }
27         public String getColumnName(int column) {
28                 if (columns.size() < column) return ""; //$NON-NLS-1$
29                 return columns.elementAt(column - 1).toString();
30                         
31         }
32         public void setColumnTypes(Vector columnsTypes) {
33                 this.columnTypes = columnsTypes;
34         }
35         public String getColumnType(int column) {
36                 if (columnTypes.size() < column) return ""; //$NON-NLS-1$
37                 return columnTypes.elementAt(column - 1).toString();
38         }
39         public void setColumnSizes(int[] columnSizes) {
40                 this.columnSizes = columnSizes;
41         }
42         public int getColumnSize(int column) {
43                 if (columnSizes.length < column) return 0;
44                 return columnSizes[column - 1];
45         }
46         public void addRow(Vector row) {
47                 rows.add(row);
48         }
49         public Object getElement(int column, int row) {
50                 return ((Vector) rows.get(row - 1)).elementAt(column - 1);
51         }
52         public int getColumnCount() {
53                 if (columns.size() > 0) {
54                         return columns.size();
55                 }
56                 return 0;
57         }
58         public int getRowCount() {
59                 return rows.size();
60         }
61         /**
62          * Returns the query.
63          * @return String
64          */
65         public String getQuery() {
66                 return query;
67         }
68
69         /**
70          * Sets the query.
71          * @param query The query to set
72          */
73         public void setQuery(String query) {
74                 this.query = query;
75         }
76
77         /**
78          * Returns the resultSet.
79          * @return boolean
80          */
81         public boolean isResultSet() {
82                 return resultSet;
83         }
84
85         /**
86          * Sets the resultSet.
87          * @param resultSet The resultSet to set
88          */
89         public void setResultSet(boolean resultSet) {
90                 this.resultSet = resultSet;
91         }
92
93         public int getUpdateCount() {
94                 return updateCount;
95         }
96
97         public void setUpdateCount(int updateCount) {
98                 this.updateCount = updateCount;
99         }
100
101         public String getTable() {
102                 return table;
103         }
104
105         public void setTable(String table) {
106                 this.table = table;
107         }
108
109         public boolean hasMore() {
110                 return hasMore;
111         }
112
113         public void setHasMore(boolean hasMore) {
114                 this.hasMore = hasMore;
115         }
116
117         public int getMaxSize() {
118                 return maxSize;
119         }
120
121         public void setMaxSize(int maxSize) {
122                 this.maxSize = maxSize;
123         }
124
125         public boolean isError() {
126                 return isError;
127         }
128
129         public void setIsError(boolean isError) {
130                 this.isError = isError;
131         }
132         /**
133          * 
134          */
135         public Object[] getRows() {
136                 return rows.toArray();          
137         }
138
139 }