Changeset 1138
- Timestamp:
- 08/31/06 16:42:36 (4 years ago)
- Location:
- trunk
- Files:
-
- 103 modified
-
ChangeLog (modified) (1 diff)
-
README (modified) (2 diffs)
-
configure.ac.in (modified) (1 diff)
-
include/pqxx/basic_connection.hxx (modified) (1 diff)
-
include/pqxx/binarystring.hxx (modified) (4 diffs)
-
include/pqxx/cachedresult.h (modified) (4 diffs)
-
include/pqxx/connection.hxx (modified) (1 diff)
-
include/pqxx/connection_base.hxx (modified) (12 diffs)
-
include/pqxx/cursor.hxx (modified) (5 diffs)
-
include/pqxx/dbtransaction.hxx (modified) (2 diffs)
-
include/pqxx/except.hxx (modified) (1 diff)
-
include/pqxx/largeobject.hxx (modified) (17 diffs)
-
include/pqxx/pipeline.hxx (modified) (3 diffs)
-
include/pqxx/result.hxx (modified) (29 diffs)
-
include/pqxx/robusttransaction.hxx (modified) (1 diff)
-
include/pqxx/tablereader.hxx (modified) (1 diff)
-
include/pqxx/tablewriter.hxx (modified) (2 diffs)
-
include/pqxx/transaction.hxx (modified) (1 diff)
-
include/pqxx/transaction_base.hxx (modified) (8 diffs)
-
include/pqxx/trigger.hxx (modified) (1 diff)
-
include/pqxx/util.hxx (modified) (12 diffs)
-
pqxx-config.in (modified) (1 diff)
-
src/connection_base.cxx (modified) (5 diffs)
-
src/cursor.cxx (modified) (2 diffs)
-
src/largeobject.cxx (modified) (2 diffs)
-
src/tablereader.cxx (modified) (1 diff)
-
src/transaction_base.cxx (modified) (1 diff)
-
src/util.cxx (modified) (4 diffs)
-
test/test001.cxx (modified) (1 diff)
-
test/test002.cxx (modified) (3 diffs)
-
test/test003.cxx (modified) (1 diff)
-
test/test004.cxx (modified) (3 diffs)
-
test/test005.cxx (modified) (2 diffs)
-
test/test006.cxx (modified) (7 diffs)
-
test/test007.cxx (modified) (3 diffs)
-
test/test008.cxx (modified) (2 diffs)
-
test/test009.cxx (modified) (2 diffs)
-
test/test010.cxx (modified) (5 diffs)
-
test/test011.cxx (modified) (3 diffs)
-
test/test012.cxx (modified) (4 diffs)
-
test/test013.cxx (modified) (4 diffs)
-
test/test014.cxx (modified) (2 diffs)
-
test/test016.cxx (modified) (1 diff)
-
test/test018.cxx (modified) (5 diffs)
-
test/test019.cxx (modified) (3 diffs)
-
test/test020.cxx (modified) (4 diffs)
-
test/test022.cxx (modified) (1 diff)
-
test/test023.cxx (modified) (3 diffs)
-
test/test024.cxx (modified) (3 diffs)
-
test/test025.cxx (modified) (6 diffs)
-
test/test026.cxx (modified) (2 diffs)
-
test/test027.cxx (modified) (2 diffs)
-
test/test028.cxx (modified) (2 diffs)
-
test/test029.cxx (modified) (5 diffs)
-
test/test030.cxx (modified) (4 diffs)
-
test/test031.cxx (modified) (4 diffs)
-
test/test032.cxx (modified) (5 diffs)
-
test/test033.cxx (modified) (1 diff)
-
test/test035.cxx (modified) (1 diff)
-
test/test037.cxx (modified) (5 diffs)
-
test/test038.cxx (modified) (2 diffs)
-
test/test039.cxx (modified) (4 diffs)
-
test/test040.cxx (modified) (2 diffs)
-
test/test041.cxx (modified) (3 diffs)
-
test/test042.cxx (modified) (2 diffs)
-
test/test043.cxx (modified) (3 diffs)
-
test/test044.cxx (modified) (1 diff)
-
test/test045.cxx (modified) (4 diffs)
-
test/test047.cxx (modified) (2 diffs)
-
test/test048.cxx (modified) (1 diff)
-
test/test049.cxx (modified) (5 diffs)
-
test/test050.cxx (modified) (3 diffs)
-
test/test051.cxx (modified) (1 diff)
-
test/test052.cxx (modified) (1 diff)
-
test/test053.cxx (modified) (2 diffs)
-
test/test055.cxx (modified) (1 diff)
-
test/test057.cxx (modified) (1 diff)
-
test/test058.cxx (modified) (3 diffs)
-
test/test059.cxx (modified) (1 diff)
-
test/test062.cxx (modified) (1 diff)
-
test/test063.cxx (modified) (1 diff)
-
test/test065.cxx (modified) (1 diff)
-
test/test066.cxx (modified) (4 diffs)
-
test/test067.cxx (modified) (4 diffs)
-
test/test068.cxx (modified) (2 diffs)
-
test/test069.cxx (modified) (3 diffs)
-
test/test070.cxx (modified) (4 diffs)
-
test/test071.cxx (modified) (1 diff)
-
test/test072.cxx (modified) (1 diff)
-
test/test073.cxx (modified) (2 diffs)
-
test/test074.cxx (modified) (1 diff)
-
test/test076.cxx (modified) (1 diff)
-
test/test077.cxx (modified) (1 diff)
-
test/test078.cxx (modified) (4 diffs)
-
test/test079.cxx (modified) (4 diffs)
-
test/test080.cxx (modified) (3 diffs)
-
test/test081.cxx (modified) (4 diffs)
-
test/test083.cxx (modified) (2 diffs)
-
test/test084.cxx (modified) (3 diffs)
-
test/test087.cxx (modified) (5 diffs)
-
test/test091.cxx (modified) (2 diffs)
-
test/test092.cxx (modified) (2 diffs)
-
win32/INSTALL.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r1137 r1138 7 7 include/pqxx/util.hxx, src/util.cxx: 8 8 - Factored reference-counting out of PQAlloc 9 *: 10 - Whitespace cleanup: spaces before tab 11 - Whitespace cleanup: whitespace before end-of-line 9 12 2006-08-29 Jeroen T. Vermeulen <jtv@xs4all.nl> 10 13 include/pqxx/connection_base.hxx, include/pqxx/transaction_base.hxx, -
trunk/README
r1034 r1138 455 455 456 456 DocConversion http://docconversion.sourceforge.net/ 457 Genea http://savannah.nongnu.org/projects/genea/457 Genea http://savannah.nongnu.org/projects/genea/ 458 458 Gnucomo http://www.gnucomo.org/ 459 459 MapServer http://mapserver.gis.umn.edu/ … … 464 464 Confirmed by authors: 465 465 466 OKE http://www.liacs.nl/home/bsamwel/oke/prerelease-0.10/466 OKE http://www.liacs.nl/home/bsamwel/oke/prerelease-0.10/ 467 467 KOffice / Kexi http://www.kexi-project.org/ 468 468 KPoGre http://kpogre.sourceforge.net/ -
trunk/configure.ac.in
r1129 r1138 820 820 1, 821 821 [Define if <iterator> lacks an iterator template definition]) 822 it='no'])822 it='no']) 823 823 AC_MSG_RESULT($it) 824 824 -
trunk/include/pqxx/basic_connection.hxx
r1026 r1138 43 43 * unacceptable code duplication. 44 44 */ 45 template<typename CONNECTPOLICY> class basic_connection : 45 template<typename CONNECTPOLICY> class basic_connection : 46 46 public connection_base 47 47 { 48 48 public: 49 basic_connection() : 49 basic_connection() : 50 50 connection_base(m_policy), 51 51 m_options(PGSTD::string()), -
trunk/include/pqxx/binarystring.hxx
r1123 r1138 79 79 * @param F the field to read; must be a bytea field 80 80 */ 81 explicit binarystring(const result::field &F); //[t62]81 explicit binarystring(const result::field &F); //[t62] 82 82 83 83 /// Size of converted string in bytes … … 94 94 95 95 #ifdef PQXX_HAVE_REVERSE_ITERATOR 96 const_reverse_iterator rbegin() const //[t62]97 { return const_reverse_iterator(end()); }98 const_reverse_iterator rend() const //[t62]99 { return const_reverse_iterator(begin()); }96 const_reverse_iterator rbegin() const //[t62] 97 { return const_reverse_iterator(end()); } 98 const_reverse_iterator rend() const //[t62] 99 { return const_reverse_iterator(begin()); } 100 100 #endif 101 101 … … 103 103 const value_type *data() const throw () {return super::c_ptr();} //[t62] 104 104 105 const_reference operator[](size_type i) const throw () //[t62]106 { return data()[i]; }105 const_reference operator[](size_type i) const throw () //[t62] 106 { return data()[i]; } 107 107 108 108 bool operator==(const binarystring &) const throw (); //[t62] 109 109 bool operator!=(const binarystring &rhs) const throw () //[t62] 110 { return !operator==(rhs); }110 { return !operator==(rhs); } 111 111 112 112 /// Index contained string, checking for valid index … … 120 120 * a null character, you will not find one here. 121 121 */ 122 const char *c_ptr() const throw () //[t62]122 const char *c_ptr() const throw () //[t62] 123 123 { 124 124 return reinterpret_cast<char *>(super::c_ptr()); -
trunk/include/pqxx/cachedresult.h
r968 r1138 67 67 /** Perform query and transparently fetch and cache resulting data. 68 68 * @param T is the transaction context in which the cachedresult lives. This 69 * will be used whenever data is fetched. Must have isolation level70 * "serializable," otherwise a build error will be generated for the symbol71 * error_permitted_isolation_level.69 * will be used whenever data is fetched. Must have isolation level 70 * "serializable," otherwise a build error will be generated for the symbol 71 * error_permitted_isolation_level. 72 72 * @param Query is the SQL query that yields the desired result set. 73 73 * @param BaseName gives the initial part of the name for this cachedresult 74 * and the Cursor it uses to obtain its results.74 * and the Cursor it uses to obtain its results. 75 75 * @param Granularity determines how large the blocks of data used internally 76 76 * will be; must be at least 2. … … 103 103 */ 104 104 const tuple operator[](size_type i) const //[t41] 105 { return GetBlock(BlockFor(i))[Offset(i)]; }105 { return GetBlock(BlockFor(i))[Offset(i)]; } 106 106 107 107 /// Access a tuple. Throws exception if index is out of range. … … 118 118 */ 119 119 const tuple at(size_type i) const //[t40] 120 { return GetBlock(BlockFor(i)).at(Offset(i)); }120 { return GetBlock(BlockFor(i)).at(Offset(i)); } 121 121 122 122 /// Number of rows in result set. First call may be slow. … … 141 141 142 142 blocknum BlockFor(size_type Row) const throw () 143 { return Row / m_Granularity; }143 { return Row / m_Granularity; } 144 144 size_type Offset(size_type Row) const throw () 145 { return Row % m_Granularity; }145 { return Row % m_Granularity; } 146 146 Cursor::size_type FirstRowOf(blocknum Block) const throw () 147 { return Block*m_Granularity; }147 { return Block*m_Granularity; } 148 148 149 149 void MoveTo(blocknum) const; -
trunk/include/pqxx/connection.hxx
r1123 r1138 29 29 * @addtogroup connection Connection classes 30 30 * 31 * Several types of connections are available, including plain connection and 31 * Several types of connections are available, including plain connection and 32 32 * lazyconnection. These types are typedefs combining a derivative of the 33 33 * connection_base class (where essentially all connection-related functionality -
trunk/include/pqxx/connection_base.hxx
r1133 r1138 184 184 * the temp tables, you can permit it again to get the benefits of connection 185 185 * reactivation for the remainder of the program. 186 * 186 * 187 187 * @param inhibit should reactivation be inhibited from here on? 188 188 * … … 196 196 * you inhibit it. 197 197 */ 198 void inhibit_reactivation(bool inhibit) //[t86]198 void inhibit_reactivation(bool inhibit) //[t86] 199 199 { m_inhibit_reactivation=inhibit; } 200 200 … … 249 249 250 250 /// Server port number we're connected to. 251 const char *port(); //[t1]251 const char *port(); //[t1] 252 252 253 253 /// Process ID for backend process. … … 366 366 */ 367 367 void set_client_encoding(const PGSTD::string &Encoding) //[t7] 368 { set_variable("CLIENT_ENCODING", Encoding); }368 { set_variable("CLIENT_ENCODING", Encoding); } 369 369 370 370 /// Set session variable … … 386 386 */ 387 387 void set_variable(const PGSTD::string &Var, 388 const PGSTD::string &Value); //[t60]388 const PGSTD::string &Value); //[t60] 389 389 390 390 /// Read session variable … … 405 405 //@{ 406 406 /// Check for pending trigger notifications and take appropriate action. 407 /** 407 /** 408 408 * All notifications found pending at call time are processed by finding 409 409 * any matching triggers and invoking those. If no triggers matched the … … 489 489 * void foo(connection_base &C) 490 490 * { 491 * C.prepare("findtable", 491 * C.prepare("findtable", 492 492 * "select * from pg_tables where name=$1") 493 493 * ("varchar", treat_string); … … 537 537 538 538 /// Perform the transaction defined by a transactor-based object. 539 /** 539 /** 540 540 * Invokes the given transactor, making at most Attempts attempts to perform 541 541 * the encapsulated code. If the code throws any exception other than … … 549 549 550 550 /// Perform the transaction defined by a transactor-based object. 551 /** 551 /** 552 552 * @param T The transactor to be executed. 553 553 */ … … 568 568 /** 569 569 * @name 1.x API 570 * 570 * 571 571 * These are all deprecated; they were defined in the libpqxx 1.x API but are 572 572 * no longer actively supported. … … 589 589 /// @deprecated Use process_notice() instead 590 590 void ProcessNotice(const PGSTD::string &msg) throw () PQXX_DEPRECATED 591 { return process_notice(msg); }591 { return process_notice(msg); } 592 592 /// @deprecated Use trace() instead 593 593 void Trace(FILE *F) PQXX_DEPRECATED { trace(F); } … … 613 613 /// @deprecated Use set_variable() instead 614 614 void SetVariable(const PGSTD::string &Var, const PGSTD::string &Val) 615 PQXX_DEPRECATED { set_variable(Var, Val); }615 PQXX_DEPRECATED { set_variable(Var, Val); } 616 616 617 617 /** -
trunk/include/pqxx/cursor.hxx
r1137 r1138 240 240 template<> void 241 241 cursor_base::check_displacement<cursor_base::forward_only>(difference_type) 242 const;242 const; 243 243 #endif 244 244 … … 422 422 423 423 difference_type move_to(cursor_base::size_type to, //[t91] 424 cursor_base::difference_type &d)424 cursor_base::difference_type &d) 425 425 { return move(difference_type(to)-difference_type(pos()), d); } 426 426 private: … … 514 514 icursorstream(transaction_base &Context, 515 515 const result::field &Name, 516 difference_type Stride=1); //[t84]516 difference_type Stride=1); //[t84] 517 517 518 518 /// Read new value into given result object; same as operator >> … … 593 593 class PQXX_LIBEXPORT icursor_iterator : 594 594 public PGSTD::iterator<PGSTD::input_iterator_tag, 595 result,595 result, 596 596 cursor_base::size_type, 597 597 const result *, … … 617 617 bool operator==(const icursor_iterator &rhs) const; //[t84] 618 618 bool operator!=(const icursor_iterator &rhs) const throw () //[t84] 619 { return !operator==(rhs); }619 { return !operator==(rhs); } 620 620 bool operator<(const icursor_iterator &rhs) const; //[t84] 621 621 bool operator>(const icursor_iterator &rhs) const //[t84] -
trunk/include/pqxx/dbtransaction.hxx
r1026 r1138 26 26 27 27 /// Abstract base class responsible for bracketing a backend transaction 28 /** 28 /** 29 29 * @addtogroup transaction Transaction classes 30 30 * … … 84 84 85 85 static PGSTD::string fullname(const PGSTD::string &ttype, 86 const PGSTD::string &isolation);86 const PGSTD::string &isolation); 87 87 88 88 private: -
trunk/include/pqxx/except.hxx
r1123 r1138 117 117 sql_error(err) {} 118 118 integrity_constraint_violation(const PGSTD::string &err, 119 const PGSTD::string &Q) :119 const PGSTD::string &Q) : 120 120 sql_error(err, Q) {} 121 121 }; -
trunk/include/pqxx/largeobject.hxx
r1036 r1138 93 93 /// Compare object identities 94 94 /** @warning Only valid between large objects in the same database. */ 95 bool operator==(const largeobject &other) const //[t51]95 bool operator==(const largeobject &other) const //[t51] 96 96 { return m_ID == other.m_ID; } 97 97 /// Compare object identities 98 98 /** @warning Only valid between large objects in the same database. */ 99 bool operator!=(const largeobject &other) const //[t51]99 bool operator!=(const largeobject &other) const //[t51] 100 100 { return m_ID != other.m_ID; } 101 101 /// Compare object identities 102 102 /** @warning Only valid between large objects in the same database. */ 103 bool operator<=(const largeobject &other) const //[t51]103 bool operator<=(const largeobject &other) const //[t51] 104 104 { return m_ID <= other.m_ID; } 105 105 /// Compare object identities 106 106 /** @warning Only valid between large objects in the same database. */ 107 bool operator>=(const largeobject &other) const //[t51]107 bool operator>=(const largeobject &other) const //[t51] 108 108 { return m_ID >= other.m_ID; } 109 109 /// Compare object identities 110 110 /** @warning Only valid between large objects in the same database. */ 111 bool operator<(const largeobject &other) const //[t51]111 bool operator<(const largeobject &other) const //[t51] 112 112 { return m_ID < other.m_ID; } 113 113 /// Compare object identities 114 114 /** @warning Only valid between large objects in the same database. */ 115 bool operator>(const largeobject &other) const //[t51]115 bool operator>(const largeobject &other) const //[t51] 116 116 { return m_ID > other.m_ID; } 117 117 //@} … … 122 122 * @param File A filename on the client's filesystem 123 123 */ 124 void to_file(dbtransaction &T, const PGSTD::string &File) const; //[t52]124 void to_file(dbtransaction &T, const PGSTD::string &File) const; //[t52] 125 125 126 126 /// Delete large object from database … … 224 224 * @param File A filename on the client's filesystem 225 225 */ 226 void to_file(const PGSTD::string &File) const //[t54]227 { largeobject::to_file(m_Trans, File); }226 void to_file(const PGSTD::string &File) const //[t54] 227 { largeobject::to_file(m_Trans, File); } 228 228 229 229 #ifdef PQXX_BROKEN_USING_DECL … … 234 234 */ 235 235 void to_file(dbtransaction &T, const PGSTD::string &F) const 236 { largeobject::to_file(T, F); }236 { largeobject::to_file(T, F); } 237 237 #else 238 238 using largeobject::to_file; … … 255 255 */ 256 256 void write(const PGSTD::string &Buf) //[t50] 257 { write(Buf.c_str(), static_cast<size_type>(Buf.size())); }257 { write(Buf.c_str(), static_cast<size_type>(Buf.size())); } 258 258 259 259 /// Read data from large object … … 271 271 */ 272 272 size_type seek(size_type dest, seekdir dir); //[t51] 273 273 274 274 /// Report current position in large object's data stream 275 275 /** Throws an exception if an error occurs. … … 300 300 301 301 /// Write to large object's data stream 302 /** Does not throw exception in case of error; inspect return value and 302 /** Does not throw exception in case of error; inspect return value and 303 303 * @c errno instead. 304 304 * @param Buf Data to write … … 309 309 310 310 /// Read from large object's data stream 311 /** Does not throw exception in case of error; inspect return value and 311 /** Does not throw exception in case of error; inspect return value and 312 312 * @c errno instead. 313 313 * @param Buf Area where incoming bytes should be stored … … 316 316 */ 317 317 off_type cread(char Buf[], size_type Len) throw (); //[t50] 318 318 319 319 /// Report current position in large object's data stream 320 320 /** Does not throw exception in case of error; inspect return value and … … 345 345 PGSTD::string PQXX_PRIVATE Reason(int err) const; 346 346 internal::pq::PGconn *RawConnection() const 347 { return largeobject::RawConnection(m_Trans); }347 { return largeobject::RawConnection(m_Trans); } 348 348 349 349 void open(openmode mode); … … 395 395 largeobject O, 396 396 openmode mode = PGSTD::ios::in | PGSTD::ios::out, 397 size_type BufSize=512) : //[t48]397 size_type BufSize=512) : //[t48] 398 398 m_BufSize(BufSize), 399 399 m_Obj(T, O), 400 400 m_G(0), 401 401 m_P(0) 402 { initialize(mode); }402 { initialize(mode); } 403 403 404 404 largeobject_streambuf(dbtransaction &T, 405 405 oid O, 406 406 openmode mode = PGSTD::ios::in | PGSTD::ios::out, 407 size_type BufSize=512) : //[t48]407 size_type BufSize=512) : //[t48] 408 408 m_BufSize(BufSize), 409 409 m_Obj(T, O), 410 410 m_G(0), 411 411 m_P(0) 412 { initialize(mode); }412 { initialize(mode); } 413 413 414 414 virtual ~largeobject_streambuf() throw () { delete [] m_P; delete [] m_G; } … … 535 535 super(0), 536 536 m_Buf(T, O, PGSTD::ios::in, BufSize) 537 { super::init(&m_Buf); }537 { super::init(&m_Buf); } 538 538 539 539 /// Create a basic_ilostream … … 548 548 super(0), 549 549 m_Buf(T, O, PGSTD::ios::in, BufSize) 550 { super::init(&m_Buf); }550 { super::init(&m_Buf); } 551 551 552 552 private: … … 597 597 super(0), 598 598 m_Buf(T, O, PGSTD::ios::out, BufSize) 599 { super::init(&m_Buf); }599 { super::init(&m_Buf); } 600 600 601 601 /// Create a basic_olostream … … 606 606 */ 607 607 basic_olostream(dbtransaction &T, 608 oid O,608 oid O, 609 609 largeobject::size_type BufSize=512) : //[t57] 610 610 super(0), 611 611 m_Buf(T, O, PGSTD::ios::out, BufSize) 612 { super::init(&m_Buf); }612 { super::init(&m_Buf); } 613 613 614 614 ~basic_olostream() … … 672 672 */ 673 673 basic_lostream(dbtransaction &T, 674 largeobject O,674 largeobject O, 675 675 largeobject::size_type BufSize=512) : //[t59] 676 676 super(0), 677 677 m_Buf(T, O, PGSTD::ios::in | PGSTD::ios::out, BufSize) 678 { super::init(&m_Buf); }678 { super::init(&m_Buf); } 679 679 680 680 /// Create a basic_lostream … … 685 685 */ 686 686 basic_lostream(dbtransaction &T, 687 oid O,687 oid O, 688 688 largeobject::size_type BufSize=512) : //[t59] 689 689 super(0), 690 690 m_Buf(T, O, PGSTD::ios::in | PGSTD::ios::out, BufSize) 691 { super::init(&m_Buf); }691 { super::init(&m_Buf); } 692 692 693 693 ~basic_lostream() -
trunk/include/pqxx/pipeline.hxx
r1119 r1138 103 103 */ 104 104 result retrieve(query_id qid) //[t71] 105 { return retrieve(m_queries.find(qid)).second; }105 { return retrieve(m_queries.find(qid)).second; } 106 106 107 107 /// Retrieve oldest unretrieved result (possibly wait for one) … … 123 123 * @return Old retention capacity 124 124 */ 125 int retain(int retain_max=2); //[t70]125 int retain(int retain_max=2); //[t70] 126 126 127 127 … … 167 167 168 168 bool have_pending() const throw () 169 { return m_issuedrange.second != m_issuedrange.first; }169 { return m_issuedrange.second != m_issuedrange.first; } 170 170 171 171 void PQXX_PRIVATE issue(); -
trunk/include/pqxx/result.hxx
r1134 r1138 76 76 * 77 77 * @code 78 * cout << tuple["date"].c_str() << ": " << tuple["name"].c_str() << endl;78 * cout << tuple["date"].c_str() << ": " << tuple["name"].c_str() << endl; 79 79 * @endcode 80 80 * … … 245 245 * @param C Column number of this field. 246 246 */ 247 field(const tuple &T, tuple::size_type C) throw () : //[t1]247 field(const tuple &T, tuple::size_type C) throw () : //[t1] 248 248 m_tup(T), m_col(C) {} 249 249 … … 285 285 286 286 /// Column type 287 oid type() const { return home()->column_type(col()); } //[t7]287 oid type() const { return home()->column_type(col()); } //[t7] 288 288 289 289 /// What table did this column come from? Requires PostgreSQL 7.4 C API. … … 307 307 /** Since the field's data is stored internally in the form of a 308 308 * zero-terminated C string, this is the fastest way to read it. Use the 309 * to() or as() functions to convert the string to other types such as 309 * to() or as() functions to convert the string to other types such as 310 310 * @c int, or to C++ strings. 311 311 */ … … 387 387 const tuple, 388 388 result::difference_type, 389 const_iterator, 390 tuple> const_iterator_base; 389 const_iterator, 390 tuple> 391 const_iterator_base; 391 392 392 393 /// Iterator for rows (tuples) in a query result set. … … 436 437 const_iterator &operator--() { --m_Index; return *this; } //[t12] 437 438 438 const_iterator &operator+=(difference_type i) //[t12]439 const_iterator &operator+=(difference_type i) //[t12] 439 440 { m_Index+=i; return *this; } 440 const_iterator &operator-=(difference_type i) //[t12]441 const_iterator &operator-=(difference_type i) //[t12] 441 442 { m_Index-=i; return *this; } 442 443 //@} … … 446 447 */ 447 448 //@{ 448 bool operator==(const const_iterator &i) const //[t12]449 bool operator==(const const_iterator &i) const //[t12] 449 450 {return m_Index==i.m_Index;} 450 bool operator!=(const const_iterator &i) const //[t12]451 bool operator!=(const const_iterator &i) const //[t12] 451 452 {return m_Index!=i.m_Index;} 452 bool operator<(const const_iterator &i) const //[t12]453 {return m_Index<i.m_Index;}454 bool operator<=(const const_iterator &i) const //[t12]453 bool operator<(const const_iterator &i) const //[t12] 454 {return m_Index<i.m_Index;} 455 bool operator<=(const const_iterator &i) const //[t12] 455 456 {return m_Index<=i.m_Index;} 456 bool operator>(const const_iterator &i) const //[t12]457 bool operator>(const const_iterator &i) const //[t12] 457 458 {return m_Index>i.m_Index;} 458 bool operator>=(const const_iterator &i) const //[t12]459 bool operator>=(const const_iterator &i) const //[t12] 459 460 {return m_Index>=i.m_Index;} 460 461 //@} … … 474 475 friend class pqxx::result; 475 476 const_iterator(const pqxx::result *r, result::size_type i) throw () : 476 tuple(r, i) {}477 tuple(r, i) {} 477 478 }; 478 479 … … 496 497 const_reverse_iterator(const const_reverse_iterator &rhs) : //[t75] 497 498 const_iterator(rhs) {} 498 explicit const_reverse_iterator(const const_iterator &rhs) : //[t75]499 explicit const_reverse_iterator(const const_iterator &rhs) : //[t75] 499 500 const_iterator(rhs) { super::operator--(); } 500 501 … … 505 506 */ 506 507 //@{ 507 using const_iterator::operator->; //[t75]508 using const_iterator::operator->; //[t75] 508 509 using const_iterator::operator*; //[t75] 509 510 //@} 510 511 511 512 /** 512 513 * @name Manipulations … … 518 519 { iterator_type::operator--(); return *this; } 519 520 const_reverse_iterator operator++(int); //[t75] 520 const_reverse_iterator &operator--() //[t75]521 const_reverse_iterator &operator--() //[t75] 521 522 { iterator_type::operator++(); return *this; } 522 523 const_reverse_iterator operator--(int); //[t75] … … 548 549 { return !operator==(rhs); } 549 550 550 bool operator<(const const_reverse_iterator &rhs) const //[t75]551 bool operator<(const const_reverse_iterator &rhs) const //[t75] 551 552 { return iterator_type::operator>(rhs); } 552 bool operator<=(const const_reverse_iterator &rhs) const //[t75]553 bool operator<=(const const_reverse_iterator &rhs) const //[t75] 553 554 { return iterator_type::operator>=(rhs); } 554 bool operator>(const const_reverse_iterator &rhs) const //[t75]555 bool operator>(const const_reverse_iterator &rhs) const //[t75] 555 556 { return iterator_type::operator<(rhs); } 556 bool operator>=(const const_reverse_iterator &rhs) const //[t75]557 bool operator>=(const const_reverse_iterator &rhs) const //[t75] 557 558 { return iterator_type::operator<=(rhs); } 558 559 //@} … … 566 567 { 567 568 typedef PGSTD::iterator<PGSTD::random_access_iterator_tag, 568 const field,569 const field, 569 570 tuple::size_type> it; 570 571 public: … … 595 596 const_fielditerator &operator--() { --m_col; return *this; } //[t82] 596 597 597 const_fielditerator &operator+=(difference_type i) //[t82]598 const_fielditerator &operator+=(difference_type i) //[t82] 598 599 { m_col+=i; return *this; } 599 const_fielditerator &operator-=(difference_type i) //[t82]600 const_fielditerator &operator-=(difference_type i) //[t82] 600 601 { m_col-=i; return *this; } 601 602 //@} … … 605 606 */ 606 607 //@{ 607 bool operator==(const const_fielditerator &i) const //[t82]608 bool operator==(const const_fielditerator &i) const //[t82] 608 609 {return col()==i.col();} 609 bool operator!=(const const_fielditerator &i) const //[t82]610 bool operator!=(const const_fielditerator &i) const //[t82] 610 611 {return col()!=i.col();} 611 bool operator<(const const_fielditerator &i) const //[t82]612 {return col()<i.col();}613 bool operator<=(const const_fielditerator &i) const //[t82]612 bool operator<(const const_fielditerator &i) const //[t82] 613 {return col()<i.col();} 614 bool operator<=(const const_fielditerator &i) const //[t82] 614 615 {return col()<=i.col();} 615 bool operator>(const const_fielditerator &i) const //[t82]616 bool operator>(const const_fielditerator &i) const //[t82] 616 617 {return col()>i.col();} 617 bool operator>=(const const_fielditerator &i) const //[t82]618 bool operator>=(const const_fielditerator &i) const //[t82] 618 619 {return col()>=i.col();} 619 620 //@} … … 626 627 627 628 friend const_fielditerator operator+(difference_type, 628 const_fielditerator); //[t82]629 const_fielditerator); //[t82] 629 630 630 631 inline const_fielditerator operator-(difference_type) const; //[t82] … … 676 677 { iterator_type::operator--(); return *this; } 677 678 const_reverse_fielditerator operator++(int); //[t82] 678 const_reverse_fielditerator &operator--() //[t82]679 const_reverse_fielditerator &operator--() //[t82] 679 680 { iterator_type::operator++(); return *this; } 680 681 const_reverse_fielditerator operator--(int); //[t82] … … 709 710 { return !operator==(rhs); } 710 711 711 bool operator<(const const_reverse_fielditerator &rhs) const //[t82]712 bool operator<(const const_reverse_fielditerator &rhs) const //[t82] 712 713 { return iterator_type::operator>(rhs); } 713 bool operator<=(const const_reverse_fielditerator &rhs) const //[t82]714 bool operator<=(const const_reverse_fielditerator &rhs) const //[t82] 714 715 { return iterator_type::operator>=(rhs); } 715 bool operator>(const const_reverse_fielditerator &rhs) const //[t82]716 bool operator>(const const_reverse_fielditerator &rhs) const //[t82] 716 717 { return iterator_type::operator<(rhs); } 717 bool operator>=(const const_reverse_fielditerator &rhs) const //[t82]718 bool operator>=(const const_reverse_fielditerator &rhs) const //[t82] 718 719 { return iterator_type::operator<=(rhs); } 719 720 //@} … … 725 726 726 727 result &operator=(const result &rhs) throw () //[t10] 727 { super::operator=(rhs); return *this; }728 { super::operator=(rhs); return *this; } 728 729 729 730 /** … … 733 734 bool operator==(const result &) const throw (); //[t70] 734 735 bool operator!=(const result &rhs) const throw () //[t70] 735 { return !operator==(rhs); }736 { return !operator==(rhs); } 736 737 //@} 737 738 738 const_reverse_iterator rbegin() const //[t75]739 { return const_reverse_iterator(end()); }739 const_reverse_iterator rbegin() const //[t75] 740 { return const_reverse_iterator(end()); } 740 741 const_reverse_iterator rend() const //[t75] 741 { return const_reverse_iterator(begin()); }742 { return const_reverse_iterator(begin()); } 742 743 743 744 const_iterator begin() const throw () //[t1] 744 { return const_iterator(this, 0); }745 { return const_iterator(this, 0); } 745 746 inline const_iterator end() const throw (); //[t1] 746 747 … … 754 755 void swap(result &) throw (); //[t77] 755 756 756 const tuple operator[](size_type i) const throw () //[t2]757 { return tuple(this, i); }757 const tuple operator[](size_type i) const throw () //[t2] 758 { return tuple(this, i); } 758 759 const tuple at(size_type) const throw (PGSTD::out_of_range); //[t10] 759 760 … … 765 766 //@{ 766 767 /// Number of columns in result 767 tuple::size_type columns() const throw (); //[t11]768 tuple::size_type columns() const throw (); //[t11] 768 769 769 770 /// Number of given column (throws exception if it doesn't exist) … … 772 773 /// Number of given column (throws exception if it doesn't exist) 773 774 tuple::size_type column_number(const PGSTD::string &Name) const //[t11] 774 {return column_number(Name.c_str());}775 {return column_number(Name.c_str());} 775 776 776 777 /// Name of column with this number (throws exception if it doesn't exist) … … 781 782 /// Type of given column 782 783 oid column_type(int ColNum) const //[t7] 783 { return column_type(tuple::size_type(ColNum)); }784 { return column_type(tuple::size_type(ColNum)); } 784 785 785 786 /// Type of given column 786 787 oid column_type(const PGSTD::string &ColName) const //[t7] 787 { return column_type(column_number(ColName)); }788 { return column_type(column_number(ColName)); } 788 789 789 790 /// Type of given column 790 791 oid column_type(const char ColName[]) const //[t7] 791 { return column_type(column_number(ColName)); }792 { return column_type(column_number(ColName)); } 792 793 793 794 /// What table did this column come from? Requires PostgreSQL 7.4 C API. … … 810 811 */ 811 812 oid column_table(int ColNum) const //[t2] 812 { return column_table(tuple::size_type(ColNum)); }813 { return column_table(tuple::size_type(ColNum)); } 813 814 814 815 /// What table did this column come from? Requires PostgreSQL 7.4 C API. … … 821 822 */ 822 823 oid column_table(const PGSTD::string &ColName) const //[t2] 823 { return column_table(column_number(ColName)); }824 { return column_table(column_number(ColName)); } 824 825 //@} 825 826 … … 858 859 /// @deprecated Use column_number() instead 859 860 tuple::size_type ColumnNumber(const PGSTD::string &Name) const PQXX_DEPRECATED 860 {return column_number(Name);}861 {return column_number(Name);} 861 862 /// @deprecated Use column_name() instead 862 863 const char *ColumnName(tuple::size_type Number) const PQXX_DEPRECATED 863 {return column_name(Number);}864 {return column_name(Number);} 864 865 //@} 865 866 #endif … … 876 877 explicit result(internal::pq::PGresult *rhs) throw () : super(rhs) {} 877 878 result &operator=(internal::pq::PGresult *rhs) throw () 878 { super::operator=(rhs); return *this; }879 { super::operator=(rhs); return *this; } 879 880 bool operator!() const throw () { return !c_ptr(); } 880 881 operator bool() const throw () { return c_ptr() != 0; } … … 1027 1028 typedef PGSTD::ios::seekdir seekdir; 1028 1029 1029 explicit field_streambuf(const result::field &F) : //[t74]1030 explicit field_streambuf(const result::field &F) : //[t74] 1030 1031 m_Field(F) 1031 1032 { -
trunk/include/pqxx/robusttransaction.hxx
r1123 r1138 148 148 namedclass(fullname("robusttransaction",isolation_tag::name()), Name), 149 149 basic_robusttransaction(C, isolation_tag::name()) 150 { Begin(); }150 { Begin(); } 151 151 152 152 virtual ~robusttransaction() throw () -
trunk/include/pqxx/tablereader.hxx
r1062 r1138 98 98 /// @deprecated Use tokenize<>() instead 99 99 template<typename TUPLE> void Tokenize(PGSTD::string L, TUPLE &T) const 100 PQXX_DEPRECATED { tokenize(L, T); }100 PQXX_DEPRECATED { tokenize(L, T); } 101 101 #endif 102 102 -
trunk/include/pqxx/tablewriter.hxx
r1062 r1138 96 96 /// @deprecated Use generate() instead 97 97 template<typename IT> PGSTD::string ezinekoT(IT Begin, IT End) const 98 PQXX_DEPRECATED { return generate(Begin, End); }98 PQXX_DEPRECATED { return generate(Begin, End); } 99 99 /// @deprecated Use generate() instead 100 100 template<typename TUPLE> PGSTD::string ezinekoT(const TUPLE &T) const 101 PQXX_DEPRECATED { return generate(T); }101 PQXX_DEPRECATED { return generate(T); } 102 102 #endif 103 103 … … 130 130 131 131 back_insert_iterator & 132 operator=(const back_insert_iterator &rhs) throw () //[t83]132 operator=(const back_insert_iterator &rhs) throw () //[t83] 133 133 { 134 134 m_Writer = rhs.m_Writer; -
trunk/include/pqxx/transaction.hxx
r1026 r1138 91 91 namedclass(fullname("transaction",isolation_tag::name()), TName), 92 92 basic_transaction(C, isolation_tag::name()) 93 { Begin(); }93 { Begin(); } 94 94 95 95 explicit transaction(connection_base &C) : //[t1] 96 96 namedclass(fullname("transaction",isolation_tag::name())), 97 97 basic_transaction(C, isolation_tag::name()) 98 { Begin(); }98 { Begin(); } 99 99 100 100 virtual ~transaction() throw () -
trunk/include/pqxx/transaction_base.hxx
r1133 r1138 79 79 80 80 /// Interface definition (and common code) for "transaction" classes. 81 /** 81 /** 82 82 * @addtogroup transaction Transaction classes 83 83 * All database access must be channeled through one of these classes for … … 155 155 */ 156 156 result exec(const char Query[], 157 const PGSTD::string &Desc=PGSTD::string()); //[t1]157 const PGSTD::string &Desc=PGSTD::string()); //[t1] 158 158 159 159 /// Execute query … … 167 167 */ 168 168 result exec(const PGSTD::string &Query, 169 const PGSTD::string &Desc=PGSTD::string()) //[t2]170 { return exec(Query.c_str(), Desc); }169 const PGSTD::string &Desc=PGSTD::string()) //[t2] 170 { return exec(Query.c_str(), Desc); } 171 171 172 172 result exec(const PGSTD::stringstream &Query, 173 const PGSTD::string &Desc=PGSTD::string()) //[t9]174 { return exec(Query.str(), Desc); }173 const PGSTD::string &Desc=PGSTD::string()) //[t9] 174 { return exec(Query.str(), Desc); } 175 175 176 176 /** … … 222 222 //@{ 223 223 /// Have connection process warning message 224 void process_notice(const char Msg[]) const //[t14]225 { m_Conn.process_notice(Msg); }224 void process_notice(const char Msg[]) const //[t14] 225 { m_Conn.process_notice(Msg); } 226 226 /// Have connection process warning message 227 227 void process_notice(const PGSTD::string &Msg) const //[t14] 228 { m_Conn.process_notice(Msg); }228 { m_Conn.process_notice(Msg); } 229 229 //@} 230 230 … … 269 269 /// @deprecated Use exec() instead 270 270 result Exec(const PGSTD::string &Q, const PGSTD::string &D=PGSTD::string()) 271 PQXX_DEPRECATED { return exec(Q,D); }271 PQXX_DEPRECATED { return exec(Q,D); } 272 272 /// @deprecated Use process_notice() instead 273 273 void ProcessNotice(const char M[]) const PQXX_DEPRECATED … … 282 282 /// @deprecated Use set_variable() instead 283 283 void SetVariable(const PGSTD::string &Var, const PGSTD::string &Val) 284 PQXX_DEPRECATED { set_variable(Var,Val); }284 PQXX_DEPRECATED { set_variable(Var,Val); } 285 285 //@} 286 286 #endif … … 377 377 friend class tablewriter; 378 378 void PQXX_PRIVATE BeginCopyWrite(const PGSTD::string &Table, 379 const PGSTD::string &Columns = PGSTD::string());379 const PGSTD::string &Columns = PGSTD::string()); 380 380 void WriteCopyLine(const PGSTD::string &L) { m_Conn.WriteCopyLine(L); } 381 381 void EndCopyWrite() { m_Conn.EndCopyWrite(); } … … 389 389 friend class prepare::invocation; 390 390 result prepared_exec(const PGSTD::string &, 391 const char *const[],391 const char *const[], 392 392 const int[], 393 393 int); -
trunk/include/pqxx/trigger.hxx
r1115 r1138 62 62 * @param N A name for the trigger. 63 63 */ 64 trigger(connection_base &C, const PGSTD::string &N) : //[t4]64 trigger(connection_base &C, const PGSTD::string &N) : //[t4] 65 65 m_Conn(C), m_Name(N) { m_Conn.AddTrigger(this); } 66 66 67 virtual ~trigger() throw () //[t4]67 virtual ~trigger() throw () //[t4] 68 68 { 69 69 #ifdef PQXX_QUIET_DESTRUCTORS -
trunk/include/pqxx/util.hxx
r1136 r1138 46 46 47 47 /** @page threading Thread safety 48 * 48 * 49 49 * This library does not contain any locking code to protect objects against 50 50 * simultaneous modification in multi-threaded programs. Therefore it is up to … … 189 189 template<> 190 190 inline void from_string(const char Str[], PGSTD::stringstream &Obj) //[t0] 191 { Obj.clear(); Obj << Str; }191 { Obj.clear(); Obj << Str; } 192 192 193 193 template<typename T> 194 inline void from_string(const PGSTD::string &Str, T &Obj) //[t45]194 inline void from_string(const PGSTD::string &Str, T &Obj) //[t45] 195 195 { from_string(Str.c_str(), Obj); } 196 196 197 197 template<typename T> 198 198 inline void from_string(const PGSTD::stringstream &Str, T &Obj) //[t0] 199 { from_string(Str.str(), Obj); }199 { from_string(Str.str(), Obj); } 200 200 201 201 template<> inline void 202 from_string(const PGSTD::string &Str, PGSTD::string &Obj) //[t46]202 from_string(const PGSTD::string &Str, PGSTD::string &Obj) //[t46] 203 203 { Obj = Str; } 204 204 … … 255 255 #endif 256 256 257 inline PGSTD::string to_string(const char Obj[]) //[t14]257 inline PGSTD::string to_string(const char Obj[]) //[t14] 258 258 { return PGSTD::string(Obj); } 259 259 … … 303 303 /// Create items list with one element 304 304 explicit items(const T &t) : CONT() { push_back(t); } //[t0] 305 items(const T &t1, const T &t2) : CONT() //[t80]306 { push_back(t1); push_back(t2); }307 items(const T &t1, const T &t2, const T &t3) : CONT() //[t0]308 { push_back(t1); push_back(t2); push_back(t3); }309 items(const T &t1, const T &t2, const T &t3, const T &t4) : CONT() //[t0]310 { push_back(t1); push_back(t2); push_back(t3); push_back(t4); }311 items(const T&t1,const T&t2,const T&t3,const T&t4,const T&t5):CONT() //[t0]312 {push_back(t1);push_back(t2);push_back(t3);push_back(t4);push_back(t5);}305 items(const T &t1, const T &t2) : CONT() //[t80] 306 { push_back(t1); push_back(t2); } 307 items(const T &t1, const T &t2, const T &t3) : CONT() //[t0] 308 { push_back(t1); push_back(t2); push_back(t3); } 309 items(const T &t1, const T &t2, const T &t3, const T &t4) : CONT() //[t0] 310 { push_back(t1); push_back(t2); push_back(t3); push_back(t4); } 311 items(const T&t1,const T&t2,const T&t3,const T&t4,const T&t5):CONT() //[t0] 312 {push_back(t1);push_back(t2);push_back(t3);push_back(t4);push_back(t5);} 313 313 /// Copy container 314 314 items(const CONT &c) : CONT(c) {} //[t0] … … 512 512 */ 513 513 void PQXX_LIBEXPORT FromString_ucharptr(const char Str[], 514 const unsigned char *&Obj)514 const unsigned char *&Obj) 515 515 PQXX_DEPRECATED; 516 516 517 517 /// For libpqxx internal use only: quote std::string 518 518 PGSTD::string PQXX_LIBEXPORT Quote_string(const PGSTD::string &Obj, 519 bool EmptyIsNull);519 bool EmptyIsNull); 520 520 521 521 /// For libpqxx internal use only: quote const char * … … 559 559 * 560 560 * @code 561 * TX.exec("SELECT number,amount "562 * "FROM accounts "563 * "WHERE allowed_to_see('" + userid + "','" + password + "')");561 * TX.exec("SELECT number,amount " 562 * "FROM accounts " 563 * "WHERE allowed_to_see('" + userid + "','" + password + "')"); 564 564 * @endcode 565 565 * … … 572 572 * 573 573 * @code 574 * 'x') OR ('x' = 'x574 * 'x') OR ('x' = 'x 575 575 * @endcode 576 576 * … … 579 579 * 580 580 * @code 581 * SELECT number,amount582 * FROM accounts583 * WHERE allowed_to_see('user','x') OR ('x' = 'x')581 * SELECT number,amount 582 * FROM accounts 583 * WHERE allowed_to_see('user','x') OR ('x' = 'x') 584 584 * @endcode 585 585 * … … 592 592 * 593 593 * @code 594 * TX.exec("SELECT number,amount "595 * "FROM accounts "596 * "WHERE allowed_to_see('" + TX.esc(userid) + "', "597 * "'" + TX.esc(password) + "')");594 * TX.exec("SELECT number,amount " 595 * "FROM accounts " 596 * "WHERE allowed_to_see('" + TX.esc(userid) + "', " 597 * "'" + TX.esc(password) + "')"); 598 598 * @endcode 599 599 * … … 602 602 * 603 603 * @code 604 * SELECT number,amount605 * FROM accounts606 * WHERE allowed_to_see('user', 'x'') OR (''x'' = ''x')604 * SELECT number,amount 605 * FROM accounts 606 * WHERE allowed_to_see('user', 'x'') OR (''x'' = ''x') 607 607 * @endcode 608 608 * … … 692 692 */ 693 693 template<int LEN> inline PGSTD::string Quote(const char (&Obj)[LEN], 694 bool EmptyIsNull)694 bool EmptyIsNull) 695 695 PQXX_DEPRECATED 696 696 { … … 772 772 ~PQAlloc() throw () { loseref(); } 773 773 774 PQAlloc &operator=(const PQAlloc &rhs) throw () 775 { redoref(rhs); return *this; } 774 PQAlloc &operator=(const PQAlloc &rhs) throw () {redoref(rhs); return *this;} 776 775 777 776 /// Assume ownership of a pointer -
trunk/pqxx-config.in
r1110 r1138 66 66 deprecated "\"$pkgconfig --cflags libpqxx\"" 67 67 $pkgconfig --cflags libpqxx 68 ;;68 ;; 69 69 70 70 --libs) 71 71 deprecated "\"$pkgconfig --libs libpqxx\"" 72 72 $pkgconfig --libs libpqxx 73 ;;73 ;; 74 74 75 75 *) -
trunk/src/connection_base.cxx
r1135 r1138 590 590 { 591 591 // Erase first; otherwise a notification for the same trigger may yet come 592 // in and wreak havoc. Thanks Dragan Milenkovic. 592 // in and wreak havoc. Thanks Dragan Milenkovic. 593 593 m_Triggers.erase(i); 594 594 … … 766 766 { 767 767 if (!in) return "null"; 768 768 769 769 switch (treatment) 770 770 { … … 861 861 P << '(' 862 862 << separated_list(",", 863 s.parameters.begin(),863 s.parameters.begin(), 864 864 s.parameters.end(), 865 865 prepare::internal::get_sqltype()) … … 879 879 880 880 result r(PQexecPrepared(m_Conn, 881 statement.c_str(),881 statement.c_str(), 882 882 nparams, 883 883 params, … … 910 910 const string key = "$" + to_string(n+1), 911 911 val = escape_param(params[n], 912 paramlengths[n],912 paramlengths[n], 913 913 s.parameters[n].treatment); 914 914 const string::size_type keysz = key.size(); -
trunk/src/cursor.cxx
r1137 r1138 31 31 /// Compute actual displacement based on requested and reported displacements 32 32 pqxx::cursor_base::difference_type adjust( 33 pqxx::cursor_base::difference_type d, 33 pqxx::cursor_base::difference_type d, 34 34 pqxx::cursor_base::difference_type r) 35 35 { … … 171 171 { 172 172 result r; 173 if (n) 173 if (n) 174 174 { 175 175 // We cache the last-executed fetch query. If the current fetch uses the -
trunk/src/largeobject.cxx
r1119 r1138 157 157 158 158 pqxx::largeobjectaccess::largeobjectaccess(dbtransaction &T, 159 oid O,159 oid O, 160 160 openmode mode) : 161 161 largeobject(O), … … 168 168 169 169 pqxx::largeobjectaccess::largeobjectaccess(dbtransaction &T, 170 largeobject O,170 largeobject O, 171 171 openmode mode) : 172 172 largeobject(O), -
trunk/src/tablereader.cxx
r1119 r1138 175 175 if (!is_octalchar(n1) || !is_octalchar(n2)) 176 176 throw runtime_error("Invalid octal in encoded table stream"); 177 R += char((digit_to_number(n)<<6) | 178 (digit_to_number(n1)<<3) | 177 R += char((digit_to_number(n)<<6) | 178 (digit_to_number(n1)<<3) | 179 179 digit_to_number(n2)); 180 180 } 181 181 break; 182 182 183 case 'b':183 case 'b': 184 184 // TODO: Escape code? 185 185 R += char(8); 186 186 break; // Backspace 187 case 'v':187 case 'v': 188 188 // TODO: Escape code? 189 189 R += char(11); 190 190 break; // Vertical tab 191 case 'f':191 case 'f': 192 192 // TODO: Escape code? 193 193 R += char(12); 194 194 break; // Form feed 195 case 'n':195 case 'n': 196 196 R += '\n'; 197 197 break; // Newline 198 case 't':198 case 't': 199 199 R += '\t'; 200 200 break; // Tab 201 case 'r':201 case 'r': 202 202 R += '\r'; 203 203 break; // Carriage return; -
trunk/src/transaction_base.cxx
r1133 r1138 210 210 211 211 pqxx::result pqxx::transaction_base::exec(const char Query[], 212 const PGSTD::string &Desc)212 const PGSTD::string &Desc) 213 213 { 214 214 CheckPendingError(); -
trunk/src/util.cxx
r1136 r1138 110 110 if (Str[i] != '-') 111 111 throw runtime_error("Could not convert string to integer: '" + 112 string(Str) + "'");112 string(Str) + "'"); 113 113 114 114 for (++i; isdigit(Str[i]); ++i) … … 143 143 if (!isdigit(Str[i])) 144 144 throw runtime_error("Could not convert string to unsigned integer: '" + 145 string(Str) + "'");145 string(Str) + "'"); 146 146 147 147 for (result=0; isdigit(Str[i]); ++i) … … 352 352 { 353 353 // TODO: Is this workaround for missing isnan() reliable? Infinities? 354 return 354 return 355 355 #if defined(PQXX_HAVE_ISNAN) 356 356 isnan(Obj); … … 666 666 if (!New) 667 667 throw logic_error("Expected to close " + Old->description() + ", " 668 "but got NULL pointer instead");668 "but got NULL pointer instead"); 669 669 if (!Old) 670 670 throw logic_error("Closed while not open: " + New->description()); -
trunk/test/test001.cxx
r1130 r1138 37 37 { 38 38 // Dump tuple number and column 0 value to cout. Read the value using 39 // as(), which converts the field to the same type as the default value 39 // as(), which converts the field to the same type as the default value 40 40 // you give it (or returns the default value if the field is null). 41 41 cout << '\t' << to_string(c.num()) << '\t' << c[0].as(string()) << endl; -
trunk/test/test002.cxx
r1069 r1138 61 61 T.commit(); 62 62 63 // Since we don't need the database anymore, we can be even more 63 // Since we don't need the database anymore, we can be even more 64 64 // considerate and close the connection now. This is optional. 65 65 C.disconnect(); … … 77 77 throw logic_error("Field " + rcol + " comes from " 78 78 "'" + to_string(rtable) + "', " 79 "but by name, result says it's from "79 "but by name, result says it's from " 80 80 "'" + to_string(crtable) + "'"); 81 81 #endif … … 98 98 throw logic_error("Tuple says field comes from " 99 99 "'" + to_string(ttable) + "'; " 100 "expected '" + to_string(rtable) + "'");100 "expected '" + to_string(rtable) + "'"); 101 101 const oid cttable = R[i].column_table(rcol); 102 102 if (cttable != rtable) 103 103 throw logic_error("Field comes from '" + to_string(rtable) + "', " 104 "but by name, tuple says it's from '" + 104 "but by name, tuple says it's from '" + 105 105 to_string(cttable) + "'"); 106 106 #endif -
trunk/test/test003.cxx
r898 r1138 57 57 if (!Cur) throw logic_error("Inconsistent cursor state!"); 58 58 59 // Received a block of rows. Note that this may be less than the 59 // Received a block of rows. Note that this may be less than the 60 60 // blocksize we requested if we're at the end of our query. 61 61 cout << "* Got " << R.size() << " row(s) *" << endl; -
trunk/test/test004.cxx
r1040 r1138 59 59 60 60 public: 61 explicit Notify(string TrigName) : 61 explicit Notify(string TrigName) : 62 62 transactor<>("Notifier"), m_Trigger(TrigName) { } 63 63 … … 99 99 { 100 100 if (notifs) 101 throw logic_error("Got " + to_string(notifs) + 101 throw logic_error("Got " + to_string(notifs) + 102 102 " unexpected notification(s)!"); 103 103 // Sleep one second using a libpqxx-internal function. Kids, don't try … … 110 110 cout << endl; 111 111 112 if (!Trig.Done()) 112 if (!Trig.Done()) 113 113 { 114 114 cout << "No notification received!" << endl; -
trunk/test/test005.cxx
r1124 r1138 55 55 work T(C, "test5"); 56 56 57 T.exec(("CREATE TABLE " + 58 TableName + 57 T.exec(("CREATE TABLE " + 58 TableName + 59 59 "(year INTEGER, event VARCHAR)").c_str()); 60 60 … … 82 82 83 83 // Insert tuple of data using "begin" and "end" abstraction 84 for (int i=0; CData[i][0]; ++i) 84 for (int i=0; CData[i][0]; ++i) 85 85 W.insert(&CData[i][0], &CData[i][2]); 86 86 -
trunk/test/test006.cxx
r1040 r1138 14 14 15 15 16 // Test program for libpqxx. Copy a table from one database connection to 16 // Test program for libpqxx. Copy a table from one database connection to 17 17 // another using a tablereader and a tablewriter. Any data already in the 18 18 // destination table is overwritten. … … 22 22 // Where the connect-string is a set of connection options in Postgresql's 23 23 // PQconnectdb() format, eg. "dbname=template1" to select from a database 24 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 24 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 25 25 // running on host foo.bar.net, logging in as user smith. 26 26 // … … 29 29 // specified explicitly on the command line) connects to. 30 30 // 31 // The default origin table name is "pqxxorgevents"; the default destination 31 // The default origin table name is "pqxxorgevents"; the default destination 32 32 // table is "pqxxevents". 33 33 … … 44 44 void operator()(argument_type &T) 45 45 { 46 T.exec(("CREATE TABLE " + m_Table + 46 T.exec(("CREATE TABLE " + m_Table + 47 47 "(year INTEGER, event TEXT)").c_str()); 48 48 cout << "Table " << m_Table << " created." << endl; … … 100 100 CheckState(Org); 101 101 102 // Copy table Org into table Dst. This transfers all the data to the 102 // Copy table Org into table Dst. This transfers all the data to the 103 103 // frontend and back to the backend. Since in this example Org and Dst are 104 104 // really in the same database, we'd do this differently in real life; a … … 134 134 // Set up a transaction to access the original table from 135 135 work orgTrans(orgC, "test6org"); 136 136 137 137 // Attempt to create table. Ignore errors, as they're probably one of: 138 138 // (1) Table already exists--fine with us … … 141 141 { 142 142 dstC.perform(CreateTable(dstTable)); 143 } 143 } 144 144 catch (const exception &) 145 145 { -
trunk/test/test007.cxx
r1040 r1138 22 22 // backend running on host foo.bar.net, logging in as user smith. 23 23 // 24 // This assumes the existence of a database table "pqxxevents" containing a 25 // 2-digit "year" field, which is extended to a 4-digit format by assuming all 26 // year numbers of 70 or higher are in the 20th century, and all others in the 24 // This assumes the existence of a database table "pqxxevents" containing a 25 // 2-digit "year" field, which is extended to a 4-digit format by assuming all 26 // year numbers of 70 or higher are in the 20th century, and all others in the 27 27 // 21st, and that no years before 1970 are possible. 28 28 … … 76 76 if (rcctype != rctype) 77 77 throw logic_error("Column has type " + rct + ", " 78 "but by name, it's " + to_string(rcctype));78 "but by name, it's " + to_string(rcctype)); 79 79 const oid rawrcctype = R.column_type(rcol.c_str()); 80 80 if (rawrcctype != rctype) … … 101 101 if (ctctype != rctype) 102 102 throw logic_error("Column has type " + rct + ", " 103 "but by name, tuple says it's " + to_string(ctctype));103 "but by name, tuple says it's " + to_string(ctctype)); 104 104 const oid rawctctype = r->column_type(rcol.c_str()); 105 105 if (rawctctype != rctype) 106 106 throw logic_error("Column has type " + rct + ", " 107 "but by C-style name, tuple says it's " +107 "but by C-style name, tuple says it's " + 108 108 to_string(rawctctype)); 109 109 const oid fctype = r[0].type(); 110 110 if (fctype != rctype) 111 111 throw logic_error("Column has type " + rct + ", " 112 "but field says it's " + to_string(fctype));112 "but field says it's " + to_string(fctype)); 113 113 } 114 114 -
trunk/test/test008.cxx
r480 r1138 11 11 12 12 13 // Simple test program for libpqxx. Read a table using a tablereader, which 13 // Simple test program for libpqxx. Read a table using a tablereader, which 14 14 // may be faster than a conventional query. A tablereader is really a frontend 15 15 // for a PostgreSQL COPY TO stdout command. … … 19 19 // Where connect-string is a set of connection options in Postgresql's 20 20 // PQconnectdb() format, eg. "dbname=template1" to select from a database 21 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 21 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 22 22 // running on host foo.bar.net, logging in as user smith. 23 23 // 24 24 // The default table name is "pqxxevents" as used by other test programs. 25 25 // PostgreSQL currently implements pg_tables as a view, which cannot be read by 26 // using the COPY command. Otherwise, pg_tables would have made a better 26 // using the COPY command. Otherwise, pg_tables would have made a better 27 27 // default value here. 28 28 int main(int argc, char *argv[]) -
trunk/test/test009.cxx
r564 r1138 19 19 // Where the connect-string is a set of connection options in Postgresql's 20 20 // PQconnectdb() format, eg. "dbname=template1" to select from a database 21 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 21 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 22 22 // running on host foo.bar.net, logging in as user smith. 23 23 // … … 75 75 76 76 if (Rows != Contents.size()) 77 throw runtime_error("Found " + 78 string(Count[0][0].c_str()) + 77 throw runtime_error("Found " + 78 string(Count[0][0].c_str()) + 79 79 " rows in table--after writing " + 80 80 to_string(Contents.size()) + -
trunk/test/test010.cxx
r478 r1138 12 12 13 13 14 // Test program for libpqxx. Open connection to database, start a transaction, 14 // Test program for libpqxx. Open connection to database, start a transaction, 15 15 // abort it, and verify that it "never happened." 16 16 // … … 37 37 { 38 38 const string EventsQuery = "SELECT count(*) FROM " + Table; 39 const string BoringQuery = EventsQuery + 40 " WHERE year=" + 39 const string BoringQuery = EventsQuery + 40 " WHERE year=" + 41 41 to_string(BoringYear); 42 42 int EventsCount = 0, … … 101 101 throw runtime_error("Expected to find one event for " + 102 102 to_string(BoringYear) + ", " 103 "found " + 103 "found " + 104 104 to_string(Recount.second)); 105 105 106 106 if (Recount.first != EventCounts.first+1) 107 throw runtime_error("Number of events changed from " + 107 throw runtime_error("Number of events changed from " + 108 108 to_string(EventCounts.first) + " " 109 109 "to " + … … 120 120 121 121 // Now check that we're back in the original state. Note that this may go 122 // wrong if somebody managed to change the table between our two 122 // wrong if somebody managed to change the table between our two 123 123 // transactions. 124 124 work Checkup(C, "Checkup"); … … 126 126 const pair<int,int> NewEvents = CountEvents(Checkup); 127 127 if (NewEvents.first != EventCounts.first) 128 throw runtime_error("Number of events changed from " + 128 throw runtime_error("Number of events changed from " + 129 129 to_string(EventCounts.first) + " " 130 130 "to " + -
trunk/test/test011.cxx
r621 r1138 38 38 cout << c << ":\t" << N << endl; 39 39 if (R.column_number(N) != c) 40 throw logic_error("Expected column '" + N + 40 throw logic_error("Expected column '" + N + 41 41 "' to be no. " + to_string(c) + ", " 42 42 "but it was no. " + to_string(R.column_number(N))); … … 46 46 if (!R.empty()) 47 47 { 48 if (R[0].rownumber() != 0) 48 if (R[0].rownumber() != 0) 49 49 throw logic_error("Row 0 said it was row " + R[0].rownumber()); 50 50 … … 87 87 if (size_t(R[0][c].size()) != strlen(R[0][c].c_str())) 88 88 throw logic_error("Field '" + N + "' " 89 "says its length is " + to_string(R[0][c].size()) + 89 "says its length is " + to_string(R[0][c].size()) + 90 90 ", " 91 91 "but its value is '" + R[0][c].c_str() + "' " -
trunk/test/test012.cxx
r421 r1138 26 26 namespace 27 27 { 28 template<typename VEC, typename VAL> 28 template<typename VEC, typename VAL> 29 29 void InitVector(VEC &V, typename VEC::size_type s, VAL val) 30 30 { … … 63 63 { 64 64 if ((*i).rownumber() != i->rownumber()) 65 throw logic_error("Inconsistent rows: operator*() says " + 65 throw logic_error("Inconsistent rows: operator*() says " + 66 66 to_string((*i).rownumber()) + ", " 67 67 "operator->() says " + … … 98 98 to_string(j-i)); 99 99 100 if ((j == i) || !(j != i) || 100 if ((j == i) || !(j != i) || 101 101 (j >= i) || (j > i) || 102 102 (i <= j) || (i < j) || … … 150 150 << R.column_name(f) << '\t' 151 151 << NullFields[f] << '\t' 152 << (SortedUp[f] ? 153 (SortedDown[f] ? "equal" : "up" ) : 152 << (SortedUp[f] ? 153 (SortedDown[f] ? "equal" : "up" ) : 154 154 (SortedDown[f] ? "down" : "no" ) ) 155 155 << endl; -
trunk/test/test013.cxx
r1040 r1138 43 43 pair<int, int> &m_Results; 44 44 public: 45 CountEvents(string Table, pair<int,int> &Results) : 45 CountEvents(string Table, pair<int,int> &Results) : 46 46 transactor<>("CountEvents"), m_Table(Table), m_Results(Results) {} 47 47 … … 65 65 string m_Table; 66 66 public: 67 FailedInsert(string Table) : 67 FailedInsert(string Table) : 68 68 transactor<>("FailedInsert"), 69 69 m_Table(Table) … … 113 113 pair<int,int> Before; 114 114 C.perform(CountEvents(Table, Before)); 115 if (Before.second) 116 throw runtime_error("Table already has an event for " + 115 if (Before.second) 116 throw runtime_error("Table already has an event for " + 117 117 to_string(BoringYear) + ", " 118 118 "cannot run."); … … 134 134 if (After != Before) 135 135 throw logic_error("Event counts changed from " 136 "{" + to_string(Before.first) + "," + 136 "{" + to_string(Before.first) + "," + 137 137 to_string(Before.second) + "} " 138 138 "to " -
trunk/test/test014.cxx
r822 r1138 10 10 11 11 12 // Define a pqxx::noticer to process warnings generated by the database 12 // Define a pqxx::noticer to process warnings generated by the database 13 13 // connection and (in this case) pass them to cerr. This is optional. 14 14 namespace … … 66 66 67 67 // Begin a "non-transaction" acting on our current connection. This is 68 // really all the transactional integrity we need since we're only 68 // really all the transactional integrity we need since we're only 69 69 // performing one query which does not modify the database. 70 70 nontransaction T(C, "test14"); -
trunk/test/test016.cxx
r622 r1138 25 25 26 26 // Begin a "non-transaction" acting on our current connection. This is 27 // really all the transactional integrity we need since we're only 27 // really all the transactional integrity we need since we're only 28 28 // performing one query which does not modify the database. 29 29 robusttransaction<> T(C, "test16"); -
trunk/test/test018.cxx
r1069 r1138 40 40 pair<int, int> &m_Results; 41 41 public: 42 CountEvents(string Table, pair<int,int> &Results) : 43 transactor<nontransaction>("CountEvents"), 44 m_Table(Table), 45 m_Results(Results) 42 CountEvents(string Table, pair<int,int> &Results) : 43 transactor<nontransaction>("CountEvents"), 44 m_Table(Table), 45 m_Results(Results) 46 46 { 47 47 } … … 67 67 static string LastReason; 68 68 public: 69 FailedInsert(string Table) : 70 transactor<argument_type>("FailedInsert"), 69 FailedInsert(string Table) : 70 transactor<argument_type>("FailedInsert"), 71 71 m_Table(Table) 72 72 { … … 85 85 if (Reason != LastReason) 86 86 { 87 cout << "(Expected) Transactor " << Name() << " failed: " 87 cout << "(Expected) Transactor " << Name() << " failed: " 88 88 << Reason << endl; 89 89 LastReason = Reason; … … 117 117 pair<int,int> Before; 118 118 C.perform(CountEvents(Table, Before)); 119 if (Before.second) 120 throw runtime_error("Table already has an event for " + 119 if (Before.second) 120 throw runtime_error("Table already has an event for " + 121 121 to_string(BoringYear) + ", " 122 122 "cannot run."); … … 138 138 if (After != Before) 139 139 throw logic_error("Event counts changed from " 140 "{" + to_string(Before.first) + "," + 140 "{" + to_string(Before.first) + "," + 141 141 to_string(Before.second) + "} " 142 142 "to " -
trunk/test/test019.cxx
r898 r1138 15 15 16 16 17 // Cursor test program for libpqxx. Read table through a cursor, scanning back 17 // Cursor test program for libpqxx. Read table through a cursor, scanning back 18 18 // and forth and checking for consistent results. 19 19 // … … 60 60 R.at(0).at(0).to(Rows); 61 61 62 if (Rows <= 10) 62 if (Rows <= 10) 63 63 throw runtime_error("Not enough rows in '" + Table + "' " 64 64 "for serious testing. Sorry."); … … 123 123 124 124 R = Cur.fetch(cursor_base::next()); 125 if (R.size() != 1) 125 if (R.size() != 1) 126 126 throw logic_error("NEXT: wanted 1 row, got " + to_string(R.size())); 127 127 const string Row = R[0][0].c_str(); -
trunk/test/test020.cxx
r428 r1138 11 11 12 12 // Test program for libpqxx. Modify the database inside a NonTransaction, and 13 // verify that the change gets made regardless of whether the NonTransaction is 13 // verify that the change gets made regardless of whether the NonTransaction is 14 14 // eventually committed or aborted. 15 15 // … … 21 21 // backend running on host foo.bar.net, logging in as user smith. 22 22 // 23 // The table argument is the table being modified. This defaults to 23 // The table argument is the table being modified. This defaults to 24 24 // "pqxxevents". 25 25 // It is assumed to consist of an integer key called year, and a string. … … 46 46 "WHERE year=" + to_string(BoringYear)).c_str()) ); 47 47 if (R.size() != 0) 48 throw runtime_error("There is already a record for " + 48 throw runtime_error("There is already a record for " + 49 49 to_string(BoringYear) + ". " 50 50 "Can't run test."); … … 72 72 "WHERE year=" + to_string(BoringYear)).c_str()); 73 73 if (R.size() != 1) 74 throw runtime_error("Expected to find 1 record for " + 74 throw runtime_error("Expected to find 1 record for " + 75 75 to_string(BoringYear) + ", found " + 76 76 to_string(R.size()) + ". " -
trunk/test/test022.cxx
r898 r1138 13 13 14 14 // Test program for libpqxx. Read list of tables through a cursor, starting 15 // with a deferred connection. Default blocksize is 1; use 0 to read all rows 15 // with a deferred connection. Default blocksize is 1; use 0 to read all rows 16 16 // at once. Negative blocksizes read backwards. 17 17 // -
trunk/test/test023.cxx
r1040 r1138 36 36 if (be_pid != Conn().backendpid()) 37 37 throw logic_error("Expected notification from backend process " + 38 to_string(Conn().backendpid()) + 38 to_string(Conn().backendpid()) + 39 39 ", but got one from " + 40 40 to_string(be_pid)); … … 53 53 54 54 public: 55 explicit Notify(string TrigName) : 55 explicit Notify(string TrigName) : 56 56 transactor<>("Notifier"), m_Trigger(TrigName) { } 57 57 … … 99 99 cout << endl; 100 100 101 if (!Trig.Done()) 101 if (!Trig.Done()) 102 102 { 103 103 cout << "No notification received!" << endl; -
trunk/test/test024.cxx
r489 r1138 10 10 11 11 12 // Test program for libpqxx. Write a predetermined data set to a table using a 13 // tablewriter on a deferred connection. This data will be used by subsequent 12 // Test program for libpqxx. Write a predetermined data set to a table using a 13 // tablewriter on a deferred connection. This data will be used by subsequent 14 14 // tests. Any data previously in the table will be deleted. 15 15 // … … 48 48 T.exec("CREATE TABLE " + TableName + "(year INTEGER, event VARCHAR)"); 49 49 50 // NOTE: start a nested block here to ensure that our stream W is closed 51 // before we attempt to commit our transaction T. Otherwise we might end 50 // NOTE: start a nested block here to ensure that our stream W is closed 51 // before we attempt to commit our transaction T. Otherwise we might end 52 52 // up committing T before all data going into W had been written. 53 53 { … … 74 74 75 75 // Insert tuple of data using "begin" and "end" abstraction 76 for (int i=0; CData[i][0]; ++i) 76 for (int i=0; CData[i][0]; ++i) 77 77 W.insert(&CData[i][0], &CData[i][2]); 78 78 -
trunk/test/test025.cxx
r1040 r1138 13 13 14 14 15 // Test program for libpqxx. Copy a table from one database connection to 15 // Test program for libpqxx. Copy a table from one database connection to 16 16 // another using a tablereader and a tablewriter. Any data already in the 17 17 // destination table is overwritten. Lazy connections are used. … … 21 21 // Where the connect-string is a set of connection options in Postgresql's 22 22 // PQconnectdb() format, eg. "dbname=template1" to select from a database 23 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 23 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 24 24 // running on host foo.bar.net, logging in as user smith. 25 25 // … … 28 28 // specified explicitly on the command line) connects to. 29 29 // 30 // The default origin table name is "pqxxorgevents"; the default destination 30 // The default origin table name is "pqxxorgevents"; the default destination 31 31 // table is "pqxxevents". 32 32 … … 98 98 CheckState(Org); 99 99 100 // Copy table Org into table Dst. This transfers all the data to the 100 // Copy table Org into table Dst. This transfers all the data to the 101 101 // frontend and back to the backend. Since in this example Ord and Dst are 102 102 // really in the same database, we'd do this differently in real life; a … … 132 132 // Set up a transaction to access the original table from 133 133 work orgTrans(orgC, "test25org"); 134 134 135 135 // Attempt to create table. Ignore errors, as they're probably one of: 136 136 // (1) Table already exists--fine with us … … 139 139 { 140 140 dstC.perform(CreateTable(dstTable)); 141 } 141 } 142 142 catch (const sql_error &) 143 143 { -
trunk/test/test026.cxx
r1040 r1138 21 21 // backend running on host foo.bar.net, logging in as user smith. 22 22 // 23 // This assumes the existence of a database table "pqxxevents" containing a 24 // 2-digit "year" field, which is extended to a 4-digit format by assuming all 25 // year numbers of 70 or higher are in the 20th century, and all others in the 23 // This assumes the existence of a database table "pqxxevents" containing a 24 // 2-digit "year" field, which is extended to a 4-digit format by assuming all 25 // year numbers of 70 or higher are in the 20th century, and all others in the 26 26 // 21st, and that no years before 1970 are possible. 27 27 … … 66 66 67 67 // Read year, and if it is non-null, note its converted value 68 if (r[0].to(Y)) 68 if (r[0].to(Y)) 69 69 m_Conversions[Y] = To4Digits(Y); 70 70 } -
trunk/test/test027.cxx
r328 r1138 11 11 12 12 13 // Test program for libpqxx. Read a table using a tablereader, which may be 13 // Test program for libpqxx. Read a table using a tablereader, which may be 14 14 // faster than a conventional query, on a lazy connection. 15 15 // … … 18 18 // Where connect-string is a set of connection options in Postgresql's 19 19 // PQconnectdb() format, eg. "dbname=template1" to select from a database 20 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 20 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 21 21 // running on host foo.bar.net, logging in as user smith. 22 22 // 23 23 // The default table name is "pqxxevents" as used by other test programs. 24 24 // PostgreSQL currently implements pg_tables as a view, which cannot be read by 25 // using the COPY command. Otherwise, pg_tables would have made a better 25 // using the COPY command. Otherwise, pg_tables would have made a better 26 26 // default value here. 27 27 int main(int argc, char *argv[]) -
trunk/test/test028.cxx
r421 r1138 19 19 // Where the connect-string is a set of connection options in Postgresql's 20 20 // PQconnectdb() format, eg. "dbname=template1" to select from a database 21 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 21 // called template1, or "host=foo.bar.net user=smith" to connect to a backend 22 22 // running on host foo.bar.net, logging in as user smith. 23 23 // … … 75 75 76 76 if (Rows != Contents.size()) 77 throw runtime_error("Found " + 78 string(Count[0][0].c_str()) + 77 throw runtime_error("Found " + 78 string(Count[0][0].c_str()) + 79 79 " rows in table--after writing " + 80 80 to_string(Contents.size()) + -
trunk/test/test029.cxx
r421 r1138 12 12 13 13 14 // Test program for libpqxx. Open connection to database, start a transaction, 14 // Test program for libpqxx. Open connection to database, start a transaction, 15 15 // abort it, and verify that it "never happened." Use lazy connection. 16 16 // … … 38 38 { 39 39 const string EventsQuery = "SELECT count(*) FROM " + Table; 40 const string BoringQuery = EventsQuery + 41 " WHERE year=" + 40 const string BoringQuery = EventsQuery + 41 " WHERE year=" + 42 42 to_string(BoringYear); 43 43 int EventsCount = 0, … … 104 104 throw runtime_error("Expected to find one event for " + 105 105 to_string(BoringYear) + ", " 106 "found " + 106 "found " + 107 107 to_string(Recount.second)); 108 108 109 109 if (Recount.first != EventCounts.first+1) 110 throw runtime_error("Number of events changed from " + 110 throw runtime_error("Number of events changed from " + 111 111 to_string(EventCounts.first) + " " 112 112 "to " + … … 123 123 124 124 // Now check that we're back in the original state. Note that this may go 125 // wrong if somebody managed to change the table between our two 125 // wrong if somebody managed to change the table between our two 126 126 // transactions. 127 127 work Checkup(C, "Checkup"); … … 129 129 const pair<int,int> NewEvents = CountEvents(Checkup); 130 130 if (NewEvents.first != EventCounts.first) 131 throw runtime_error("Number of events changed from " + 131 throw runtime_error("Number of events changed from " + 132 132 to_string(EventCounts.first) + " " 133 133 "to " + -
trunk/test/test030.cxx
r421 r1138 43 43 44 44 if (R[0].column_number(N) != R.column_number(N)) 45 throw logic_error("tuple::column_number(" + N + ") is " + 45 throw logic_error("tuple::column_number(" + N + ") is " + 46 46 to_string(R[0].column_number(N)) + ", " 47 47 "but result::column_number(" + N + ") is " + … … 49 49 50 50 if (R[0].column_number(N.c_str()) != c) 51 throw logic_error("Expected column '" + N + 51 throw logic_error("Expected column '" + N + 52 52 "' to be no. " + to_string(c) + ", " 53 53 "but it was no. " + to_string(R.column_number(N))); … … 57 57 if (!R.empty()) 58 58 { 59 if (R[0].rownumber() != 0) 59 if (R[0].rownumber() != 0) 60 60 throw logic_error("Row 0 said it was row " + R[0].rownumber()); 61 61 … … 85 85 if (size_t(R[0][c].size()) != strlen(R[0][c].c_str())) 86 86 throw logic_error("Field '" + N + "' " 87 "says its length is " + to_string(R[0][c].size()) + 87 "says its length is " + to_string(R[0][c].size()) + 88 88 ", " 89 89 "but its value is '" + R[0][c].c_str() + "' " -
trunk/test/test031.cxx
r421 r1138 26 26 namespace 27 27 { 28 template<typename VEC, typename VAL> 28 template<typename VEC, typename VAL> 29 29 void InitVector(VEC &V, typename VEC::size_type s, VAL val) 30 30 { … … 62 62 { 63 63 if ((*i).rownumber() != i->rownumber()) 64 throw logic_error("Inconsistent rows: operator*() says " + 64 throw logic_error("Inconsistent rows: operator*() says " + 65 65 to_string((*i).rownumber()) + ", " 66 66 "operator->() says " + … … 97 97 to_string(j-i)); 98 98 99 if ((j == i) || !(j != i) || 99 if ((j == i) || !(j != i) || 100 100 (j >= i) || (j > i) || 101 101 (i <= j) || (i < j) || … … 149 149 << R.column_name(f) << '\t' 150 150 << NullFields[f] << '\t' 151 << (SortedUp[f] ? 152 (SortedDown[f] ? "equal" : "up" ) : 151 << (SortedUp[f] ? 152 (SortedDown[f] ? "equal" : "up" ) : 153 153 (SortedDown[f] ? "down" : "no" ) ) 154 154 << endl; -
trunk/test/test032.cxx
r1040 r1138 43 43 pair<int, int> &m_Results; 44 44 public: 45 CountEvents(string Table, pair<int,int> &Results) : 45 CountEvents(string Table, pair<int,int> &Results) : 46 46 transactor<>("CountEvents"), m_Table(Table), m_Results(Results) {} 47 47
