You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by is...@apache.org on 2017/04/13 11:48:00 UTC
[3/8] ignite git commit: IGNITE-3581: Implemented for enums from ODBC
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/common_types.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/common_types.cpp b/modules/platforms/cpp/odbc/src/common_types.cpp
index 36d11c2..09ea3dc 100644
--- a/modules/platforms/cpp/odbc/src/common_types.cpp
+++ b/modules/platforms/cpp/odbc/src/common_types.cpp
@@ -24,99 +24,99 @@ namespace ignite
{
namespace odbc
{
- int SqlResultToReturnCode(SqlResult result)
+ int SqlResultToReturnCode(SqlResult::Type result)
{
switch (result)
{
- case SQL_RESULT_SUCCESS:
+ case SqlResult::AI_SUCCESS:
return SQL_SUCCESS;
- case SQL_RESULT_SUCCESS_WITH_INFO:
+ case SqlResult::AI_SUCCESS_WITH_INFO:
return SQL_SUCCESS_WITH_INFO;
- case SQL_RESULT_NO_DATA:
+ case SqlResult::AI_NO_DATA:
return SQL_NO_DATA;
- case SQL_RESULT_NEED_DATA:
+ case SqlResult::AI_NEED_DATA:
return SQL_NEED_DATA;
- case SQL_RESULT_ERROR:
+ case SqlResult::AI_ERROR:
default:
return SQL_ERROR;
}
}
- DiagnosticField DiagnosticFieldToInternal(int16_t field)
+ DiagnosticField::Type DiagnosticFieldToInternal(int16_t field)
{
switch (field)
{
case SQL_DIAG_CURSOR_ROW_COUNT:
- return IGNITE_SQL_DIAG_HEADER_CURSOR_ROW_COUNT;
+ return DiagnosticField::HEADER_CURSOR_ROW_COUNT;
case SQL_DIAG_DYNAMIC_FUNCTION:
- return IGNITE_SQL_DIAG_HEADER_DYNAMIC_FUNCTION;
+ return DiagnosticField::HEADER_DYNAMIC_FUNCTION;
case SQL_DIAG_DYNAMIC_FUNCTION_CODE:
- return IGNITE_SQL_DIAG_HEADER_DYNAMIC_FUNCTION_CODE;
+ return DiagnosticField::HEADER_DYNAMIC_FUNCTION_CODE;
case SQL_DIAG_NUMBER:
- return IGNITE_SQL_DIAG_HEADER_NUMBER;
+ return DiagnosticField::HEADER_NUMBER;
case SQL_DIAG_RETURNCODE:
- return IGNITE_SQL_DIAG_HEADER_RETURNCODE;
+ return DiagnosticField::HEADER_RETURNCODE;
case SQL_DIAG_ROW_COUNT:
- return IGNITE_SQL_DIAG_HEADER_ROW_COUNT;
+ return DiagnosticField::HEADER_ROW_COUNT;
case SQL_DIAG_CLASS_ORIGIN:
- return IGNITE_SQL_DIAG_STATUS_CLASS_ORIGIN;
+ return DiagnosticField::STATUS_CLASS_ORIGIN;
case SQL_DIAG_COLUMN_NUMBER:
- return IGNITE_SQL_DIAG_STATUS_COLUMN_NUMBER;
+ return DiagnosticField::STATUS_COLUMN_NUMBER;
case SQL_DIAG_CONNECTION_NAME:
- return IGNITE_SQL_DIAG_STATUS_CONNECTION_NAME;
+ return DiagnosticField::STATUS_CONNECTION_NAME;
case SQL_DIAG_MESSAGE_TEXT:
- return IGNITE_SQL_DIAG_STATUS_MESSAGE_TEXT;
+ return DiagnosticField::STATUS_MESSAGE_TEXT;
case SQL_DIAG_NATIVE:
- return IGNITE_SQL_DIAG_STATUS_NATIVE;
+ return DiagnosticField::STATUS_NATIVE;
case SQL_DIAG_ROW_NUMBER:
- return IGNITE_SQL_DIAG_STATUS_ROW_NUMBER;
+ return DiagnosticField::STATUS_ROW_NUMBER;
case SQL_DIAG_SERVER_NAME:
- return IGNITE_SQL_DIAG_STATUS_SERVER_NAME;
+ return DiagnosticField::STATUS_SERVER_NAME;
case SQL_DIAG_SQLSTATE:
- return IGNITE_SQL_DIAG_STATUS_SQLSTATE;
+ return DiagnosticField::STATUS_SQLSTATE;
case SQL_DIAG_SUBCLASS_ORIGIN:
- return IGNITE_SQL_DIAG_STATUS_SUBCLASS_ORIGIN;
+ return DiagnosticField::STATUS_SUBCLASS_ORIGIN;
default:
break;
}
- return IGNITE_SQL_DIAG_UNKNOWN;
+ return DiagnosticField::UNKNOWN;
}
- EnvironmentAttribute EnvironmentAttributeToInternal(int32_t attr)
+ EnvironmentAttribute::Type EnvironmentAttributeToInternal(int32_t attr)
{
switch (attr)
{
case SQL_ATTR_ODBC_VERSION:
- return IGNITE_SQL_ENV_ATTR_ODBC_VERSION;
+ return EnvironmentAttribute::ODBC_VERSION;
case SQL_ATTR_OUTPUT_NTS:
- return IGNITE_SQL_ENV_ATTR_OUTPUT_NTS;
+ return EnvironmentAttribute::OUTPUT_NTS;
default:
break;
}
- return IGNITE_SQL_ENV_ATTR_UNKNOWN;
+ return EnvironmentAttribute::UNKNOWN;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/config/connection_info.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/connection_info.cpp b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
index a34d434..b642a39 100644
--- a/modules/platforms/cpp/odbc/src/config/connection_info.cpp
+++ b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
@@ -627,11 +627,11 @@ namespace ignite
// No-op.
}
- SqlResult ConnectionInfo::GetInfo(InfoType type, void* buf,
+ SqlResult::Type ConnectionInfo::GetInfo(InfoType type, void* buf,
short buflen, short* reslen) const
{
if (!buf || !buflen)
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
StringInfoMap::const_iterator itStr = strParams.find(type);
@@ -644,7 +644,7 @@ namespace ignite
if (reslen)
*reslen = strlen;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
UintInfoMap::const_iterator itInt = intParams.find(type);
@@ -655,7 +655,7 @@ namespace ignite
*res = itInt->second;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
UshortInfoMap::const_iterator itShort = shortParams.find(type);
@@ -666,10 +666,10 @@ namespace ignite
*res = itShort->second;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/connection.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/connection.cpp b/modules/platforms/cpp/odbc/src/connection.cpp
index 960a507..62194d0 100644
--- a/modules/platforms/cpp/odbc/src/connection.cpp
+++ b/modules/platforms/cpp/odbc/src/connection.cpp
@@ -76,14 +76,14 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalGetInfo(type, buf, buflen, reslen));
}
- SqlResult Connection::InternalGetInfo(config::ConnectionInfo::InfoType type, void* buf, short buflen, short* reslen)
+ SqlResult::Type Connection::InternalGetInfo(config::ConnectionInfo::InfoType type, void* buf, short buflen, short* reslen)
{
const config::ConnectionInfo& info = GetInfo();
- SqlResult res = info.GetInfo(type, buf, buflen, reslen);
+ SqlResult::Type res = info.GetInfo(type, buf, buflen, reslen);
- if (res != SQL_RESULT_SUCCESS)
- AddStatusRecord(SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED, "Not implemented.");
+ if (res != SqlResult::AI_SUCCESS)
+ AddStatusRecord(SqlState::SHYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED, "Not implemented.");
return res;
}
@@ -93,7 +93,7 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalEstablish(connectStr));
}
- SqlResult Connection::InternalEstablish(const std::string& connectStr)
+ SqlResult::Type Connection::InternalEstablish(const std::string& connectStr)
{
config::Configuration config;
@@ -103,9 +103,9 @@ namespace ignite
}
catch (IgniteError& e)
{
- AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, e.GetText());
+ AddStatusRecord(SqlState::SHY000_GENERAL_ERROR, e.GetText());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
return InternalEstablish(config);
@@ -116,24 +116,24 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalEstablish(cfg));
}
- SqlResult Connection::InternalEstablish(const config::Configuration cfg)
+ SqlResult::Type Connection::InternalEstablish(const config::Configuration cfg)
{
config = cfg;
if (connected)
{
- AddStatusRecord(SQL_STATE_08002_ALREADY_CONNECTED, "Already connected.");
+ AddStatusRecord(SqlState::S08002_ALREADY_CONNECTED, "Already connected.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
connected = socket.Connect(cfg.GetHost().c_str(), cfg.GetTcpPort());
if (!connected)
{
- AddStatusRecord(SQL_STATE_08001_CANNOT_CONNECT, "Failed to establish connection with the host.");
+ AddStatusRecord(SqlState::S08001_CANNOT_CONNECT, "Failed to establish connection with the host.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
return MakeRequestHandshake();
@@ -144,20 +144,20 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalRelease());
}
- SqlResult Connection::InternalRelease()
+ SqlResult::Type Connection::InternalRelease()
{
if (!connected)
{
- AddStatusRecord(SQL_STATE_08003_NOT_CONNECTED, "Connection is not open.");
+ AddStatusRecord(SqlState::S08003_NOT_CONNECTED, "Connection is not open.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
socket.Close();
connected = false;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
Statement* Connection::CreateStatement()
@@ -169,18 +169,18 @@ namespace ignite
return statement;
}
- SqlResult Connection::InternalCreateStatement(Statement*& statement)
+ SqlResult::Type Connection::InternalCreateStatement(Statement*& statement)
{
statement = new Statement(*this);
if (!statement)
{
- AddStatusRecord(SQL_STATE_HY001_MEMORY_ALLOCATION, "Not enough memory.");
+ AddStatusRecord(SqlState::SHY001_MEMORY_ALLOCATION, "Not enough memory.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
void Connection::Send(const int8_t* data, size_t len)
@@ -288,7 +288,7 @@ namespace ignite
return config;
}
- diagnostic::DiagnosticRecord Connection::CreateStatusRecord(SqlState sqlState,
+ diagnostic::DiagnosticRecord Connection::CreateStatusRecord(SqlState::Type sqlState,
const std::string& message, int32_t rowNum, int32_t columnNum)
{
return diagnostic::DiagnosticRecord(sqlState, message, "", "", rowNum, columnNum);
@@ -299,9 +299,9 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalTransactionCommit());
}
- SqlResult Connection::InternalTransactionCommit()
+ SqlResult::Type Connection::InternalTransactionCommit()
{
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
void Connection::TransactionRollback()
@@ -309,15 +309,15 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalTransactionRollback());
}
- SqlResult Connection::InternalTransactionRollback()
+ SqlResult::Type Connection::InternalTransactionRollback()
{
- AddStatusRecord(SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
+ AddStatusRecord(SqlState::SHYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
"Rollback operation is not supported.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- SqlResult Connection::MakeRequestHandshake()
+ SqlResult::Type Connection::MakeRequestHandshake()
{
bool distributedJoins = false;
bool enforceJoinOrder = false;
@@ -331,9 +331,9 @@ namespace ignite
}
catch (const IgniteError& err)
{
- AddStatusRecord(SQL_STATE_01S00_INVALID_CONNECTION_STRING_ATTRIBUTE, err.GetText());
+ AddStatusRecord(SqlState::S01S00_INVALID_CONNECTION_STRING_ATTRIBUTE, err.GetText());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
HandshakeRequest req(protocolVersion, distributedJoins, enforceJoinOrder);
@@ -345,20 +345,20 @@ namespace ignite
}
catch (const IgniteError& err)
{
- AddStatusRecord(SQL_STATE_HYT01_CONNECTIOIN_TIMEOUT, err.GetText());
+ AddStatusRecord(SqlState::SHYT01_CONNECTIOIN_TIMEOUT, err.GetText());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
+ if (rsp.GetStatus() != ResponseStatus::SUCCESS)
{
LOG_MSG("Error: " << rsp.GetError().c_str());
- AddStatusRecord(SQL_STATE_08001_CANNOT_CONNECT, rsp.GetError());
+ AddStatusRecord(SqlState::S08001_CANNOT_CONNECT, rsp.GetError());
InternalRelease();
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
if (!rsp.IsAccepted())
@@ -372,14 +372,14 @@ namespace ignite
<< "node protocol version introduced in version: " << rsp.ProtoVerSince() << ", "
<< "driver protocol version introduced in version: " << config.GetProtocolVersion().ToString() << ".";
- AddStatusRecord(SQL_STATE_08001_CANNOT_CONNECT, constructor.str());
+ AddStatusRecord(SqlState::S08001_CANNOT_CONNECT, constructor.str());
InternalRelease();
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp b/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
index 94ea53e..6c07c29 100644
--- a/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
+++ b/modules/platforms/cpp/odbc/src/diagnostic/diagnosable_adapter.cpp
@@ -25,7 +25,7 @@ namespace ignite
{
namespace diagnostic
{
- void DiagnosableAdapter::AddStatusRecord(SqlState sqlState,
+ void DiagnosableAdapter::AddStatusRecord(SqlState::Type sqlState,
const std::string& message, int32_t rowNum, int32_t columnNum)
{
if (connection)
@@ -40,7 +40,7 @@ namespace ignite
}
}
- void DiagnosableAdapter::AddStatusRecord(SqlState sqlState, const std::string& message)
+ void DiagnosableAdapter::AddStatusRecord(SqlState::Type sqlState, const std::string& message)
{
LOG_MSG("Adding new record: " << message);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
index 3c411d2..c8e0e81 100644
--- a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
+++ b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
@@ -102,7 +102,7 @@ namespace ignite
namespace diagnostic
{
DiagnosticRecord::DiagnosticRecord() :
- sqlState(SQL_STATE_UNKNOWN),
+ sqlState(SqlState::UNKNOWN),
message(),
connectionName(),
serverName(),
@@ -113,7 +113,7 @@ namespace ignite
// No-op.
}
- DiagnosticRecord::DiagnosticRecord(SqlState sqlState,
+ DiagnosticRecord::DiagnosticRecord(SqlState::Type sqlState,
const std::string& message, const std::string& connectionName,
const std::string& serverName, int32_t rowNum, int32_t columnNum) :
sqlState(sqlState),
@@ -221,67 +221,67 @@ namespace ignite
{
switch (sqlState)
{
- case SQL_STATE_01004_DATA_TRUNCATED:
+ case SqlState::S01004_DATA_TRUNCATED:
return STATE_01004;
- case SQL_STATE_01S00_INVALID_CONNECTION_STRING_ATTRIBUTE:
+ case SqlState::S01S00_INVALID_CONNECTION_STRING_ATTRIBUTE:
return STATE_01S00;
- case SQL_STATE_01S01_ERROR_IN_ROW:
+ case SqlState::S01S01_ERROR_IN_ROW:
return STATE_01S01;
- case SQL_STATE_22026_DATA_LENGTH_MISMATCH:
+ case SqlState::S22026_DATA_LENGTH_MISMATCH:
return STATE_22026;
- case SQL_STATE_24000_INVALID_CURSOR_STATE:
+ case SqlState::S24000_INVALID_CURSOR_STATE:
return STATE_24000;
- case SQL_STATE_07009_INVALID_DESCRIPTOR_INDEX:
+ case SqlState::S07009_INVALID_DESCRIPTOR_INDEX:
return STATE_07009;
- case SQL_STATE_08001_CANNOT_CONNECT:
+ case SqlState::S08001_CANNOT_CONNECT:
return STATE_08001;
- case SQL_STATE_08002_ALREADY_CONNECTED:
+ case SqlState::S08002_ALREADY_CONNECTED:
return STATE_08002;
- case SQL_STATE_08003_NOT_CONNECTED:
+ case SqlState::S08003_NOT_CONNECTED:
return STATE_08003;
- case SQL_STATE_HY000_GENERAL_ERROR:
+ case SqlState::SHY000_GENERAL_ERROR:
return STATE_HY000;
- case SQL_STATE_HY001_MEMORY_ALLOCATION:
+ case SqlState::SHY001_MEMORY_ALLOCATION:
return STATE_HY001;
- case SQL_STATE_HY003_INVALID_APPLICATION_BUFFER_TYPE:
+ case SqlState::SHY003_INVALID_APPLICATION_BUFFER_TYPE:
return STATE_HY003;
- case SQL_STATE_HY009_INVALID_USE_OF_NULL_POINTER:
+ case SqlState::SHY009_INVALID_USE_OF_NULL_POINTER:
return STATE_HY009;
- case SQL_STATE_HY010_SEQUENCE_ERROR:
+ case SqlState::SHY010_SEQUENCE_ERROR:
return STATE_HY010;
- case SQL_STATE_HY090_INVALID_STRING_OR_BUFFER_LENGTH:
+ case SqlState::SHY090_INVALID_STRING_OR_BUFFER_LENGTH:
return STATE_HY090;
- case SQL_STATE_HY092_OPTION_TYPE_OUT_OF_RANGE:
+ case SqlState::SHY092_OPTION_TYPE_OUT_OF_RANGE:
return STATE_HY092;
- case SQL_STATE_HY105_INVALID_PARAMETER_TYPE:
+ case SqlState::SHY105_INVALID_PARAMETER_TYPE:
return STATE_HY105;
- case SQL_STATE_HY106_FETCH_TYPE_OUT_OF_RANGE:
+ case SqlState::SHY106_FETCH_TYPE_OUT_OF_RANGE:
return STATE_HY106;
- case SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED:
+ case SqlState::SHYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED:
return STATE_HYC00;
- case SQL_STATE_HYT01_CONNECTIOIN_TIMEOUT:
+ case SqlState::SHYT01_CONNECTIOIN_TIMEOUT:
return STATE_HYT01;
- case SQL_STATE_IM001_FUNCTION_NOT_SUPPORTED:
+ case SqlState::SIM001_FUNCTION_NOT_SUPPORTED:
return STATE_IM001;
default:
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp
index c075567..4b90e44 100644
--- a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp
+++ b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp
@@ -30,7 +30,7 @@ namespace ignite
rowCount(0),
dynamicFunction(),
dynamicFunctionCode(0),
- result(SQL_RESULT_SUCCESS),
+ result(SqlResult::AI_SUCCESS),
rowsAffected(0)
{
// No-op.
@@ -41,7 +41,7 @@ namespace ignite
// No-op.
}
- void DiagnosticRecordStorage::SetHeaderRecord(SqlResult result)
+ void DiagnosticRecordStorage::SetHeaderRecord(SqlResult::Type result)
{
rowCount = 0;
dynamicFunction.clear();
@@ -57,12 +57,12 @@ namespace ignite
void DiagnosticRecordStorage::Reset()
{
- SetHeaderRecord(SQL_RESULT_ERROR);
+ SetHeaderRecord(SqlResult::AI_ERROR);
statusRecords.clear();
}
- SqlResult DiagnosticRecordStorage::GetOperaionResult() const
+ SqlResult::Type DiagnosticRecordStorage::GetOperaionResult() const
{
return result;
}
@@ -122,55 +122,55 @@ namespace ignite
bool DiagnosticRecordStorage::IsSuccessful() const
{
- return result == SQL_RESULT_SUCCESS ||
- result == SQL_RESULT_SUCCESS_WITH_INFO;
+ return result == SqlResult::AI_SUCCESS ||
+ result == SqlResult::AI_SUCCESS_WITH_INFO;
}
- SqlResult DiagnosticRecordStorage::GetField(int32_t recNum, DiagnosticField field, app::ApplicationDataBuffer& buffer) const
+ SqlResult::Type DiagnosticRecordStorage::GetField(int32_t recNum, DiagnosticField::Type field, app::ApplicationDataBuffer& buffer) const
{
// Header record.
switch (field)
{
- case IGNITE_SQL_DIAG_HEADER_CURSOR_ROW_COUNT:
+ case DiagnosticField::HEADER_CURSOR_ROW_COUNT:
{
buffer.PutInt64(GetRowCount());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_HEADER_DYNAMIC_FUNCTION:
+ case DiagnosticField::HEADER_DYNAMIC_FUNCTION:
{
buffer.PutString(GetDynamicFunction());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_HEADER_DYNAMIC_FUNCTION_CODE:
+ case DiagnosticField::HEADER_DYNAMIC_FUNCTION_CODE:
{
buffer.PutInt32(GetDynamicFunctionCode());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_HEADER_NUMBER:
+ case DiagnosticField::HEADER_NUMBER:
{
buffer.PutInt32(GetStatusRecordsNumber());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_HEADER_RETURNCODE:
+ case DiagnosticField::HEADER_RETURNCODE:
{
buffer.PutInt32(GetReturnCode());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_HEADER_ROW_COUNT:
+ case DiagnosticField::HEADER_ROW_COUNT:
{
buffer.PutInt64(GetRowsAffected());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
default:
@@ -178,81 +178,81 @@ namespace ignite
}
if (recNum < 1 || static_cast<size_t>(recNum) > statusRecords.size())
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
// Status record.
const DiagnosticRecord& record = GetStatusRecord(recNum);
switch (field)
{
- case IGNITE_SQL_DIAG_STATUS_CLASS_ORIGIN:
+ case DiagnosticField::STATUS_CLASS_ORIGIN:
{
buffer.PutString(record.GetClassOrigin());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_STATUS_COLUMN_NUMBER:
+ case DiagnosticField::STATUS_COLUMN_NUMBER:
{
buffer.PutInt32(record.GetColumnNumber());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_STATUS_CONNECTION_NAME:
+ case DiagnosticField::STATUS_CONNECTION_NAME:
{
buffer.PutString(record.GetConnectionName());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_STATUS_MESSAGE_TEXT:
+ case DiagnosticField::STATUS_MESSAGE_TEXT:
{
buffer.PutString(record.GetMessageText());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_STATUS_NATIVE:
+ case DiagnosticField::STATUS_NATIVE:
{
buffer.PutInt32(0);
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_STATUS_ROW_NUMBER:
+ case DiagnosticField::STATUS_ROW_NUMBER:
{
buffer.PutInt64(record.GetRowNumber());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_STATUS_SERVER_NAME:
+ case DiagnosticField::STATUS_SERVER_NAME:
{
buffer.PutString(record.GetServerName());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_STATUS_SQLSTATE:
+ case DiagnosticField::STATUS_SQLSTATE:
{
buffer.PutString(record.GetSqlState());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_DIAG_STATUS_SUBCLASS_ORIGIN:
+ case DiagnosticField::STATUS_SUBCLASS_ORIGIN:
{
buffer.PutString(record.GetSubclassOrigin());
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
default:
break;
}
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/environment.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/environment.cpp b/modules/platforms/cpp/odbc/src/environment.cpp
index 3928295..6182fa2 100644
--- a/modules/platforms/cpp/odbc/src/environment.cpp
+++ b/modules/platforms/cpp/odbc/src/environment.cpp
@@ -43,18 +43,18 @@ namespace ignite
return connection;
}
- SqlResult Environment::InternalCreateConnection(Connection*& connection)
+ SqlResult::Type Environment::InternalCreateConnection(Connection*& connection)
{
connection = new Connection;
if (!connection)
{
- AddStatusRecord(SQL_STATE_HY001_MEMORY_ALLOCATION, "Not enough memory.");
+ AddStatusRecord(SqlState::SHY001_MEMORY_ALLOCATION, "Not enough memory.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
void Environment::TransactionCommit()
@@ -62,9 +62,9 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalTransactionCommit());
}
- SqlResult Environment::InternalTransactionCommit()
+ SqlResult::Type Environment::InternalTransactionCommit()
{
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
void Environment::TransactionRollback()
@@ -72,12 +72,12 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalTransactionRollback());
}
- SqlResult Environment::InternalTransactionRollback()
+ SqlResult::Type Environment::InternalTransactionRollback()
{
- AddStatusRecord(SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
+ AddStatusRecord(SqlState::SHYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
"Rollback operation is not supported.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
void Environment::SetAttribute(int32_t attr, void* value, int32_t len)
@@ -85,51 +85,51 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalSetAttribute(attr, value, len));
}
- SqlResult Environment::InternalSetAttribute(int32_t attr, void* value, int32_t len)
+ SqlResult::Type Environment::InternalSetAttribute(int32_t attr, void* value, int32_t len)
{
- EnvironmentAttribute attribute = EnvironmentAttributeToInternal(attr);
+ EnvironmentAttribute::Type attribute = EnvironmentAttributeToInternal(attr);
switch (attribute)
{
- case IGNITE_SQL_ENV_ATTR_ODBC_VERSION:
+ case EnvironmentAttribute::ODBC_VERSION:
{
int32_t version = static_cast<int32_t>(reinterpret_cast<intptr_t>(value));
if (version != odbcVersion)
{
- AddStatusRecord(SQL_STATE_01S02_OPTION_VALUE_CHANGED,
+ AddStatusRecord(SqlState::S01S02_OPTION_VALUE_CHANGED,
"ODBC version is not supported.");
- return SQL_RESULT_SUCCESS_WITH_INFO;
+ return SqlResult::AI_SUCCESS_WITH_INFO;
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_ENV_ATTR_OUTPUT_NTS:
+ case EnvironmentAttribute::OUTPUT_NTS:
{
int32_t nts = static_cast<int32_t>(reinterpret_cast<intptr_t>(value));
if (nts != odbcNts)
{
- AddStatusRecord(SQL_STATE_01S02_OPTION_VALUE_CHANGED,
+ AddStatusRecord(SqlState::S01S02_OPTION_VALUE_CHANGED,
"Only null-termination of strings is supported.");
- return SQL_RESULT_SUCCESS_WITH_INFO;
+ return SqlResult::AI_SUCCESS_WITH_INFO;
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_ENV_ATTR_UNKNOWN:
+ case EnvironmentAttribute::UNKNOWN:
default:
break;
}
- AddStatusRecord(SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
+ AddStatusRecord(SqlState::SHYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
"Attribute is not supported.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
void Environment::GetAttribute(int32_t attr, app::ApplicationDataBuffer& buffer)
@@ -137,35 +137,35 @@ namespace ignite
IGNITE_ODBC_API_CALL(InternalGetAttribute(attr, buffer));
}
- SqlResult Environment::InternalGetAttribute(int32_t attr, app::ApplicationDataBuffer& buffer)
+ SqlResult::Type Environment::InternalGetAttribute(int32_t attr, app::ApplicationDataBuffer& buffer)
{
- EnvironmentAttribute attribute = EnvironmentAttributeToInternal(attr);
+ EnvironmentAttribute::Type attribute = EnvironmentAttributeToInternal(attr);
switch (attribute)
{
- case IGNITE_SQL_ENV_ATTR_ODBC_VERSION:
+ case EnvironmentAttribute::ODBC_VERSION:
{
buffer.PutInt32(odbcVersion);
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_ENV_ATTR_OUTPUT_NTS:
+ case EnvironmentAttribute::OUTPUT_NTS:
{
buffer.PutInt32(odbcNts);
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- case IGNITE_SQL_ENV_ATTR_UNKNOWN:
+ case EnvironmentAttribute::UNKNOWN:
default:
break;
}
- AddStatusRecord(SQL_STATE_HYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
+ AddStatusRecord(SqlState::SHYC00_OPTIONAL_FEATURE_NOT_IMPLEMENTED,
"Attribute is not supported.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/odbc.cpp b/modules/platforms/cpp/odbc/src/odbc.cpp
index 542e64c..ed5e362 100644
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@ -85,7 +85,7 @@ namespace ignite
*result = 0;
connection->GetDiagnosticRecords().Reset();
- connection->AddStatusRecord(odbc::SQL_STATE_IM001_FUNCTION_NOT_SUPPORTED,
+ connection->AddStatusRecord(odbc::SqlState::SIM001_FUNCTION_NOT_SUPPORTED,
"The HandleType argument was SQL_HANDLE_DESC, and "
"the driver does not support allocating a descriptor handle");
@@ -919,11 +919,11 @@ namespace ignite
LOG_MSG("SQLGetDiagField called: " << recNum);
SqlLen outResLen;
- ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_DEFAULT, buffer, bufferLen, &outResLen);
+ ApplicationDataBuffer outBuffer(OdbcNativeType::AI_DEFAULT, buffer, bufferLen, &outResLen);
- SqlResult result;
+ SqlResult::Type result;
- DiagnosticField field = DiagnosticFieldToInternal(diagId);
+ DiagnosticField::Type field = DiagnosticFieldToInternal(diagId);
switch (handleType)
{
@@ -940,12 +940,12 @@ namespace ignite
default:
{
- result = SQL_RESULT_NO_DATA;
+ result = SqlResult::AI_NO_DATA;
break;
}
}
- if (resLen && result == SQL_RESULT_SUCCESS)
+ if (resLen && result == SqlResult::AI_SUCCESS)
*resLen = static_cast<SQLSMALLINT>(outResLen);
return SqlResultToReturnCode(result);
@@ -1000,7 +1000,7 @@ namespace ignite
*nativeError = 0;
SqlLen outResLen;
- ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_CHAR, msgBuffer, msgBufferLen, &outResLen);
+ ApplicationDataBuffer outBuffer(OdbcNativeType::AI_CHAR, msgBuffer, msgBufferLen, &outResLen);
outBuffer.PutString(record.GetMessageText());
@@ -1100,7 +1100,7 @@ namespace ignite
if (!statement)
return SQL_INVALID_HANDLE;
- IgniteSqlType driverType = ToDriverType(targetType);
+ OdbcNativeType::Type driverType = ToDriverType(targetType);
ApplicationDataBuffer dataBuffer(driverType, targetValue, bufferLength, strLengthOrIndicator);
@@ -1147,7 +1147,7 @@ namespace ignite
return SQL_INVALID_HANDLE;
SqlLen outResLen;
- ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_DEFAULT, valueBuf,
+ ApplicationDataBuffer outBuffer(OdbcNativeType::AI_DEFAULT, valueBuf,
static_cast<int32_t>(valueBufLen), &outResLen);
environment->GetAttribute(attr, outBuffer);
@@ -1295,7 +1295,7 @@ namespace ignite
*error = 0;
SqlLen outResLen;
- ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_CHAR, msgBuf, msgBufLen, &outResLen);
+ ApplicationDataBuffer outBuffer(OdbcNativeType::AI_CHAR, msgBuf, msgBufLen, &outResLen);
outBuffer.PutString(record.GetMessageText());
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp b/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp
index 9aa5f7d..cca3eb5 100644
--- a/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/column_metadata_query.cpp
@@ -25,43 +25,46 @@
namespace
{
- enum ResultColumn
+ struct ResultColumn
{
- /** Catalog name. NULL if not applicable to the data source. */
- TABLE_CAT = 1,
+ enum Type
+ {
+ /** Catalog name. NULL if not applicable to the data source. */
+ TABLE_CAT = 1,
- /** Schema name. NULL if not applicable to the data source. */
- TABLE_SCHEM,
+ /** Schema name. NULL if not applicable to the data source. */
+ TABLE_SCHEM,
- /** Table name. */
- TABLE_NAME,
+ /** Table name. */
+ TABLE_NAME,
- /** Column name. */
- COLUMN_NAME,
+ /** Column name. */
+ COLUMN_NAME,
- /** SQL data type. */
- DATA_TYPE,
+ /** SQL data type. */
+ DATA_TYPE,
- /** Data source\ufffddependent data type name. */
- TYPE_NAME,
+ /** Data source\ufffddependent data type name. */
+ TYPE_NAME,
- /** Column size. */
- COLUMN_SIZE,
+ /** Column size. */
+ COLUMN_SIZE,
- /** The length in bytes of data transferred on fetch. */
- BUFFER_LENGTH,
+ /** The length in bytes of data transferred on fetch. */
+ BUFFER_LENGTH,
- /** The total number of significant digits to the right of the decimal point. */
- DECIMAL_DIGITS,
+ /** The total number of significant digits to the right of the decimal point. */
+ DECIMAL_DIGITS,
- /** Precision. */
- NUM_PREC_RADIX,
+ /** Precision. */
+ NUM_PREC_RADIX,
- /** Nullability of the data in column. */
- NULLABLE,
+ /** Nullability of the data in column. */
+ NULLABLE,
- /** A description of the column. */
- REMARKS
+ /** A description of the column. */
+ REMARKS
+ };
};
}
@@ -74,7 +77,7 @@ namespace ignite
ColumnMetadataQuery::ColumnMetadataQuery(diagnostic::Diagnosable& diag,
Connection& connection, const std::string& schema,
const std::string& table, const std::string& column) :
- Query(diag, COLUMN_METADATA),
+ Query(diag, QueryType::COLUMN_METADATA),
connection(connection),
schema(schema),
table(table),
@@ -112,14 +115,14 @@ namespace ignite
// No-op.
}
- SqlResult ColumnMetadataQuery::Execute()
+ SqlResult::Type ColumnMetadataQuery::Execute()
{
if (executed)
Close();
- SqlResult result = MakeRequestGetColumnsMeta();
+ SqlResult::Type result = MakeRequestGetColumnsMeta();
- if (result == SQL_RESULT_SUCCESS)
+ if (result == SqlResult::AI_SUCCESS)
{
executed = true;
@@ -134,17 +137,17 @@ namespace ignite
return columnsMeta;
}
- SqlResult ColumnMetadataQuery::FetchNextRow(app::ColumnBindingMap & columnBindings)
+ SqlResult::Type ColumnMetadataQuery::FetchNextRow(app::ColumnBindingMap & columnBindings)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
if (cursor == meta.end())
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
app::ColumnBindingMap::iterator it;
@@ -153,75 +156,75 @@ namespace ignite
++cursor;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- SqlResult ColumnMetadataQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer & buffer)
+ SqlResult::Type ColumnMetadataQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer & buffer)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
if (cursor == meta.end())
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
const meta::ColumnMeta& currentColumn = *cursor;
uint8_t columnType = currentColumn.GetDataType();
switch (columnIdx)
{
- case TABLE_CAT:
+ case ResultColumn::TABLE_CAT:
{
buffer.PutNull();
break;
}
- case TABLE_SCHEM:
+ case ResultColumn::TABLE_SCHEM:
{
buffer.PutString(currentColumn.GetSchemaName());
break;
}
- case TABLE_NAME:
+ case ResultColumn::TABLE_NAME:
{
buffer.PutString(currentColumn.GetTableName());
break;
}
- case COLUMN_NAME:
+ case ResultColumn::COLUMN_NAME:
{
buffer.PutString(currentColumn.GetColumnName());
break;
}
- case DATA_TYPE:
+ case ResultColumn::DATA_TYPE:
{
buffer.PutInt16(type_traits::BinaryToSqlType(columnType));
break;
}
- case TYPE_NAME:
+ case ResultColumn::TYPE_NAME:
{
buffer.PutString(type_traits::BinaryTypeToSqlTypeName(currentColumn.GetDataType()));
break;
}
- case COLUMN_SIZE:
+ case ResultColumn::COLUMN_SIZE:
{
buffer.PutInt16(type_traits::BinaryTypeColumnSize(columnType));
break;
}
- case BUFFER_LENGTH:
+ case ResultColumn::BUFFER_LENGTH:
{
buffer.PutInt16(type_traits::BinaryTypeTransferLength(columnType));
break;
}
- case DECIMAL_DIGITS:
+ case ResultColumn::DECIMAL_DIGITS:
{
int32_t decDigits = type_traits::BinaryTypeDecimalDigits(columnType);
if (decDigits < 0)
@@ -231,19 +234,19 @@ namespace ignite
break;
}
- case NUM_PREC_RADIX:
+ case ResultColumn::NUM_PREC_RADIX:
{
buffer.PutInt16(type_traits::BinaryTypeNumPrecRadix(columnType));
break;
}
- case NULLABLE:
+ case ResultColumn::NULLABLE:
{
buffer.PutInt16(type_traits::BinaryTypeNullability(columnType));
break;
}
- case REMARKS:
+ case ResultColumn::REMARKS:
{
buffer.PutNull();
break;
@@ -253,16 +256,16 @@ namespace ignite
break;
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- SqlResult ColumnMetadataQuery::Close()
+ SqlResult::Type ColumnMetadataQuery::Close()
{
meta.clear();
executed = false;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
bool ColumnMetadataQuery::DataAvailable() const
@@ -275,7 +278,7 @@ namespace ignite
return 0;
}
- SqlResult ColumnMetadataQuery::MakeRequestGetColumnsMeta()
+ SqlResult::Type ColumnMetadataQuery::MakeRequestGetColumnsMeta()
{
QueryGetColumnsMetaRequest req(schema, table, column);
QueryGetColumnsMetaResponse rsp;
@@ -286,17 +289,17 @@ namespace ignite
}
catch (const IgniteError& err)
{
- diag.AddStatusRecord(SQL_STATE_HYT01_CONNECTIOIN_TIMEOUT, err.GetText());
+ diag.AddStatusRecord(SqlState::SHYT01_CONNECTIOIN_TIMEOUT, err.GetText());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
+ if (rsp.GetStatus() != ResponseStatus::SUCCESS)
{
LOG_MSG("Error: " << rsp.GetError());
- diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
+ diag.AddStatusRecord(SqlState::SHY000_GENERAL_ERROR, rsp.GetError());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
meta = rsp.GetMeta();
@@ -309,7 +312,7 @@ namespace ignite
<< "\n[" << i << "] ColumnType: " << meta[i].GetDataType());
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/query/data_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/data_query.cpp b/modules/platforms/cpp/odbc/src/query/data_query.cpp
index c9762ad..33e763f 100644
--- a/modules/platforms/cpp/odbc/src/query/data_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/data_query.cpp
@@ -29,7 +29,7 @@ namespace ignite
DataQuery::DataQuery(diagnostic::Diagnosable& diag,
Connection& connection, const std::string& sql,
const app::ParameterBindingMap& params) :
- Query(diag, DATA),
+ Query(diag, QueryType::DATA),
connection(connection),
sql(sql),
params(params)
@@ -42,13 +42,13 @@ namespace ignite
Close();
}
- SqlResult DataQuery::Execute()
+ SqlResult::Type DataQuery::Execute()
{
if (cursor.get())
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query cursor is in open state already.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query cursor is in open state already.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
return MakeRequestExecute();
@@ -59,38 +59,38 @@ namespace ignite
return resultMeta;
}
- SqlResult DataQuery::FetchNextRow(app::ColumnBindingMap& columnBindings)
+ SqlResult::Type DataQuery::FetchNextRow(app::ColumnBindingMap& columnBindings)
{
if (!cursor.get())
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
if (!cursor->HasData())
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
cursor->Increment();
if (cursor->NeedDataUpdate())
{
- SqlResult result = MakeRequestFetch();
+ SqlResult::Type result = MakeRequestFetch();
- if (result != SQL_RESULT_SUCCESS)
+ if (result != SqlResult::AI_SUCCESS)
return result;
}
if (!cursor->HasData())
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
Row* row = cursor->GetRow();
if (!row)
{
- diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, "Unknown error.");
+ diag.AddStatusRecord(SqlState::SHY000_GENERAL_ERROR, "Unknown error.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
for (int32_t i = 1; i < row->GetSize() + 1; ++i)
@@ -100,53 +100,53 @@ namespace ignite
if (it == columnBindings.end())
continue;
- SqlResult result = row->ReadColumnToBuffer(i, it->second);
+ SqlResult::Type result = row->ReadColumnToBuffer(i, it->second);
- if (result == SQL_RESULT_ERROR)
+ if (result == SqlResult::AI_ERROR)
{
- diag.AddStatusRecord(SQL_STATE_01S01_ERROR_IN_ROW, "Can not retrieve row column.", 0, i);
+ diag.AddStatusRecord(SqlState::S01S01_ERROR_IN_ROW, "Can not retrieve row column.", 0, i);
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- SqlResult DataQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer)
+ SqlResult::Type DataQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer)
{
if (!cursor.get())
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
Row* row = cursor->GetRow();
if (!row)
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
- SqlResult result = row->ReadColumnToBuffer(columnIdx, buffer);
+ SqlResult::Type result = row->ReadColumnToBuffer(columnIdx, buffer);
- if (result == SQL_RESULT_ERROR)
+ if (result == SqlResult::AI_ERROR)
{
- diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, "Unknown column type.");
+ diag.AddStatusRecord(SqlState::SHY000_GENERAL_ERROR, "Unknown column type.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
return result;
}
- SqlResult DataQuery::Close()
+ SqlResult::Type DataQuery::Close()
{
if (!cursor.get())
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
- SqlResult result = MakeRequestClose();
+ SqlResult::Type result = MakeRequestClose();
- if (result == SQL_RESULT_SUCCESS)
+ if (result == SqlResult::AI_SUCCESS)
{
cursor.reset();
@@ -167,7 +167,7 @@ namespace ignite
return 0;
}
- SqlResult DataQuery::MakeRequestExecute()
+ SqlResult::Type DataQuery::MakeRequestExecute()
{
const std::string& cacheName = connection.GetCache();
@@ -180,18 +180,18 @@ namespace ignite
}
catch (const IgniteError& err)
{
- diag.AddStatusRecord(SQL_STATE_HYT01_CONNECTIOIN_TIMEOUT, err.GetText());
+ diag.AddStatusRecord(SqlState::SHYT01_CONNECTIOIN_TIMEOUT, err.GetText());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
+ if (rsp.GetStatus() != ResponseStatus::SUCCESS)
{
LOG_MSG("Error: " << rsp.GetError());
- diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
+ diag.AddStatusRecord(SqlState::SHY000_GENERAL_ERROR, rsp.GetError());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
cursor.reset(new Cursor(rsp.GetQueryId()));
@@ -207,10 +207,10 @@ namespace ignite
<< "\n[" << i << "] ColumnType: " << rsp.GetMeta()[i].GetDataType());
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- SqlResult DataQuery::MakeRequestClose()
+ SqlResult::Type DataQuery::MakeRequestClose()
{
QueryCloseRequest req(cursor->GetQueryId());
QueryCloseResponse rsp;
@@ -221,26 +221,26 @@ namespace ignite
}
catch (const IgniteError& err)
{
- diag.AddStatusRecord(SQL_STATE_HYT01_CONNECTIOIN_TIMEOUT, err.GetText());
+ diag.AddStatusRecord(SqlState::SHYT01_CONNECTIOIN_TIMEOUT, err.GetText());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
LOG_MSG("Query id: " << rsp.GetQueryId());
- if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
+ if (rsp.GetStatus() != ResponseStatus::SUCCESS)
{
LOG_MSG("Error: " << rsp.GetError());
- diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
+ diag.AddStatusRecord(SqlState::SHY000_GENERAL_ERROR, rsp.GetError());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- SqlResult DataQuery::MakeRequestFetch()
+ SqlResult::Type DataQuery::MakeRequestFetch()
{
std::auto_ptr<ResultPage> resultPage(new ResultPage());
@@ -253,23 +253,23 @@ namespace ignite
}
catch (const IgniteError& err)
{
- diag.AddStatusRecord(SQL_STATE_HYT01_CONNECTIOIN_TIMEOUT, err.GetText());
+ diag.AddStatusRecord(SqlState::SHYT01_CONNECTIOIN_TIMEOUT, err.GetText());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
+ if (rsp.GetStatus() != ResponseStatus::SUCCESS)
{
LOG_MSG("Error: " << rsp.GetError());
- diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
+ diag.AddStatusRecord(SqlState::SHY000_GENERAL_ERROR, rsp.GetError());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
cursor->UpdateData(resultPage);
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/query/foreign_keys_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/foreign_keys_query.cpp b/modules/platforms/cpp/odbc/src/query/foreign_keys_query.cpp
index 5813767..4ca7709 100644
--- a/modules/platforms/cpp/odbc/src/query/foreign_keys_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/foreign_keys_query.cpp
@@ -32,7 +32,7 @@ namespace ignite
const std::string& primaryCatalog, const std::string& primarySchema,
const std::string& primaryTable, const std::string& foreignCatalog,
const std::string& foreignSchema, const std::string& foreignTable) :
- Query(diag, FOREIGN_KEYS),
+ Query(diag, QueryType::FOREIGN_KEYS),
connection(connection),
primaryCatalog(primaryCatalog),
primarySchema(primarySchema),
@@ -74,11 +74,11 @@ namespace ignite
// No-op.
}
- SqlResult ForeignKeysQuery::Execute()
+ SqlResult::Type ForeignKeysQuery::Execute()
{
executed = true;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
const meta::ColumnMetaVector & ForeignKeysQuery::GetMeta() const
@@ -86,35 +86,35 @@ namespace ignite
return columnsMeta;
}
- SqlResult ForeignKeysQuery::FetchNextRow(app::ColumnBindingMap & columnBindings)
+ SqlResult::Type ForeignKeysQuery::FetchNextRow(app::ColumnBindingMap & columnBindings)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
}
- SqlResult ForeignKeysQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer)
+ SqlResult::Type ForeignKeysQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
}
- SqlResult ForeignKeysQuery::Close()
+ SqlResult::Type ForeignKeysQuery::Close()
{
executed = false;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
bool ForeignKeysQuery::DataAvailable() const
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/query/primary_keys_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/primary_keys_query.cpp b/modules/platforms/cpp/odbc/src/query/primary_keys_query.cpp
index a24670d..ef99db3 100644
--- a/modules/platforms/cpp/odbc/src/query/primary_keys_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/primary_keys_query.cpp
@@ -24,25 +24,28 @@
namespace
{
- enum ResultColumn
+ struct ResultColumn
{
- /** Catalog name. NULL if not applicable to the data source. */
- TABLE_CAT = 1,
+ enum Type
+ {
+ /** Catalog name. NULL if not applicable to the data source. */
+ TABLE_CAT = 1,
- /** Schema name. NULL if not applicable to the data source. */
- TABLE_SCHEM,
+ /** Schema name. NULL if not applicable to the data source. */
+ TABLE_SCHEM,
- /** Table name. */
- TABLE_NAME,
+ /** Table name. */
+ TABLE_NAME,
- /** Column name. */
- COLUMN_NAME,
+ /** Column name. */
+ COLUMN_NAME,
- /** Column sequence number in key. */
- KEY_SEQ,
+ /** Column sequence number in key. */
+ KEY_SEQ,
- /** Primary key name. */
- PK_NAME
+ /** Primary key name. */
+ PK_NAME
+ };
};
}
@@ -55,7 +58,7 @@ namespace ignite
PrimaryKeysQuery::PrimaryKeysQuery(diagnostic::Diagnosable& diag,
Connection& connection, const std::string& catalog,
const std::string& schema, const std::string& table) :
- Query(diag, PRIMARY_KEYS),
+ Query(diag, QueryType::PRIMARY_KEYS),
connection(connection),
catalog(catalog),
schema(schema),
@@ -86,7 +89,7 @@ namespace ignite
// No-op.
}
- SqlResult PrimaryKeysQuery::Execute()
+ SqlResult::Type PrimaryKeysQuery::Execute()
{
if (executed)
Close();
@@ -97,7 +100,7 @@ namespace ignite
cursor = meta.begin();
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
const meta::ColumnMetaVector & PrimaryKeysQuery::GetMeta() const
@@ -105,17 +108,17 @@ namespace ignite
return columnsMeta;
}
- SqlResult PrimaryKeysQuery::FetchNextRow(app::ColumnBindingMap & columnBindings)
+ SqlResult::Type PrimaryKeysQuery::FetchNextRow(app::ColumnBindingMap & columnBindings)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
if (cursor == meta.end())
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
app::ColumnBindingMap::iterator it;
@@ -124,56 +127,56 @@ namespace ignite
++cursor;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- SqlResult PrimaryKeysQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer)
+ SqlResult::Type PrimaryKeysQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
if (cursor == meta.end())
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
const meta::PrimaryKeyMeta& currentColumn = *cursor;
switch (columnIdx)
{
- case TABLE_CAT:
+ case ResultColumn::TABLE_CAT:
{
buffer.PutString(currentColumn.GetCatalogName());
break;
}
- case TABLE_SCHEM:
+ case ResultColumn::TABLE_SCHEM:
{
buffer.PutString(currentColumn.GetSchemaName());
break;
}
- case TABLE_NAME:
+ case ResultColumn::TABLE_NAME:
{
buffer.PutString(currentColumn.GetTableName());
break;
}
- case COLUMN_NAME:
+ case ResultColumn::COLUMN_NAME:
{
buffer.PutString(currentColumn.GetColumnName());
break;
}
- case KEY_SEQ:
+ case ResultColumn::KEY_SEQ:
{
buffer.PutInt16(currentColumn.GetKeySeq());
break;
}
- case PK_NAME:
+ case ResultColumn::PK_NAME:
{
buffer.PutString(currentColumn.GetKeyName());
break;
@@ -183,16 +186,16 @@ namespace ignite
break;
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- SqlResult PrimaryKeysQuery::Close()
+ SqlResult::Type PrimaryKeysQuery::Close()
{
meta.clear();
executed = false;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
bool PrimaryKeysQuery::DataAvailable() const
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/query/special_columns_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/special_columns_query.cpp b/modules/platforms/cpp/odbc/src/query/special_columns_query.cpp
index f507c52..b0f534c 100644
--- a/modules/platforms/cpp/odbc/src/query/special_columns_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/special_columns_query.cpp
@@ -29,7 +29,7 @@ namespace ignite
SpecialColumnsQuery::SpecialColumnsQuery(diagnostic::Diagnosable& diag,
int16_t type, const std::string& catalog, const std::string& schema,
const std::string& table, int16_t scope, int16_t nullable) :
- Query(diag, SPECIAL_COLUMNS),
+ Query(diag, QueryType::SPECIAL_COLUMNS),
type(type),
catalog(catalog),
schema(schema),
@@ -64,11 +64,11 @@ namespace ignite
// No-op.
}
- SqlResult SpecialColumnsQuery::Execute()
+ SqlResult::Type SpecialColumnsQuery::Execute()
{
executed = true;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
const meta::ColumnMetaVector& SpecialColumnsQuery::GetMeta() const
@@ -76,35 +76,35 @@ namespace ignite
return columnsMeta;
}
- SqlResult SpecialColumnsQuery::FetchNextRow(app::ColumnBindingMap & columnBindings)
+ SqlResult::Type SpecialColumnsQuery::FetchNextRow(app::ColumnBindingMap & columnBindings)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
}
- SqlResult SpecialColumnsQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer)
+ SqlResult::Type SpecialColumnsQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer& buffer)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
}
- SqlResult SpecialColumnsQuery::Close()
+ SqlResult::Type SpecialColumnsQuery::Close()
{
executed = false;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
bool SpecialColumnsQuery::DataAvailable() const
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c4b7b03/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp b/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp
index 4fd5f7b..401a1d2 100644
--- a/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/table_metadata_query.cpp
@@ -25,22 +25,25 @@
namespace
{
- enum ResultColumn
+ struct ResultColumn
{
- /** Catalog name. NULL if not applicable to the data source. */
- TABLE_CAT = 1,
+ enum Type
+ {
+ /** Catalog name. NULL if not applicable to the data source. */
+ TABLE_CAT = 1,
- /** Schema name. NULL if not applicable to the data source. */
- TABLE_SCHEM,
+ /** Schema name. NULL if not applicable to the data source. */
+ TABLE_SCHEM,
- /** Table name. */
- TABLE_NAME,
+ /** Table name. */
+ TABLE_NAME,
- /** Table type. */
- TABLE_TYPE,
+ /** Table type. */
+ TABLE_TYPE,
- /** A description of the column. */
- REMARKS
+ /** A description of the column. */
+ REMARKS
+ };
};
}
@@ -53,7 +56,7 @@ namespace ignite
TableMetadataQuery::TableMetadataQuery(diagnostic::Diagnosable& diag,
Connection& connection, const std::string& catalog,const std::string& schema,
const std::string& table, const std::string& tableType) :
- Query(diag, TABLE_METADATA),
+ Query(diag, QueryType::TABLE_METADATA),
connection(connection),
catalog(catalog),
schema(schema),
@@ -85,14 +88,14 @@ namespace ignite
// No-op.
}
- SqlResult TableMetadataQuery::Execute()
+ SqlResult::Type TableMetadataQuery::Execute()
{
if (executed)
Close();
- SqlResult result = MakeRequestGetTablesMeta();
+ SqlResult::Type result = MakeRequestGetTablesMeta();
- if (result == SQL_RESULT_SUCCESS)
+ if (result == SqlResult::AI_SUCCESS)
{
executed = true;
@@ -107,17 +110,17 @@ namespace ignite
return columnsMeta;
}
- SqlResult TableMetadataQuery::FetchNextRow(app::ColumnBindingMap& columnBindings)
+ SqlResult::Type TableMetadataQuery::FetchNextRow(app::ColumnBindingMap& columnBindings)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
if (cursor == meta.end())
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
app::ColumnBindingMap::iterator it;
@@ -126,50 +129,50 @@ namespace ignite
++cursor;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- SqlResult TableMetadataQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer & buffer)
+ SqlResult::Type TableMetadataQuery::GetColumn(uint16_t columnIdx, app::ApplicationDataBuffer & buffer)
{
if (!executed)
{
- diag.AddStatusRecord(SQL_STATE_HY010_SEQUENCE_ERROR, "Query was not executed.");
+ diag.AddStatusRecord(SqlState::SHY010_SEQUENCE_ERROR, "Query was not executed.");
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
if (cursor == meta.end())
- return SQL_RESULT_NO_DATA;
+ return SqlResult::AI_NO_DATA;
const meta::TableMeta& currentColumn = *cursor;
switch (columnIdx)
{
- case TABLE_CAT:
+ case ResultColumn::TABLE_CAT:
{
buffer.PutString(currentColumn.GetCatalogName());
break;
}
- case TABLE_SCHEM:
+ case ResultColumn::TABLE_SCHEM:
{
buffer.PutString(currentColumn.GetSchemaName());
break;
}
- case TABLE_NAME:
+ case ResultColumn::TABLE_NAME:
{
buffer.PutString(currentColumn.GetTableName());
break;
}
- case TABLE_TYPE:
+ case ResultColumn::TABLE_TYPE:
{
buffer.PutString(currentColumn.GetTableType());
break;
}
- case REMARKS:
+ case ResultColumn::REMARKS:
{
buffer.PutNull();
break;
@@ -179,16 +182,16 @@ namespace ignite
break;
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
- SqlResult TableMetadataQuery::Close()
+ SqlResult::Type TableMetadataQuery::Close()
{
meta.clear();
executed = false;
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
bool TableMetadataQuery::DataAvailable() const
@@ -201,7 +204,7 @@ namespace ignite
return 0;
}
- SqlResult TableMetadataQuery::MakeRequestGetTablesMeta()
+ SqlResult::Type TableMetadataQuery::MakeRequestGetTablesMeta()
{
QueryGetTablesMetaRequest req(catalog, schema, table, tableType);
QueryGetTablesMetaResponse rsp;
@@ -212,18 +215,18 @@ namespace ignite
}
catch (const IgniteError& err)
{
- diag.AddStatusRecord(SQL_STATE_HYT01_CONNECTIOIN_TIMEOUT, err.GetText());
+ diag.AddStatusRecord(SqlState::SHYT01_CONNECTIOIN_TIMEOUT, err.GetText());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
- if (rsp.GetStatus() != RESPONSE_STATUS_SUCCESS)
+ if (rsp.GetStatus() != ResponseStatus::SUCCESS)
{
LOG_MSG("Error: " << rsp.GetError());
- diag.AddStatusRecord(SQL_STATE_HY000_GENERAL_ERROR, rsp.GetError());
+ diag.AddStatusRecord(SqlState::SHY000_GENERAL_ERROR, rsp.GetError());
- return SQL_RESULT_ERROR;
+ return SqlResult::AI_ERROR;
}
meta = rsp.GetMeta();
@@ -236,7 +239,7 @@ namespace ignite
<< "\n[" << i << "] TableType: " << meta[i].GetTableType());
}
- return SQL_RESULT_SUCCESS;
+ return SqlResult::AI_SUCCESS;
}
}
}