| OLD | NEW |
| 1 // Copyright 2008, Google Inc. | 1 // Copyright 2008, Google Inc. |
| 2 // | 2 // |
| 3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions are met: | 4 // modification, are permitted provided that the following conditions are met: |
| 5 // | 5 // |
| 6 // 1. Redistributions of source code must retain the above copyright notice, | 6 // 1. Redistributions of source code must retain the above copyright notice, |
| 7 // this list of conditions and the following disclaimer. | 7 // this list of conditions and the following disclaimer. |
| 8 // 2. Redistributions in binary form must reproduce the above copyright notice, | 8 // 2. Redistributions in binary form must reproduce the above copyright notice, |
| 9 // this list of conditions and the following disclaimer in the documentation | 9 // this list of conditions and the following disclaimer in the documentation |
| 10 // and/or other materials provided with the distribution. | 10 // and/or other materials provided with the distribution. |
| 11 // 3. Neither the name of Google Inc. nor the names of its contributors may be | 11 // 3. Neither the name of Google Inc. nor the names of its contributors may be |
| 12 // used to endorse or promote products derived from this software without | 12 // used to endorse or promote products derived from this software without |
| 13 // specific prior written permission. | 13 // specific prior written permission. |
| 14 // | 14 // |
| 15 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | 15 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 16 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 16 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 17 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | 17 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
| 18 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 18 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 19 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 21 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 21 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 22 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 22 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 23 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 23 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 24 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | 25 |
| 26 #include "gears/database2/result_set2.h" | 26 #include "gears/database2/result_set2.h" |
| 27 | 27 |
| 28 #include "gears/base/common/dispatcher.h" | 28 #include "gears/base/common/dispatcher.h" |
| 29 #include "gears/base/common/js_types.h" | 29 #include "gears/base/common/js_types.h" |
| 30 #include "gears/base/common/js_runner.h" | 30 #include "gears/base/common/js_runner.h" |
| 31 #include "gears/base/common/module_wrapper.h" | 31 #include "gears/base/common/module_wrapper.h" |
| 32 | 32 |
| 33 DECLARE_GEARS_WRAPPER(Database2ResultSet); | 33 DECLARE_GEARS_WRAPPER(Database2ResultSet); |
| 34 | 34 |
| 35 template<> | 35 template<> |
| 36 void Dispatcher<Database2ResultSet>::Init() { | 36 void Dispatcher<Database2ResultSet>::Init() { |
| 37 RegisterProperty("insertId", &Database2ResultSet::GetInsertId, NULL); | 37 RegisterProperty("insertId", &Database2ResultSet::GetInsertId, NULL); |
| 38 RegisterProperty("rowsAffected", &Database2ResultSet::GetRowsAffected, NULL); | 38 RegisterProperty("rowsAffected", &Database2ResultSet::GetRowsAffected, NULL); |
| 39 RegisterProperty("rows", &Database2ResultSet::GetRows, NULL); | 39 RegisterProperty("rows", &Database2ResultSet::GetRows, NULL); |
| 40 } |
| 41 |
| 42 |
| 43 // static |
| 44 bool Database2ResultSet::Create(const ModuleImplBaseClass *sibling, |
| 45 scoped_refptr<Database2ResultSet> *instance) { |
| 46 assert(instance); |
| 47 return CreateModule<Database2ResultSet>(sibling->GetJsRunner(), instance) |
| 48 && instance->get()->InitBaseFromSibling(sibling); |
| 40 } | 49 } |
| 41 | 50 |
| 42 void Database2ResultSet::GetInsertId(JsCallContext *context) { | 51 void Database2ResultSet::GetInsertId(JsCallContext *context) { |
| 43 // stub | 52 // stub |
| 44 context->SetReturnValue(JSPARAM_INT, 0); | 53 context->SetReturnValue(JSPARAM_INT, 0); |
| 45 } | 54 } |
| 46 | 55 |
| 47 void Database2ResultSet::GetRowsAffected(JsCallContext *context) { | 56 void Database2ResultSet::GetRowsAffected(JsCallContext *context) { |
| 48 // stub | 57 // stub |
| 49 context->SetReturnValue(JSPARAM_INT, 0); | 58 context->SetReturnValue(JSPARAM_INT, 0); |
| 50 } | 59 } |
| 51 | 60 |
| 52 void Database2ResultSet::GetRows(JsCallContext *context) { | 61 void Database2ResultSet::GetRows(JsCallContext *context) { |
| 53 // stub | 62 // stub |
| 54 // return nothing for now | 63 // return nothing for now |
| 55 } | 64 } |
| 56 | |
| 57 bool Database2ResultSet::Create(const ModuleImplBaseClass *sibling, | |
| 58 scoped_refptr<Database2ResultSet> *instance) { | |
| 59 assert(instance); | |
| 60 return CreateModule<Database2ResultSet>(sibling->GetJsRunner(), instance) | |
| 61 && instance->get()->InitBaseFromSibling(sibling); | |
| 62 } | |
| OLD | NEW |