ODBC: refreshment [#METR-18538].

This commit is contained in:
Alexey Milovidov 2016-12-08 05:55:58 +03:00
parent 514715589b
commit 6998b5ecd9
5 changed files with 16 additions and 10 deletions

View File

@ -2,10 +2,11 @@
#include <iostream>
#include <stdexcept>
#include <Poco/Types.h>
/// В формате VarUInt.
inline void readSize(UInt64 & res, std::istream & istr)
inline void readSize(Poco::UInt64 & res, std::istream & istr)
{
static constexpr auto MAX_LENGTH_OF_SIZE = 4; /// Ограничивает размер 256 мегабайтами (2 ^ (7 * 4)).
@ -17,7 +18,7 @@ inline void readSize(UInt64 & res, std::istream & istr)
if (byte == EOF)
throw std::runtime_error("Incomplete result received.");
res |= (static_cast<UInt64>(byte) & 0x7F) << (7 * i);
res |= (static_cast<Poco::UInt64>(byte) & 0x7F) << (7 * i);
if (!(byte & 0x80))
return;
@ -29,7 +30,7 @@ inline void readSize(UInt64 & res, std::istream & istr)
inline void readString(std::string & res, std::istream & istr)
{
UInt64 size = 0;
Poco::UInt64 size = 0;
readSize(size, istr);
res.resize(size);

View File

@ -2,6 +2,8 @@
#include "Statement.h"
#include "Log.h"
#include <Poco/Types.h>
void ResultSet::init(Statement & statement_)
{
@ -11,7 +13,7 @@ void ResultSet::init(Statement & statement_)
return;
/// Заголовок: количество столбцов, их имена и типы.
UInt64 num_columns = 0;
Poco::UInt64 num_columns = 0;
readSize(num_columns, in());
if (!num_columns)

View File

@ -2,6 +2,7 @@
#include <vector>
#include <Poco/NumberParser.h>
#include <Poco/Types.h>
#include <sqltypes.h>
#include "ReadHelpers.h"
@ -14,8 +15,8 @@ class Field
public:
std::string data;
UInt64 getUInt() const { return Poco::NumberParser::parseUnsigned64(data); }
Int64 getInt() const { return Poco::NumberParser::parse64(data); }
Poco::UInt64 getUInt() const{ return Poco::NumberParser::parseUnsigned64(data); }
Poco::Int64 getInt() const { return Poco::NumberParser::parse64(data); }
float getFloat() const { return Poco::NumberParser::parseFloat(data); }
double getDouble() const { return Poco::NumberParser::parseFloat(data); }

View File

@ -2,8 +2,8 @@
# First, compile and install Poco library with static libraries and -fPIC option enabled.
g++ \
-std=c++11 \
g++-5 \
-std=c++14 \
-Wall -Werror \
-O2 \
-g \

View File

@ -9,6 +9,8 @@
#include <sstream>
#include <stdexcept>
#include <Poco/Types.h>
#include "StringRef.h"
#include "Log.h"
#include "DiagnosticRecord.h"
@ -340,10 +342,10 @@ impl_SQLGetData(HSTMT statement_handle,
return fillOutputNumber<uint32_t>(field.getUInt(), out_value, out_value_max_size, out_value_size_or_indicator);
case SQL_C_SBIGINT:
return fillOutputNumber<int64_t>(field.getInt(), out_value, out_value_max_size, out_value_size_or_indicator);
return fillOutputNumber<Poco::Int64>(field.getInt(), out_value, out_value_max_size, out_value_size_or_indicator);
case SQL_C_UBIGINT:
return fillOutputNumber<uint64_t>(field.getUInt(), out_value, out_value_max_size, out_value_size_or_indicator);
return fillOutputNumber<Poco::UInt64>(field.getUInt(), out_value, out_value_max_size, out_value_size_or_indicator);
case SQL_C_FLOAT:
return fillOutputNumber<float>(field.getFloat(), out_value, out_value_max_size, out_value_size_or_indicator);