| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 finalize(); | 93 finalize(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 int SQLiteStatement::prepare() { | 96 int SQLiteStatement::prepare() { |
| 97 ASSERT(!m_isPrepared); | 97 ASSERT(!m_isPrepared); |
| 98 | 98 |
| 99 CString query = m_query.stripWhiteSpace().utf8(); | 99 CString query = m_query.stripWhiteSpace().utf8(); |
| 100 | 100 |
| 101 // Need to pass non-stack |const char*| and |sqlite3_stmt*| to avoid race | 101 // Need to pass non-stack |const char*| and |sqlite3_stmt*| to avoid race |
| 102 // with Oilpan stack scanning. | 102 // with Oilpan stack scanning. |
| 103 std::unique_ptr<const char*> tail = wrapUnique(new const char*); | 103 std::unique_ptr<const char*> tail = WTF::wrapUnique(new const char*); |
| 104 std::unique_ptr<sqlite3_stmt*> statement = wrapUnique(new sqlite3_stmt*); | 104 std::unique_ptr<sqlite3_stmt*> statement = WTF::wrapUnique(new sqlite3_stmt*); |
| 105 *tail = nullptr; | 105 *tail = nullptr; |
| 106 *statement = nullptr; | 106 *statement = nullptr; |
| 107 int error; | 107 int error; |
| 108 { | 108 { |
| 109 SafePointScope scope(BlinkGC::HeapPointersOnStack); | 109 SafePointScope scope(BlinkGC::HeapPointersOnStack); |
| 110 | 110 |
| 111 SQL_DVLOG(1) << "SQL - prepare - " << query.data(); | 111 SQL_DVLOG(1) << "SQL - prepare - " << query.data(); |
| 112 | 112 |
| 113 // Pass the length of the string including the null character to | 113 // Pass the length of the string including the null character to |
| 114 // sqlite3_prepare_v2; this lets SQLite avoid an extra string copy. | 114 // sqlite3_prepare_v2; this lets SQLite avoid an extra string copy. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 ASSERT(col >= 0); | 306 ASSERT(col >= 0); |
| 307 if (!m_statement) | 307 if (!m_statement) |
| 308 if (prepareAndStep() != SQLITE_ROW) | 308 if (prepareAndStep() != SQLITE_ROW) |
| 309 return 0; | 309 return 0; |
| 310 if (columnCount() <= col) | 310 if (columnCount() <= col) |
| 311 return 0; | 311 return 0; |
| 312 return sqlite3_column_int64(m_statement, col); | 312 return sqlite3_column_int64(m_statement, col); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace blink | 315 } // namespace blink |
| OLD | NEW |