From: <ibr...@us...> - 2010-10-07 13:36:49
|
Revision: 3757 http://tora.svn.sourceforge.net/tora/?rev=3757&view=rev Author: ibre5041 Date: 2010-10-07 13:36:42 +0000 (Thu, 07 Oct 2010) Log Message: ----------- allow updates in tables having varchar and number columns only Modified Paths: -------------- branches/tora-trotl/src/tooracleconnection.cpp Modified: branches/tora-trotl/src/tooracleconnection.cpp =================================================================== --- branches/tora-trotl/src/tooracleconnection.cpp 2010-10-07 13:34:33 UTC (rev 3756) +++ branches/tora-trotl/src/tooracleconnection.cpp 2010-10-07 13:36:42 UTC (rev 3757) @@ -274,7 +274,7 @@ _length = data.get_length(); return _length; }; - + mutable ub4 _length; // NOTE: OCILobGetLength makes one roundtrip to the server toOracleClob(toOracleClob const&); toOracleClob operator=(toOracleClob const&); @@ -799,10 +799,16 @@ TLOG(0,toDecorator,__HERE__) << "rowsProcessed() - non-query" << std::endl; return 0; } - //return Query->get_last_row(); ???? - unsigned i = Query->get_last_row(); - TLOG(0,toDecorator,__HERE__) << "rowsProcessed(" << i << ")" << std::endl; - return i; + int retval; + + if( Query->get_stmt_type() == ::trotl::SqlStatement::STMT_SELECT ) + { + retval = Query->get_last_row(); + } else { + retval = Query->row_count(); + } + TLOG(0,toDecorator,__HERE__) << "rowsProcessed(" << retval << ")" << std::endl; + return retval; } virtual int columns(void) @@ -1458,7 +1464,9 @@ << ", placeholder=" << bp.bind_name << ", value=" << (*i).toInt() << ");" << "\t of:" << query()->params().size() << std::endl; - } else if( (bp.bind_typename == "char" || bp.bind_typename == "varchar") && (*i).isString()) { + } else if( (bp.bind_typename == "char" || bp.bind_typename == "varchar") + && ((*i).isString() || (*i).isNumber() || (*i).isNull() )) + { std::string param((const char*)((*i).toString().toUtf8().constData())); (*Query) << ::std::string((const char*)((*i).toString().toUtf8().constData())); TLOG(0,toDecorator,__HERE__) @@ -1468,9 +1476,18 @@ << ", value=" << ::std::string((const char*)((*i).toString().toUtf8().constData())) << ");" << "\t of:" << query()->params().size() << std::endl; } else { - std::cerr << "Fatal pruser error - unsupported BindPar:" << std::endl; + TLOG(0,toDecorator,__HERE__) + << "Fatal pruser error - unsupported BindPar: " << bp.bind_typename << std::endl + << " For SQL: \n" << query()->sql() << std::endl + << "<<(conn=" << conn->_conn << ", this=" << Query << ")" + << "::operator<<(" << bp.type_name << " ftype=" << bp.dty + << ", placeholder=" << bp.bind_name + << ", value=" << ::std::string((const char*)((*i).toString().toUtf8().constData())) << ");" + << "\t of:" << query()->params().size() << std::endl; throw toConnection::exception( - QString::fromLatin1("Fatal pruser error - unsupported BindPar:") + bp.bind_typename.c_str()); + QString::fromLatin1("Fatal pruser error - unsupported BindPar:%1\nFor SQL:\n%2\n") + .arg(bp.bind_typename.c_str()) + .arg(query()->sql())); exit(-1); } } @@ -1479,6 +1496,11 @@ } catch (const ::trotl::OciException &exc) { + TLOG(0,toDecorator,__HERE__) + << "What:" << exc.what() << std::endl + << exc.get_sql() << std::endl + << "--------------------------------------------------------------------------------" + << std::endl; conn->_conn->reset(); delete Query; Query = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |