Home | Trees | Indices | Help |
|
---|
|
1 # osh 2 # Copyright (C) Jack Orenstein <jao@geophile.com> 3 # 4 # This program is free software; you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License as published by 6 # the Free Software Foundation; either version 2 of the License, or 7 # (at your option) any later version. 8 # 9 # This program is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License 15 # along with this program; if not, write to the Free Software 16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 18 import osh.command.sql 19 20 CURSOR_ARRAYSIZE = 20 21235225 connect_args = [] 26 driver = None 27 for key, value in connect_info.iteritems(): 28 if key == 'driver': 29 driver = value 30 else: 31 connect_args.append("%s = '%s'" % (key, value)) 32 connect_statement = '%s.connect(%s)' % (driver, ', '.join(connect_args)) 33 exec('import %s' % driver) 34 connection = _Connection(eval(connect_statement)) 35 return connection3638 cursor = connection.cursor 39 cursor.execute(query, inputs) 40 rows = cursor.fetchmany() 41 while len(rows) > 0: 42 for row in rows: 43 yield row 44 rows = cursor.fetchmany()4554 55 connection = None 56 cursor = None 576559 self.connection = connection 60 self.cursor = connection.cursor() 61 self.cursor.arraysize = CURSOR_ARRAYSIZE62
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu Jul 31 17:01:38 2008 | http://epydoc.sourceforge.net |