database.hxx   database.hxx 
skipping to change at line 47 skipping to change at line 47
const std::string& db, const std::string& db,
const std::string& host = "", const std::string& host = "",
unsigned int port = 0, unsigned int port = 0,
const std::string& extra_conninfo = "", const std::string& extra_conninfo = "",
details::transfer_ptr<connection_factory> = details::transfer_ptr<connection_factory> =
details::transfer_ptr<connection_factory> ()); details::transfer_ptr<connection_factory> ());
database (const std::string& user, database (const std::string& user,
const std::string& password, const std::string& password,
const std::string& db, const std::string& db,
const std::string& host = "", const std::string& host,
const std::string& socket_ext = "", const std::string& socket_ext,
const std::string& extra_conninfo = "", const std::string& extra_conninfo = "",
details::transfer_ptr<connection_factory> = details::transfer_ptr<connection_factory> =
details::transfer_ptr<connection_factory> ()); details::transfer_ptr<connection_factory> ());
explicit explicit
database (const std::string& conninfo, database (const std::string& conninfo,
details::transfer_ptr<connection_factory> = details::transfer_ptr<connection_factory> =
details::transfer_ptr<connection_factory> ()); details::transfer_ptr<connection_factory> ());
// Extract the database parameters from the command line. The // Extract the database parameters from the command line. The
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 options.hxx   options.hxx 
// This code was generated by CLI, a command line interface // This code was generated by CLI, a command line interface
// compiler for C++. // compiler for C++.
// //
#ifndef LIBODB_PGSQL_DETAILS_OPTIONS_HXX #ifndef LIBODB_PGSQL_DETAILS_OPTIONS_HXX
#define LIBODB_PGSQL_DETAILS_OPTIONS_HXX #define LIBODB_PGSQL_DETAILS_OPTIONS_HXX
// Begin prologue.
//
//
// End prologue.
#include <deque> #include <deque>
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <cstddef> #include <cstddef>
#include <exception> #include <exception>
namespace odb namespace odb
{ {
namespace pgsql namespace pgsql
{ {
skipping to change at line 50 skipping to change at line 55
value v_; value v_;
}; };
// Exceptions. // Exceptions.
// //
class exception: public std::exception class exception: public std::exception
{ {
public: public:
virtual void virtual void
print (std::ostream&) const = 0; print (::std::ostream&) const = 0;
}; };
std::ostream& ::std::ostream&
operator<< (std::ostream&, const exception&); operator<< (::std::ostream&, const exception&);
class unknown_option: public exception class unknown_option: public exception
{ {
public: public:
virtual virtual
~unknown_option () throw (); ~unknown_option () throw ();
unknown_option (const std::string& option); unknown_option (const std::string& option);
const std::string& const std::string&
option () const; option () const;
virtual void virtual void
print (std::ostream&) const; print (::std::ostream&) const;
virtual const char* virtual const char*
what () const throw (); what () const throw ();
private: private:
std::string option_; std::string option_;
}; };
class unknown_argument: public exception class unknown_argument: public exception
{ {
public: public:
virtual virtual
~unknown_argument () throw (); ~unknown_argument () throw ();
unknown_argument (const std::string& argument); unknown_argument (const std::string& argument);
const std::string& const std::string&
argument () const; argument () const;
virtual void virtual void
print (std::ostream&) const; print (::std::ostream&) const;
virtual const char* virtual const char*
what () const throw (); what () const throw ();
private: private:
std::string argument_; std::string argument_;
}; };
class missing_value: public exception class missing_value: public exception
{ {
public: public:
virtual virtual
~missing_value () throw (); ~missing_value () throw ();
missing_value (const std::string& option); missing_value (const std::string& option);
const std::string& const std::string&
option () const; option () const;
virtual void virtual void
print (std::ostream&) const; print (::std::ostream&) const;
virtual const char* virtual const char*
what () const throw (); what () const throw ();
private: private:
std::string option_; std::string option_;
}; };
class invalid_value: public exception class invalid_value: public exception
{ {
skipping to change at line 135 skipping to change at line 140
invalid_value (const std::string& option, invalid_value (const std::string& option,
const std::string& value); const std::string& value);
const std::string& const std::string&
option () const; option () const;
const std::string& const std::string&
value () const; value () const;
virtual void virtual void
print (std::ostream&) const; print (::std::ostream&) const;
virtual const char* virtual const char*
what () const throw (); what () const throw ();
private: private:
std::string option_; std::string option_;
std::string value_; std::string value_;
}; };
class eos_reached: public exception class eos_reached: public exception
{ {
public: public:
virtual void virtual void
print (std::ostream&) const; print (::std::ostream&) const;
virtual const char* virtual const char*
what () const throw (); what () const throw ();
}; };
class file_io_failure: public exception class file_io_failure: public exception
{ {
public: public:
virtual virtual
~file_io_failure () throw (); ~file_io_failure () throw ();
file_io_failure (const std::string& file); file_io_failure (const std::string& file);
const std::string& const std::string&
file () const; file () const;
virtual void virtual void
print (std::ostream&) const; print (::std::ostream&) const;
virtual const char* virtual const char*
what () const throw (); what () const throw ();
private: private:
std::string file_; std::string file_;
}; };
class unmatched_quote: public exception class unmatched_quote: public exception
{ {
public: public:
virtual virtual
~unmatched_quote () throw (); ~unmatched_quote () throw ();
unmatched_quote (const std::string& argument); unmatched_quote (const std::string& argument);
const std::string& const std::string&
argument () const; argument () const;
virtual void virtual void
print (std::ostream&) const; print (::std::ostream&) const;
virtual const char* virtual const char*
what () const throw (); what () const throw ();
private: private:
std::string argument_; std::string argument_;
}; };
class scanner class scanner
{ {
skipping to change at line 312 skipping to change at line 317
const std::string option_; const std::string option_;
option_info option_info_; option_info option_info_;
const option_info* options_; const option_info* options_;
std::size_t options_count_; std::size_t options_count_;
std::string hold_; std::string hold_;
std::deque<std::string> args_; std::deque<std::string> args_;
bool skip_; bool skip_;
}; };
template <typename X>
struct parser;
} }
} }
} }
} }
#include <string> #include <string>
namespace odb namespace odb
{ {
namespace pgsql namespace pgsql
{ {
namespace details namespace details
{ {
class options class options
{ {
public: public:
options (int& argc, options (int& argc,
char** argv, char** argv,
bool erase = false, bool erase = false,
::odb::pgsql::details::cli::unknown_mode option = ::odb::p gsql::details::cli::unknown_mode::fail, ::odb::pgsql::details::cli::unknown_mode option = ::odb::p gsql::details::cli::unknown_mode::fail,
::odb::pgsql::details::cli::unknown_mode argument = ::odb: :pgsql::details::cli::unknown_mode::stop); ::odb::pgsql::details::cli::unknown_mode argument = ::odb: :pgsql::details::cli::unknown_mode::stop);
options (int start, options (int start,
int& argc, int& argc,
char** argv, char** argv,
bool erase = false, bool erase = false,
skipping to change at line 361 skipping to change at line 368
char** argv, char** argv,
int& end, int& end,
bool erase = false, bool erase = false,
::odb::pgsql::details::cli::unknown_mode option = ::odb::p gsql::details::cli::unknown_mode::fail, ::odb::pgsql::details::cli::unknown_mode option = ::odb::p gsql::details::cli::unknown_mode::fail,
::odb::pgsql::details::cli::unknown_mode argument = ::odb: :pgsql::details::cli::unknown_mode::stop); ::odb::pgsql::details::cli::unknown_mode argument = ::odb: :pgsql::details::cli::unknown_mode::stop);
options (::odb::pgsql::details::cli::scanner&, options (::odb::pgsql::details::cli::scanner&,
::odb::pgsql::details::cli::unknown_mode option = ::odb::p gsql::details::cli::unknown_mode::fail, ::odb::pgsql::details::cli::unknown_mode option = ::odb::p gsql::details::cli::unknown_mode::fail,
::odb::pgsql::details::cli::unknown_mode argument = ::odb: :pgsql::details::cli::unknown_mode::stop); ::odb::pgsql::details::cli::unknown_mode argument = ::odb: :pgsql::details::cli::unknown_mode::stop);
options ();
// Option accessors. // Option accessors.
// //
const std::string& const std::string&
user () const; user () const;
bool bool
user_specified () const; user_specified () const;
const std::string& const std::string&
password () const; password () const;
bool bool
skipping to change at line 405 skipping to change at line 413
options_file () const; options_file () const;
bool bool
options_file_specified () const; options_file_specified () const;
// Print usage information. // Print usage information.
// //
static void static void
print_usage (::std::ostream&); print_usage (::std::ostream&);
// Implementation details.
//
protected:
bool
_parse (const char*, ::odb::pgsql::details::cli::scanner&);
private: private:
void void
_parse (::odb::pgsql::details::cli::scanner&, _parse (::odb::pgsql::details::cli::scanner&,
::odb::pgsql::details::cli::unknown_mode option, ::odb::pgsql::details::cli::unknown_mode option,
::odb::pgsql::details::cli::unknown_mode argument); ::odb::pgsql::details::cli::unknown_mode argument);
public: public:
std::string user_; std::string user_;
bool user_specified_; bool user_specified_;
std::string password_; std::string password_;
skipping to change at line 431 skipping to change at line 445
bool port_specified_; bool port_specified_;
std::string options_file_; std::string options_file_;
bool options_file_specified_; bool options_file_specified_;
}; };
} }
} }
} }
#include "options.ixx" #include "options.ixx"
// Begin epilogue.
//
//
// End epilogue.
#endif // LIBODB_PGSQL_DETAILS_OPTIONS_HXX #endif // LIBODB_PGSQL_DETAILS_OPTIONS_HXX
 End of changes. 16 change blocks. 
12 lines changed or deleted 31 lines changed or added


 options.ixx   options.ixx 
// This code was generated by CLI, a command line interface // This code was generated by CLI, a command line interface
// compiler for C++. // compiler for C++.
// //
// Begin prologue.
//
//
// End prologue.
namespace odb namespace odb
{ {
namespace pgsql namespace pgsql
{ {
namespace details namespace details
{ {
namespace cli namespace cli
{ {
// unknown_mode // unknown_mode
// //
inline unknown_mode:: inline unknown_mode::
unknown_mode (value v) unknown_mode (value v)
: v_ (v) : v_ (v)
{ {
} }
// exception // exception
// //
inline std::ostream& inline ::std::ostream&
operator<< (std::ostream& os, const exception& e) operator<< (::std::ostream& os, const exception& e)
{ {
e.print (os); e.print (os);
return os; return os;
} }
// unknown_option // unknown_option
// //
inline unknown_option:: inline unknown_option::
unknown_option (const std::string& option) unknown_option (const std::string& option)
: option_ (option) : option_ (option)
skipping to change at line 288 skipping to change at line 293
} }
inline bool options:: inline bool options::
options_file_specified () const options_file_specified () const
{ {
return this->options_file_specified_; return this->options_file_specified_;
} }
} }
} }
} }
// Begin epilogue.
//
//
// End epilogue.
 End of changes. 3 change blocks. 
2 lines changed or deleted 7 lines changed or added


 query.hxx   query.hxx 
skipping to change at line 26 skipping to change at line 26
#include <odb/pgsql/version.hxx> #include <odb/pgsql/version.hxx>
#include <odb/pgsql/forward.hxx> #include <odb/pgsql/forward.hxx>
#include <odb/pgsql/traits.hxx> #include <odb/pgsql/traits.hxx>
#include <odb/pgsql/binding.hxx> #include <odb/pgsql/binding.hxx>
#include <odb/pgsql/pgsql-oid.hxx> #include <odb/pgsql/pgsql-oid.hxx>
#include <odb/details/buffer.hxx> #include <odb/details/buffer.hxx>
#include <odb/details/shared-ptr.hxx> #include <odb/details/shared-ptr.hxx>
#include <odb/pgsql/details/export.hxx> #include <odb/pgsql/details/export.hxx>
#include <odb/pgsql/details/conversion.hxx>
namespace odb namespace odb
{ {
namespace pgsql namespace pgsql
{ {
template <typename T> template <typename T>
class val_bind class val_bind
{ {
public: public:
explicit explicit
skipping to change at line 106 skipping to change at line 107
param, param,
native, native,
boolean boolean
}; };
clause_part (kind_type k): kind (k) {} clause_part (kind_type k): kind (k) {}
clause_part (kind_type k, const std::string& p): kind (k), part (p) {} clause_part (kind_type k, const std::string& p): kind (k), part (p) {}
clause_part (bool p): kind (boolean), bool_part (p) {} clause_part (bool p): kind (boolean), bool_part (p) {}
kind_type kind; kind_type kind;
std::string part; std::string part; // If kind is param, then part is conversion expr .
bool bool_part; bool bool_part;
}; };
query () query ()
: binding_ (0, 0), native_binding_ (0, 0, 0, 0) : binding_ (0, 0), native_binding_ (0, 0, 0, 0)
{ {
} }
// True or false literal. // True or false literal.
// //
skipping to change at line 149 skipping to change at line 150
: binding_ (0, 0), native_binding_ (0, 0, 0, 0) : binding_ (0, 0), native_binding_ (0, 0, 0, 0)
{ {
append (table, column); append (table, column);
} }
template <typename T> template <typename T>
explicit explicit
query (val_bind<T> v) query (val_bind<T> v)
: binding_ (0, 0), native_binding_ (0, 0, 0, 0) : binding_ (0, 0), native_binding_ (0, 0, 0, 0)
{ {
append<T, type_traits<T>::db_type_id> (v); append<T, type_traits<T>::db_type_id> (
v, details::conversion<T>::to ());
} }
template <typename T> template <typename T>
explicit explicit
query (ref_bind<T> r) query (ref_bind<T> r)
: binding_ (0, 0), native_binding_ (0, 0, 0, 0) : binding_ (0, 0), native_binding_ (0, 0, 0, 0)
{ {
append<T, type_traits<T>::db_type_id> (r); append<T, type_traits<T>::db_type_id> (
r, details::conversion<T>::to ());
} }
template <database_type_id ID> template <database_type_id ID>
query (const query_column<bool, ID>&); query (const query_column<bool, ID>&);
query (const query&); query (const query&);
query& query&
operator= (const query&); operator= (const query&);
skipping to change at line 240 skipping to change at line 243
operator+= (const std::string& q) operator+= (const std::string& q)
{ {
append (q); append (q);
return *this; return *this;
} }
template <typename T> template <typename T>
query& query&
operator+= (val_bind<T> v) operator+= (val_bind<T> v)
{ {
append<T, type_traits<T>::db_type_id> (v); append<T, type_traits<T>::db_type_id> (
v, details::conversion<T>::to ());
return *this; return *this;
} }
template <typename T> template <typename T>
query& query&
operator+= (ref_bind<T> r) operator+= (ref_bind<T> r)
{ {
append<T, type_traits<T>::db_type_id> (r); append<T, type_traits<T>::db_type_id> (
r, details::conversion<T>::to ());
return *this; return *this;
} }
public: public:
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
void void
append (val_bind<T>); append (val_bind<T>, const char* conv);
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
void void
append (ref_bind<T>); append (ref_bind<T>, const char* conv);
void void
append (const std::string& native); append (const std::string& native);
void void
append (const char* table, const char* column); append (const char* table, const char* column);
private: private:
void void
add (details::shared_ptr<query_param>); add (details::shared_ptr<query_param>, const char* conv);
private: private:
typedef std::vector<clause_part> clause_type; typedef std::vector<clause_part> clause_type;
typedef std::vector<details::shared_ptr<query_param> > parameters_typ e; typedef std::vector<details::shared_ptr<query_param> > parameters_typ e;
clause_type clause_; clause_type clause_;
parameters_type parameters_; parameters_type parameters_;
mutable std::vector<bind> bind_; mutable std::vector<bind> bind_;
mutable binding binding_; mutable binding binding_;
skipping to change at line 417 skipping to change at line 422
const T val; const T val;
}; };
template <typename T> template <typename T>
const T& const T&
type_instance (); type_instance ();
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
struct query_column struct query_column
{ {
// Note that we keep shalow copies of the table and column names. // Note that we keep shallow copies of the table, column, and convers
ion
// expression. The latter can be NULL.
// //
query_column (const char* table, const char* column) query_column (const char* table, const char* column, const char* conv
: table_ (table), column_ (column) )
: table_ (table), column_ (column), conversion_ (conv)
{ {
} }
const char* const char*
table () const table () const
{ {
return table_; return table_;
} }
const char* const char*
column () const column () const
{ {
return column_; return column_;
} }
// Can be NULL.
//
const char*
conversion () const
{
return conversion_;
}
// is_null, is_not_null // is_null, is_not_null
// //
public: public:
query query
is_null () const is_null () const
{ {
query q (table_, column_); query q (table_, column_);
q += "IS NULL"; q += "IS NULL";
return q; return q;
} }
skipping to change at line 488 skipping to change at line 502
equal (const T& v) const equal (const T& v) const
{ {
return equal (val_bind<T> (v)); return equal (val_bind<T> (v));
} }
query query
equal (val_bind<T> v) const equal (val_bind<T> v) const
{ {
query q (table_, column_); query q (table_, column_);
q += "="; q += "=";
q.append<T, ID> (v); q.append<T, ID> (v, conversion_);
return q; return q;
} }
template <typename T2> template <typename T2>
query query
equal (val_bind<T2> v) const equal (val_bind<T2> v) const
{ {
copy_bind<T, T2> c (v.val); copy_bind<T, T2> c (v.val);
return equal (c); return equal (c);
} }
query query
equal (ref_bind<T> r) const equal (ref_bind<T> r) const
{ {
query q (table_, column_); query q (table_, column_);
q += "="; q += "=";
q.append<T, ID> (r); q.append<T, ID> (r, conversion_);
return q; return q;
} }
friend query friend query
operator== (const query_column& c, const T& v) operator== (const query_column& c, const T& v)
{ {
return c.equal (v); return c.equal (v);
} }
friend query friend query
skipping to change at line 573 skipping to change at line 587
unequal (const T& v) const unequal (const T& v) const
{ {
return unequal (val_bind<T> (v)); return unequal (val_bind<T> (v));
} }
query query
unequal (val_bind<T> v) const unequal (val_bind<T> v) const
{ {
query q (table_, column_); query q (table_, column_);
q += "!="; q += "!=";
q.append<T, ID> (v); q.append<T, ID> (v, conversion_);
return q; return q;
} }
template <typename T2> template <typename T2>
query query
unequal (val_bind<T2> v) const unequal (val_bind<T2> v) const
{ {
copy_bind<T, T2> c (v.val); copy_bind<T, T2> c (v.val);
return unequal (c); return unequal (c);
} }
query query
unequal (ref_bind<T> r) const unequal (ref_bind<T> r) const
{ {
query q (table_, column_); query q (table_, column_);
q += "!="; q += "!=";
q.append<T, ID> (r); q.append<T, ID> (r, conversion_);
return q; return q;
} }
friend query friend query
operator!= (const query_column& c, const T& v) operator!= (const query_column& c, const T& v)
{ {
return c.unequal (v); return c.unequal (v);
} }
friend query friend query
skipping to change at line 658 skipping to change at line 672
less (const T& v) const less (const T& v) const
{ {
return less (val_bind<T> (v)); return less (val_bind<T> (v));
} }
query query
less (val_bind<T> v) const less (val_bind<T> v) const
{ {
query q (table_, column_); query q (table_, column_);
q += "<"; q += "<";
q.append<T, ID> (v); q.append<T, ID> (v, conversion_);
return q; return q;
} }
template <typename T2> template <typename T2>
query query
less (val_bind<T2> v) const less (val_bind<T2> v) const
{ {
copy_bind<T, T2> c (v.val); copy_bind<T, T2> c (v.val);
return less (c); return less (c);
} }
query query
less (ref_bind<T> r) const less (ref_bind<T> r) const
{ {
query q (table_, column_); query q (table_, column_);
q += "<"; q += "<";
q.append<T, ID> (r); q.append<T, ID> (r, conversion_);
return q; return q;
} }
friend query friend query
operator< (const query_column& c, const T& v) operator< (const query_column& c, const T& v)
{ {
return c.less (v); return c.less (v);
} }
friend query friend query
skipping to change at line 743 skipping to change at line 757
greater (const T& v) const greater (const T& v) const
{ {
return greater (val_bind<T> (v)); return greater (val_bind<T> (v));
} }
query query
greater (val_bind<T> v) const greater (val_bind<T> v) const
{ {
query q (table_, column_); query q (table_, column_);
q += ">"; q += ">";
q.append<T, ID> (v); q.append<T, ID> (v, conversion_);
return q; return q;
} }
template <typename T2> template <typename T2>
query query
greater (val_bind<T2> v) const greater (val_bind<T2> v) const
{ {
copy_bind<T, T2> c (v.val); copy_bind<T, T2> c (v.val);
return greater (c); return greater (c);
} }
query query
greater (ref_bind<T> r) const greater (ref_bind<T> r) const
{ {
query q (table_, column_); query q (table_, column_);
q += ">"; q += ">";
q.append<T, ID> (r); q.append<T, ID> (r, conversion_);
return q; return q;
} }
friend query friend query
operator> (const query_column& c, const T& v) operator> (const query_column& c, const T& v)
{ {
return c.greater (v); return c.greater (v);
} }
friend query friend query
skipping to change at line 828 skipping to change at line 842
less_equal (const T& v) const less_equal (const T& v) const
{ {
return less_equal (val_bind<T> (v)); return less_equal (val_bind<T> (v));
} }
query query
less_equal (val_bind<T> v) const less_equal (val_bind<T> v) const
{ {
query q (table_, column_); query q (table_, column_);
q += "<="; q += "<=";
q.append<T, ID> (v); q.append<T, ID> (v, conversion_);
return q; return q;
} }
template <typename T2> template <typename T2>
query query
less_equal (val_bind<T2> v) const less_equal (val_bind<T2> v) const
{ {
copy_bind<T, T2> c (v.val); copy_bind<T, T2> c (v.val);
return less_equal (c); return less_equal (c);
} }
query query
less_equal (ref_bind<T> r) const less_equal (ref_bind<T> r) const
{ {
query q (table_, column_); query q (table_, column_);
q += "<="; q += "<=";
q.append<T, ID> (r); q.append<T, ID> (r, conversion_);
return q; return q;
} }
friend query friend query
operator<= (const query_column& c, const T& v) operator<= (const query_column& c, const T& v)
{ {
return c.less_equal (v); return c.less_equal (v);
} }
friend query friend query
skipping to change at line 913 skipping to change at line 927
greater_equal (const T& v) const greater_equal (const T& v) const
{ {
return greater_equal (val_bind<T> (v)); return greater_equal (val_bind<T> (v));
} }
query query
greater_equal (val_bind<T> v) const greater_equal (val_bind<T> v) const
{ {
query q (table_, column_); query q (table_, column_);
q += ">="; q += ">=";
q.append<T, ID> (v); q.append<T, ID> (v, conversion_);
return q; return q;
} }
template <typename T2> template <typename T2>
query query
greater_equal (val_bind<T2> v) const greater_equal (val_bind<T2> v) const
{ {
copy_bind<T, T2> c (v.val); copy_bind<T, T2> c (v.val);
return greater_equal (c); return greater_equal (c);
} }
query query
greater_equal (ref_bind<T> r) const greater_equal (ref_bind<T> r) const
{ {
query q (table_, column_); query q (table_, column_);
q += ">="; q += ">=";
q.append<T, ID> (r); q.append<T, ID> (r, conversion_);
return q; return q;
} }
friend query friend query
operator>= (const query_column& c, const T& v) operator>= (const query_column& c, const T& v)
{ {
return c.greater_equal (v); return c.greater_equal (v);
} }
friend query friend query
skipping to change at line 1074 skipping to change at line 1088
query q (table_, column_); query q (table_, column_);
q += ">="; q += ">=";
q.append (c.table (), c.column ()); q.append (c.table (), c.column ());
return q; return q;
} }
private: private:
const char* table_; const char* table_;
const char* column_; const char* column_;
const char* conversion_;
}; };
// Provide operator+() for using columns to construct native // Provide operator+() for using columns to construct native
// query fragments (e.g., ORDER BY). // query fragments (e.g., ORDER BY).
// //
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
inline query inline query
operator+ (const query_column<T, ID>& c, const std::string& s) operator+ (const query_column<T, ID>& c, const std::string& s)
{ {
query q (c.table (), c.column ()); query q (c.table (), c.column ());
skipping to change at line 1152 skipping to change at line 1167
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return bool_oid; return bool_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_boolean>::set_image (image_, dummy, v); value_traits<T, id_boolean>::set_image (image_, is_null, v);
} }
private: private:
bool image_; bool image_;
}; };
// SMALLINT // SMALLINT
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_smallint>: query_param struct query_param_impl<T, id_smallint>: query_param
skipping to change at line 1192 skipping to change at line 1207
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return int2_oid; return int2_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_smallint>::set_image (image_, dummy, v); value_traits<T, id_smallint>::set_image (image_, is_null, v);
} }
private: private:
short image_; short image_;
}; };
// INTEGER // INTEGER
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_integer>: query_param struct query_param_impl<T, id_integer>: query_param
skipping to change at line 1232 skipping to change at line 1247
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return int4_oid; return int4_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_integer>::set_image (image_, dummy, v); value_traits<T, id_integer>::set_image (image_, is_null, v);
} }
private: private:
int image_; int image_;
}; };
// BIGINT // BIGINT
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_bigint>: query_param struct query_param_impl<T, id_bigint>: query_param
skipping to change at line 1272 skipping to change at line 1287
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return int8_oid; return int8_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_bigint>::set_image (image_, dummy, v); value_traits<T, id_bigint>::set_image (image_, is_null, v);
} }
private: private:
long long image_; long long image_;
}; };
// REAL // REAL
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_real>: query_param struct query_param_impl<T, id_real>: query_param
skipping to change at line 1312 skipping to change at line 1327
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return float4_oid; return float4_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_real>::set_image (image_, dummy, v); value_traits<T, id_real>::set_image (image_, is_null, v);
} }
private: private:
float image_; float image_;
}; };
// DOUBLE // DOUBLE
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_double>: query_param struct query_param_impl<T, id_double>: query_param
skipping to change at line 1352 skipping to change at line 1367
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return float8_oid; return float8_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_double>::set_image (image_, dummy, v); value_traits<T, id_double>::set_image (image_, is_null, v);
} }
private: private:
double image_; double image_;
}; };
// NUMERIC // NUMERIC
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_numeric>: query_param struct query_param_impl<T, id_numeric>: query_param
skipping to change at line 1393 skipping to change at line 1408
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return numeric_oid; return numeric_oid;
} }
private: private:
bool bool
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
std::size_t size (0), cap (buffer_.capacity ()); std::size_t size (0), cap (buffer_.capacity ());
value_traits<T, id_numeric>::set_image (buffer_, size, dummy, v); value_traits<T, id_numeric>::set_image (buffer_, size, is_null, v);
size_ = size; size_ = size;
return cap != buffer_.capacity (); return cap != buffer_.capacity ();
} }
private: private:
details::buffer buffer_; details::buffer buffer_;
std::size_t size_; std::size_t size_;
}; };
// DATE // DATE
skipping to change at line 1437 skipping to change at line 1452
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return date_oid; return date_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_date>::set_image (image_, dummy, v); value_traits<T, id_date>::set_image (image_, is_null, v);
} }
private: private:
int image_; int image_;
}; };
// TIME // TIME
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_time>: query_param struct query_param_impl<T, id_time>: query_param
skipping to change at line 1477 skipping to change at line 1492
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return time_oid; return time_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_time>::set_image (image_, dummy, v); value_traits<T, id_time>::set_image (image_, is_null, v);
} }
private: private:
long long image_; long long image_;
}; };
// TIMESTAMP // TIMESTAMP
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_timestamp>: query_param struct query_param_impl<T, id_timestamp>: query_param
skipping to change at line 1517 skipping to change at line 1532
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return timestamp_oid; return timestamp_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_timestamp>::set_image (image_, dummy, v); value_traits<T, id_timestamp>::set_image (image_, is_null, v);
} }
private: private:
long long image_; long long image_;
}; };
// STRING // STRING
// //
template <typename T> template <typename T>
struct query_param_impl<T, id_string>: query_param struct query_param_impl<T, id_string>: query_param
skipping to change at line 1558 skipping to change at line 1573
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return text_oid; return text_oid;
} }
private: private:
bool bool
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
std::size_t size (0), cap (buffer_.capacity ()); std::size_t size (0), cap (buffer_.capacity ());
value_traits<T, id_string>::set_image (buffer_, size, dummy, v); value_traits<T, id_string>::set_image (buffer_, size, is_null, v);
size_ = size; size_ = size;
return cap != buffer_.capacity (); return cap != buffer_.capacity ();
} }
private: private:
details::buffer buffer_; details::buffer buffer_;
std::size_t size_; std::size_t size_;
}; };
// BYTEA // BYTEA
skipping to change at line 1603 skipping to change at line 1618
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return bytea_oid; return bytea_oid;
} }
private: private:
bool bool
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
std::size_t size (0), cap (buffer_.capacity ()); std::size_t size (0), cap (buffer_.capacity ());
value_traits<T, id_bytea>::set_image (buffer_, size, dummy, v); value_traits<T, id_bytea>::set_image (buffer_, size, is_null, v);
size_ = size; size_ = size;
return cap != buffer_.capacity (); return cap != buffer_.capacity ();
} }
private: private:
details::buffer buffer_; details::buffer buffer_;
std::size_t size_; std::size_t size_;
}; };
// BIT // BIT
skipping to change at line 1642 skipping to change at line 1657
b->type = bind::bit; b->type = bind::bit;
b->buffer = buffer_.data (); b->buffer = buffer_.data ();
b->capacity = buffer_.capacity (); b->capacity = buffer_.capacity ();
b->size = &size_; b->size = &size_;
} }
private: private:
bool bool
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
std::size_t size (0), cap (buffer_.capacity ()); std::size_t size (0), cap (buffer_.capacity ());
// NOTE: Using a fixed size bit type in queries requires // NOTE: Using a fixed size bit type in queries requires
// alternative image buffer type support. // alternative image buffer type support.
// //
value_traits<T, id_bit>::set_image (buffer_, size, dummy, v); value_traits<T, id_bit>::set_image (buffer_, size, is_null, v);
size_ = size; size_ = size;
return cap != buffer_.capacity (); return cap != buffer_.capacity ();
} }
private: private:
details::ubuffer buffer_; details::ubuffer buffer_;
std::size_t size_; std::size_t size_;
}; };
skipping to change at line 1692 skipping to change at line 1707
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return varbit_oid; return varbit_oid;
} }
private: private:
bool bool
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
std::size_t size (0), cap (buffer_.capacity ()); std::size_t size (0), cap (buffer_.capacity ());
value_traits<T, id_varbit>::set_image (buffer_, size, dummy, v); value_traits<T, id_varbit>::set_image (buffer_, size, is_null, v);
size_ = size; size_ = size;
return cap != buffer_.capacity (); return cap != buffer_.capacity ();
} }
private: private:
details::ubuffer buffer_; details::ubuffer buffer_;
std::size_t size_; std::size_t size_;
}; };
// UUID // UUID
skipping to change at line 1736 skipping to change at line 1751
virtual unsigned int virtual unsigned int
oid () const oid () const
{ {
return uuid_oid; return uuid_oid;
} }
private: private:
void void
init (const T& v) init (const T& v)
{ {
bool dummy; bool is_null (false); // Can't be NULL.
value_traits<T, id_uuid>::set_image (buffer_, dummy, v); value_traits<T, id_uuid>::set_image (buffer_, is_null, v);
} }
private: private:
unsigned char buffer_[16]; unsigned char buffer_[16];
}; };
} }
} }
// odb::query specialization for PostgreSQL. // odb::query specialization for PostgreSQL.
// //
namespace odb namespace odb
{ {
template <typename T> template <typename T>
class query<T, pgsql::query>: public query_selector<T>::type class query<T, pgsql::query>: public pgsql::query,
public query_selector<T>::columns_type
{ {
public: public:
// We don't define any typedefs here since they may clash with // We don't define any typedefs here since they may clash with
// column names defined by our base type. // column names defined by our base type.
// //
query () query ()
{ {
} }
explicit explicit
query (bool v) query (bool v)
: query_selector<T>::type (v) : pgsql::query (v)
{ {
} }
explicit explicit
query (const char* q) query (const char* q)
: query_selector<T>::type (q) : pgsql::query (q)
{ {
} }
explicit explicit
query (const std::string& q) query (const std::string& q)
: query_selector<T>::type (q) : pgsql::query (q)
{ {
} }
template <typename T2> template <typename T2>
explicit explicit
query (pgsql::val_bind<T2> v) query (pgsql::val_bind<T2> v)
: query_selector<T>::type (pgsql::query (v)) : pgsql::query (pgsql::query (v))
{ {
} }
template <typename T2> template <typename T2>
explicit explicit
query (pgsql::ref_bind<T2> r) query (pgsql::ref_bind<T2> r)
: query_selector<T>::type (pgsql::query (r)) : pgsql::query (pgsql::query (r))
{ {
} }
query (const pgsql::query& q) query (const pgsql::query& q)
: query_selector<T>::type (q) : pgsql::query (q)
{ {
} }
template <pgsql::database_type_id ID> template <pgsql::database_type_id ID>
query (const pgsql::query_column<bool, ID>& qc) query (const pgsql::query_column<bool, ID>& qc)
: query_selector<T>::type (qc) : pgsql::query (qc)
{ {
} }
}; };
} }
#include <odb/pgsql/query.ixx> #include <odb/pgsql/query.ixx>
#include <odb/pgsql/query.txx> #include <odb/pgsql/query.txx>
#include <odb/post.hxx> #include <odb/post.hxx>
 End of changes. 53 change blocks. 
61 lines changed or deleted 79 lines changed or added


 query.ixx   query.ixx 
// file : odb/pgsql/query.ixx // file : odb/pgsql/query.ixx
// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC // copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file // license : GNU GPL v2; see accompanying LICENSE file
namespace odb namespace odb
{ {
namespace pgsql namespace pgsql
{ {
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
inline void query:: inline void query::
append (val_bind<T> v) append (val_bind<T> v, const char* conv)
{ {
add ( add (
details::shared_ptr<query_param> ( details::shared_ptr<query_param> (
new (details::shared) query_param_impl<T, ID> (v))); new (details::shared) query_param_impl<T, ID> (v)),
conv);
} }
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
inline void query:: inline void query::
append (ref_bind<T> r) append (ref_bind<T> r, const char* conv)
{ {
add ( add (
details::shared_ptr<query_param> ( details::shared_ptr<query_param> (
new (details::shared) query_param_impl<T, ID> (r))); new (details::shared) query_param_impl<T, ID> (r)),
conv);
} }
} }
} }
 End of changes. 4 change blocks. 
4 lines changed or deleted 6 lines changed or added


 query.txx   query.txx 
skipping to change at line 22 skipping to change at line 22
template <database_type_id ID> template <database_type_id ID>
query:: query::
query (const query_column<bool, ID>& c) query (const query_column<bool, ID>& c)
: binding_ (0, 0), native_binding_ (0, 0, 0, 0) : binding_ (0, 0), native_binding_ (0, 0, 0, 0)
{ {
// Cannot use IS TRUE here since database type can be a non- // Cannot use IS TRUE here since database type can be a non-
// integral type. // integral type.
// //
append (c.table (), c.column ()); append (c.table (), c.column ());
append ("="); append ("=");
append<bool, ID> (val_bind<bool> (true)); append<bool, ID> (val_bind<bool> (true), c.conversion ());
} }
// query_column // query_column
// //
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
query query_column<T, ID>:: query query_column<T, ID>::
in (const T& v1, const T& v2) const in (const T& v1, const T& v2) const
{ {
query q (table_, column_); query q (table_, column_);
q += "IN ("; q += "IN (";
q.append<T, ID> (val_bind<T> (v1)); q.append<T, ID> (val_bind<T> (v1), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v2)); q.append<T, ID> (val_bind<T> (v2), conversion_);
q += ")"; q += ")";
return q; return q;
} }
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
query query_column<T, ID>:: query query_column<T, ID>::
in (const T& v1, const T& v2, const T& v3) const in (const T& v1, const T& v2, const T& v3) const
{ {
query q (table_, column_); query q (table_, column_);
q += "IN ("; q += "IN (";
q.append<T, ID> (val_bind<T> (v1)); q.append<T, ID> (val_bind<T> (v1), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v2)); q.append<T, ID> (val_bind<T> (v2), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v3)); q.append<T, ID> (val_bind<T> (v3), conversion_);
q += ")"; q += ")";
return q; return q;
} }
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
query query_column<T, ID>:: query query_column<T, ID>::
in (const T& v1, const T& v2, const T& v3, const T& v4) const in (const T& v1, const T& v2, const T& v3, const T& v4) const
{ {
query q (table_, column_); query q (table_, column_);
q += "IN ("; q += "IN (";
q.append<T, ID> (val_bind<T> (v1)); q.append<T, ID> (val_bind<T> (v1), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v2)); q.append<T, ID> (val_bind<T> (v2), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v3)); q.append<T, ID> (val_bind<T> (v3), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v4)); q.append<T, ID> (val_bind<T> (v4), conversion_);
q += ")"; q += ")";
return q; return q;
} }
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
query query_column<T, ID>:: query query_column<T, ID>::
in (const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) co nst in (const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) co nst
{ {
query q (table_, column_); query q (table_, column_);
q += "IN ("; q += "IN (";
q.append<T, ID> (val_bind<T> (v1)); q.append<T, ID> (val_bind<T> (v1), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v2)); q.append<T, ID> (val_bind<T> (v2), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v3)); q.append<T, ID> (val_bind<T> (v3), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v4)); q.append<T, ID> (val_bind<T> (v4), conversion_);
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (v5)); q.append<T, ID> (val_bind<T> (v5), conversion_);
q += ")"; q += ")";
return q; return q;
} }
template <typename T, database_type_id ID> template <typename T, database_type_id ID>
template <typename I> template <typename I>
query query_column<T, ID>:: query query_column<T, ID>::
in_range (I begin, I end) const in_range (I begin, I end) const
{ {
query q (table_, column_); query q (table_, column_);
q += "IN ("; q += "IN (";
for (I i (begin); i != end; ++i) for (I i (begin); i != end; ++i)
{ {
if (i != begin) if (i != begin)
q += ","; q += ",";
q.append<T, ID> (val_bind<T> (*i)); q.append<T, ID> (val_bind<T> (*i), conversion_);
} }
q += ")"; q += ")";
return q; return q;
} }
} }
} }
 End of changes. 16 change blocks. 
16 lines changed or deleted 16 lines changed or added


 simple-object-statements.hxx   simple-object-statements.hxx 
skipping to change at line 440 skipping to change at line 440
// Container statement cache. // Container statement cache.
// //
container_statement_cache_type& container_statement_cache_type&
container_statment_cache () container_statment_cache ()
{ {
return container_statement_cache_.get (conn_); return container_statement_cache_.get (conn_);
} }
public: public:
// select = total // select = total
// insert = total - inverse - managed_optimistic // insert = total - inverse - managed_optimistic - auto_id
// update = total - inverse - managed_optimistic - id - readonly // update = total - inverse - managed_optimistic - id - readonly
// //
static const std::size_t select_column_count = static const std::size_t select_column_count =
object_traits::column_count; object_traits::column_count;
static const std::size_t id_column_count =
object_traits::id_column_count;
static const std::size_t insert_column_count = static const std::size_t insert_column_count =
object_traits::column_count - object_traits::inverse_column_count - object_traits::column_count - object_traits::inverse_column_count -
object_traits::managed_optimistic_column_count; object_traits::managed_optimistic_column_count -
(object_traits::auto_id ? id_column_count : 0);
static const std::size_t update_column_count = insert_column_count - static const std::size_t update_column_count = insert_column_count -
object_traits::id_column_count - object_traits::readonly_column_cou (object_traits::auto_id ? 0 : id_column_count) -
nt; object_traits::readonly_column_count;
static const std::size_t id_column_count =
object_traits::id_column_count;
static const std::size_t managed_optimistic_column_count = static const std::size_t managed_optimistic_column_count =
object_traits::managed_optimistic_column_count; object_traits::managed_optimistic_column_count;
private: private:
object_statements (const object_statements&); object_statements (const object_statements&);
object_statements& operator= (const object_statements&); object_statements& operator= (const object_statements&);
private: private:
void void
skipping to change at line 487 skipping to change at line 489
// //
std::size_t select_image_version_; std::size_t select_image_version_;
binding select_image_binding_; binding select_image_binding_;
bind select_image_bind_[select_column_count]; bind select_image_bind_[select_column_count];
bool select_image_truncated_[select_column_count]; bool select_image_truncated_[select_column_count];
// Insert binding. // Insert binding.
// //
std::size_t insert_image_version_; std::size_t insert_image_version_;
binding insert_image_binding_; binding insert_image_binding_;
bind insert_image_bind_[insert_column_count]; bind insert_image_bind_[
insert_column_count != 0 ? insert_column_count : 1];
native_binding insert_image_native_binding_; native_binding insert_image_native_binding_;
char* insert_image_values_[insert_column_count]; char* insert_image_values_[
int insert_image_lengths_[insert_column_count]; insert_column_count != 0 ? insert_column_count : 1];
int insert_image_formats_[insert_column_count]; int insert_image_lengths_[
insert_column_count != 0 ? insert_column_count : 1];
int insert_image_formats_[
insert_column_count != 0 ? insert_column_count : 1];
// Update binding. Note that the id suffix is bound to id_image_ // Update binding. Note that the id suffix is bound to id_image_
// below instead of image_ which makes this binding effectively // below instead of image_ which makes this binding effectively
// bound to two images. As a result, we have to track versions // bound to two images. As a result, we have to track versions
// for both of them. If this object uses optimistic concurrency, // for both of them. If this object uses optimistic concurrency,
// then the binding for the managed column (version, timestamp, // then the binding for the managed column (version, timestamp,
// etc) comes after the id and the image for such a column is // etc) comes after the id and the image for such a column is
// stored as part of the id image. // stored as part of the id image.
// //
std::size_t update_image_version_; std::size_t update_image_version_;
 End of changes. 6 change blocks. 
11 lines changed or deleted 16 lines changed or added


 traits.hxx   traits.hxx 
// file : odb/pgsql/traits.hxx // file : odb/pgsql/traits.hxx
// copyright : Copyright (c) 2005-2012 Code Synthesis Tools CC // copyright : Copyright (c) 2005-2012 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file // license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_PGSQL_TRAITS_HXX #ifndef ODB_PGSQL_TRAITS_HXX
#define ODB_PGSQL_TRAITS_HXX #define ODB_PGSQL_TRAITS_HXX
#include <odb/pre.hxx> #include <odb/pre.hxx>
#include <odb/details/config.hxx> // ODB_CXX11
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstddef> // std::size_t #include <cstddef> // std::size_t
#include <cstring> // std::memcpy, std::memset, std::strlen #include <cstring> // std::memcpy, std::memset, std::strlen
#ifdef ODB_CXX11
# include <array>
#endif
#include <odb/traits.hxx> #include <odb/traits.hxx>
#include <odb/wrapper-traits.hxx> #include <odb/wrapper-traits.hxx>
#include <odb/details/buffer.hxx> #include <odb/details/buffer.hxx>
#include <odb/details/wrapper-p.hxx> #include <odb/details/wrapper-p.hxx>
#include <odb/pgsql/version.hxx> #include <odb/pgsql/version.hxx>
#include <odb/pgsql/pgsql-types.hxx> #include <odb/pgsql/pgsql-types.hxx>
#include <odb/pgsql/details/export.hxx> #include <odb/pgsql/details/export.hxx>
skipping to change at line 444 skipping to change at line 450
c_string_value_traits c_string_value_traits
{ {
}; };
template <> template <>
struct LIBODB_PGSQL_EXPORT default_value_traits<const char*, id_string> : struct LIBODB_PGSQL_EXPORT default_value_traits<const char*, id_string> :
c_string_value_traits c_string_value_traits
{ {
}; };
template <std::size_t n> template <std::size_t N>
struct default_value_traits<char[n], id_numeric>: c_string_value_traits struct default_value_traits<char[N], id_numeric>: c_string_value_traits
{ {
}; };
template <std::size_t n> template <std::size_t N>
struct default_value_traits<const char[n], id_numeric>: struct default_value_traits<const char[N], id_numeric>:
c_string_value_traits c_string_value_traits
{ {
}; };
template <std::size_t n> template <std::size_t N>
struct default_value_traits<char[n], id_string>: c_string_value_traits struct default_value_traits<char[N], id_string>: c_string_value_traits
{ {
}; };
template <std::size_t n> template <std::size_t N>
struct default_value_traits<const char[n], id_string>: struct default_value_traits<const char[N], id_string>:
c_string_value_traits c_string_value_traits
{ {
}; };
// std::vector<char> (buffer) specialization. // std::vector<char> (buffer) specialization.
// //
template <> template <>
struct LIBODB_PGSQL_EXPORT default_value_traits< struct LIBODB_PGSQL_EXPORT default_value_traits<
std::vector<char>, id_bytea> std::vector<char>, id_bytea>
{ {
skipping to change at line 530 skipping to change at line 536
v.clear (); v.clear ();
} }
static void static void
set_image (details::buffer&, set_image (details::buffer&,
std::size_t& n, std::size_t& n,
bool& is_null, bool& is_null,
const value_type&); const value_type&);
}; };
// char[n] (buffer) specialization. // char[N] (buffer) specialization.
// //
template <std::size_t N> template <std::size_t N>
struct default_value_traits<char[N], id_bytea> struct default_value_traits<char[N], id_bytea>
{ {
public: public:
typedef char* value_type; typedef char* value_type;
typedef const char* query_type; typedef const char* query_type;
typedef details::buffer image_type; typedef details::buffer image_type;
static void static void
skipping to change at line 568 skipping to change at line 574
is_null = false; is_null = false;
n = N; n = N;
if (n > b.capacity ()) if (n > b.capacity ())
b.capacity (n); b.capacity (n);
std::memcpy (b.data (), v, n); std::memcpy (b.data (), v, n);
} }
}; };
// unsigned char[n] (buffer) specialization. // unsigned char[N] (buffer) specialization.
// //
template <std::size_t N> template <std::size_t N>
struct default_value_traits<unsigned char[N], id_bytea> struct default_value_traits<unsigned char[N], id_bytea>
{ {
public: public:
typedef unsigned char* value_type; typedef unsigned char* value_type;
typedef const unsigned char* query_type; typedef const unsigned char* query_type;
typedef details::buffer image_type; typedef details::buffer image_type;
static void static void
skipping to change at line 606 skipping to change at line 612
is_null = false; is_null = false;
n = N; n = N;
if (n > b.capacity ()) if (n > b.capacity ())
b.capacity (n); b.capacity (n);
std::memcpy (b.data (), v, n); std::memcpy (b.data (), v, n);
} }
}; };
#ifdef ODB_CXX11
// std::array<char, N> (buffer) specialization.
//
template <std::size_t N>
struct default_value_traits<std::array<char, N>, id_bytea>
{
public:
typedef std::array<char, N> value_type;
typedef value_type query_type;
typedef details::buffer image_type;
static void
set_value (value_type& v,
const details::buffer& b,
std::size_t n,
bool is_null)
{
if (!is_null)
std::memcpy (v.data (), b.data (), (n < N ? n : N));
else
std::memset (v.data (), 0, N);
}
static void
set_image (details::buffer& b,
std::size_t& n,
bool& is_null,
const value_type& v)
{
is_null = false;
n = N;
if (n > b.capacity ())
b.capacity (n);
std::memcpy (b.data (), v.data (), n);
}
};
// std::array<unsigned char, N> (buffer) specialization.
//
template <std::size_t N>
struct default_value_traits<std::array<unsigned char, N>, id_bytea>
{
public:
typedef std::array<unsigned char, N> value_type;
typedef value_type query_type;
typedef details::buffer image_type;
static void
set_value (value_type& v,
const details::buffer& b,
std::size_t n,
bool is_null)
{
if (!is_null)
std::memcpy (v.data (), b.data (), (n < N ? n : N));
else
std::memset (v.data (), 0, N);
}
static void
set_image (details::buffer& b,
std::size_t& n,
bool& is_null,
const value_type& v)
{
is_null = false;
n = N;
if (n > b.capacity ())
b.capacity (n);
std::memcpy (b.data (), v.data (), n);
}
};
#endif
// char[16] specialization for uuid.
//
template <>
struct LIBODB_PGSQL_EXPORT default_value_traits<char[16], id_uuid>
{
typedef char* value_type;
typedef const char* query_type;
typedef unsigned char* image_type;
static void
set_value (char* const& v, const unsigned char* i, bool is_null)
{
if (!is_null)
std::memcpy (v, i, 16);
else
std::memset (v, 0, 16);
}
static void
set_image (unsigned char* i, bool& is_null, const char* v)
{
is_null = false;
std::memcpy (i, v, 16);
}
};
// //
// type_traits // type_traits
// //
template <typename T> template <typename T>
struct default_type_traits; struct default_type_traits;
template <typename T> template <typename T>
class type_traits: public default_type_traits<T> class type_traits: public default_type_traits<T>
{ {
skipping to change at line 700 skipping to change at line 810
{ {
static const database_type_id db_type_id = id_real; static const database_type_id db_type_id = id_real;
}; };
template <> template <>
struct default_type_traits<double> struct default_type_traits<double>
{ {
static const database_type_id db_type_id = id_double; static const database_type_id db_type_id = id_double;
}; };
// String type. // String types.
// //
template <> template <>
struct default_type_traits<std::string> struct default_type_traits<std::string>
{ {
static const database_type_id db_type_id = id_string; static const database_type_id db_type_id = id_string;
}; };
template <> template <>
struct default_type_traits<const char*> struct default_type_traits<const char*>
{ {
static const database_type_id db_type_id = id_string; static const database_type_id db_type_id = id_string;
}; };
template <std::size_t n> template <std::size_t N>
struct default_type_traits<char[n]> struct default_type_traits<char[N]>
{ {
static const database_type_id db_type_id = id_string; static const database_type_id db_type_id = id_string;
}; };
template <std::size_t n> template <std::size_t N>
struct default_type_traits<const char[n]> struct default_type_traits<const char[N]>
{ {
static const database_type_id db_type_id = id_string; static const database_type_id db_type_id = id_string;
}; };
// Binary types.
//
template <>
struct default_type_traits<std::vector<char> >
{
static const database_type_id db_type_id = id_bytea;
};
template <>
struct default_type_traits<std::vector<unsigned char> >
{
static const database_type_id db_type_id = id_bytea;
};
#ifdef ODB_CXX11
template <std::size_t N>
struct default_type_traits<std::array<char, N> >
{
static const database_type_id db_type_id = id_bytea;
};
template <std::size_t N>
struct default_type_traits<std::array<unsigned char, N> >
{
static const database_type_id db_type_id = id_bytea;
};
#endif
} }
} }
#include <odb/post.hxx> #include <odb/post.hxx>
#endif // ODB_PGSQL_TRAITS_HXX #endif // ODB_PGSQL_TRAITS_HXX
 End of changes. 13 change blocks. 
15 lines changed or deleted 153 lines changed or added


 version.hxx   version.hxx 
skipping to change at line 32 skipping to change at line 32
// Version AABBCCDD // Version AABBCCDD
// 2.0.0 02000000 // 2.0.0 02000000
// 2.1.0 02010000 // 2.1.0 02010000
// 2.1.1 02010100 // 2.1.1 02010100
// 2.2.0.a1 02019901 // 2.2.0.a1 02019901
// 3.0.0.b2 02999952 // 3.0.0.b2 02999952
// //
// Check that we have compatible ODB version. // Check that we have compatible ODB version.
// //
#if ODB_VERSION != 20000 #if ODB_VERSION != 20100
# error incompatible odb interface version detected # error incompatible odb interface version detected
#endif #endif
// libodb-pgsql version: odb interface version plus the bugfix // libodb-pgsql version: odb interface version plus the bugfix
// version. // version.
// //
#define LIBODB_PGSQL_VERSION 2000100 #define LIBODB_PGSQL_VERSION 2010000
#define LIBODB_PGSQL_VERSION_STR "2.0.1" #define LIBODB_PGSQL_VERSION_STR "2.1.0"
#include <odb/post.hxx> #include <odb/post.hxx>
#endif // ODB_PGSQL_VERSION_HXX #endif // ODB_PGSQL_VERSION_HXX
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/