~mysql/mysql-connector-cpp/trunk

« back to all changes in this revision

Viewing changes to test/unit/classes/savepoint.cpp

  • Committer: Hemant Dangi
  • Date: 2014-12-17 16:28:39 UTC
  • Revision ID: hemant.dangi@oracle.com-20141217162839-sdbpj3fcwn5gxjxh
Bug #75251: Add C++11 support and replace (deprecated in C++11) auto_ptr

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
 
2
Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
3
3
 
4
4
The MySQL Connector/C++ is licensed under the terms of the GPLv2
5
5
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
32
32
#include "savepoint.h"
33
33
#include <stdlib.h>
34
34
 
 
35
#include <boost/scoped_ptr.hpp>
 
36
 
35
37
namespace testsuite
36
38
{
37
39
namespace classes
44
46
  try
45
47
  {
46
48
    con->setAutoCommit(true);
47
 
    std::auto_ptr< sql::Savepoint > sp(con->setSavepoint("mysavepoint"));
 
49
    boost::scoped_ptr< sql::Savepoint > sp(con->setSavepoint("mysavepoint"));
48
50
    FAIL("You should not be able to set a savepoint in autoCommit mode");
49
51
  }
50
52
  catch (sql::SQLException &)
54
56
  try
55
57
  {
56
58
    con->setAutoCommit(false);
57
 
    std::auto_ptr< sql::Savepoint > sp(con->setSavepoint("mysavepoint"));
 
59
    boost::scoped_ptr< sql::Savepoint > sp(con->setSavepoint("mysavepoint"));
58
60
    try
59
61
    {
60
62
      sp->getSavepointId();
79
81
  try
80
82
  {
81
83
    con->setAutoCommit(false);
82
 
    std::auto_ptr< sql::Savepoint > sp(con->setSavepoint("mysavepoint"));
 
84
    boost::scoped_ptr< sql::Savepoint > sp(con->setSavepoint("mysavepoint"));
83
85
    ASSERT_EQUALS("mysavepoint", sp->getSavepointName());
84
86
    con->releaseSavepoint(sp.get());
85
87
  }