コード例 #1
0
ファイル: EnvironmentHandle.cpp プロジェクト: as2120/ZPoco
EnvironmentHandle::EnvironmentHandle(): _henv(SQL_NULL_HENV)
{
    if (Utility::isError(SQLAllocHandle(SQL_HANDLE_ENV,
                                        SQL_NULL_HANDLE,
                                        &_henv)) ||
            Utility::isError(SQLSetEnvAttr(_henv,
                                           SQL_ATTR_ODBC_VERSION,
                                           (SQLPOINTER) SQL_OV_ODBC3,
                                           0)))
    {
        throw ODBCException("Could not initialize environment.");
    }
}
コード例 #2
0
void ODBCStatementImpl::addPreparation()
{
	if (0 == _preparations.size())
	{
		std::string statement(toString());
		if (statement.empty())
			throw ODBCException("Empty statements are illegal");

		Preparation::DataExtraction ext = session().getFeature("autoExtract") ? 
			Preparation::DE_BOUND : Preparation::DE_MANUAL;
		
		std::size_t maxFieldSize = AnyCast<std::size_t>(session().getProperty("maxFieldSize"));

		_preparations.push_back(new Preparation(_stmt, statement, maxFieldSize, ext));
	}
	else
		_preparations.push_back(new Preparation(*_preparations[0]));

	_extractors.push_back(new Extractor(_stmt, *_preparations.back()));
}