Changeset: f9a40f66e573 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f9a40f66e573
Modified Files:
        clients/python2/monetdb/sql/connections.py
        clients/python2/monetdb/sql/cursors.py
        clients/python3/monetdb/sql/connections.py
        clients/python3/monetdb/sql/cursors.py
Branch: Feb2013
Log Message:

only set reply_size once


diffs (86 lines):

diff --git a/clients/python2/monetdb/sql/connections.py 
b/clients/python2/monetdb/sql/connections.py
--- a/clients/python2/monetdb/sql/connections.py
+++ b/clients/python2/monetdb/sql/connections.py
@@ -49,6 +49,7 @@ class Connection(object):
             password=password, database=database, language="sql")
         self.set_autocommit(autocommit)
         self.set_sizeheader(True)
+        self.set_replysize(100)
 
     def close(self):
         """ Close the connection. The connection will be unusable from this
@@ -81,6 +82,9 @@ class Connection(object):
         self.command("Xsizeheader %s" % int(sizeheader))
         self.sizeheader = sizeheader
 
+    def set_replysize(self, replysize):
+        self.command("Xreply_size %s" % int(replysize))
+        self.replysize = replysize
 
     def commit(self):
         """
diff --git a/clients/python2/monetdb/sql/cursors.py 
b/clients/python2/monetdb/sql/cursors.py
--- a/clients/python2/monetdb/sql/cursors.py
+++ b/clients/python2/monetdb/sql/cursors.py
@@ -40,7 +40,7 @@ class Cursor(object):
 
         """This read/write attribute specifies the number of rows to
         fetch at a time with .fetchmany()"""
-        self.arraysize = 100
+        self.arraysize = connection.replysize
 
 
         """This read-only attribute specifies the number of rows that
@@ -165,7 +165,8 @@ class Cursor(object):
         operation = unicode(operation).encode('utf-8')
 
         # set the number of rows to fetch
-        self.connection.command('Xreply_size %s' % self.arraysize)
+        if self.arraysize != self.connection.replysize:
+            self.connection.set_replysize(self.arraysize)
 
         if operation == self.operation:
             #same operation, DBAPI mentioned something about reuse
diff --git a/clients/python3/monetdb/sql/connections.py 
b/clients/python3/monetdb/sql/connections.py
--- a/clients/python3/monetdb/sql/connections.py
+++ b/clients/python3/monetdb/sql/connections.py
@@ -49,6 +49,7 @@ class Connection(object):
             password=password, database=database, language="sql")
         self.set_autocommit(autocommit)
         self.set_sizeheader(True)
+        self.set_replysize(100)
 
     def close(self):
         """ Close the connection. The connection will be unusable from this
@@ -81,6 +82,9 @@ class Connection(object):
         self.command("Xsizeheader %s" % int(sizeheader))
         self.sizeheader = sizeheader
 
+    def set_replysize(self, replysize):
+        self.command("Xreply_size %s" % int(replysize))
+        self.replysize = replysize
 
     def commit(self):
         """
diff --git a/clients/python3/monetdb/sql/cursors.py 
b/clients/python3/monetdb/sql/cursors.py
--- a/clients/python3/monetdb/sql/cursors.py
+++ b/clients/python3/monetdb/sql/cursors.py
@@ -40,7 +40,7 @@ class Cursor(object):
 
         """This read/write attribute specifies the number of rows to
         fetch at a time with .fetchmany()"""
-        self.arraysize = 100
+        self.arraysize = connection.replysize
 
 
         """This read-only attribute specifies the number of rows that
@@ -165,7 +165,8 @@ class Cursor(object):
         #operation = str(operation).encode('utf-8')
 
         # set the number of rows to fetch
-        self.connection.command('Xreply_size %s' % self.arraysize)
+        if self.arraysize != self.connection.replysize:
+            self.connection.set_replysize(self.arraysize)
 
         if operation == self.operation:
             #same operation, DBAPI mentioned something about reuse
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to