|
1 /* |
|
2 This file is part of the WebKit open source project. |
|
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Library General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2 of the License, or (at your option) any later version. |
|
9 |
|
10 This library is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 Library General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Library General Public License |
|
16 along with this library; see the file COPYING.LIB. If not, write to |
|
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
18 Boston, MA 02110-1301, USA. |
|
19 */ |
|
20 |
|
21 #include "config.h" |
|
22 |
|
23 #if ENABLE(DATABASE) |
|
24 |
|
25 #include "JSSQLResultSet.h" |
|
26 |
|
27 #include "JSSQLResultSetRowList.h" |
|
28 #include "SQLResultSet.h" |
|
29 #include "SQLResultSetRowList.h" |
|
30 #include <runtime/JSNumberCell.h> |
|
31 #include <wtf/GetPtr.h> |
|
32 |
|
33 using namespace JSC; |
|
34 |
|
35 namespace WebCore { |
|
36 |
|
37 ASSERT_CLASS_FITS_IN_CELL(JSSQLResultSet); |
|
38 |
|
39 /* Hash table */ |
|
40 #if ENABLE(JIT) |
|
41 #define THUNK_GENERATOR(generator) , generator |
|
42 #else |
|
43 #define THUNK_GENERATOR(generator) |
|
44 #endif |
|
45 |
|
46 static const HashTableValue JSSQLResultSetTableValues[4] = |
|
47 { |
|
48 { "rows", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLResultSetRows), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
49 { "insertId", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLResultSetInsertId), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "rowsAffected", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLResultSetRowsAffected), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
52 }; |
|
53 |
|
54 #undef THUNK_GENERATOR |
|
55 static JSC_CONST_HASHTABLE HashTable JSSQLResultSetTable = { 9, 7, JSSQLResultSetTableValues, 0 }; |
|
56 /* Hash table for prototype */ |
|
57 #if ENABLE(JIT) |
|
58 #define THUNK_GENERATOR(generator) , generator |
|
59 #else |
|
60 #define THUNK_GENERATOR(generator) |
|
61 #endif |
|
62 |
|
63 static const HashTableValue JSSQLResultSetPrototypeTableValues[1] = |
|
64 { |
|
65 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
66 }; |
|
67 |
|
68 #undef THUNK_GENERATOR |
|
69 static JSC_CONST_HASHTABLE HashTable JSSQLResultSetPrototypeTable = { 1, 0, JSSQLResultSetPrototypeTableValues, 0 }; |
|
70 static const HashTable* getJSSQLResultSetPrototypeTable(ExecState* exec) |
|
71 { |
|
72 return getHashTableForGlobalData(exec->globalData(), &JSSQLResultSetPrototypeTable); |
|
73 } |
|
74 const ClassInfo JSSQLResultSetPrototype::s_info = { "SQLResultSetPrototype", 0, 0, getJSSQLResultSetPrototypeTable }; |
|
75 |
|
76 JSObject* JSSQLResultSetPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
77 { |
|
78 return getDOMPrototype<JSSQLResultSet>(exec, globalObject); |
|
79 } |
|
80 |
|
81 static const HashTable* getJSSQLResultSetTable(ExecState* exec) |
|
82 { |
|
83 return getHashTableForGlobalData(exec->globalData(), &JSSQLResultSetTable); |
|
84 } |
|
85 const ClassInfo JSSQLResultSet::s_info = { "SQLResultSet", 0, 0, getJSSQLResultSetTable }; |
|
86 |
|
87 JSSQLResultSet::JSSQLResultSet(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<SQLResultSet> impl) |
|
88 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
89 , m_impl(impl) |
|
90 { |
|
91 } |
|
92 |
|
93 JSSQLResultSet::~JSSQLResultSet() |
|
94 { |
|
95 forgetDOMObject(this, impl()); |
|
96 } |
|
97 |
|
98 JSObject* JSSQLResultSet::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
99 { |
|
100 return new (exec) JSSQLResultSetPrototype(globalObject, JSSQLResultSetPrototype::createStructure(globalObject->objectPrototype())); |
|
101 } |
|
102 |
|
103 bool JSSQLResultSet::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
104 { |
|
105 return getStaticValueSlot<JSSQLResultSet, Base>(exec, getJSSQLResultSetTable(exec), this, propertyName, slot); |
|
106 } |
|
107 |
|
108 bool JSSQLResultSet::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
109 { |
|
110 return getStaticValueDescriptor<JSSQLResultSet, Base>(exec, getJSSQLResultSetTable(exec), this, propertyName, descriptor); |
|
111 } |
|
112 |
|
113 JSValue jsSQLResultSetRows(ExecState* exec, JSValue slotBase, const Identifier&) |
|
114 { |
|
115 JSSQLResultSet* castedThis = static_cast<JSSQLResultSet*>(asObject(slotBase)); |
|
116 UNUSED_PARAM(exec); |
|
117 SQLResultSet* imp = static_cast<SQLResultSet*>(castedThis->impl()); |
|
118 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->rows())); |
|
119 return result; |
|
120 } |
|
121 |
|
122 JSValue jsSQLResultSetInsertId(ExecState* exec, JSValue slotBase, const Identifier&) |
|
123 { |
|
124 JSSQLResultSet* castedThis = static_cast<JSSQLResultSet*>(asObject(slotBase)); |
|
125 ExceptionCode ec = 0; |
|
126 SQLResultSet* imp = static_cast<SQLResultSet*>(castedThis->impl()); |
|
127 JSC::JSValue result = jsNumber(exec, imp->insertId(ec)); |
|
128 setDOMException(exec, ec); |
|
129 return result; |
|
130 } |
|
131 |
|
132 JSValue jsSQLResultSetRowsAffected(ExecState* exec, JSValue slotBase, const Identifier&) |
|
133 { |
|
134 JSSQLResultSet* castedThis = static_cast<JSSQLResultSet*>(asObject(slotBase)); |
|
135 UNUSED_PARAM(exec); |
|
136 SQLResultSet* imp = static_cast<SQLResultSet*>(castedThis->impl()); |
|
137 JSValue result = jsNumber(exec, imp->rowsAffected()); |
|
138 return result; |
|
139 } |
|
140 |
|
141 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SQLResultSet* object) |
|
142 { |
|
143 return getDOMObjectWrapper<JSSQLResultSet>(exec, globalObject, object); |
|
144 } |
|
145 SQLResultSet* toSQLResultSet(JSC::JSValue value) |
|
146 { |
|
147 return value.inherits(&JSSQLResultSet::s_info) ? static_cast<JSSQLResultSet*>(asObject(value))->impl() : 0; |
|
148 } |
|
149 |
|
150 } |
|
151 |
|
152 #endif // ENABLE(DATABASE) |