Changeset 1664 for trunk/src

Show
Ignore:
Timestamp:
06/29/10 13:11:05 (2 months ago)
Author:
jtv
Message:

Added quote() for binarystring.

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/connection_base.cxx

    r1652 r1664  
    15061506 
    15071507 
     1508string pqxx::connection_base::quote_raw(const unsigned char str[], size_t len) 
     1509{ 
     1510  // Since 8.2, postgres prefers E'escape strings' for bytea. 
     1511  const string prefix((server_version() >= 80200) ? "E'" : "'"); 
     1512  return prefix + esc_raw(str, len) + "'::bytea"; 
     1513} 
     1514 
     1515 
     1516string pqxx::connection_base::quote(const binarystring &b) 
     1517{ 
     1518  return quote_raw(b.data(), b.size()); 
     1519} 
     1520 
     1521 
    15081522pqxx::internal::reactivation_avoidance_exemption:: 
    15091523  reactivation_avoidance_exemption( 
  • trunk/src/transaction_base.cxx

    r1591 r1664  
    99 *   represents a database transaction 
    1010 * 
    11  * Copyright (c) 2001-2009, Jeroen T. Vermeulen <jtv@xs4all.nl> 
     11 * Copyright (c) 2001-2010, Jeroen T. Vermeulen <jtv@xs4all.nl> 
    1212 * 
    1313 * See COPYING for copyright license.  If you did not receive a file called 
     
    224224{ 
    225225  const unsigned char *p = reinterpret_cast<const unsigned char *>(str.c_str()); 
    226   return m_Conn.esc_raw(p, str.size()); 
     226  return conn().esc_raw(p, str.size()); 
     227} 
     228 
     229 
     230string pqxx::transaction_base::quote_raw(const PGSTD::string &str) const 
     231{ 
     232  const unsigned char *p = reinterpret_cast<const unsigned char *>(str.c_str()); 
     233  return conn().quote_raw(p, str.size()); 
    227234} 
    228235