001    package com.sptci.rwt;
002    
003    import java.util.ArrayList;
004    import java.util.Collection;
005    import java.util.Collections;
006    
007    /**
008     * A value object that represents metadata about limits enforced by
009     * the database.  All limits are expressed in terms of the maximum values
010     * allowed.
011     *
012     * <p>&copy; Copyright 2007 <a href='http://sptci.com/' target='_new'>Sans Pareil Technologies, Inc.</a></p>
013     * @author Rakesh Vidyadharan 2007-09-25
014     * @version $Id: LimitsMetaData.java 4123 2008-05-25 21:49:01Z rakesh $
015     * @see java.sql.DatabaseMetaData
016     */
017    public class LimitsMetaData extends MetaData
018    {
019      /** 
020       * The maximum number of characters this database allows for a character
021       * literal.
022       */
023      private int characterLength;
024    
025      /**
026       * The maximum number of characters this database allows for a column
027       * name.
028       */
029      private int columnNameLength;
030    
031      /**
032       * The maximum number of columns this database allows in a <code>GROUP
033       * BY</code> clause.
034       */
035      private int columnsInGroupBy;
036    
037      /** The maximum number of columns this database allows in an index. */
038      private int columnsInIndex;
039    
040      /**
041       * The maximum number of columns this database allows in an <code>ORDER
042       * BY</code> clause.
043       */
044      private int columnsInOrderBy;
045    
046      /**
047       * The maximum number of columns this database allows in a <code>SELECT
048       * </code> list.
049       */
050      private int columnsInSelect;
051    
052      /** The maximum number of columns this database allows in a table. */
053      private int columnsInTable;
054    
055      /**
056       * The maximum number of concurrent connections to this database that
057       * are possible.
058       */
059      private int connections;
060    
061      /**
062       * The maximum number of characters that this database allows in a
063       * <code>cursor</code> name.
064       */
065      private int cursorNameLength;
066    
067      /**
068       * The maximum number of bytes this database allows for an index,
069       * including all of the parts of the index.
070       */
071      private int indexLength;
072    
073      /**
074       * The maximum number of characters that this database allows in a
075       * procedure name.
076       */
077      private int procedureNameLength;
078    
079      /** The maximum number of bytes this database allows in a single row. */
080      private int rowSize;
081    
082      /**
083       * The maximum number of characters that this database allows in a
084       * schema name.
085       */
086      private int schemaNameLength;
087    
088      /**
089       * The maximum number of characters this database allows in an <code>SQL
090       * </code> statement.
091       */
092      private int statementLength;
093    
094      /**
095       * The maximum number of active statements to this database that can be
096       * open at the same time.
097       */
098      private int statements;
099    
100      /**
101       * The maximum number of characters this database allows in a table name.
102       */
103      private int tableNameLength;
104    
105      /**
106       * The maximum number of tables this database allows in a <code>SELECT
107       * </code> statement.
108       */
109      private int tablesInSelect;
110    
111      /**
112       * The maximum number of characters this database allows in a user name.
113       */
114      private int userNameLength;
115      
116      /**
117       * Returns {@link #characterLength}.
118       *
119       * @return The value/reference of/to characterLength.
120       */
121      public int getCharacterLength()
122      {
123        return characterLength;
124      }
125      
126      /**
127       * Set {@link #characterLength}.
128       *
129       * @param characterLength The value to set.
130       */
131      protected void setCharacterLength( final int characterLength )
132      {
133        this.characterLength = characterLength;
134      }
135      
136      /**
137       * Returns {@link #columnNameLength}.
138       *
139       * @return The value/reference of/to columnNameLength.
140       */
141      public int getColumnNameLength()
142      {
143        return columnNameLength;
144      }
145      
146      /**
147       * Set {@link #columnNameLength}.
148       *
149       * @param columnNameLength The value to set.
150       */
151      protected void setColumnNameLength( final int columnNameLength )
152      {
153        this.columnNameLength = columnNameLength;
154      }
155      
156      /**
157       * Returns {@link #columnsInGroupBy}.
158       *
159       * @return The value/reference of/to columnsInGroupBy.
160       */
161      public int getColumnsInGroupBy()
162      {
163        return columnsInGroupBy;
164      }
165      
166      /**
167       * Set {@link #columnsInGroupBy}.
168       *
169       * @param columnsInGroupBy The value to set.
170       */
171      protected void setColumnsInGroupBy( final int columnsInGroupBy )
172      {
173        this.columnsInGroupBy = columnsInGroupBy;
174      }
175      
176      /**
177       * Returns {@link #columnsInIndex}.
178       *
179       * @return The value/reference of/to columnsInIndex.
180       */
181      public int getColumnsInIndex()
182      {
183        return columnsInIndex;
184      }
185      
186      /**
187       * Set {@link #columnsInIndex}.
188       *
189       * @param columnsInIndex The value to set.
190       */
191      protected void setColumnsInIndex( final int columnsInIndex )
192      {
193        this.columnsInIndex = columnsInIndex;
194      }
195      
196      /**
197       * Returns {@link #columnsInOrderBy}.
198       *
199       * @return The value/reference of/to columnsInOrderBy.
200       */
201      public int getColumnsInOrderBy()
202      {
203        return columnsInOrderBy;
204      }
205      
206      /**
207       * Set {@link #columnsInOrderBy}.
208       *
209       * @param columnsInOrderBy The value to set.
210       */
211      protected void setColumnsInOrderBy( final int columnsInOrderBy )
212      {
213        this.columnsInOrderBy = columnsInOrderBy;
214      }
215      
216      /**
217       * Returns {@link #columnsInSelect}.
218       *
219       * @return The value/reference of/to columnsInSelect.
220       */
221      public int getColumnsInSelect()
222      {
223        return columnsInSelect;
224      }
225      
226      /**
227       * Set {@link #columnsInSelect}.
228       *
229       * @param columnsInSelect The value to set.
230       */
231      protected void setColumnsInSelect( final int columnsInSelect )
232      {
233        this.columnsInSelect = columnsInSelect;
234      }
235      
236      /**
237       * Returns {@link #columnsInTable}.
238       *
239       * @return The value/reference of/to columnsInTable.
240       */
241      public int getColumnsInTable()
242      {
243        return columnsInTable;
244      }
245      
246      /**
247       * Set {@link #columnsInTable}.
248       *
249       * @param columnsInTable The value to set.
250       */
251      protected void setColumnsInTable( final int columnsInTable )
252      {
253        this.columnsInTable = columnsInTable;
254      }
255      
256      /**
257       * Returns {@link #connections}.
258       *
259       * @return The value/reference of/to connections.
260       */
261      public int getConnections()
262      {
263        return connections;
264      }
265      
266      /**
267       * Set {@link #connections}.
268       *
269       * @param connections The value to set.
270       */
271      protected void setConnections( final int connections )
272      {
273        this.connections = connections;
274      }
275      
276      /**
277       * Returns {@link #cursorNameLength}.
278       *
279       * @return The value/reference of/to cursorNameLength.
280       */
281      public int getCursorNameLength()
282      {
283        return cursorNameLength;
284      }
285      
286      /**
287       * Set {@link #cursorNameLength}.
288       *
289       * @param cursorNameLength The value to set.
290       */
291      protected void setCursorNameLength( final int cursorNameLength )
292      {
293        this.cursorNameLength = cursorNameLength;
294      }
295      
296      /**
297       * Returns {@link #indexLength}.
298       *
299       * @return The value/reference of/to indexLength.
300       */
301      public int getIndexLength()
302      {
303        return indexLength;
304      }
305      
306      /**
307       * Set {@link #indexLength}.
308       *
309       * @param indexLength The value to set.
310       */
311      protected void setIndexLength( final int indexLength )
312      {
313        this.indexLength = indexLength;
314      }
315      
316      /**
317       * Returns {@link #procedureNameLength}.
318       *
319       * @return The value/reference of/to procedureNameLength.
320       */
321      public int getProcedureNameLength()
322      {
323        return procedureNameLength;
324      }
325      
326      /**
327       * Set {@link #procedureNameLength}.
328       *
329       * @param procedureNameLength The value to set.
330       */
331      protected void setProcedureNameLength( final int procedureNameLength )
332      {
333        this.procedureNameLength = procedureNameLength;
334      }
335      
336      /**
337       * Returns {@link #rowSize}.
338       *
339       * @return The value/reference of/to rowSize.
340       */
341      public int getRowSize()
342      {
343        return rowSize;
344      }
345      
346      /**
347       * Set {@link #rowSize}.
348       *
349       * @param rowSize The value to set.
350       */
351      protected void setRowSize( final int rowSize )
352      {
353        this.rowSize = rowSize;
354      }
355      
356      /**
357       * Returns {@link #schemaNameLength}.
358       *
359       * @return The value/reference of/to schemaNameLength.
360       */
361      public int getSchemaNameLength()
362      {
363        return schemaNameLength;
364      }
365      
366      /**
367       * Set {@link #schemaNameLength}.
368       *
369       * @param schemaNameLength The value to set.
370       */
371      protected void setSchemaNameLength( final int schemaNameLength )
372      {
373        this.schemaNameLength = schemaNameLength;
374      }
375      
376      /**
377       * Returns {@link #statementLength}.
378       *
379       * @return The value/reference of/to statementLength.
380       */
381      public int getStatementLength()
382      {
383        return statementLength;
384      }
385      
386      /**
387       * Set {@link #statementLength}.
388       *
389       * @param statementLength The value to set.
390       */
391      protected void setStatementLength( final int statementLength )
392      {
393        this.statementLength = statementLength;
394      }
395      
396      /**
397       * Returns {@link #statements}.
398       *
399       * @return The value/reference of/to statements.
400       */
401      public int getStatements()
402      {
403        return statements;
404      }
405      
406      /**
407       * Set {@link #statements}.
408       *
409       * @param statements The value to set.
410       */
411      protected void setStatements( final int statements )
412      {
413        this.statements = statements;
414      }
415      
416      /**
417       * Returns {@link #tableNameLength}.
418       *
419       * @return The value/reference of/to tableNameLength.
420       */
421      public int getTableNameLength()
422      {
423        return tableNameLength;
424      }
425      
426      /**
427       * Set {@link #tableNameLength}.
428       *
429       * @param tableNameLength The value to set.
430       */
431      protected void setTableNameLength( final int tableNameLength )
432      {
433        this.tableNameLength = tableNameLength;
434      }
435      
436      /**
437       * Returns {@link #tablesInSelect}.
438       *
439       * @return The value/reference of/to tablesInSelect.
440       */
441      public int getTablesInSelect()
442      {
443        return tablesInSelect;
444      }
445      
446      /**
447       * Set {@link #tablesInSelect}.
448       *
449       * @param tablesInSelect The value to set.
450       */
451      protected void setTablesInSelect( final int tablesInSelect )
452      {
453        this.tablesInSelect = tablesInSelect;
454      }
455      
456      /**
457       * Returns {@link #userNameLength}.
458       *
459       * @return The value/reference of/to userNameLength.
460       */
461      public int getUserNameLength()
462      {
463        return userNameLength;
464      }
465      
466      /**
467       * Set {@link #userNameLength}.
468       *
469       * @param userNameLength The value to set.
470       */
471      protected void setUserNameLength( final int userNameLength )
472      {
473        this.userNameLength = userNameLength;
474      }
475    }