for (int i = 1; i <= md.getColumnCount(); i++)
int columnCount = md.getColumnCount(); for (int i = 1; i <= columnCount; i++)
  public LuaObject fetch(LuaObject table, String modeString)  {    try    {      if (!rs.next())        return null;      table.push();      ResultSetMetaData md = rs.getMetaData();      for (int i = 1; i <= md.getColumnCount(); i++)      {        int type = md.getColumnType(i);                if ("a".equalsIgnoreCase(modeString))          L.pushString(md.getColumnName(i));        else          L.pushNumber(i);                switch (type)        {          case Types.INTEGER: case Types.BIGINT: case Types.SMALLINT:          case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT:          case Types.NUMERIC: case Types.REAL: case Types.TINYINT:                        L.pushNumber(rs.getDouble(i));            break;                      case Types.CHAR: case Types.VARCHAR:          case Types.LONGVARCHAR: case Types.CLOB:            L.pushString(rs.getString(i));            break;          case Types.BINARY: case Types.VARBINARY:          case Types.LONGVARBINARY: case Types.BLOB:                        L.pushString(rs.getBytes(i));            break;                    case Types.BIT: case Types.BOOLEAN:                        L.pushBoolean(rs.getBoolean(i)? 1 : 0);            break;                    case Types.DATE: case Types.TIME: case Types.TIMESTAMP:                        L.pushString(rs.getDate(i).toString());            break;                    default:                        L.pushString(rs.getString(i));            break;        }                L.setTable(-3);      }            L.pop(1);      return table;    }    catch (SQLException e)    {      return table;    }  }