Checks the number of values returned when looking up meta info about
 the procedure.
 @see #load
 @see #info_sql
420951
def validate(result)
      if result.ntuples == 0
        raise NotFound
      elsif result.ntuples > 1
        raise TooManyChoices
      end
    end
1234352
public int getCount() {
		if (metadata != null && metadata.get("count") != null) {
			return Integer.parseInt(metadata.get("count"));
		}
		
		if (entities == null && entity !=null) {
			return 1;
		}
		
		return 0;
	}
1265632
public static <T extends Entity> T handleRow(T row, int columnCount, ResultSetMetaData meta, ResultSet rs, boolean withMetaInfo) throws SQLException {
		String columnLabel;
		int type;
		for (int i = 1; i <= columnCount; i++) {
			columnLabel = meta.getColumnLabel(i);
			type = meta.getColumnType(i);
			row.put(columnLabel, getColumnValue(rs, columnLabel, type, null));
		}
		if (withMetaInfo) {
			row.setTableName(meta.getTableName(1));
			row.setFieldNames(row.keySet());
		}
		return row;
	}
574380
public int numValues(String property) {
		int count = 0;
		if (has()) {
			TResult result = queryForValues(property);
			try {
				count = result.getCount();
			} finally {
				result.close();
			}
		}
		return count;
	}
1143462
public function loadResult()
	{
		// Initialise variables
		$return = null;

		// Execute the query
		if (!$this->execute())
		{
			return null;
		}

		// Get the first row from the result set as an array
		if ($row = $this->fetchArray())
		{
			$return = $row[0];
		}

		// Free up system resources and return
		$this->freeResult();

		return $return;
	}
89127
public function num_rows()
	{
		return is_int($this->num_rows)
			? $this->num_rows
			: $this->num_rows = @sqlite_num_rows($this->result_id);
	}
777647
public function sqlLoadCount()
    {
        if (!$this->hasTable()) {
            throw new UnexpectedValueException(
                'Can not get SQL count. No table defined.'
            );
        }

        $tables  = $this->sqlFrom();
        $filters = $this->sqlFilters();

        $query = 'SELECT COUNT(*) FROM '.$tables.$filters;
        return $query;
    }
907645
static QueryMeta buildCountSql(ActiveRecord activeRecord) {
        QueryMeta     queryMeta = new QueryMeta();
        StringBuilder sqlBuf    = new StringBuilder("SELECT COUNT(*) FROM " + activeRecord.getTableName());
        int[]         pos       = {1};
        List<Object>  list      = parseWhere(activeRecord, pos, sqlBuf);

        List<Object> temp = andWhere(activeRecord, pos, sqlBuf);
        if (null != temp) {
            list.addAll(temp);
        }

        String   sql  = sqlFilter(sqlBuf.toString());
        Object[] args = list.toArray();
        queryMeta.setSql(sql);
        queryMeta.setParams(args);
        return queryMeta;
    }
337729
def rpc_get_num_names( self, **con_info ):
        
        db = get_db_state(self.working_dir)
        num_names = db.get_num_names()
        db.close()

        return self.success_response( {'count': num_names} )
544714
def count *where
    sql, *binds = SQLHelper.count :table => name, :where => @query_where + where, :prepared => true
    pstmt = prepare :count, sql
    pstmt.query(*binds).to_a[0][0].to_i
  end
395417
public boolean isFilled() {
        boolean isFilled = false;

        if (this.originalSql != null && this.originalSql.length() > 0) {
            if (this.parsedSql != null && this.parsedSql.length() > 0) {
                if (this.sqlParameterNames != null) {
                    if (this.sqlParameterValues != null) {
                        isFilled = true;
                    }
                }
            }
        }

        return isFilled;
    }
318484
private void processIntegerReturn() {
        if ((sawConstant == null) && (stack.getStackDepth() == 0)) {
            throw new StopOpcodeParsingException();
        }

        Integer returnValue = null;
        if (sawConstant == null) {
            OpcodeStack.Item item = stack.getStackItem(0);
            returnValue = (Integer) item.getConstant();
        } else {
            returnValue = sawConstant;
        }

        if (returnValue == null) {
            throw new StopOpcodeParsingException();
        }
        int v = returnValue.intValue();
        if (v < 0) {
            seenNegative = true;
            if (getPC() > furthestBranchTarget) {
                seenUnconditionalNonZero = true;
            }
        } else if (v > 0) {
            seenPositive = true;
            if (getPC() > furthestBranchTarget) {
                seenUnconditionalNonZero = true;
            }
        } else {
            seenZero = true;
        }

        sawConstant = null;
    }
911620
boolean getMoreResults(int current) throws SQLException {
        checkClosed();

        if (resultIn == null || !resultIn.isData()) {
            return false;
        }

        if (resultSetCounter == 0) {
            resultSetCounter++;
            return true;
        }

        if (currentResultSet != null && current != KEEP_CURRENT_RESULT) {
            currentResultSet.close();
        }

        resultIn = null;

        return false;
    }
1040923
def count(self):
        
        sql = u'SELECT count() FROM (%s)' % self.as_sql()
        raw = self._database.raw(sql)
        return int(raw) if raw else 0
1318007
public Integer getAmountOfParameters() {
        Integer size = 0;

        if (this.sqlParameterNames != null) {
            size = this.sqlParameterNames.size();
        }
        return size;
    }
352486
private int getNumObjectsWithVersion(Connection conn, int n)
            throws SQLException {

        PreparedStatement st = null;
        try {
            String query;
            // Because we are dealing with only two Strings, one of which is fixed,
            // take advantage of String.concat
            if (n > 0) {
                query = "SELECT COUNT(*) FROM doRegistry WHERE systemVersion = ".concat(Integer.toString(n));
            } else {
                query = "SELECT COUNT(*) FROM doRegistry";
            }
            st = conn.prepareStatement(query);
            ResultSet results = st.executeQuery();
            results.next();
            return results.getInt(1);
        } finally {
            if (st != null) {
                st.close();
            }
        }
    }
893122
def count
      raise OData::NotSupportedError.new("You cannot call both the `links` method and the `count` method in the same query.") if @links_navigation_property
      raise OData::NotSupportedError.new("You cannot call both the `select` method and the `count` method in the same query.") unless @select.empty?

      @count = true
      self
    end