001: package com.mysql.jdbc;
002:
003: import java.sql.SQLException;
004:
005: class RowDataKeyset implements RowData {
006:
007: private ResultSetInternalMethods keyset;
008:
009: private void buildKeysetColumnsClause(Field[] originalQueryMetadata)
010: throws SQLException {
011:
012: StringBuffer buf = new StringBuffer();
013:
014: for (int i = 0; i < originalQueryMetadata.length; i++) {
015: if (originalQueryMetadata[i].isPrimaryKey()) {
016: if (buf.length() != 0) {
017: buf.append(", ");
018: }
019:
020: buf.append("`");
021: buf.append(originalQueryMetadata[i].getDatabaseName());
022: buf.append("`.`");
023: buf.append(originalQueryMetadata[i]
024: .getOriginalTableName());
025: buf.append("`.`");
026: buf.append(originalQueryMetadata[i].getOriginalName());
027: buf.append("`");
028: }
029: }
030: }
031:
032: private String extractWhereClause(String sql) {
033: String delims = "'`\"";
034:
035: String canonicalSql = StringUtils.stripComments(sql, delims,
036: delims, true, false, true, true);
037:
038: int whereClausePos = StringUtils
039: .indexOfIgnoreCaseRespectMarker(0, canonicalSql,
040: " WHERE ", delims, delims, false /* fixme */);
041:
042: if (whereClausePos == -1) {
043: return "";
044: }
045:
046: return canonicalSql.substring(whereClausePos);
047: }
048:
049: public void addRow(ResultSetRow row) throws SQLException {
050: // TODO Auto-generated method stub
051:
052: }
053:
054: public void afterLast() throws SQLException {
055: // TODO Auto-generated method stub
056:
057: }
058:
059: public void beforeFirst() throws SQLException {
060: // TODO Auto-generated method stub
061:
062: }
063:
064: public void beforeLast() throws SQLException {
065: // TODO Auto-generated method stub
066:
067: }
068:
069: public void close() throws SQLException {
070: SQLException caughtWhileClosing = null;
071:
072: if (this .keyset != null) {
073: try {
074: this .keyset.close();
075: } catch (SQLException sqlEx) {
076: caughtWhileClosing = sqlEx;
077: }
078:
079: this .keyset = null;
080: }
081:
082: if (caughtWhileClosing != null) {
083: throw caughtWhileClosing;
084: }
085: }
086:
087: public ResultSetRow getAt(int index) throws SQLException {
088: // TODO Auto-generated method stub
089: return null;
090: }
091:
092: public int getCurrentRowNumber() throws SQLException {
093: // TODO Auto-generated method stub
094: return 0;
095: }
096:
097: public ResultSetInternalMethods getOwner() {
098: // TODO Auto-generated method stub
099: return null;
100: }
101:
102: public boolean hasNext() throws SQLException {
103: // TODO Auto-generated method stub
104: return false;
105: }
106:
107: public boolean isAfterLast() throws SQLException {
108: // TODO Auto-generated method stub
109: return false;
110: }
111:
112: public boolean isBeforeFirst() throws SQLException {
113: // TODO Auto-generated method stub
114: return false;
115: }
116:
117: public boolean isDynamic() throws SQLException {
118: // TODO Auto-generated method stub
119: return false;
120: }
121:
122: public boolean isEmpty() throws SQLException {
123: // TODO Auto-generated method stub
124: return false;
125: }
126:
127: public boolean isFirst() throws SQLException {
128: // TODO Auto-generated method stub
129: return false;
130: }
131:
132: public boolean isLast() throws SQLException {
133: // TODO Auto-generated method stub
134: return false;
135: }
136:
137: public void moveRowRelative(int rows) throws SQLException {
138: // TODO Auto-generated method stub
139:
140: }
141:
142: public ResultSetRow next() throws SQLException {
143: // TODO Auto-generated method stub
144: return null;
145: }
146:
147: public void removeRow(int index) throws SQLException {
148: // TODO Auto-generated method stub
149:
150: }
151:
152: public void setCurrentRow(int rowNumber) throws SQLException {
153: // TODO Auto-generated method stub
154:
155: }
156:
157: public void setOwner(ResultSetImpl rs) {
158: // TODO Auto-generated method stub
159:
160: }
161:
162: public int size() throws SQLException {
163: // TODO Auto-generated method stub
164: return 0;
165: }
166:
167: public boolean wasEmpty() {
168: // TODO Auto-generated method stub
169: return false;
170: }
171:
172: public void setMetadata(Field[] metadata) {
173: // no-op
174: }
175: }
|