Source Code Cross Referenced for BindVariable.java in  » Database-Client » iSQL-Viewer » org » isqlviewer » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » iSQL Viewer » org.isqlviewer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the Mozilla Public License
003:         * Version 1.1 (the "License"); you may not use this file except in
004:         * compliance with the License. You may obtain a copy of the License at
005:         * http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
009:         * License for the specific language governing rights and limitations
010:         * under the License.
011:         * 
012:         * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
013:         *
014:         * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
015:         * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
016:         *
017:         * Contributor(s): 
018:         *  Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
019:         *  
020:         * If you didn't download this code from the following link, you should check
021:         * if you aren't using an obsolete version: http://www.isqlviewer.com
022:         */
023:        package org.isqlviewer;
024:
025:        /**
026:         * Represents parameterized data for bookmarks and historical items that are to be executed as a prepared statement.
027:         * <p>
028:         * Each parameter has an optional index to specify the order in the prepared statement to bound in. If the order is not
029:         * specified it will be automatically set based on the order it was added to the bookmark.
030:         * <p>
031:         * Each parameter has the user data to be transformed into a specific object in the form of a string, the format options
032:         * will represent a string of commands to transform the user data into the specific type.
033:         * 
034:         * @author Mark A. Kobold &lt;mkobold at isqlviewer dot com&gt;
035:         * @version 1.0
036:         */
037:        public class BindVariable implements  Comparable<BindVariable> {
038:
039:            private int index = 0;
040:            private int type = 1;
041:            private String userData = null;
042:            private String formatOptions = null;
043:
044:            /**
045:             * Compares this parameter data to another for ordering by the index of the parameter.
046:             * <p>
047:             * 
048:             * @param o other bookmark parameter data to be comparaed against.
049:             * @return number indicating relative value as specificed by comparable.
050:             * @see Comparable
051:             */
052:            public int compareTo(BindVariable o) {
053:
054:                if (o == null) {
055:                    return 1;
056:                }
057:                return index > o.index ? 1 : (index == o.index ? 0 : -1);
058:            }
059:
060:            /**
061:             * Returns the formatting options to be applied to the user data.
062:             * <p>
063:             * These commands are semi-colon ';' seperated commands that will be applied to the user data field of this object
064:             * in order to transfor the user data in to the proper data type.
065:             * 
066:             * @return formatting options and commands for the user data; can be <tt>null</tt>.
067:             */
068:            public String getFormatOptions() {
069:
070:                return formatOptions;
071:            }
072:
073:            /**
074:             * Sets the formatting options and commands for the user data.
075:             * <p>
076:             * 
077:             * @param formatOptions The formatOptions for the user data to set; use <tt>null</tt> to disable.
078:             */
079:            public void setFormatOptions(String formatOptions) {
080:
081:                this .formatOptions = formatOptions;
082:            }
083:
084:            /**
085:             * Gets the index of this parameter as part of the prepared statement.
086:             * <p>
087:             * This value will be a number of 1..n where n is total number of parameters for a bookmark. if the value is
088:             * anything else like 0 or less then actual index will be determined automatically by the bookmark this instance is
089:             * added to.
090:             * 
091:             * @return index of this parameter for order within a prepared statement.
092:             */
093:            public int getIndex() {
094:
095:                return index;
096:            }
097:
098:            /**
099:             * Sets the parameter index for determining order for a prepared statement.
100:             * <p>
101:             * 
102:             * @param index order of the parameter binding. within a prepared statement; use 0 or less to make index automatic.
103:             */
104:            public void setIndex(int index) {
105:
106:                this .index = index;
107:            }
108:
109:            /**
110:             * Get the SQL type that represents the intended data type for this parameter.
111:             * <p>
112:             * This should always be a value that is defined within the java.sql.Types interface. The Types interface defines
113:             * the domain of inteded values for this field.
114:             * 
115:             * @return the intended SQL data type for this parameter.
116:             * @see java.sql.Types
117:             */
118:            public int getType() {
119:
120:                return type;
121:            }
122:
123:            /**
124:             * Sets the SQL data-type for the parameter.
125:             * <p>
126:             * 
127:             * @param type data-type identifier as defined by java.sql.Types.
128:             * @see java.sql.Types
129:             */
130:            public void setType(int type) {
131:
132:                this .type = type;
133:            }
134:
135:            /**
136:             * Gets the user data that represents the actual data to be bound to the prepared statement.
137:             * <p>
138:             * If there are formatting options those commands will be applied to this content to transform it to the target
139:             * data-type.
140:             * <p>
141:             * This value can be null if not specified. It is not recommended to use the NULL Type for null values as that is
142:             * not actually what the NULL type is for, so if a null date is needed that still use the DATE data-type.
143:             * 
144:             * @return user data that represents the data to be bound to a prepared statement.
145:             */
146:            public String getUserData() {
147:
148:                return userData;
149:            }
150:
151:            /**
152:             * Sets the user data to be bound to a prepared statement.
153:             * <p>
154:             * 
155:             * @param userData that represents the data-type; can be null.
156:             */
157:            public void setUserData(String userData) {
158:
159:                this.userData = userData;
160:            }
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.