diff options
author | Pixel <pixel@nobis-crew.org> | 2009-04-14 15:15:32 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2009-04-14 16:46:25 -0700 |
commit | 2b19076a9f4325b42316983a0317f87a40864e78 (patch) | |
tree | 3804953e15b16e7e4ad385cbce16b1344d487a76 /lib/LuaOCCI.cc | |
parent | 5f063693f29ba58c4253f8b1f602a6e826e94e85 (diff) |
Adding a hack to have getFieldsInfo for OCCI's ResultSets; partial support of the MetaData call that is.
Diffstat (limited to 'lib/LuaOCCI.cc')
-rw-r--r-- | lib/LuaOCCI.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/LuaOCCI.cc b/lib/LuaOCCI.cc index 8c02e9f..df5ea66 100644 --- a/lib/LuaOCCI.cc +++ b/lib/LuaOCCI.cc @@ -1165,6 +1165,7 @@ enum EncapOCCI_ResultSet_methods_t { RESULTSET_STATUS, RESULTSET_SETBLOB, + RESULTSET_GETFIELDSINFO, }; struct lua_functypes_t EncapOCCI_ResultSet_methods[] = { @@ -1202,6 +1203,7 @@ struct lua_functypes_t EncapOCCI_ResultSet_methods[] = { { RESULTSET_STATUS, "status", 0, 0, { } }, { RESULTSET_SETBLOB, "setBlob", 2, 2, { BLUA_NUMBER, BLUA_OBJECT } }, + { RESULTSET_GETFIELDSINFO, "getFieldsInfo", 0, 0, { } }, { -1, 0, 0, 0, 0 }, }; @@ -1245,6 +1247,7 @@ class sLua_EncapOCCI_ResultSet : public Base { DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_STATUS); DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_SETBLOB); + DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_GETFIELDSINFO); private: static int EncapOCCI_ResultSet_proceed(Lua * L, int n, EncapOCCI_ResultSet * obj, int caller); @@ -1289,6 +1292,7 @@ void LuaOCCI_ResultSet::pushmembers(Lua * L) { PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_STATUS); PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_SETBLOB); + PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_GETFIELDSINFO); } void LuaOCCI_ResultSet::pushstatics(Lua * L) throw (GeneralException) { @@ -1511,6 +1515,23 @@ int sLua_EncapOCCI_ResultSet::EncapOCCI_ResultSet_proceed_unprotected(Lua * L, i blob.closeStream(outstream); blob.close(); } + break; + case RESULTSET_GETFIELDSINFO: + { + std::vector<MetaData> meta = rset->getColumnListMetaData(); + L->push((lua_Number) meta.size()); + + int c = 1; + L->newtable(); + for (std::vector<MetaData>::iterator i = meta.begin(); i != meta.end(); i++, c++) { + L->push((lua_Number) c); + L->push(String(i->getString(MetaData::ATTR_NAME).c_str())); + L->settable(); + } + + r = 2; + } + break; } return r; |