This read-only attribute specifies the number of rows that the last
        .execute*() produced (for DQL statements like ``SELECT``) or affected
        (for DML statements like ``UPDATE`` or ``INSERT``).
353480
def rowcount(self):
        
        if (self._closed or not self._result or "rows" not in self._result):
            return -1
        return self._result.get("rowcount", -1)
392722
public String getCountStatement()
    {
        StringBuilder  stmt = new StringBuilder();
        stmt.append( _SELECT_COUNT_ ).append( _fromClause ).append( _whereClause );

        return stmt.toString();
    }
984642
def executemany(self, query, args):
        
        if not args:
            return

        m = RE_INSERT_VALUES.match(query)
        if m:
            q_prefix = m.group(1)
            q_values = m.group(2).rstrip()
            q_postfix = m.group(3) or ''
            assert q_values[0] == '(' and q_values[-1] == ')'
            yield self._do_execute_many(q_prefix, q_values, q_postfix, args,
                                        self.max_stmt_length,
                                        self._get_db().encoding)
        else:
            rows = 0
            for arg in args:
                yield self.execute(query, arg)
                rows += self.rowcount
            self.rowcount = rows
        raise gen.Return(self.rowcount)
1157635
public int execSelectCount(Class<? extends D6Model> modelClazz) {

    final D6CrudSelectHelper d6CrudSelectHelper = new D6CrudSelectHelper(modelClazz);
    final String sqlForSelectCount = d6CrudSelectHelper.getSQLForSelectCount();

    return execSelectCount(sqlForSelectCount);
  }
1178807
private Statement compileAlterTableDropLimit(Table t) {

        HsqlName readName  = null;
        HsqlName writeName = null;
        boolean  cascade   = false;

        if (token.tokenType == Tokens.RESTRICT) {
            read();
        } else if (token.tokenType == Tokens.CASCADE) {
            read();

            cascade = true;
        }

        SchemaObject object = t.getLimitConstraint();
        if (object == null) {
            throw Error.error(ErrorCode.X_42501);
        }

        if (cascade) {
            writeName = database.getCatalogName();
        } else {
            writeName = t.getName();
        }

        Object[] args = new Object[] {
            object.getName(), Integer.valueOf(SchemaObject.CONSTRAINT),
            Boolean.valueOf(cascade), Boolean.valueOf(false)
        };
        String sql = getLastPart();

        return new StatementSchema(sql, StatementTypes.DROP_CONSTRAINT, args,
                                   readName, writeName);
    }
987477
def _count(self, method, limit, keywords):
        
        # The limit will be mutated, so copy it and leave the original intact
        limit = limit.copy()
        has_more = True
        count = None
        while has_more:
            limit.set_request_args(keywords)
            response = self.call(method, **keywords)
            limit.post_fetch(response)
            count += Count.from_response(response)
            last_evaluated_key = response.get('LastEvaluatedKey')
            has_more = last_evaluated_key is not None and not limit.complete
            if has_more:
                keywords['ExclusiveStartKey'] = last_evaluated_key
        return count
105037
protected function countTotalRows()
    {
        $source = $this->getSource();
        /** @var \Doctrine\ORM\Query\Expr\Select $select */
        $source->resetDQLPart('select')->setFirstResult(0)->select('count(' . $this->entityAlias . ')');
        return (int)$source->getQuery()->getSingleScalarResult();
    }
642673
def execute(stmt, args=()):
    
    ctx = Context.current()
    with ctx.mdr:
        cursor = ctx.execute(stmt, args)
        row_count = cursor.rowcount
        _safe_close(cursor)
    return row_count
76326
private void updateReadonly(EntityType entityType, Attribute attr, Attribute updatedAttr) {
    Map<String, Attribute> readonlyTableAttrs =
        getTableAttributesReadonly(entityType)
            .collect(toLinkedMap(Attribute::getName, Function.identity()));
    if (!readonlyTableAttrs.isEmpty()) {
      dropTableTriggers(entityType);
    }

    if (attr.isReadOnly() && !updatedAttr.isReadOnly()) {
      readonlyTableAttrs.remove(attr.getName());
    } else if (!attr.isReadOnly() && updatedAttr.isReadOnly()) {
      readonlyTableAttrs.put(updatedAttr.getName(), updatedAttr);
    }

    if (!readonlyTableAttrs.isEmpty()) {
      createTableTriggers(entityType, readonlyTableAttrs.values());
    }
  }
518595
protected final int doSelect(Connection c) throws SQLException {
		Statement stmt = null;
		ResultSet rs = null;
		try {
			stmt = c.createStatement();
			rs = stmt.executeQuery("select * from foo");
			int count = 0;
			while (rs.next()) {
				count++;
			}
			return count;
		} finally {
			if (rs != null) {
				rs.close();
			}
			if (stmt != null) {
				stmt.close();
			}
		}
	}
50721
private void throwIfStatementForbidden(PreparedStatement statement) {
        if (mOnlyAllowReadOnlyOperations && !statement.mReadOnly) {
            throw new com.couchbase.lite.internal.database.sqlite.exception.SQLiteException(
                    "Cannot execute this statement because it "
                    + "might modify the database but the connection is read-only.");
        }
    }
261605
public function affected_rows($result = null)
    {
        if ($result || ($result === null && ($result = $this->last_result))) {
            if ($result !== true) {
                return $result->rowCount();
            }
        }

        return 0;
    }
1076695
def is_read_only(cls,
                     db: DATABASE_SUPPORTER_FWD_REF,
                     logger: logging.Logger = None) -> bool:
        """"""

        def convert_enums(row_):
            # All these columns are of type enum('N', 'Y');
            # https://dev.mysql.com/doc/refman/5.0/en/enum.html
            return [True if x == 'Y' else (False if x == 'N' else None)
                    for x in row_]

        # 1. Check per-database privileges.
        # We don't check SELECT privileges. We're just trying to ensure
        # nothing dangerous is present - for ANY database.
        # If we get an exception
        try:
            sql = """
                SELECT db,
                       /* must not have: */
                       Insert_priv, Update_priv, Delete_priv,
                       Create_priv, Drop_priv, Index_priv, Alter_priv,
                       Lock_tables_priv, Create_view_priv,
                       Create_routine_priv, Alter_routine_priv,
                       Execute_priv, Event_priv, Trigger_priv
                FROM mysql.db
                WHERE
                    CONCAT(user, '@', host) = CURRENT_USER()
            """
            rows = db.fetchall(sql)
            for row in rows:
                dbname = row[0]
                prohibited = convert_enums(row[1:])
                if any(prohibited):
                    if logger:
                        logger.debug(
                            "MySQL.is_read_only(): FAIL: database privileges "
                            "wrong: dbname={}, prohibited={}".format(
                                dbname, prohibited
                            )
                        )
                    return False
        except mysql.OperationalError:
            # Probably: error 1142, "SELECT command denied to user 'xxx'@'yyy'
            # for table 'db'". This would be OK.
            pass

        # 2. Global privileges, e.g. as held by root
        try:
            sql = """
                SELECT /* must not have: */
                       Insert_priv, Update_priv, Delete_priv,
                       Create_priv, Drop_priv,
                       Reload_priv, Shutdown_priv,
                       Process_priv, File_priv, Grant_priv,
                       Index_priv, Alter_priv,
                       Show_db_priv, Super_priv,
                       Lock_tables_priv, Execute_priv,
                       Repl_slave_priv, Repl_client_priv,
                       Create_view_priv,
                       Create_routine_priv, Alter_routine_priv,
                       Create_user_priv,
                       Event_priv, Trigger_priv,
                       Create_tablespace_priv
                FROM mysql.user
                WHERE
                    CONCAT(user, '@', host) = CURRENT_USER()
            """
            rows = db.fetchall(sql)
            if not rows or len(rows) > 1:
                return False
            prohibited = convert_enums(rows[0])
            if any(prohibited):
                if logger:
                    logger.debug(
                        "MySQL.is_read_only(): FAIL: GLOBAL privileges "
                        "wrong: prohibited={}".format(prohibited))
                return False
        except mysql.OperationalError:
            # Probably: error 1142, "SELECT command denied to user 'xxx'@'yyy'
            # for table 'user'". This would be OK.
            pass

        return True
728119
public int execSelectCount(String preparedSql, Object[] searchKeys) {
    log("#execSelectCount preparedSql=" + preparedSql + " searchKeys=" + searchKeys);
    int retVal = 0;

    PreparedStatement preparedStmt = null;
    ResultSet rs = null;

    final Connection conn = createConnection();

    try {

      preparedStmt = conn.prepareStatement(preparedSql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

      final StringBuilder logSb = new StringBuilder();

      if (searchKeys != null) {
        logSb.append("/ ");
        for (int i = 0; i < searchKeys.length; i++) {

          setObject((i + 1), preparedStmt, searchKeys[i]);

          logSb.append("key(" + (i + 1) + ")=" + searchKeys[i]);
          logSb.append(" ");
        }
      }

      log("#execSelectCount SQL=" + preparedSql + " " + logSb.toString());

      // execute SQL
      rs = preparedStmt.executeQuery();

      while (rs.next()) {
        retVal = rs.getInt(1);
      }

    } catch (Exception e) {
      loge("#execSelectCount", e);

    } finally {
      try {
        if (rs != null) {
          rs.close();
        }
        if (preparedStmt != null) {
          preparedStmt.close();
        }
        if (conn != null) {
          conn.close();
        }
      } catch (SQLException e) {

        loge("#execSelectCount", e);
      }
    }
    return retVal;

  }
87362
public static void warnedUpdate (PreparedStatement stmt, int expectedCount)
        throws SQLException
    {
        int modified = stmt.executeUpdate();
        if (modified != expectedCount) {
            log.warning("Statement did not modify expected number of rows", "stmt", stmt,
                        "expected", expectedCount, "modified", modified);
        }
    }
996572
private void checkIndex(int parameterIndex, boolean fetchingData) throws SQLException {
    if (!isFunction) {
      throw new PSQLException(
          GT.tr(
              "A CallableStatement was declared, but no call to registerOutParameter(1, <some type>) was made."),
          PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
    }

    if (fetchingData) {
      if (!returnTypeSet) {
        throw new PSQLException(GT.tr("No function outputs were registered."),
            PSQLState.OBJECT_NOT_IN_STATE);
      }

      if (callResult == null) {
        throw new PSQLException(
            GT.tr("Results cannot be retrieved from a CallableStatement before it is executed."),
            PSQLState.NO_DATA);
      }

      lastIndex = parameterIndex;
    }
  }
1254037
def _select_batched(self, table, cols, num_rows, limit, queries_per_batch=3, execute=True):
        """"""
        # Execute select queries in small batches to avoid connection timeout
        commands, offset = [], 0
        while num_rows > 0:
            # Use number of rows as limit if num_rows < limit
            _limit = min(limit, num_rows)

            # Execute select_limit query
            commands.append(self._select_limit_statement(table, cols=cols, offset=offset, limit=limit))
            offset += _limit
            num_rows += -_limit

        # Execute commands
        if execute:
            rows = []
            til_reconnect = queries_per_batch
            for c in commands:
                if til_reconnect == 0:
                    self.disconnect()
                    self.reconnect()
                    til_reconnect = queries_per_batch
                rows.extend(self.fetch(c, False))
                til_reconnect += -1
            del commands
            return rows
        # Return commands
        else:
            return commands