Beispiel #1
0
QueryResult SQLQueryHolder::GetResult(size_t index) {
	// Don't call to this function if the index is of an ad-hoc statement
	if (index < m_queries.size()) {
		ResultSet* result = m_queries[index].second.qresult;
		if (!result || !result->GetRowCount())
			return QueryResult(NULL);

		result->NextRow();
		return QueryResult(result);
	} else
		return QueryResult(NULL);
}
QueryResult DatabaseWorkerPool<T>::Query(const char* sql, T* connection /*= nullptr*/)
{
	if (!connection)
		connection = GetFreeConnection();

	ResultSet* result = connection->Query(sql);
	connection->Unlock();
	if (!result || !result->GetRowCount() || !result->NextRow())
	{
		delete result;
		return QueryResult(NULL);
	}

	return QueryResult(result);
}
Beispiel #3
0
bool BasicStatementTask::Execute()
{
    if(m_has_result)
    {
        ResultSet* result = m_conn->Query(m_sql);
        if(!result || !result->GetRowCount())
        {
            m_result.set(QueryResult(NULL));
            return false;
        }
        result->NextRow();
        m_result.set(QueryResult(result));
        return true;
    }

    return m_conn->Execute(m_sql);
}
bool BasicStatementTask::Execute()
{
    if (m_has_result)
    {
        ResultSet* result = m_conn->Query(m_sql);
        if (!result || !result->GetRowCount() || !result->NextRow())
        {
            delete result;
            m_result->set_value(QueryResult(nullptr));
            return false;
        }

        m_result->set_value(QueryResult(result));
        return true;
    }

    return m_conn->Execute(m_sql);
}