コード例 #1
0
Dictionary::Ptr IdoPgsqlConnection::FetchRow(const IdoPgsqlResult& result, int row)
{
	AssertOnWorkQueue();

	if (row >= PQntuples(result.get()))
		return Dictionary::Ptr();

	int columns = PQnfields(result.get());

	Dictionary::Ptr dict = new Dictionary();

	for (int column = 0; column < columns; column++) {
		Value value;

		if (!PQgetisnull(result.get(), row, column))
			value = PQgetvalue(result.get(), row, column);

		dict->Set(PQfname(result.get(), column), value);
	}

	return dict;
}
コード例 #2
0
Dictionary::Ptr IdoPgsqlConnection::FetchRow(const IdoPgsqlResult& result, int row)
{
	AssertOnWorkQueue();

	if (row >= m_Pgsql->ntuples(result.get()))
		return nullptr;

	int columns = m_Pgsql->nfields(result.get());

	DictionaryData dict;

	for (int column = 0; column < columns; column++) {
		Value value;

		if (!m_Pgsql->getisnull(result.get(), row, column))
			value = m_Pgsql->getvalue(result.get(), row, column);

		dict.emplace_back(m_Pgsql->fname(result.get(), column), value);
	}

	return new Dictionary(std::move(dict));
}