diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/LuaOCCI.cc | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/lib/LuaOCCI.cc b/lib/LuaOCCI.cc index df5ea66..17279db 100644 --- a/lib/LuaOCCI.cc +++ b/lib/LuaOCCI.cc @@ -464,7 +464,7 @@ enum EncapOCCI_Statement_methods_t { STATEMENT_GETBLOB, STATEMENT_GETBYTES, STATEMENT_GETCHARSET, -// STATEMENT_GETCLOB, + STATEMENT_GETCLOB, STATEMENT_GETCURRENTITERATION, STATEMENT_GETCURRENTSTREAMITERATION, STATEMENT_GETCURRENTSTREAMPARAM, @@ -548,6 +548,7 @@ struct lua_functypes_t EncapOCCI_Statement_methods[] = { { STATEMENT_GETBLOB, "getBlob", 1, 1, { BLUA_NUMBER } }, { STATEMENT_GETBYTES, "getBytes", 1, 1, { BLUA_NUMBER } }, { STATEMENT_GETCHARSET, "getCharSet", 1, 1, { BLUA_NUMBER } }, + { STATEMENT_GETCLOB, "getClob", 1, 1, { BLUA_NUMBER } }, { STATEMENT_GETCURRENTITERATION, "getCurrentIteration", 0, 0, { } }, { STATEMENT_GETCURRENTSTREAMITERATION, "getCurrentStreamIteration", 0, 0, { } }, { STATEMENT_GETCURRENTSTREAMPARAM, "getCurrentStreamParam", 0, 0, { } }, @@ -616,6 +617,7 @@ class sLua_EncapOCCI_Statement : public Base { DECLARE_METHOD(EncapOCCI_Statement, STATEMENT_GETBLOB); DECLARE_METHOD(EncapOCCI_Statement, STATEMENT_GETBYTES); DECLARE_METHOD(EncapOCCI_Statement, STATEMENT_GETCHARSET); + DECLARE_METHOD(EncapOCCI_Statement, STATEMENT_GETCLOB); DECLARE_METHOD(EncapOCCI_Statement, STATEMENT_GETCURRENTITERATION); DECLARE_METHOD(EncapOCCI_Statement, STATEMENT_GETCURRENTSTREAMITERATION); DECLARE_METHOD(EncapOCCI_Statement, STATEMENT_GETCURRENTSTREAMPARAM); @@ -685,6 +687,7 @@ void LuaOCCI_Statement::pushmembers(Lua * L) { PUSH_METHOD(EncapOCCI_Statement, STATEMENT_GETBLOB); PUSH_METHOD(EncapOCCI_Statement, STATEMENT_GETBYTES); PUSH_METHOD(EncapOCCI_Statement, STATEMENT_GETCHARSET); + PUSH_METHOD(EncapOCCI_Statement, STATEMENT_GETCLOB); PUSH_METHOD(EncapOCCI_Statement, STATEMENT_GETCURRENTITERATION); PUSH_METHOD(EncapOCCI_Statement, STATEMENT_GETCURRENTSTREAMITERATION); PUSH_METHOD(EncapOCCI_Statement, STATEMENT_GETCURRENTSTREAMPARAM); @@ -873,6 +876,23 @@ int sLua_EncapOCCI_Statement::EncapOCCI_Statement_proceed_unprotected(Lua * L, i L->push(stmt->getCharSet(L->tonumber(2)).c_str()); r = 1; break; + case STATEMENT_GETCLOB: + { + Clob clob = stmt->getClob(L->tonumber(2)); + Buffer * b = new Buffer(true); + int size = clob.length(); + char * x = (char *) malloc(size); + strm = clob.getStream(1, 0); + strm->readBuffer(x, size); + clob.closeStream(strm); + b->write(x, size); + free(x); + LuaBuffer o(b); + o.pushdestruct(L); + L->push((lua_Number) size); + } + r = 2; + break; case STATEMENT_GETCURRENTITERATION: L->push((lua_Number) stmt->getCurrentIteration()); r = 1; @@ -1126,7 +1146,7 @@ enum EncapOCCI_ResultSet_methods_t { RESULTSET_GETBLOB, RESULTSET_GETBYTES, RESULTSET_GETCHARSET, -// RESULTSET_GETCLOB, + RESULTSET_GETCLOB, // RESULTSET_GETCOLUMNLISTMETADATA, RESULTSET_GETCURRENTSTREAMCOLUMN, RESULTSET_GETCURRENTSTREAMROW, @@ -1176,6 +1196,7 @@ struct lua_functypes_t EncapOCCI_ResultSet_methods[] = { { RESULTSET_GETBLOB, "getBlob", 1, 1, { BLUA_NUMBER } }, { RESULTSET_GETBYTES, "getBytes", 1, 1, { BLUA_NUMBER } }, { RESULTSET_GETCHARSET, "getCharSet", 1, 1, { BLUA_NUMBER } }, + { RESULTSET_GETCLOB, "getClob", 1, 1, { BLUA_NUMBER } }, { RESULTSET_GETCURRENTSTREAMCOLUMN, "getCurrentStreamColumn", 0, 0, { } }, { RESULTSET_GETCURRENTSTREAMROW, "getCurrentStreamRow", 0, 0, { } }, { RESULTSET_GETCURSOR, "getCursor", 1, 1, { BLUA_NUMBER } }, @@ -1220,6 +1241,7 @@ class sLua_EncapOCCI_ResultSet : public Base { DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_GETBLOB); DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_GETBYTES); DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCHARSET); + DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCLOB); DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCURRENTSTREAMCOLUMN); DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCURRENTSTREAMROW); DECLARE_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCURSOR); @@ -1265,6 +1287,7 @@ void LuaOCCI_ResultSet::pushmembers(Lua * L) { PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_GETBLOB); PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_GETBYTES); PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCHARSET); + PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCLOB); PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCURRENTSTREAMCOLUMN); PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCURRENTSTREAMROW); PUSH_METHOD(EncapOCCI_ResultSet, RESULTSET_GETCURSOR); @@ -1378,6 +1401,23 @@ int sLua_EncapOCCI_ResultSet::EncapOCCI_ResultSet_proceed_unprotected(Lua * L, i } r = 2; break; + case RESULTSET_GETCLOB: + { + Clob clob = rset->getClob(L->tonumber(2)); + Buffer * b = new Buffer(true); + int size = clob.length(); + char * x = (char *) malloc(size); + strm = clob.getStream(1, 0); + strm->readBuffer(x, size); + clob.closeStream(strm); + b->write(x, size); + free(x); + LuaBuffer o(b); + o.pushdestruct(L); + L->push((lua_Number) size); + } + r = 2; + break; case RESULTSET_GETCURRENTSTREAMCOLUMN: L->push((lua_Number) rset->getCurrentStreamColumn()); r = 1; |