Hi,
Should reading a Clob/Text field into a vector work in Soci 3.2.2 with ODBC
connecting to SQL server? I'm compiling using visual studio 2013 and MingW,
and the code crashes with both.
If I change the SQL to cast the Clob field to a Varchar, the problem goes
away, and the code works fine with MySQL.
The code I'm using is :-
#include <string>
#include <soci.h>
#include <iostream>
using namespace soci;
using namespace std;
int main()
{
try
{
session dbConnection("odbc", "xxxx");
std::string sql = "select colbfield from table where id = :a";
const int BATCH_SIZE = 300;
int id = 0;
std::vector<std::string> vClob(BATCH_SIZE);
std::vector<indicator> inds(BATCH_SIZE);
statement st = (dbConnection.prepare << sql, into(vClob, inds),
use(id));
st.execute();
while (st.fetch())
{
for (int i = 0; i < vClob.size(); i++)
std::cout << "Value = " << vClob.at(i) << std::endl;
vClob.resize(BATCH_SIZE);
}
}
catch (exception const &e)
{
std::cout << "Error: " << e.what() << '\n';
}
}
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users