Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco ODBC and while SQL loop

Please post support and help requests here.

Poco ODBC and while SQL loop

Postby AMV007 » 27 Jun 2013, 07:36

i'm working with mssql odbc C++ code :

Code: Select all
Session session("ODBC", connectionString);

Statement select(session); 

select << sql; 
select.execute();   
Poco::Data::RecordSet rs(select);   
bool more = rs.moveFirst();   
std::size_t cols = rs.columnCount();   
std::stringstream ss;
ss << "<table>";
while (more)
{
    ss << "<row>";
    for (std::size_t col = 0; col < cols; ++col)
    {
        std::string cn = rs.columnName (col);
        ss << "<" << cn << ">";
        ss << rs[col].convert<std::string>();
        ss << "</" << cn << ">";
    }
    ss << "</row>";
    more = rs.moveNext();
}
ss << "</table>";

all working fine, but if i trying sql loop, for example :

Code: Select all
DECLARE @database_name sysname ;
SET @database_name = NULL;
WHILE @database_name IS NOT NULL
BEGIN
SET @database_name = NULL;
END;
SELECT '0'

then i have error in line : bool more = rs.moveFirst();
Assertion violation: extractions().size() in file "C:\External\poco\include\Poco/Data/RecordSet.h", line 241 without while loop in sql all working, in MSSQL server management studio all working, and in ODBC query tool it not problem, but it not working with poco. any suggestions ?
AMV007
 
Posts: 1
Joined: 26 Jun 2013, 10:47

Re: Poco ODBC and while SQL loop

Postby alex » 27 Jun 2013, 14:02

See the answer on Stack Overflow.
alex
 
Posts: 1103
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 4 guests

cron