Re: [IBPP-DISCUSS] Problem Fetching Rows
IBPP is a C++ client class library for FirebirdSQL
Status: Inactive
Brought to you by:
epocman
From: Olivier M. <om...@ti...> - 2015-03-30 16:54:56
|
This is *very* strange. Pardon me asking this: are you really sure you're not hit by a side-effect where you wouldn't be talking to the DB you think you are? Because if the query was to return nothing, it sure would have mOutRow->Columns() == 0. I know you wrote: > It makes no difference what the query is, I've tried > several, the above was just a concise example. so the above assumption is certainly invalid, but I had to ask. You might want to break on the line mOutRow->Columns() and inspect the mType variable before the call, will give a hint if the Prepare did at least anything plausible, it should return the right type of query you prepared. Test some select and some insert for instance. If it looks good, I would step inside Columns() right up to the return mDescrArea->slqd in order to inspect the whole structure pointed to by mDescrArea. If that content is weird (and it might be as it looks like from your description that sqld member is always 0), then it means this (below) on line 94+ of statement.cpp went wrong despite no exception has been thrown: status.Reset(); (*gds.Call()->m_dsql_prepare)(status.Self(), mTransaction->GetHandlePtr(), &mHandle, (short)sql.length(), const_cast<char*>(sql.c_str()), short(mDatabase->Dialect()), mOutRow->Self()); But by the way, are you sure exceptions are properly thrown and caught if any? The project settings in Builder might have an unexpected configuration about propagation of C++ exceptions? A breakpoint on : if (status.Errors()) on line 98 of statement.cpp and then follow step by step might give some clue. (It's been *years* that I have even started any C++ Builder version - I don't have any license for any current version.) Yours, __ Olivier Mascia integral.be/om > Le 30 mars 2015 à 17:22, David Bridges <da...@sp...> a écrit : > > I've implemented a windows server program using VS2013 that > is working properly. Now I'm making a utility program using > C++Builder 2007 that uses essentially the same proven code > from the VS2013 server. The problem is that whenever I do a > fetch I'm hitting this exception.... > > bool StatementImpl::Fetch() > { > if (! mResultSetAvailable) > throw LogicExceptionImpl("Statement::Fetch", > _("No statement has been executed or no result > set available.")); > > In the below function, only in the utility program; the > server works fine, I always get the exception when I do the > fetch > > //------------------------------------------------------------------------------ > bool tableExists(IBPP::Database db,std::string table_name) > { > bool exists = false; > IBPP::Transaction tr = IBPP::TransactionFactory(db, > IBPP::amRead, IBPP::ilConcurrency, IBPP::lrWait); > tr->Start(); > > IBPP::Statement st = IBPP::StatementFactory(db, tr); > > st->Execute("SELECT RDB$RELATION_FIELDS.RDB$FIELD_NAME > FROM RDB$RELATION_FIELDS WHERE > RDB$RELATION_FIELDS.RDB$RELATION_NAME = UPPER('" + > table_name + "')"); > exists = st->Fetch(); > tr->Commit(); > return exists; > } > > It makes no difference what the query is, I've tried > several, the above was just a concise example. > > In StatementImpl::Prepare..... > > if (mOutRow->Columns() == 0) <<<<<<<<<<< THIS IS ALWAYS > TRUE > { > // Get rid of the output descriptor, if it wasn't > required (no output) > mOutRow->Release(); > mOutRow = 0; > > The database open/connectand the execution of the query all > seem to work properly. > > In the VS2013 I'm linking to a lib file, in the BCB utility > program I've added all_in_one.cpp to the project. The IBPP > version is 2.5.3.1. > > I appreciate any help with this. > > David > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > ibpp-discuss mailing list > Post to ibp...@li... > Settings https://lists.sourceforge.net/lists/listinfo/ibpp-discuss > http://www.ibpp.org |