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 11 matching lines...) Expand all Loading... |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
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" | |
33 #include "core/dom/ExceptionCode.h" | 32 #include "core/dom/ExceptionCode.h" |
34 | 33 |
35 namespace WebCore { | 34 namespace WebCore { |
36 | 35 |
37 static unsigned const MaxErrorCode = 2; | 36 static unsigned const MaxErrorCode = 2; |
38 | 37 |
39 SQLResultSet::SQLResultSet() | 38 SQLResultSet::SQLResultSet() |
40 : m_rows(SQLResultSetRowList::create()) | 39 : m_rows(SQLResultSetRowList::create()) |
41 , m_insertId(0) | 40 , m_insertId(0) |
42 , m_insertIdSet(false) | 41 , m_insertIdSet(false) |
43 , m_rowsAffected(0) | 42 , m_rowsAffected(0) |
44 { | 43 { |
45 ScriptWrappable::init(this); | 44 ScriptWrappable::init(this); |
46 } | 45 } |
47 | 46 |
48 int64_t SQLResultSet::insertId(ExceptionState& es) const | 47 int64_t SQLResultSet::insertId(ExceptionCode& ec) const |
49 { | 48 { |
50 // 4.11.4 - Return the id of the last row inserted as a result of the query | 49 // 4.11.4 - Return the id of the last row inserted as a result of the query |
51 // If the query didn't result in any rows being added, raise an InvalidAcces
sError exception | 50 // If the query didn't result in any rows being added, raise an InvalidAcces
sError exception |
52 if (m_insertIdSet) | 51 if (m_insertIdSet) |
53 return m_insertId; | 52 return m_insertId; |
54 | 53 |
55 es.throwDOMException(InvalidAccessError); | 54 ec = InvalidAccessError; |
56 return -1; | 55 return -1; |
57 } | 56 } |
58 | 57 |
59 int SQLResultSet::rowsAffected() const | 58 int SQLResultSet::rowsAffected() const |
60 { | 59 { |
61 return m_rowsAffected; | 60 return m_rowsAffected; |
62 } | 61 } |
63 | 62 |
64 SQLResultSetRowList* SQLResultSet::rows() const | 63 SQLResultSetRowList* SQLResultSet::rows() const |
65 { | 64 { |
66 return m_rows.get(); | 65 return m_rows.get(); |
67 } | 66 } |
68 | 67 |
69 void SQLResultSet::setInsertId(int64_t id) | 68 void SQLResultSet::setInsertId(int64_t id) |
70 { | 69 { |
71 ASSERT(!m_insertIdSet); | 70 ASSERT(!m_insertIdSet); |
72 | 71 |
73 m_insertId = id; | 72 m_insertId = id; |
74 m_insertIdSet = true; | 73 m_insertIdSet = true; |
75 } | 74 } |
76 | 75 |
77 void SQLResultSet::setRowsAffected(int count) | 76 void SQLResultSet::setRowsAffected(int count) |
78 { | 77 { |
79 m_rowsAffected = count; | 78 m_rowsAffected = count; |
80 } | 79 } |
81 | 80 |
82 } | 81 } |
OLD | NEW |