如何使用 OCCI 的 setDataBuffer 进行数组获取
我正在数据库上执行一个查询,该查询返回一组记录,我在 Oracle OCCI 文档中读到,您必须使用 ResultSet::setDataBuffer() 函数从数据库获取数据数组。
当数据库行包含多列不同数据时,我只是不明白我应该给出什么作为前两个参数?我应该指定什么类型作为我的缓冲区类型?
//example, does not contain all parts, just enough to demonstrate my point
SELECT AGE, BIRTHDATE, NAME FROM PEOPLE;
int i[10]; // Type of buffer??? Age is int, but name is a string?
ResultSet* res;
res->setDataBuffer(1 /*col index of first col in select statement*/, &i[0], OCCIINT, 10 * sizeof(int));
while(res->next()) { //Fetch data...}
到目前为止,我已经在谷歌上搜索了一些例子,但没有成功。我希望这里有人能帮忙?
I have a query that I'm executing on a database that returns an array of records, I read in the Oracle OCCI documentation you have to use the ResultSet::setDataBuffer() function to fetch array's of data from the db.
I just don't get what I'm supposed to give as the first two args when a database row contains multiple columns of different data? What type should I give as my buffer type?
//example, does not contain all parts, just enough to demonstrate my point
SELECT AGE, BIRTHDATE, NAME FROM PEOPLE;
int i[10]; // Type of buffer??? Age is int, but name is a string?
ResultSet* res;
res->setDataBuffer(1 /*col index of first col in select statement*/, &i[0], OCCIINT, 10 * sizeof(int));
while(res->next()) { //Fetch data...}
I have searched Google for examples in vain so far. I'm hoping that someone here could help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据我们的评论,我提供了一个使用 getString(),... 函数的简单示例:
但我想这正是您最初所做的?
As per our comments, I provide a simple example using the getString(),... functions:
But I guess this is exactly what you were originally doing?