Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(21)

Side by Side Diff: src/com/ziclix/python/sql/PyConnection.java

Issue 2888: __findattr__ refactor (Closed) SVN Base: https://jython.svn.sourceforge.net/svnroot/jython/branches/asm
Patch Set: This is the actually commited patch (on r5155), in case you have more comments Created 1 year, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Jython Database Specification API 2.0 2 * Jython Database Specification API 2.0
3 * 3 *
4 * $Id$ 4 * $Id$
5 * 5 *
6 * Copyright (c) 2001 brian zimmer <bzimmer@ziclix.com> 6 * Copyright (c) 2001 brian zimmer <bzimmer@ziclix.com>
7 * 7 *
8 */ 8 */
9 package com.ziclix.python.sql; 9 package com.ziclix.python.sql;
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 super.__setattr__(name, value); 172 super.__setattr__(name, value);
173 } 173 }
174 174
175 /** 175 /**
176 * Finds the attribute. 176 * Finds the attribute.
177 * 177 *
178 * @param name the name of the attribute of interest 178 * @param name the name of the attribute of interest
179 * @return the value for the attribute of the specified name 179 * @return the value for the attribute of the specified name
180 */ 180 */
181 public PyObject __findattr__(String name) { 181 public PyObject __findattr_ex__(String name) {
182 182
183 if ("autocommit".equals(name)) { 183 if ("autocommit".equals(name)) {
184 try { 184 try {
185 return connection.getAutoCommit() ? Py.One : Py.Zero; 185 return connection.getAutoCommit() ? Py.One : Py.Zero;
186 } catch (SQLException e) { 186 } catch (SQLException e) {
187 throw zxJDBC.makeException(zxJDBC.DatabaseError, e); 187 throw zxJDBC.makeException(zxJDBC.DatabaseError, e);
188 } 188 }
189 } else if ("dbname".equals(name)) { 189 } else if ("dbname".equals(name)) {
190 try { 190 try {
191 return Py.newString(this.connection.getMetaData().getDatabasePro ductName()); 191 return Py.newString(this.connection.getMetaData().getDatabasePro ductName());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } else if ("__statements__".equals(name)) { 223 } else if ("__statements__".equals(name)) {
224 return Py.java2py(Collections.unmodifiableSet(this.statements)); 224 return Py.java2py(Collections.unmodifiableSet(this.statements));
225 } else if ("__methods__".equals(name)) { 225 } else if ("__methods__".equals(name)) {
226 return __methods__; 226 return __methods__;
227 } else if ("__members__".equals(name)) { 227 } else if ("__members__".equals(name)) {
228 return __members__; 228 return __members__;
229 } else if ("closed".equals(name)) { 229 } else if ("closed".equals(name)) {
230 return Py.newBoolean(closed); 230 return Py.newBoolean(closed);
231 } 231 }
232 232
233 return super.__findattr__(name); 233 return super.__findattr_ex__(name);
234 } 234 }
235 235
236 /** 236 /**
237 * Close the connection now (rather than whenever __del__ is called). 237 * Close the connection now (rather than whenever __del__ is called).
238 * The connection will be unusable from this point forward; an Error 238 * The connection will be unusable from this point forward; an Error
239 * (or subclass) exception will be raised if any operation is attempted 239 * (or subclass) exception will be raised if any operation is attempted
240 * with the connection. The same applies to all cursor objects trying 240 * with the connection. The same applies to all cursor objects trying
241 * to use the connection. 241 * to use the connection.
242 */ 242 */
243 public void close() { 243 public void close() {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 rstype = (parser.numArg() >= 2) ? parser.arg(1) : rstype; 504 rstype = (parser.numArg() >= 2) ? parser.arg(1) : rstype;
505 rsconcur = (parser.numArg() >= 3) ? parser.arg(2) : rsconcur; 505 rsconcur = (parser.numArg() >= 3) ? parser.arg(2) : rsconcur;
506 506
507 return c.cursor(dynamic.__nonzero__(), rstype, rsconcur); 507 return c.cursor(dynamic.__nonzero__(), rstype, rsconcur);
508 508
509 default : 509 default :
510 throw info.unexpectedCall(args.length, true); 510 throw info.unexpectedCall(args.length, true);
511 } 511 }
512 } 512 }
513 } 513 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r483