title: Why the returning object of the orm function is limited to 100?
body: <p>In a Node.js project I'm using <a href="https://www.npmjs.com/package/oracle-orm-zn" rel="nofollow noreferrer">oracle-orm-zn</a> for the communication with my Oracle database.</p>
  
  <p>At some point I call the function <code>findAllandCount()</code> to get all the records in a table:</p>
  
  <pre><code>...
  tipm.findAllandCount(params).then(function (r) {
      if (r.all &gt; 0) {
          locals.data.righe = r.rows;
  
          console.log("+allRows:", r.all);
          console.log("+NumRows:", r.rows.length);
      }
  ...
  </code></pre>
  
  <p>Where <code>params</code> is the Object:</p>
  
  <pre><code>// var params = { attributes: viewOrder, order: sortOrder, limit: 9999 };
  var params = { attributes: viewOrder, order: sortOrder};
  </code></pre>
  
  <p>As indicated in <a href="https://www.npmjs.com/package/oracle-orm-zn#modelfindallandcount" rel="nofollow noreferrer">findAllandCount() documentation</a> without limit (or with limit = 9999) I should get all the records of the table!
  Instead I get only 100 records, as I can see from the <code>console.log("+NumRows:", r.rows.length)</code> statement.</p>
  
  <p>The statement <code>console.log("+allRows:", r.all)</code> give me the correct number of records.</p>
  
  <p>I thought so that the problem is in <code>findAllandCount()</code> function of the module, that is:</p>
  
  <pre><code>Model.prototype.findAllandCount = function(options){
      var pro = Q.defer(), self = this;
      var sql_count = 'select count(*) as count from ' + self.table_name;
      var sql = 'select * from (select rownum rownum_,t.* from ', start = 0, end = 100;
      if(!options){
          sql += self.table_name+ ' where rownum &lt;= ' + end ;
      }else{
          sql += '(';
          var _col = '', _tab = '', _where = '';
          var makeCTW = function(opt, par_tn){
              if(!opt.model ) { pro.reject(ecode.lack_para());return pro.promise;}
              var sub_tn = opt.model.table_name;
              //make column sql (has ',' last)
              if(opt.attributes &amp;&amp; opt.attributes.length){
                  for(var i=0;i&lt;opt.attributes.length;i++){
                      _col += par_tn? sub_tn+'.'+opt.attributes[i]+' as '+sub_tn+'#'+opt.attributes[i]+',' : sub_tn+'.'+opt.attributes[i]+',';
                  }
              }else{
                  if(par_tn){
                      for(var colkey in opt.model.col_def){
                          _col += sub_tn+'.'+colkey+' as '+sub_tn+'#'+colkey+',';
                      }
                  }else
                      _col += sub_tn+'.*,';
              }
              //make table sql (has ',' front)
              if(opt.notRequired &amp;&amp; par_tn){
                  if(!opt.use||!opt.on){ pro.reject(ecode.lack_para());return pro.promise;}
                  _tab += ' left join '+sub_tn+' on '+par_tn+'.'+opt.use+'='+sub_tn+'.'+opt.on;
              }else{
                  _tab += ','+sub_tn;
              }
              //make where sql (has ' and ' last)
              if(opt.where){
                  _where += lib.whereObjToSqlStr(opt.where,opt.model.col_def,sub_tn)+' and ';
              }
              if(!opt.notRequired &amp;&amp; par_tn){
                  if(!opt.use||!opt.on){
                      pro.reject(ecode.lack_para());return pro.promise;
                  }
                  _where += par_tn+'.'+opt.use+'='+sub_tn+'.'+opt.on+' and ';
              }
              if(opt.include &amp;&amp; opt.include.length){
                  for(var j= 0; j&lt;opt.include.length; j++) makeCTW(opt.include[j],sub_tn);
              }
          };
          options.model = self;
          makeCTW(options);
          sql += 'select '+_col.substring(0,_col.length-1)+' from '+_tab.substring(1,_tab.length)+
              (_where==''?'':(' where '+_where.substring(0,_where.length-4)))+
              ') t where rownum&lt;='+end+' ) where rownum_&gt;='+start;
          if(options.order){
              if(typeof(options.order) == 'string') sql += ' order by '+options.order;
              else if(options.order.length){
                  sql += ' order by ';
                  for(var i= 0,l= options.order.length;i&lt;l;i++) sql += options.order[i]+',';
                  sql = sql.substring(0,sql.length-1);
              }
          }
      }
      self.orm.getCon().then(function(con){
          var _pro = Q.defer();
          con.execute(sql_count,{},self.orm.opt,function(e,r){
              if(e) _pro.reject({c:con,e:'FindAllandCount count error: '+ e.message});
              else _pro.resolve({c:con,r: r.rows[0].COUNT});
          });
          return _pro.promise;
      }).then(function(res){
          var con = res.c, count = res.r;
          var _pro = Q.defer();
          con.execute(sql,{},self.orm.opt,function(e,r){
              if(e) _pro.reject({c:con,e:'FindAllandCount select error: '+ e.message});
              else _pro.resolve({c:con,r: r.rows.length? r.rows: null, count: count});
          });
          return _pro.promise;
      }).then(function(res){
          res.c.release();
          if(res.r &amp;&amp; res.r.length){
              for(var i= 0,l=res.r.length;i&lt;l;i++){
                  delete res.r[i].ROWNUM_;
                  for(var k in res.r[i]){
                      var ks = k.split('#');
                      if(ks.length ==2 &amp;&amp; ks[0] &amp;&amp; ks[1]){
                          if(!res.r[i][ks[0]]) res.r[i][ks[0]] = {};
                          res.r[i][ks[0]][ks[1]] = res.r[i][k];
                          delete res.r[i][k];
                      }
                  }
              }
          }
          pro.resolve({
              all: res.count,
              rows: res.r
          });
      }).catch(function(e){
          e.c.release();
          pro.reject(ecode.sql_execute(e.e));
      });
      return pro.promise;
  };
  </code></pre>
  
  <p>And, unless my mistakes, everything seems to depend on that <code>end = 100</code>. Which does not seem to be set dynamically.</p>
  
  <p>Is this really the case?
  Should I open an issue on the github page of oracle-orm-zn?</p>
  
  <p>Can I do some more tests? Any idea?</p>