Returns a new TableWrapper object with the given fetch size.
 If a block is given, executes the select statement and yields each row to the block.
 @param [Fixnum] fsz Fetch size
 @return [JDBCHelper::TableWrapper]
 @since 0.7.7
976948
def fetch_size fsz, &block
    obj = self.dup
    obj.instance_variable_set :@fetch_size, fsz
    ret obj, &block
  end
435150
def enumerable(sql, fetch_size = 1000)
      results = @statement.execute_query(sql)

      Enumerator.new do |y|
        column_count = results.get_meta_data.get_column_count
        while(results.next) do
          row = {}
          1.upto(column_count) do |i|
            column_name = results.get_meta_data.get_column_name(i).to_sym
            row[column_name] = to_ruby_type(results.get_object(i))
          end
          y << row
        end
      end
    end
1139367
def unpack_rawr_zip_payload(table_sources, payload):
    """"""
    # the io we get from S3 is streaming, so we can't seek on it, but zipfile
    # seems to require that. so we buffer it all in memory. RAWR tiles are
    # generally up to around 100MB in size, which should be safe to store in
    # RAM.
    from tilequeue.query.common import Table
    from io import BytesIO

    zfh = zipfile.ZipFile(BytesIO(payload), 'r')

    def get_table(table_name):
        # need to extract the whole compressed file from zip reader, as it
        # doesn't support .tell() on the filelike, which gzip requires.
        data = zfh.open(table_name, 'r').read()
        unpacker = Unpacker(file_like=BytesIO(data))
        source = table_sources[table_name]
        return Table(source, unpacker)

    return get_table
530902
def _get_table_width(table_spec):
    

    # Remove things like {\bfseries}
    cleaner_spec = re.sub(r'{[^}]*}', '', table_spec)

    # Remove X[] in tabu environments so they dont interfere with column count
    cleaner_spec = re.sub(r'X\[(.*?(.))\]', r'\2', cleaner_spec)
    spec_counter = Counter(cleaner_spec)

    return sum(spec_counter[l] for l in COLUMN_LETTERS)
759834
def transpose
      return @list.clone if @list.size == 0
      row_count = @list.size
      max_column_count = @list.map{|row| row.cells.size}.max
      result = Array.new(max_column_count) { Array.new(row_count) }
      # yes, I know it is silly, but that warning is really annoying
      row_count.times do |row_index|
         max_column_count.times do |column_index|
          datum = if @list[row_index].cells.size >= max_column_count
                    @list[row_index].cells[column_index]
                  elsif block_given?
                    yield(column_index, row_index)
                  end
          result[column_index][row_index] = datum
        end
      end
      result
    end
1055873
@Override
    public Row buildRow(final DefaultDataSet ds) {
        /** loop through each line in the file */
        while (true) {
            String line;
            try {
                line = fetchNextRecord(br, getQualifier(), getDelimiter());
            } catch (final IOException e) {
                throw new FPException("Error Fetching Record From File...", e);
            }

            if (line == null) {
                return null;
            }

            // check to see if the user has elected to skip the first record
            if (shouldSkipFirstRecord(line, ds)) {
                continue;
            }

            // TODO
            // seems like we may want to try doing something like this. I have my reservations because
            // it is possible that we don't get a "detail" id and this might generate NPE
            // is it going to create too much overhead to do a null check here as well???
            List<String> columns = ParserUtils.splitLine(line, getDelimiter(), getQualifier(), FPConstants.SPLITLINE_SIZE_INIT,
                    isPreserveLeadingWhitespace(), isPreserveTrailingWhitespace());
            final String mdkey = ParserUtils.getCMDKeyForDelimitedFile(getPzMetaData(), columns);
            final List<ColumnMetaData> cmds = ParserUtils.getColumnMetaData(mdkey, getPzMetaData());
            // DEBUG

            // Incorrect record length on line log the error. Line
            // will not be included in the dataset
            if (!validateColumns(ds, columns, cmds, line)) {
                continue;
            }

            return createRow(line, columns, mdkey);
        }
    }
376822
def table(self, table):
        
        return DataFrame.from_spark_rdd(self.sql_ctx.table(table),
                                        self.sql_ctx)
1105106
def get_table(table_name):
    
    table = get_raw_table(table_name)
    if isinstance(table, TableFuncWrapper):
        table = table()
    return table
636148
@Override
    public void setFetchSize(int rows) throws SQLException
    {
        checkClosed();
        if (rows < 0) {
            throw SQLError.get(SQLError.ILLEGAL_ARGUMENT, rows);
        }
        this.fetchSize = rows;
    }
502165
def gen_table(self):
        
        table_length = 1 << self.TableIdxWidth
        tbl = [0] * table_length
        for i in range(table_length):
            register = i
            if self.ReflectIn:
                register = self.reflect(register, self.TableIdxWidth)
            register = register << (self.Width - self.TableIdxWidth + self.CrcShift)
            for j in range(self.TableIdxWidth):
                if register & (self.MSB_Mask << self.CrcShift) != 0:
                    register = (register << 1) ^ (self.Poly << self.CrcShift)
                else:
                    register = (register << 1)
            if self.ReflectIn:
                register = self.reflect(register >> self.CrcShift, self.Width) << self.CrcShift
            tbl[i] = register & (self.Mask << self.CrcShift)
        return tbl
631355
protected void generateFetchMethods(TableDefinition table, JavaWriter out){
        VertxJavaWriter vOut = (VertxJavaWriter) out;
        String pType = vOut.ref(getStrategy().getFullJavaClassName(table, GeneratorStrategy.Mode.POJO));
        UniqueKeyDefinition primaryKey = table.getPrimaryKey();
        ColumnDefinition firstPrimaryKeyColumn = primaryKey.getKeyColumns().get(0);
        for (ColumnDefinition column : table.getColumns()) {
            final String colName = column.getOutputName();
            final String colClass = getStrategy().getJavaClassName(column);
            final String colType = vOut.ref(getJavaType(column.getType()));
            final String colIdentifier = vOut.ref(getStrategy().getFullJavaIdentifier(column), colRefSegments(column));


            //fetchById is already defined in VertxDAO
            if(!firstPrimaryKeyColumn.equals(column)){


                // fetchBy[Column]([T]...)
                // -----------------------

                generateFindManyByMethods(out, pType, colName, colClass, colType, colIdentifier);
            }


            ukLoop:
            for (UniqueKeyDefinition uk : column.getUniqueKeys()) {

                // If column is part of a single-column unique key...
                if (uk.getKeyColumns().size() == 1 && uk.getKeyColumns().get(0).equals(column) && !uk.isPrimaryKey()) {
                    // fetchOneBy[Column]([T])
                    // -----------------------
                    generateFindOneByMethods(out, pType, colName, colClass, colType, colIdentifier);
                    break ukLoop;
                }
            }
        }
    }
498234
int getSize(ResultSet rs) {
    try {
      if (rs.getType() == ResultSet.TYPE_FORWARD_ONLY) {
        return -1;
      }

      rs.last();
      int total = rs.getRow();
      rs.beforeFirst();
      return total;
    } catch (SQLException | AbstractMethodError sqle) {
      return -1;
    }
  }
1362155
def get_table(self, tablename):
        
        table, (_row, _col) = self.__tables[tablename]
        return table
584261
public static String getSql(Object jdbcWrapper) {
        if (jdbcWrapper instanceof WSJdbcPreparedStatement) // also includes WSJdbcCallableStatement
            return ((WSJdbcPreparedStatement) jdbcWrapper).sql;
        else if (jdbcWrapper instanceof WSJdbcResultSet)
            return ((WSJdbcResultSet) jdbcWrapper).sql;
        else
            return null;
    }
100036
def _TableFactory(tag, stream, offset, length):
    
    TableClass = {
        'head': _HeadTable,
        'name': _NameTable,
    }.get(tag, _BaseTable)
    return TableClass(tag, stream, offset, length)
246061
def formatted_size
      @formats.rcompact!
      sz = size
      fs = @formats.size
      fs > sz ? fs : sz
    end
1023322
def lcs_table(x, y)
      # This method does not take a block as an explicit parameter for performance reasons.
      c = Array.new(x.size) {[]}
      x.size.times {|i| c[i][0] = 0}
      y.size.times {|j| c[0][j] = 0}
      (1...x.size).each do |i|
        (1...y.size).each do |j|
          c[i][j] =
            if yield x[i], y[j]
              c[i - 1][j - 1] + 1
            else
              [c[i][j - 1], c[i - 1][j]].max
            end
        end
      end
      c
    end