        attribute = [EOAttribute attributeWithOracleType: info->type  name: cname  length: clen  width: info->max_width];
        [_resultSetProperties addObject: attribute];
  
-@@ -394,16 +459,17 @@
+@@ -394,16 +481,17 @@
        return NO;
      }
  

 {
   if (OCITerminate(OCI_DEFAULT))
     NSLog(@"FAILED: OCITerminate()");
@@ -89,6 +112,11 @@
 
 + (void) initialize
 {

   // We alloc our statement handle
   if ((status = OCIHandleAlloc((dvoid *)_oci_env, (dvoid **)&_current_stm, (ub4)OCI_HTYPE_STMT, (CONST size_t) 0, (dvoid **) 0)))
     {
@@ -253,6 +296,22 @@
       return NO;
     }
 
+  prefetchrows = 100000; /* huge numbers here force a fallback on the memory limit below, which is what we really are interested in */
+  if ((status = OCIAttrSet(_current_stm, (ub4)OCI_HTYPE_STMT, (dvoid *)&prefetchrows, (ub4) sizeof(ub4), (ub4)OCI_ATTR_PREFETCH_ROWS, _oci_err)))
+    {
+      checkerr(_oci_err, status);
+      NSLog(@"Can't set prefetch rows (%d).", prefetchrows);
+      return NO;
+    }
+  
+  memory = prefetchMemorySize;
+  if ((status = OCIAttrSet(_current_stm, (ub4)OCI_HTYPE_STMT, (dvoid *)&memory, (ub4) sizeof(ub4), (ub4)OCI_ATTR_PREFETCH_MEMORY, _oci_err)))
+    {
+      checkerr(_oci_err, status);
+      NSLog(@"Can't set prefetch memory (%d).", memory);
+      return NO;
+    }
+
   // We prepare our statement
   if ((status = OCIStmtPrepare(_current_stm, _oci_err, sql, strlen((const char *)sql), OCI_NTV_SYNTAX, OCI_DEFAULT)))
     {
@@ -264,13 +323,39 @@
   // We check if we're doing a SELECT and if so, we're fetching data!
   OCIAttrGet(_current_stm, OCI_HTYPE_STMT, &type, 0, OCI_ATTR_STMT_TYPE, _oci_err);
   self->isFetchInProgress = (type == OCI_STMT_SELECT ? YES : NO);
