OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 13 matching lines...) Expand all Loading... |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "modules/webdatabase/SQLResultSet.h" | 30 #include "modules/webdatabase/SQLResultSet.h" |
31 | 31 |
32 #include "bindings/v8/ExceptionState.h" | 32 #include "bindings/v8/ExceptionState.h" |
33 #include "core/dom/ExceptionCode.h" | 33 #include "core/dom/ExceptionCode.h" |
| 34 #include "heap/Handle.h" |
34 | 35 |
35 namespace WebCore { | 36 namespace WebCore { |
36 | 37 |
37 SQLResultSet::SQLResultSet() | 38 SQLResultSet::SQLResultSet() |
38 : m_rows(SQLResultSetRowList::create()) | 39 : m_rows(SQLResultSetRowList::create()) |
39 , m_insertId(0) | 40 , m_insertId(0) |
| 41 , m_rowsAffected(0) |
40 , m_insertIdSet(false) | 42 , m_insertIdSet(false) |
41 , m_rowsAffected(0) | 43 , m_isValid(false) |
42 { | 44 { |
43 ScriptWrappable::init(this); | 45 ScriptWrappable::init(this); |
44 } | 46 } |
45 | 47 |
| 48 void SQLResultSet::trace(Visitor* visitor) |
| 49 { |
| 50 visitor->trace(m_rows); |
| 51 } |
| 52 |
46 int64_t SQLResultSet::insertId(ExceptionState& exceptionState) const | 53 int64_t SQLResultSet::insertId(ExceptionState& exceptionState) const |
47 { | 54 { |
48 // 4.11.4 - Return the id of the last row inserted as a result of the query | 55 // 4.11.4 - Return the id of the last row inserted as a result of the query |
49 // If the query didn't result in any rows being added, raise an InvalidAcces
sError exception | 56 // If the query didn't result in any rows being added, raise an InvalidAcces
sError exception |
50 if (m_insertIdSet) | 57 if (m_insertIdSet) |
51 return m_insertId; | 58 return m_insertId; |
52 | 59 |
53 exceptionState.throwDOMException(InvalidAccessError, "The query didn't resul
t in any rows being added."); | 60 exceptionState.throwDOMException(InvalidAccessError, "The query didn't resul
t in any rows being added."); |
54 return -1; | 61 return -1; |
55 } | 62 } |
(...skipping 12 matching lines...) Expand all Loading... |
68 { | 75 { |
69 ASSERT(!m_insertIdSet); | 76 ASSERT(!m_insertIdSet); |
70 | 77 |
71 m_insertId = id; | 78 m_insertId = id; |
72 m_insertIdSet = true; | 79 m_insertIdSet = true; |
73 } | 80 } |
74 | 81 |
75 void SQLResultSet::setRowsAffected(int count) | 82 void SQLResultSet::setRowsAffected(int count) |
76 { | 83 { |
77 m_rowsAffected = count; | 84 m_rowsAffected = count; |
| 85 m_isValid = true; |
78 } | 86 } |
79 | 87 |
80 } | 88 } |
OLD | NEW |