| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sql/connection.h" | 5 #include "sql/connection.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 namespace sql { | 45 namespace sql { |
| 46 | 46 |
| 47 bool StatementID::operator<(const StatementID& other) const { | 47 bool StatementID::operator<(const StatementID& other) const { |
| 48 if (number_ != other.number_) | 48 if (number_ != other.number_) |
| 49 return number_ < other.number_; | 49 return number_ < other.number_; |
| 50 return strcmp(str_, other.str_) < 0; | 50 return strcmp(str_, other.str_) < 0; |
| 51 } | 51 } |
| 52 | 52 |
| 53 ErrorDelegate::ErrorDelegate() { | |
| 54 } | |
| 55 | |
| 56 ErrorDelegate::~ErrorDelegate() { | 53 ErrorDelegate::~ErrorDelegate() { |
| 57 } | 54 } |
| 58 | 55 |
| 59 Connection::StatementRef::StatementRef() | 56 Connection::StatementRef::StatementRef() |
| 60 : connection_(NULL), | 57 : connection_(NULL), |
| 61 stmt_(NULL) { | 58 stmt_(NULL) { |
| 62 } | 59 } |
| 63 | 60 |
| 64 Connection::StatementRef::StatementRef(sqlite3_stmt* stmt) | 61 Connection::StatementRef::StatementRef(sqlite3_stmt* stmt) |
| 65 : connection_(NULL), | 62 : connection_(NULL), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 95 connection_ = NULL; // The connection may be getting deleted. | 92 connection_ = NULL; // The connection may be getting deleted. |
| 96 } | 93 } |
| 97 | 94 |
| 98 Connection::Connection() | 95 Connection::Connection() |
| 99 : db_(NULL), | 96 : db_(NULL), |
| 100 page_size_(0), | 97 page_size_(0), |
| 101 cache_size_(0), | 98 cache_size_(0), |
| 102 exclusive_locking_(false), | 99 exclusive_locking_(false), |
| 103 transaction_nesting_(0), | 100 transaction_nesting_(0), |
| 104 needs_rollback_(false), | 101 needs_rollback_(false), |
| 105 in_memory_(false) { | 102 in_memory_(false), |
| 103 error_delegate_(NULL) { |
| 106 } | 104 } |
| 107 | 105 |
| 108 Connection::~Connection() { | 106 Connection::~Connection() { |
| 109 Close(); | 107 Close(); |
| 110 } | 108 } |
| 111 | 109 |
| 112 bool Connection::Open(const FilePath& path) { | 110 bool Connection::Open(const FilePath& path) { |
| 113 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
| 114 return OpenInternal(WideToUTF8(path.value())); | 112 return OpenInternal(WideToUTF8(path.value())); |
| 115 #elif defined(OS_POSIX) | 113 #elif defined(OS_POSIX) |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 603 |
| 606 int Connection::OnSqliteError(int err, sql::Statement *stmt) { | 604 int Connection::OnSqliteError(int err, sql::Statement *stmt) { |
| 607 if (error_delegate_.get()) | 605 if (error_delegate_.get()) |
| 608 return error_delegate_->OnError(err, this, stmt); | 606 return error_delegate_->OnError(err, this, stmt); |
| 609 // The default handling is to assert on debug and to ignore on release. | 607 // The default handling is to assert on debug and to ignore on release. |
| 610 DLOG(FATAL) << GetErrorMessage(); | 608 DLOG(FATAL) << GetErrorMessage(); |
| 611 return err; | 609 return err; |
| 612 } | 610 } |
| 613 | 611 |
| 614 } // namespace sql | 612 } // namespace sql |
| OLD | NEW |