Source Code Cross Referenced for NetSqldta.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » client » net » 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 DBMS » db derby 10.2 » org.apache.derby.client.net 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.client.net.NetSqldta
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to You under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.client.net;
023:
024:        public class NetSqldta extends NetCursor {
025:            private NetConnection netConnection_;
026:
027:            public NetSqldta(NetAgent netAgent) {
028:                super (netAgent);
029:                netConnection_ = netAgent.netConnection_;
030:            }
031:
032:            public boolean next()
033:                    throws org.apache.derby.client.am.SqlException {
034:                if (allRowsReceivedFromServer()) {
035:                    return false;
036:                } else {
037:                    setAllRowsReceivedFromServer(true);
038:                    return true;
039:                }
040:            }
041:
042:            protected boolean calculateColumnOffsetsForRow() {
043:                int colNullIndicator = CodePoint.NULLDATA;
044:                int length;
045:
046:                extdtaPositions_.clear(); // reset positions for this row
047:
048:                // read the da null indicator
049:                if (readFdocaOneByte() == 0xff) {
050:                    return false;
051:                }
052:
053:                incrementRowsReadEvent();
054:                // Use the arrays defined on the Cursor for forward-only cursors.
055:                // can they ever be null
056:                if (columnDataPosition_ == null
057:                        || columnDataComputedLength_ == null || isNull_ == null) {
058:                    allocateColumnOffsetAndLengthArrays();
059:                }
060:
061:                // Loop through the columns
062:                for (int index = 0; index < columns_; index++) {
063:                    // If column is nullable, read the 1-byte null indicator.
064:                    if (nullable_[index])
065:                    // Need to pass the column index so all previously calculated offsets can be
066:                    // readjusted if the query block splits on a column null indicator.
067:
068:                    // null indicators from FD:OCA data
069:                    // 0 to 127: a data value will flow.
070:                    // -1 to -128: no data value will flow.
071:                    {
072:                        colNullIndicator = readFdocaOneByte();
073:                    }
074:
075:                    // If non-null column data
076:                    if (!nullable_[index]
077:                            || (colNullIndicator >= 0 && colNullIndicator <= 127)) {
078:                        isNull_[index] = false;
079:
080:                        switch (typeToUseForComputingDataLength_[index]) {
081:                        // for variable character string and variable byte string,
082:                        // there are 2-byte of length in front of the data
083:                        case Typdef.TWOBYTELENGTH:
084:                            columnDataPosition_[index] = position_;
085:                            length = readFdocaTwoByteLength();
086:                            // skip length + the 2-byte length field
087:                            if (isGraphic_[index]) {
088:                                columnDataComputedLength_[index] = skipFdocaBytes(length * 2) + 2;
089:                            } else {
090:                                columnDataComputedLength_[index] = skipFdocaBytes(length) + 2;
091:                            }
092:                            break;
093:
094:                        // for short variable character string and short variable byte string,
095:                        // there is a 1-byte length in front of the data
096:                        case Typdef.ONEBYTELENGTH:
097:                            columnDataPosition_[index] = position_;
098:                            length = readFdocaOneByte();
099:                            // skip length + the 1-byte length field
100:                            if (isGraphic_[index]) {
101:                                columnDataComputedLength_[index] = skipFdocaBytes(length * 2) + 1;
102:                            } else {
103:                                columnDataComputedLength_[index] = skipFdocaBytes(length) + 1;
104:                            }
105:                            break;
106:
107:                        // For decimal columns, determine the precision, scale, and the representation
108:                        case Typdef.DECIMALLENGTH:
109:                            columnDataPosition_[index] = position_;
110:                            columnDataComputedLength_[index] = skipFdocaBytes(getDecimalLength(index));
111:                            break;
112:
113:                        case Typdef.LOBLENGTH:
114:                            columnDataPosition_[index] = position_;
115:                            columnDataComputedLength_[index] = this 
116:                                    .skipFdocaBytes(fdocaLength_[index] & 0x7fff);
117:                            break;
118:
119:                        default:
120:                            columnDataPosition_[index] = position_;
121:                            if (isGraphic_[index]) {
122:                                columnDataComputedLength_[index] = skipFdocaBytes(fdocaLength_[index] * 2);
123:                            } else {
124:                                columnDataComputedLength_[index] = skipFdocaBytes(fdocaLength_[index]);
125:                            }
126:                            break;
127:                        }
128:                    } else if ((colNullIndicator & 0x80) == 0x80) {
129:                        // Null data. Set the isNull indicator to true.
130:                        isNull_[index] = true;
131:                    }
132:                }
133:
134:                if (!allRowsReceivedFromServer()) {
135:                    calculateLobColumnPositionsForRow();
136:                }
137:
138:                return true; // hardwired for now, this means the current row position is a valid position
139:            }
140:
141:            private int skipFdocaBytes(int length) {
142:                position_ += length;
143:                return length;
144:            }
145:
146:            private int readFdocaOneByte() {
147:                return dataBuffer_[position_++] & 0xff;
148:            }
149:
150:            private int readFdocaTwoByteLength() {
151:                return ((dataBuffer_[position_++] & 0xff) << 8)
152:                        + ((dataBuffer_[position_++] & 0xff) << 0);
153:            }
154:
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.