Parameters:
     - db_name
     - tbl_name
     - max_indexes
979048
def get_indexes(self, db_name, tbl_name, max_indexes):
    
    self.send_get_indexes(db_name, tbl_name, max_indexes)
    return self.recv_get_indexes()
454698
function getRenameIndexSQL($xmldb_table, $xmldb_index, $newname) {
    /// Get the real index name
        $dbindexname = $this->mdb->get_manager()->find_index_name($xmldb_table, $xmldb_index);
        $xmldb_index->setName($newname);
        $results = array('DROP INDEX ' . $dbindexname);
        $results = array_merge($results, $this->getCreateIndexSQL($xmldb_table, $xmldb_index));
        return $results;
    }
495931
def list_database_names(self, session=None):
        
        return [doc["name"]
                for doc in self.list_databases(session, nameOnly=True)]
423097
def atlasdb_get_zonefiles_by_name(name, max_index=None, con=None, path=None):
    
    ret = []
    with AtlasDBOpen(con=con, path=path) as dbcon:

        sql = 'SELECT * FROM zonefiles WHERE name = ? ORDER BY inv_index'
        args = (name,)

        if max_index:
            sql += ' AND inv_index <= ?'
            args += (max_index,)

        sql += ';'

        cur = dbcon.cursor()
        res = atlasdb_query_execute(cur, sql, args)

        for zfinfo in res:
            row = {}
            row.update(zfinfo)
            ret.append(row)

    return ret
1366733
def _query(self, resource_id, max_rows):
        
        from astropy.io.votable import parse_single_table

        if max_rows is not None and max_rows >= 0:
            max_rows_str = str(max_rows)
        else:
            max_rows_str = str(9999999999)

        tmp_moc = tempfile.NamedTemporaryFile(delete=False)

        self.write(tmp_moc.name)
        r = requests.post('http://cdsxmatch.u-strasbg.fr/QueryCat/QueryCat',
                          data={'mode': 'mocfile',
                                'catName': resource_id,
                                'format': 'votable',
                                'limit': max_rows_str},
                          files={'moc': open(tmp_moc.name, 'rb')},
                          headers={'User-Agent': 'MOCPy'},
                          stream=True)

        tmp_vot = BytesIO()
        tmp_vot.write(r.content)

        table = parse_single_table(tmp_vot).to_table()

        # finally delete temp files
        os.unlink(tmp_moc.name)

        return table
434855
def db_is_indexing(cls, impl, working_dir):
        
        indexing_lockfile_path = config.get_lockfile_filename(impl, working_dir)
        return os.path.exists(indexing_lockfile_path)
1048034
def meta_to_indexes(meta, table_name=None, model_name=None):
    
    indexes, pk_field = {}, None

    indexes = []
    for meta_model_name, model_meta in meta.iteritems():
        if (table_name or model_name) and not (table_name == model_meta['Meta'].get('db_table', '') or model_name == meta_model_name):
            continue
        field_name, field_infodict, score = find_index(model_meta)
        indexes.append(('%s.%s' % (meta_model_name, field_name), field_infodict, score))
    return indexes
305855
def extract_name_max_chars(name, max_chars=64, blank=" "):
    
    new_name = name.strip()
    if len(new_name) > max_chars:
        new_name = new_name[:max_chars]  # get at most 64 chars
        if new_name.rfind(blank) > 0:
            new_name = new_name[:new_name.rfind(blank)]  # nearest word
    return new_name
520224
private Table get_table(String dbname, String tbl_name) throws MetaException, NoSuchObjectException, TException {
    send_get_table(dbname, tbl_name);
    return recv_get_table();
  }
758231
def _CreateIndexIfNotExists(self, index_name, mappings):
    
    try:
      if not self._client.indices.exists(index_name):
        self._client.indices.create(
            body={'mappings': mappings}, index=index_name)

    except elasticsearch.exceptions.ConnectionError as exception:
      raise RuntimeError(
          'Unable to create Elasticsearch index with error: {0!s}'.format(
              exception))
336423
def find_holes(db_module, db, table_name, column_name, _range, filter=None):
    
    if not filter:
        filter = {"match_all": {}}

    _range = wrap(_range)
    params = {
        "min": _range.min,
        "max": _range.max - 1,
        "column_name": db_module.quote_column(column_name),
        "table_name": db_module.quote_column(table_name),
        "filter": esfilter2sqlwhere(filter)
    }

    min_max = db.query("""
        SELECT
            min({{column_name}}) `min`,
            max({{column_name}})+1 `max`
        FROM
            {{table_name}} a
        WHERE
            a.{{column_name}} BETWEEN {{min}} AND {{max}} AND
            {{filter}}
    """, params)[0]

    db.execute("SET @last={{min}}-1", {"min": _range.min})
    ranges = db.query("""
        SELECT
            prev_rev+1 `min`,
            curr_rev `max`
        FROM (
            SELECT
                a.{{column_name}}-@last diff,
                @last prev_rev,
                @last:=a.{{column_name}} curr_rev
            FROM
                {{table_name}} a
            WHERE
                a.{{column_name}} BETWEEN {{min}} AND {{max}} AND
                {{filter}}
            ORDER BY
                a.{{column_name}}
        ) a
        WHERE
            diff>1
    """, params)

    if ranges:
        ranges.append({"min": min_max.max, "max": _range.max})
    else:
        if min_max.min:
            ranges.append({"min": _range.min, "max": min_max.min})
            ranges.append({"min": min_max.max, "max": _range.max})
        else:
            ranges.append(_range)

    return ranges
1033089
def searchExpressionLevelsInDb(
            self, rnaQuantId, names=[], threshold=0.0, startIndex=0,
            maxResults=0):
        
        sql = ("SELECT * FROM Expression WHERE "
               "rna_quantification_id = ? "
               "AND expression > ? ")
        sql_args = (rnaQuantId, threshold)
        if len(names) > 0:
            sql += "AND name in ("
            sql += ",".join(['?' for name in names])
            sql += ") "
            for name in names:
                sql_args += (name,)
        sql += sqlite_backend.limitsSql(
            startIndex=startIndex, maxResults=maxResults)
        query = self._dbconn.execute(sql, sql_args)
        return sqlite_backend.iterativeFetch(query)
527200
def _IndexedScan(self, i, max_records=None):
    """"""
    self._ReadIndex()

    # The record number that we will read next.
    idx = 0
    # The timestamp that we will start reading from.
    start_ts = 0
    if i >= self._max_indexed:
      start_ts = max((0, 0), (self._index[self._max_indexed][0],
                              self._index[self._max_indexed][1] - 1))
      idx = self._max_indexed
    else:
      try:
        possible_idx = i - i % self.INDEX_SPACING
        start_ts = (max(0, self._index[possible_idx][0]),
                    self._index[possible_idx][1] - 1)
        idx = possible_idx
      except KeyError:
        pass

    if max_records is not None:
      max_records += i - idx

    with data_store.DB.GetMutationPool() as mutation_pool:
      for (ts, value) in self.Scan(
          after_timestamp=start_ts,
          max_records=max_records,
          include_suffix=True):
        self._MaybeWriteIndex(idx, ts, mutation_pool)
        if idx >= i:
          yield (idx, ts, value)
        idx += 1
982710
def get_table_objects_by_name(self, dbname, tbl_names):
    
    self.send_get_table_objects_by_name(dbname, tbl_names)
    return self.recv_get_table_objects_by_name()
313712
function index(req, res, next) {
  var nextPage
    , prevPage
    , page
    , links = {}
    , link = req.url + '?page=';

  db.users.all({page: req.query.page, limit: req.query.limit}, function(err, result) {
    if(err) { return next(err); }

    page = result.page;
    nextPage = result.count - (result.limit + result.offset) > 0;
    prevPage = page > 1;

    if(nextPage) links.next = link + (page + 1);
    if(prevPage) links.prev = link + (page - 1);
    if(Object.keys(links).length) res.links(links);

    res.json({
      links: links,
      page: page,
      count: result.count,
      users: result.rows,
      next: nextPage,
      prev: prevPage
    });

  });
}
393237
def indices(db=None):
    '''
    
    '''
    cur = _connect(db)

    if not cur:
        return False

    cur.execute(
        "SELECT name FROM sqlite_master WHERE type='index' ORDER BY name;"
    )
    rows = cur.fetchall()
    return rows
1255294
def get_partitions_by_filter(self, db_name, tbl_name, filter, max_parts):
    
    self.send_get_partitions_by_filter(db_name, tbl_name, filter, max_parts)
    return self.recv_get_partitions_by_filter()