http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/system/socket_client.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/system/socket_client.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/system/socket_client.h deleted file mode 100644 index 8a59e15..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/system/socket_client.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _IGNITE_ODBC_DRIVER_SOCKET_CLIENT -#define _IGNITE_ODBC_DRIVER_SOCKET_CLIENT - -#include <stdint.h> - -#include "ignite/common/common.h" - -namespace ignite -{ - namespace odbc - { - namespace tcp - { - /** - * Socket client implementation. - */ - class SocketClient - { - public: - /** - * Constructor. - */ - SocketClient(); - - /** - * Destructor. - */ - ~SocketClient(); - - /** - * Establish connection with remote TCP service. - * - * @param hostname Remote host name. - * @param port TCP service port. - * @return True on success. - */ - bool Connect(const char* hostname, uint16_t port); - - /** - * Close established connection. - * - * @return True on success. - */ - void Close(); - - /** - * Send data by established connection. - * - * @param data Pointer to data to be sent. - * @param size Size of the data in bytes. - * @return Number of bytes that have been sent on success and negative - * value on failure. - */ - int Send(const int8_t* data, size_t size); - - /** - * Receive data from established connection. - * - * @param data Pointer to data buffer. - * @param size Size of the buffer in bytes. - * @return Number of bytes that have been received on success and negative - * value on failure. - */ - int Receive(int8_t* buffer, size_t size); - - private: - intptr_t socketHandle; - - IGNITE_NO_COPY_ASSIGNMENT(SocketClient) - }; - } - } -} - -#endif \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/type_traits.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/type_traits.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/type_traits.h deleted file mode 100644 index 230a4ec..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/type_traits.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _IGNITE_ODBC_DRIVER_TYPE_TRAITS -#define _IGNITE_ODBC_DRIVER_TYPE_TRAITS - -#include <stdint.h> - -#include <string> - -namespace ignite -{ - namespace odbc - { - namespace type_traits - { -#ifdef ODBC_DEBUG - /** - * Convert statement attribute ID to string containing its name. - * Debug function. - * @param type Attribute ID. - * @return Null-terminated string containing attribute name. - */ - const char* StatementAttrIdToString(long id); -#endif - - /** - * ODBC type aliases. - * We use these so we will not be needed to include system-specific - * headers in our header files. - */ - enum IgniteSqlType - { - /** Alias for the SQL_C_CHAR type. */ - IGNITE_ODBC_C_TYPE_CHAR, - - /** Alias for the SQL_C_WCHAR type. */ - IGNITE_ODBC_C_TYPE_WCHAR, - - /** Alias for the SQL_C_SSHORT type. */ - IGNITE_ODBC_C_TYPE_SIGNED_SHORT, - - /** Alias for the SQL_C_USHORT type. */ - IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT, - - /** Alias for the SQL_C_SLONG type. */ - IGNITE_ODBC_C_TYPE_SIGNED_LONG, - - /** Alias for the SQL_C_ULONG type. */ - IGNITE_ODBC_C_TYPE_UNSIGNED_LONG, - - /** Alias for the SQL_C_FLOAT type. */ - IGNITE_ODBC_C_TYPE_FLOAT, - - /** Alias for the SQL_C_DOUBLE type. */ - IGNITE_ODBC_C_TYPE_DOUBLE, - - /** Alias for the SQL_C_BIT type. */ - IGNITE_ODBC_C_TYPE_BIT, - - /** Alias for the SQL_C_STINYINT type. */ - IGNITE_ODBC_C_TYPE_SIGNED_TINYINT, - - /** Alias for the SQL_C_UTINYINT type. */ - IGNITE_ODBC_C_TYPE_UNSIGNED_TINYINT, - - /** Alias for the SQL_C_SBIGINT type. */ - IGNITE_ODBC_C_TYPE_SIGNED_BIGINT, - - /** Alias for the SQL_C_UBIGINT type. */ - IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT, - - /** Alias for the SQL_C_BINARY type. */ - IGNITE_ODBC_C_TYPE_BINARY, - - /** Alias for the SQL_C_TDATE type. */ - IGNITE_ODBC_C_TYPE_TDATE, - - /** Alias for the SQL_C_TTIME type. */ - IGNITE_ODBC_C_TYPE_TTIME, - - /** Alias for the SQL_C_TTIMESTAMP type. */ - IGNITE_ODBC_C_TYPE_TTIMESTAMP, - - /** Alias for the SQL_C_NUMERIC type. */ - IGNITE_ODBC_C_TYPE_NUMERIC, - - /** Alias for the SQL_C_GUID type. */ - IGNITE_ODBC_C_TYPE_GUID, - - /** Alias for the SQL_DEFAULT. */ - IGNITE_ODBC_C_TYPE_DEFAULT, - - /** Alias for all unsupported types. */ - IGNITE_ODBC_C_TYPE_UNSUPPORTED - }; - - /** - * SQL type name constants. - */ - class SqlTypeName - { - public: - /** VARCHAR SQL type name constant. */ - static const std::string VARCHAR; - - /** SMALLINT SQL type name constant. */ - static const std::string SMALLINT; - - /** INTEGER SQL type name constant. */ - static const std::string INTEGER; - - /** DECIMAL SQL type name constant. */ - static const std::string DECIMAL; - - /** FLOAT SQL type name constant. */ - static const std::string FLOAT; - - /** DOUBLE SQL type name constant. */ - static const std::string DOUBLE; - - /** BIT SQL type name constant. */ - static const std::string BIT; - - /** TINYINT SQL type name constant. */ - static const std::string TINYINT; - - /** BIGINT SQL type name constant. */ - static const std::string BIGINT; - - /** BINARY SQL type name constant. */ - static const std::string BINARY; - - /** DATE SQL type name constant. */ - static const std::string DATE; - - /** GUID SQL type name constant. */ - static const std::string GUID; - }; - - /** - * Get SQL type name for the binary type. - * - * @param binaryType Binary type. - * @return Corresponding SQL type name. - */ - const std::string& BinaryTypeToSqlTypeName(int8_t binaryType); - - /** - * Check if the C type supported by the current implementation. - * - * @param type Application type. - * @return True if the type is supported. - */ - bool IsApplicationTypeSupported(int16_t type); - - /** - * Check if the SQL type supported by the current implementation. - * - * @param type Application type. - * @return True if the type is supported. - */ - bool IsSqlTypeSupported(int16_t type); - - /** - * Get corresponding binary type for ODBC SQL type. - * - * @param sqlType SQL type. - * @return Binary type. - */ - int8_t SqlTypeToBinary(int16_t sqlType); - - /** - * Convert ODBC type to driver type alias. - * - * @param ODBC type; - * @return Internal driver type. - */ - IgniteSqlType ToDriverType(int16_t type); - - /** - * Convert binary data type to SQL data type. - * - * @param binaryType Binary data type. - * @return SQL data type. - */ - int16_t BinaryToSqlType(int8_t binaryType); - - /** - * Get binary type SQL nullability. - * - * @param binaryType Binary data type. - * @return SQL_NO_NULLS if the column could not include NULL values. - * SQL_NULLABLE if the column accepts NULL values. - * SQL_NULLABLE_UNKNOWN if it is not known whether the - * column accepts NULL values. - */ - int16_t BinaryTypeNullability(int8_t binaryType); - - /** - * Get SQL type display size. - * - * @param type SQL type. - * @return Display size. - */ - int32_t SqlTypeDisplaySize(int16_t type); - - /** - * Get binary type display size. - * - * @param type Binary type. - * @return Display size. - */ - int32_t BinaryTypeDisplaySize(int8_t type); - - /** - * Get SQL type column size. - * - * @param type SQL type. - * @return Column size. - */ - int32_t SqlTypeColumnSize(int16_t type); - - /** - * Get binary type column size. - * - * @param type Binary type. - * @return Column size. - */ - int32_t BinaryTypeColumnSize(int8_t type); - - /** - * Get SQL type transfer octet length. - * - * @param type SQL type. - * @return Transfer octet length. - */ - int32_t SqlTypeTransferLength(int16_t type); - - /** - * Get binary type transfer octet length. - * - * @param type Binary type. - * @return Transfer octet length. - */ - int32_t BinaryTypeTransferLength(int8_t type); - - /** - * Get SQL type numeric precision radix. - * - * @param type SQL type. - * @return Numeric precision radix. - */ - int32_t SqlTypeNumPrecRadix(int8_t type); - - /** - * Get binary type numeric precision radix. - * - * @param type Binary type. - * @return Numeric precision radix. - */ - int32_t BinaryTypeNumPrecRadix(int8_t type); - - /** - * Get SQL type decimal digits. - * - * @param type SQL type. - * @return Decimal digits. - */ - int32_t SqlTypeDecimalDigits(int16_t type); - - /** - * Get binary type decimal digits. - * - * @param type Binary type. - * @return Decimal digits. - */ - int32_t BinaryTypeDecimalDigits(int8_t type); - - /** - * Checks if the SQL type is unsigned. - * - * @param type SQL type. - * @return True if unsigned or non-numeric. - */ - bool SqlTypeUnsigned(int16_t type); - - /** - * Checks if the binary type is unsigned. - * - * @param type Binary type. - * @return True if unsigned or non-numeric. - */ - bool BinaryTypeUnsigned(int8_t type); - } - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/utility.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/utility.h b/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/utility.h deleted file mode 100644 index 4a2e928..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/include/ignite/odbc/utility.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _IGNITE_ODBC_DRIVER_UTILITY -#define _IGNITE_ODBC_DRIVER_UTILITY - -#include <string> -#include <stdint.h> - -#ifdef min -# undef min -#endif //min - -#include <algorithm> - -#include <ignite/common/utils.h> - -#include "ignite/impl/binary/binary_reader_impl.h" -#include "ignite/impl/binary/binary_writer_impl.h" - -#include "ignite/odbc/decimal.h" - -#ifdef ODBC_DEBUG - -extern FILE* log_file; -void logInit(const char*); - -# define LOG_MSG(fmt, ...) \ - do { \ - logInit(ODBC_LOG_PATH); \ - fprintf(log_file, "%s: " fmt, __FUNCTION__, __VA_ARGS__); \ - fflush(log_file); \ - } while (false) - -#else -# define LOG_MSG(...) -#endif - -namespace ignite -{ - namespace utility - { - /** Using common version of the util. */ - using ignite::common::utils::IntoLower; - - /** - * Skip leading spaces. - * - * @param begin Iterator to the beginning of the character sequence. - * @param end Iterator to the end of the character sequence. - * @return Iterator to first non-blanc character. - */ - template<typename Iterator> - Iterator SkipLeadingSpaces(Iterator begin, Iterator end) - { - Iterator res = begin; - - while (isspace(*res) && res != end) - ++res; - - return res; - } - - /** - * Skip trailing spaces. - * - * @param begin Iterator to the beginning of the character sequence. - * @param end Iterator to the end of the character sequence. - * @return Iterator to last non-blanc character. - */ - template<typename Iterator> - Iterator SkipTrailingSpaces(Iterator begin, Iterator end) - { - Iterator res = end - 1; - - while (isspace(*res) && res != begin - 1) - --res; - - return res + 1; - } - - /** - * Remove leading and trailing spaces. - * - * @param begin Iterator to the beginning of the character sequence. - * @param end Iterator to the end of the character sequence. - * @return String without leading and trailing spaces. - */ - template<typename Iterator> - std::string RemoveSurroundingSpaces(Iterator begin, Iterator end) - { - std::string res; - - if (begin >= end) - return res; - - Iterator skipped_leading = SkipLeadingSpaces(begin, end); - Iterator skipped_trailing = SkipTrailingSpaces(skipped_leading, end); - - res.reserve(skipped_trailing - skipped_leading); - - std::copy(skipped_leading, skipped_trailing, std::back_insert_iterator<std::string>(res)); - - return res; - } - - template<typename T> - T* GetPointerWithOffset(T* ptr, size_t offset) - { - uint8_t* ptrBytes = (uint8_t*)ptr; - - return (T*)(ptrBytes + offset); - } - - /** - * Copy string to buffer of the specific length. - * @param str String to copy data from. - * @param buf Buffer to copy data to. - * @param buflen Length of the buffer. - * @return Length of the resulting string in buffer. - */ - size_t CopyStringToBuffer(const std::string& str, char* buf, size_t buflen); - - /** - * Read string from reader. - * @param reader Reader. - * @param str String. - */ - void ReadString(ignite::impl::binary::BinaryReaderImpl& reader, std::string& str); - - /** - * Write string using writer. - * @param writer Writer. - * @param str String. - */ - void WriteString(ignite::impl::binary::BinaryWriterImpl& writer, const std::string& str); - - /** - * Read decimal value using reader. - * - * @param reader Reader. - * @param decimal Decimal value. - */ - void ReadDecimal(ignite::impl::binary::BinaryReaderImpl& reader, Decimal& decimal); - - /** - * Convert SQL string buffer to std::string. - * - * @param sqlStr SQL string buffer. - * @param sqlStrLen SQL string length. - * @return Standard string containing the same data. - */ - std::string SqlStringToString(const unsigned char* sqlStr, int32_t sqlStrLen); - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/os/linux/src/system/socket_client.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/os/linux/src/system/socket_client.cpp b/modules/platforms/cpp/odbc/odbc-driver/os/linux/src/system/socket_client.cpp deleted file mode 100644 index a355625..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/os/linux/src/system/socket_client.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <sys/socket.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netdb.h> -#include <unistd.h> - -#include <cstring> - -#include <sstream> - -#include "ignite/odbc/system/socket_client.h" -#include "ignite/odbc/utility.h" - -#define SOCKET_ERROR (-1) - -namespace ignite -{ - namespace odbc - { - namespace tcp - { - - SocketClient::SocketClient() : socketHandle(SOCKET_ERROR) - { - // No-op. - } - - SocketClient::~SocketClient() - { - Close(); - } - - bool SocketClient::Connect(const char* hostname, uint16_t port) - { - LOG_MSG("Host: %s, port: %d\n", hostname, port); - - addrinfo hints; - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - - std::stringstream converter; - converter << port; - - // Resolve the server address and port - addrinfo *result = NULL; - int res = getaddrinfo(hostname, converter.str().c_str(), &hints, &result); - - if (res != 0) - return false; - - // Attempt to connect to an address until one succeeds - for (addrinfo *it = result; it != NULL; it = it->ai_next) - { - LOG_MSG("Addr: %u.%u.%u.%u\n", it->ai_addr->sa_data[2], it->ai_addr->sa_data[3], - it->ai_addr->sa_data[4], it->ai_addr->sa_data[5]); - - // Create a SOCKET for connecting to server - socketHandle = socket(it->ai_family, it->ai_socktype, it->ai_protocol); - - if (socketHandle == SOCKET_ERROR) - return false; - - // Connect to server. - res = connect(socketHandle, it->ai_addr, (int)it->ai_addrlen); - if (res == SOCKET_ERROR) - { - Close(); - - continue; - } - break; - } - - freeaddrinfo(result); - - return socketHandle != SOCKET_ERROR; - } - - void SocketClient::Close() - { - if (socketHandle != SOCKET_ERROR) - { - close(socketHandle); - - socketHandle = SOCKET_ERROR; - } - } - - int SocketClient::Send(const int8_t* data, size_t size) - { - return send(socketHandle, reinterpret_cast<const char*>(data), static_cast<int>(size), 0); - } - - int SocketClient::Receive(int8_t* buffer, size_t size) - { - return recv(socketHandle, reinterpret_cast<char*>(buffer), static_cast<int>(size), 0); - } - } - } -} - http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/os/win/src/system/socket_client.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/os/win/src/system/socket_client.cpp b/modules/platforms/cpp/odbc/odbc-driver/os/win/src/system/socket_client.cpp deleted file mode 100644 index bc4cdc0..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/os/win/src/system/socket_client.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define WIN32_LEAN_AND_MEAN -#define _WINSOCKAPI_ - -#include <windows.h> -#include <winsock2.h> -#include <ws2tcpip.h> - -#include <cstring> - -#include <sstream> - -#include "ignite/odbc/system/socket_client.h" -#include "ignite/odbc/utility.h" - -namespace ignite -{ - namespace odbc - { - namespace tcp - { - - SocketClient::SocketClient() : socketHandle(INVALID_SOCKET) - { - // No-op. - } - - SocketClient::~SocketClient() - { - Close(); - } - - bool SocketClient::Connect(const char* hostname, uint16_t port) - { - static bool networkInited = false; - - // Initing networking if is not inited. - if (!networkInited) - { - WSADATA wsaData; - - networkInited = (WSAStartup(MAKEWORD(2, 2), &wsaData) == 0); - - if (!networkInited) - return false; - } - - addrinfo *result = NULL; - addrinfo hints; - - LOG_MSG("Host: %s, port: %d\n", hostname, port); - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - - std::stringstream converter; - converter << port; - - // Resolve the server address and port - int res = getaddrinfo(hostname, converter.str().c_str(), &hints, &result); - - if (res != 0) - return false; - - // Attempt to connect to an address until one succeeds - for (addrinfo *it = result; it != NULL; it = it->ai_next) - { - LOG_MSG("Addr: %u.%u.%u.%u\n", it->ai_addr->sa_data[2], it->ai_addr->sa_data[3], - it->ai_addr->sa_data[4], it->ai_addr->sa_data[5]); - - // Create a SOCKET for connecting to server - socketHandle = socket(it->ai_family, it->ai_socktype, it->ai_protocol); - - if (socketHandle == INVALID_SOCKET) - return false; - - // Connect to server. - res = connect(socketHandle, it->ai_addr, static_cast<int>(it->ai_addrlen)); - if (res == SOCKET_ERROR) - { - Close(); - - continue; - } - break; - } - - freeaddrinfo(result); - - return socketHandle != INVALID_SOCKET; - } - - void SocketClient::Close() - { - if (socketHandle != INVALID_SOCKET) - { - closesocket(socketHandle); - - socketHandle = INVALID_SOCKET; - } - } - - int SocketClient::Send(const int8_t* data, size_t size) - { - return send(socketHandle, reinterpret_cast<const char*>(data), static_cast<int>(size), 0); - } - - int SocketClient::Receive(int8_t* buffer, size_t size) - { - return recv(socketHandle, reinterpret_cast<char*>(buffer), static_cast<int>(size), 0); - } - } - } -} - http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/project/README.TXT ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/project/README.TXT b/modules/platforms/cpp/odbc/odbc-driver/project/README.TXT deleted file mode 100644 index 97f4c64..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/project/README.TXT +++ /dev/null @@ -1 +0,0 @@ -Contains IDE projects artifacts. http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/project/vs/README.TXT ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/project/vs/README.TXT b/modules/platforms/cpp/odbc/odbc-driver/project/vs/README.TXT deleted file mode 100644 index f4fb456..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/project/vs/README.TXT +++ /dev/null @@ -1 +0,0 @@ -Contains Visual Studio project artifacts. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/project/vs/module.def ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/project/vs/module.def b/modules/platforms/cpp/odbc/odbc-driver/project/vs/module.def deleted file mode 100644 index 10e1461..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/project/vs/module.def +++ /dev/null @@ -1,69 +0,0 @@ - -LIBRARY odbc-driver -EXPORTS - ConfigDSN - SQLAllocConnect - SQLAllocEnv - SQLAllocStmt - SQLAllocHandle - SQLFreeConnect - SQLFreeEnv - SQLFreeStmt - SQLBindCol - SQLCancel - SQLConnect - SQLDescribeCol - SQLDisconnect - SQLError - SQLExecDirect - SQLExecute - SQLExtendedFetch - SQLFetch - SQLGetCursorName - SQLNumResultCols - SQLPrepare - SQLRowCount - SQLSetCursorName - SQLColumns - SQLDriverConnect - SQLGetData - SQLGetInfo - SQLGetTypeInfo - SQLParamData - SQLPutData - SQLStatistics - SQLTables - SQLBrowseConnect - SQLColumnPrivileges - SQLDescribeParam - SQLForeignKeys - SQLMoreResults - SQLNativeSql - SQLNumParams - SQLPrimaryKeys - SQLProcedureColumns - SQLProcedures - SQLSetPos - SQLTablePrivileges - SQLBindParameter - SQLCloseCursor - SQLColAttribute - SQLCopyDesc - SQLEndTran - SQLFetchScroll - SQLFreeHandle - SQLGetConnectAttr - SQLGetDescField - SQLGetDescRec - SQLGetDiagField - SQLGetDiagRec - SQLGetEnvAttr - SQLGetStmtAttr - SQLSetConnectAttr - SQLSetDescField - SQLSetDescRec - SQLSetEnvAttr - SQLSetStmtAttr - SQLBulkOperations - SQLSpecialColumns - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj b/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj deleted file mode 100644 index b327ffd..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj +++ /dev/null @@ -1,233 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{12F77E12-38FE-42D3-B1DA-7E5979362961}</ProjectGuid> - <RootNamespace>odbcdriver</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v100</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v100</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v100</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v100</PlatformToolset> - <WholeProgramOptimization>true</WholeProgramOptimization> - <CharacterSet>MultiByte</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="Shared"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <SDLCheck>false</SDLCheck> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\..\common\include;$(ProjectDir)\..\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\..\binary\include;$(ProjectDir)\..\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;ODBC_DEBUG;ODBC_LOG_PATH="D:\\odbc.log";_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <ModuleDefinitionFile>module.def</ModuleDefinitionFile> - <AdditionalDependencies>Ws2_32.lib;Mswsock.lib;Advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <SDLCheck>false</SDLCheck> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\..\common\include;$(ProjectDir)\..\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\..\binary\include;$(ProjectDir)\..\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;ODBC_DEBUG;ODBC_LOG_PATH="D:\\odbc.log";_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <ModuleDefinitionFile>module.def</ModuleDefinitionFile> - <AdditionalDependencies>Ws2_32.lib;Mswsock.lib;Advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>false</SDLCheck> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\..\common\include;$(ProjectDir)\..\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\..\binary\include;$(ProjectDir)\..\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;ODBC_DEBUG;ODBC_LOG_PATH="D:\\odbc.log";%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <ModuleDefinitionFile>module.def</ModuleDefinitionFile> - <AdditionalDependencies>Ws2_32.lib;Mswsock.lib;Advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>false</SDLCheck> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\..\common\include;$(ProjectDir)\..\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\..\binary\include;$(ProjectDir)\..\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;ODBC_DEBUG;ODBC_LOG_PATH="D:\\odbc.log";%(PreprocessorDefinitions)</PreprocessorDefinitions> - </ClCompile> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <ModuleDefinitionFile>module.def</ModuleDefinitionFile> - <AdditionalDependencies>Ws2_32.lib;Mswsock.lib;Advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\os\win\src\system\socket_client.cpp" /> - <ClCompile Include="..\..\src\app\application_data_buffer.cpp" /> - <ClCompile Include="..\..\src\app\parameter.cpp" /> - <ClCompile Include="..\..\src\column.cpp" /> - <ClCompile Include="..\..\src\common_types.cpp" /> - <ClCompile Include="..\..\src\config\configuration.cpp" /> - <ClCompile Include="..\..\src\config\connection_info.cpp" /> - <ClCompile Include="..\..\src\connection.cpp" /> - <ClCompile Include="..\..\src\cursor.cpp" /> - <ClCompile Include="..\..\src\decimal.cpp" /> - <ClCompile Include="..\..\src\diagnostic\diagnosable_adapter.cpp" /> - <ClCompile Include="..\..\src\diagnostic\diagnostic_record.cpp" /> - <ClCompile Include="..\..\src\diagnostic\diagnostic_record_storage.cpp" /> - <ClCompile Include="..\..\src\environment.cpp" /> - <ClCompile Include="..\..\src\meta\column_meta.cpp" /> - <ClCompile Include="..\..\src\meta\table_meta.cpp" /> - <ClCompile Include="..\..\src\odbc.cpp" /> - <ClCompile Include="..\..\src\query\data_query.cpp" /> - <ClCompile Include="..\..\src\query\column_metadata_query.cpp" /> - <ClCompile Include="..\..\src\query\foreign_keys_query.cpp" /> - <ClCompile Include="..\..\src\query\primary_keys_query.cpp" /> - <ClCompile Include="..\..\src\query\special_columns_query.cpp" /> - <ClCompile Include="..\..\src\query\table_metadata_query.cpp" /> - <ClCompile Include="..\..\src\query\type_info_query.cpp" /> - <ClCompile Include="..\..\src\result_page.cpp" /> - <ClCompile Include="..\..\src\row.cpp" /> - <ClCompile Include="..\..\src\statement.cpp" /> - <ClCompile Include="..\..\src\type_traits.cpp" /> - <ClCompile Include="..\..\src\utility.cpp" /> - </ItemGroup> - <ItemGroup> - <None Include="module.def" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\include\ignite\odbc\app\application_data_buffer.h" /> - <ClInclude Include="..\..\include\ignite\odbc\app\parameter.h" /> - <ClInclude Include="..\..\include\ignite\odbc\column.h" /> - <ClInclude Include="..\..\include\ignite\odbc\common_types.h" /> - <ClInclude Include="..\..\include\ignite\odbc\config\configuration.h" /> - <ClInclude Include="..\..\include\ignite\odbc\config\connection_info.h" /> - <ClInclude Include="..\..\include\ignite\odbc\connection.h" /> - <ClInclude Include="..\..\include\ignite\odbc\cursor.h" /> - <ClInclude Include="..\..\include\ignite\odbc\decimal.h" /> - <ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnosable.h" /> - <ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnosable_adapter.h" /> - <ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnostic_record.h" /> - <ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnostic_record_storage.h" /> - <ClInclude Include="..\..\include\ignite\odbc\environment.h" /> - <ClInclude Include="..\..\include\ignite\odbc\message.h" /> - <ClInclude Include="..\..\include\ignite\odbc\meta\column_meta.h" /> - <ClInclude Include="..\..\include\ignite\odbc\meta\primary_key_meta.h" /> - <ClInclude Include="..\..\include\ignite\odbc\meta\table_meta.h" /> - <ClInclude Include="..\..\include\ignite\odbc\parser.h" /> - <ClInclude Include="..\..\include\ignite\odbc\query\data_query.h" /> - <ClInclude Include="..\..\include\ignite\odbc\query\column_metadata_query.h" /> - <ClInclude Include="..\..\include\ignite\odbc\query\foreign_keys_query.h" /> - <ClInclude Include="..\..\include\ignite\odbc\query\primary_keys_query.h" /> - <ClInclude Include="..\..\include\ignite\odbc\query\query.h" /> - <ClInclude Include="..\..\include\ignite\odbc\query\special_columns_query.h" /> - <ClInclude Include="..\..\include\ignite\odbc\query\table_metadata_query.h" /> - <ClInclude Include="..\..\include\ignite\odbc\query\type_info_query.h" /> - <ClInclude Include="..\..\include\ignite\odbc\result_page.h" /> - <ClInclude Include="..\..\include\ignite\odbc\row.h" /> - <ClInclude Include="..\..\include\ignite\odbc\statement.h" /> - <ClInclude Include="..\..\include\ignite\odbc\system\odbc_constants.h" /> - <ClInclude Include="..\..\include\ignite\odbc\system\socket_client.h" /> - <ClInclude Include="..\..\include\ignite\odbc\type_traits.h" /> - <ClInclude Include="..\..\include\ignite\odbc\utility.h" /> - <ClInclude Include="result_page.h" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\..\binary\project\vs\binary.vcxproj"> - <Project>{4f15669b-92eb-49f0-b774-8f19bae0b960}</Project> - </ProjectReference> - <ProjectReference Include="..\..\..\..\common\project\vs\common.vcxproj"> - <Project>{4f7e4917-4612-4b96-9838-025711ade391}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj.filters ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj.filters b/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj.filters deleted file mode 100644 index d47684a..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/project/vs/odbc-driver.vcxproj.filters +++ /dev/null @@ -1,229 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Code"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="Misc"> - <UniqueIdentifier>{3f714d15-6347-46a7-bc59-d87c1aea900c}</UniqueIdentifier> - </Filter> - <Filter Include="Code\query"> - <UniqueIdentifier>{b09a6b2e-c30c-4727-8e85-4b315e757706}</UniqueIdentifier> - </Filter> - <Filter Include="Code\meta"> - <UniqueIdentifier>{71d6243f-e8c9-4f21-a5a3-3dc89641af28}</UniqueIdentifier> - </Filter> - <Filter Include="Code\config"> - <UniqueIdentifier>{71117941-fa47-4768-afe8-901c94d431c7}</UniqueIdentifier> - </Filter> - <Filter Include="Code\app"> - <UniqueIdentifier>{dbe40149-df23-4b89-92e4-16817775cd0e}</UniqueIdentifier> - </Filter> - <Filter Include="Code\system"> - <UniqueIdentifier>{7ab279dc-6586-4b32-aca7-0add0c0ab68a}</UniqueIdentifier> - </Filter> - <Filter Include="Code\diagnostic"> - <UniqueIdentifier>{df33e506-b5d8-423f-bcc5-1825242a3e28}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\src\odbc.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\connection.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\environment.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\statement.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\type_traits.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\common_types.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\utility.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\cursor.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\result_page.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\row.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\query\data_query.cpp"> - <Filter>Code\query</Filter> - </ClCompile> - <ClCompile Include="..\..\src\query\column_metadata_query.cpp"> - <Filter>Code\query</Filter> - </ClCompile> - <ClCompile Include="..\..\src\query\table_metadata_query.cpp"> - <Filter>Code\query</Filter> - </ClCompile> - <ClCompile Include="..\..\src\meta\column_meta.cpp"> - <Filter>Code\meta</Filter> - </ClCompile> - <ClCompile Include="..\..\src\meta\table_meta.cpp"> - <Filter>Code\meta</Filter> - </ClCompile> - <ClCompile Include="..\..\src\config\configuration.cpp"> - <Filter>Code\config</Filter> - </ClCompile> - <ClCompile Include="..\..\src\config\connection_info.cpp"> - <Filter>Code\config</Filter> - </ClCompile> - <ClCompile Include="..\..\src\app\application_data_buffer.cpp"> - <Filter>Code\app</Filter> - </ClCompile> - <ClCompile Include="..\..\src\app\parameter.cpp"> - <Filter>Code\app</Filter> - </ClCompile> - <ClCompile Include="..\..\src\query\foreign_keys_query.cpp"> - <Filter>Code\query</Filter> - </ClCompile> - <ClCompile Include="..\..\src\query\primary_keys_query.cpp"> - <Filter>Code\query</Filter> - </ClCompile> - <ClCompile Include="..\..\src\diagnostic\diagnostic_record.cpp"> - <Filter>Code\diagnostic</Filter> - </ClCompile> - <ClCompile Include="..\..\src\diagnostic\diagnostic_record_storage.cpp"> - <Filter>Code\diagnostic</Filter> - </ClCompile> - <ClCompile Include="..\..\src\diagnostic\diagnosable_adapter.cpp"> - <Filter>Code\diagnostic</Filter> - </ClCompile> - <ClCompile Include="..\..\os\win\src\system\socket_client.cpp"> - <Filter>Code\system</Filter> - </ClCompile> - <ClCompile Include="..\..\src\decimal.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\query\type_info_query.cpp"> - <Filter>Code\query</Filter> - </ClCompile> - <ClCompile Include="..\..\src\column.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\query\special_columns_query.cpp"> - <Filter>Code\query</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <None Include="module.def"> - <Filter>Misc</Filter> - </None> - </ItemGroup> - <ItemGroup> - <ClInclude Include="result_page.h" /> - <ClInclude Include="..\..\include\ignite\odbc\common_types.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\connection.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\cursor.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\environment.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\message.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\parser.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\result_page.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\row.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\statement.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\type_traits.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\utility.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\query\query.h"> - <Filter>Code\query</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\query\data_query.h"> - <Filter>Code\query</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\query\column_metadata_query.h"> - <Filter>Code\query</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\query\table_metadata_query.h"> - <Filter>Code\query</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\meta\column_meta.h"> - <Filter>Code\meta</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\meta\table_meta.h"> - <Filter>Code\meta</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\config\configuration.h"> - <Filter>Code\config</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\config\connection_info.h"> - <Filter>Code\config</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\app\application_data_buffer.h"> - <Filter>Code\app</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\app\parameter.h"> - <Filter>Code\app</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\query\foreign_keys_query.h"> - <Filter>Code\query</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\query\primary_keys_query.h"> - <Filter>Code\query</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\meta\primary_key_meta.h"> - <Filter>Code\meta</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnostic_record.h"> - <Filter>Code\diagnostic</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnostic_record_storage.h"> - <Filter>Code\diagnostic</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnosable.h"> - <Filter>Code\diagnostic</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\diagnostic\diagnosable_adapter.h"> - <Filter>Code\diagnostic</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\system\odbc_constants.h"> - <Filter>Code\system</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\system\socket_client.h"> - <Filter>Code\system</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\decimal.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\query\type_info_query.h"> - <Filter>Code\query</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\column.h"> - <Filter>Code</Filter> - </ClInclude> - <ClInclude Include="..\..\include\ignite\odbc\query\special_columns_query.h"> - <Filter>Code\query</Filter> - </ClInclude> - </ItemGroup> -</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-driver/src/app/application_data_buffer.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-driver/src/app/application_data_buffer.cpp b/modules/platforms/cpp/odbc/odbc-driver/src/app/application_data_buffer.cpp deleted file mode 100644 index e10011b..0000000 --- a/modules/platforms/cpp/odbc/odbc-driver/src/app/application_data_buffer.cpp +++ /dev/null @@ -1,834 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <algorithm> -#include <string> -#include <sstream> - -#include "ignite/odbc/system/odbc_constants.h" -#include "ignite/odbc/app/application_data_buffer.h" -#include "ignite/odbc/utility.h" - -namespace ignite -{ - namespace odbc - { - namespace app - { - ApplicationDataBuffer::ApplicationDataBuffer() : - type(type_traits::IGNITE_ODBC_C_TYPE_UNSUPPORTED), buffer(0), buflen(0), reslen(0), offset(0) - { - // No-op. - } - - ApplicationDataBuffer::ApplicationDataBuffer(type_traits::IgniteSqlType type, - void* buffer, SqlLen buflen, SqlLen* reslen, size_t** offset) : - type(type), buffer(buffer), buflen(buflen), reslen(reslen), offset(offset) - { - // No-op. - } - - ApplicationDataBuffer::ApplicationDataBuffer(const ApplicationDataBuffer & other) : - type(other.type), buffer(other.buffer), buflen(other.buflen), reslen(other.reslen), offset(other.offset) - { - // No-op. - } - - ApplicationDataBuffer::~ApplicationDataBuffer() - { - // No-op. - } - - ApplicationDataBuffer & ApplicationDataBuffer::operator=(const ApplicationDataBuffer & other) - { - type = other.type; - buffer = other.buffer; - buflen = other.buflen; - reslen = other.reslen; - offset = other.offset; - - return *this; - } - - template<typename T> - void ApplicationDataBuffer::PutNum(T value) - { - using namespace type_traits; - switch (type) - { - case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT: - { - PutNumToNumBuffer<signed char>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_BIT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_TINYINT: - { - PutNumToNumBuffer<unsigned char>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_SIGNED_SHORT: - { - PutNumToNumBuffer<short>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT: - { - PutNumToNumBuffer<unsigned short>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_SIGNED_LONG: - { - PutNumToNumBuffer<long>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG: - { - PutNumToNumBuffer<unsigned long>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT: - { - PutNumToNumBuffer<int64_t>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT: - { - PutNumToNumBuffer<uint64_t>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_FLOAT: - { - PutNumToNumBuffer<float>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_DOUBLE: - { - PutNumToNumBuffer<double>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_CHAR: - { - PutValToStrBuffer<char>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_WCHAR: - { - PutValToStrBuffer<wchar_t>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_NUMERIC: - { - if (GetData()) - { - SQL_NUMERIC_STRUCT* out = - reinterpret_cast<SQL_NUMERIC_STRUCT*>(GetData()); - - out->precision = 0; - out->scale = 0; - out->sign = value > 0 ? 1 : 0; - - memset(out->val, 0, SQL_MAX_NUMERIC_LEN); - - // TODO: implement propper conversation to numeric type. - int64_t intVal = static_cast<int64_t>(std::abs(value)); - - memcpy(out->val, &intVal, std::min<int>(SQL_MAX_NUMERIC_LEN, sizeof(intVal))); - } - break; - } - - case IGNITE_ODBC_C_TYPE_BINARY: - case IGNITE_ODBC_C_TYPE_DEFAULT: - { - if (GetData()) - { - if (buflen >= sizeof(value)) - { - memcpy(GetData(), &value, sizeof(value)); - - if (GetResLen()) - *GetResLen() = sizeof(value); - } - else - { - memcpy(GetData(), &value, static_cast<size_t>(buflen)); - - if (GetResLen()) - *GetResLen() = SQL_NO_TOTAL; - } - } - else if (GetResLen()) - { - *GetResLen() = sizeof(value); - } - break; - } - - default: - { - if (GetResLen()) - *GetResLen() = SQL_NO_TOTAL; - } - } - } - - template<typename Tbuf, typename Tin> - void ApplicationDataBuffer::PutNumToNumBuffer(Tin value) - { - if (GetData()) - { - Tbuf* out = reinterpret_cast<Tbuf*>(GetData()); - *out = static_cast<Tbuf>(value); - } - } - - template<typename CharT, typename Tin> - void ApplicationDataBuffer::PutValToStrBuffer(const Tin & value) - { - typedef std::basic_stringstream<CharT> ConverterType; - - ConverterType converter; - - converter << value; - - PutStrToStrBuffer<CharT>(converter.str()); - } - - template<typename CharT> - void ApplicationDataBuffer::PutValToStrBuffer(const int8_t & value) - { - typedef std::basic_stringstream<CharT> ConverterType; - - ConverterType converter; - - converter << static_cast<int>(value); - - PutStrToStrBuffer<CharT>(converter.str()); - } - - template<typename OutCharT, typename InCharT> - void ApplicationDataBuffer::PutStrToStrBuffer(const std::basic_string<InCharT>& value) - { - SqlLen charSize = static_cast<SqlLen>(sizeof(OutCharT)); - - if (GetData()) - { - if (buflen >= charSize) - { - OutCharT* out = reinterpret_cast<OutCharT*>(GetData()); - - SqlLen outLen = (buflen / charSize) - 1; - - SqlLen toCopy = std::min<size_t>(outLen, value.size()); - - for (SqlLen i = 0; i < toCopy; ++i) - out[i] = value[i]; - - out[toCopy] = 0; - } - - if (GetResLen()) - { - if (buflen >= static_cast<SqlLen>((value.size() + 1) * charSize)) - *GetResLen() = static_cast<SqlLen>(value.size()); - else - *GetResLen() = SQL_NO_TOTAL; - } - } - else if (GetResLen()) - *GetResLen() = value.size(); - } - - void ApplicationDataBuffer::PutRawDataToBuffer(void *data, size_t len) - { - SqlLen ilen = static_cast<SqlLen>(len); - - if (GetData()) - { - size_t toCopy = static_cast<size_t>(std::min(buflen, ilen)); - - memcpy(GetData(), data, toCopy); - - if (GetResLen()) - { - if (buflen >= ilen) - *GetResLen() = ilen; - else - *GetResLen() = SQL_NO_TOTAL; - } - } - else if (GetResLen()) - *GetResLen() = ilen; - } - - void ApplicationDataBuffer::PutInt8(int8_t value) - { - PutNum(value); - } - - void ApplicationDataBuffer::PutInt16(int16_t value) - { - PutNum(value); - } - - void ApplicationDataBuffer::PutInt32(int32_t value) - { - PutNum(value); - } - - void ApplicationDataBuffer::PutInt64(int64_t value) - { - PutNum(value); - } - - void ApplicationDataBuffer::PutFloat(float value) - { - PutNum(value); - } - - void ApplicationDataBuffer::PutDouble(double value) - { - PutNum(value); - } - - int32_t ApplicationDataBuffer::PutString(const std::string & value) - { - using namespace type_traits; - - int32_t used = 0; - - switch (type) - { - case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT: - case IGNITE_ODBC_C_TYPE_BIT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_TINYINT: - case IGNITE_ODBC_C_TYPE_SIGNED_SHORT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT: - case IGNITE_ODBC_C_TYPE_SIGNED_LONG: - case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG: - case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT: - case IGNITE_ODBC_C_TYPE_NUMERIC: - { - std::stringstream converter(value); - - int64_t numValue; - - converter >> numValue; - - PutNum(numValue); - - used = static_cast<int32_t>(value.size()); - - break; - } - - case IGNITE_ODBC_C_TYPE_FLOAT: - case IGNITE_ODBC_C_TYPE_DOUBLE: - { - std::stringstream converter(value); - - double numValue; - - converter >> numValue; - - PutNum(numValue); - - used = static_cast<int32_t>(value.size()); - - break; - } - - case IGNITE_ODBC_C_TYPE_CHAR: - case IGNITE_ODBC_C_TYPE_BINARY: - case IGNITE_ODBC_C_TYPE_DEFAULT: - { - PutStrToStrBuffer<char>(value); - - used = static_cast<int32_t>(GetSize()) - 1; - - break; - } - - case IGNITE_ODBC_C_TYPE_WCHAR: - { - PutStrToStrBuffer<wchar_t>(value); - - used = (static_cast<int32_t>(GetSize()) / 2) - 1; - - break; - } - - default: - { - if (GetResLen()) - *GetResLen() = SQL_NO_TOTAL; - } - } - - return used < 0 ? 0 : used; - } - - void ApplicationDataBuffer::PutGuid(const Guid & value) - { - using namespace type_traits; - - switch (type) - { - case IGNITE_ODBC_C_TYPE_CHAR: - case IGNITE_ODBC_C_TYPE_BINARY: - case IGNITE_ODBC_C_TYPE_DEFAULT: - { - PutValToStrBuffer<char>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_WCHAR: - { - PutValToStrBuffer<wchar_t>(value); - break; - } - - case IGNITE_ODBC_C_TYPE_GUID: - { - SQLGUID* guid = reinterpret_cast<SQLGUID*>(GetData()); - - guid->Data1 = static_cast<uint32_t>(value.GetMostSignificantBits() >> 32); - guid->Data2 = static_cast<uint16_t>(value.GetMostSignificantBits() >> 16); - guid->Data3 = static_cast<uint16_t>(value.GetMostSignificantBits()); - - uint64_t lsb = value.GetLeastSignificantBits(); - for (size_t i = 0; i < sizeof(guid->Data4); ++i) - guid->Data4[i] = (lsb >> (sizeof(guid->Data4) - i - 1) * 8) & 0xFF; - - break; - } - - default: - { - if (GetResLen()) - *GetResLen() = SQL_NO_TOTAL; - } - } - } - - int32_t ApplicationDataBuffer::PutBinaryData(void *data, size_t len) - { - using namespace type_traits; - - int32_t used = 0; - - switch (type) - { - case IGNITE_ODBC_C_TYPE_BINARY: - case IGNITE_ODBC_C_TYPE_DEFAULT: - { - PutRawDataToBuffer(data, len); - - used = static_cast<int32_t>(GetSize()); - - break; - } - - case IGNITE_ODBC_C_TYPE_CHAR: - { - std::stringstream converter; - - uint8_t *dataBytes = reinterpret_cast<uint8_t*>(data); - - for (size_t i = 0; i < len; ++i) - { - converter << std::hex - << std::setfill('0') - << std::setw(2) - << static_cast<unsigned>(dataBytes[i]); - } - - PutStrToStrBuffer<char>(converter.str()); - - used = static_cast<int32_t>(GetSize()) - 1; - - break; - } - - case IGNITE_ODBC_C_TYPE_WCHAR: - { - std::wstringstream converter; - - uint8_t *dataBytes = reinterpret_cast<uint8_t*>(data); - - for (size_t i = 0; i < len; ++i) - { - converter << std::hex - << std::setfill<wchar_t>('0') - << std::setw(2) - << static_cast<unsigned>(dataBytes[i]); - } - - PutStrToStrBuffer<wchar_t>(converter.str()); - - used = static_cast<int32_t>(GetSize() / 2) - 1; - - break; - } - - default: - { - if (GetResLen()) - *GetResLen() = SQL_NO_TOTAL; - } - } - - return used < 0 ? 0 : used; - } - - void ApplicationDataBuffer::PutNull() - { - if (GetResLen()) - *GetResLen() = SQL_NULL_DATA; - } - - void ApplicationDataBuffer::PutDecimal(const Decimal& value) - { - using namespace type_traits; - switch (type) - { - case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT: - case IGNITE_ODBC_C_TYPE_BIT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_TINYINT: - case IGNITE_ODBC_C_TYPE_SIGNED_SHORT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT: - case IGNITE_ODBC_C_TYPE_SIGNED_LONG: - case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG: - case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT: - case IGNITE_ODBC_C_TYPE_FLOAT: - case IGNITE_ODBC_C_TYPE_DOUBLE: - case IGNITE_ODBC_C_TYPE_CHAR: - case IGNITE_ODBC_C_TYPE_WCHAR: - { - PutNum<double>(static_cast<double>(value)); - - break; - } - - case IGNITE_ODBC_C_TYPE_NUMERIC: - { - if (GetData()) - { - SQL_NUMERIC_STRUCT* numeric = - reinterpret_cast<SQL_NUMERIC_STRUCT*>(GetData()); - - numeric->sign = value.IsNegative() ? 1 : 0; - numeric->precision = 0; - numeric->scale = value.GetScale(); - memcpy(numeric->val, value.GetMagnitude(), std::min<size_t>(SQL_MAX_NUMERIC_LEN, value.GetLength())); - } - - break; - } - - case IGNITE_ODBC_C_TYPE_DEFAULT: - { - if (GetData()) - memcpy(GetData(), &value, std::min(static_cast<size_t>(buflen), sizeof(value))); - - if (GetResLen()) - *GetResLen() = sizeof(value); - - break; - } - - case IGNITE_ODBC_C_TYPE_BINARY: - default: - { - if (GetResLen()) - *GetResLen() = SQL_NO_TOTAL; - } - } - } - - std::string ApplicationDataBuffer::GetString(size_t maxLen) const - { - using namespace type_traits; - std::string res; - - switch (type) - { - case IGNITE_ODBC_C_TYPE_CHAR: - { - res.assign(reinterpret_cast<const char*>(GetData()), - std::min(maxLen, static_cast<size_t>(buflen))); - break; - } - - case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT: - case IGNITE_ODBC_C_TYPE_SIGNED_SHORT: - case IGNITE_ODBC_C_TYPE_SIGNED_LONG: - case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT: - { - std::stringstream converter; - - converter << GetNum<int64_t>(); - - res = converter.str(); - - break; - } - - case IGNITE_ODBC_C_TYPE_BIT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_TINYINT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG: - case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT: - { - std::stringstream converter; - - converter << GetNum<uint64_t>(); - - res = converter.str(); - - break; - } - - case IGNITE_ODBC_C_TYPE_FLOAT: - { - std::stringstream converter; - - converter << GetNum<float>(); - - res = converter.str(); - - break; - } - - case IGNITE_ODBC_C_TYPE_NUMERIC: - case IGNITE_ODBC_C_TYPE_DOUBLE: - { - std::stringstream converter; - - converter << GetNum<double>(); - - res = converter.str(); - - break; - } - - default: - break; - } - - return res; - } - - int8_t ApplicationDataBuffer::GetInt8() const - { - return GetNum<int8_t>(); - } - - int16_t ApplicationDataBuffer::GetInt16() const - { - return GetNum<int16_t>(); - } - - int32_t ApplicationDataBuffer::GetInt32() const - { - return GetNum<int32_t>(); - } - - int64_t ApplicationDataBuffer::GetInt64() const - { - return GetNum<int64_t>(); - } - - float ApplicationDataBuffer::GetFloat() const - { - return GetNum<float>(); - } - - double ApplicationDataBuffer::GetDouble() const - { - return GetNum<double>(); - } - - const void* ApplicationDataBuffer::GetData() const - { - return ApplyOffset(buffer); - } - - const SqlLen* ApplicationDataBuffer::GetResLen() const - { - return ApplyOffset(reslen); - } - - void* ApplicationDataBuffer::GetData() - { - return ApplyOffset(buffer); - } - - SqlLen* ApplicationDataBuffer::GetResLen() - { - return ApplyOffset(reslen); - } - - template<typename T> - T ApplicationDataBuffer::GetNum() const - { - using namespace type_traits; - - T res = 0; - - switch (type) - { - case IGNITE_ODBC_C_TYPE_CHAR: - { - std::string str = GetString(static_cast<size_t>(buflen)); - - std::stringstream converter(str); - - // Workaround for char types which are recognised as - // symbolyc types and not numeric types. - if (sizeof(T) == 1) - { - short tmp; - - converter >> tmp; - - res = static_cast<T>(tmp); - } - else - converter >> res; - - break; - } - - case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT: - { - res = static_cast<T>(*reinterpret_cast<const signed char*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_BIT: - case IGNITE_ODBC_C_TYPE_UNSIGNED_TINYINT: - { - res = static_cast<T>(*reinterpret_cast<const unsigned char*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_SIGNED_SHORT: - { - res = static_cast<T>(*reinterpret_cast<const signed short*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT: - { - res = static_cast<T>(*reinterpret_cast<const unsigned short*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_SIGNED_LONG: - { - res = static_cast<T>(*reinterpret_cast<const signed long*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_UNSIGNED_LONG: - { - res = static_cast<T>(*reinterpret_cast<const unsigned long*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_SIGNED_BIGINT: - { - res = static_cast<T>(*reinterpret_cast<const int64_t*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT: - { - res = static_cast<T>(*reinterpret_cast<const uint64_t*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_FLOAT: - { - res = static_cast<T>(*reinterpret_cast<const float*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_DOUBLE: - { - res = static_cast<T>(*reinterpret_cast<const double*>(GetData())); - break; - } - - case IGNITE_ODBC_C_TYPE_NUMERIC: - { - const SQL_NUMERIC_STRUCT* numeric = - reinterpret_cast<const SQL_NUMERIC_STRUCT*>(GetData()); - - int64_t resInt; - - // TODO: implement propper conversation from numeric type. - memcpy(&resInt, numeric->val, std::min<int>(SQL_MAX_NUMERIC_LEN, sizeof(resInt))); - - if (numeric->sign) - resInt *= -1; - - double resDouble = static_cast<double>(resInt); - - for (SQLSCHAR scale = numeric->scale; scale > 0; --scale) - resDouble /= 10.0; - - res = static_cast<T>(resDouble); - - break; - } - - default: - break; - } - - return res; - } - - template<typename T> - T* ApplicationDataBuffer::ApplyOffset(T* ptr) const - { - if (!ptr || !offset || !*offset) - return ptr; - - return utility::GetPointerWithOffset(ptr, **offset); - } - } - } -} -
