65 nodejs_db_informix::Result::Column::Column(
76 this->typeName = std::string(ti->Name().Data());
78 if (this->typeName ==
"blob") {
83 if (this->typeName ==
"boolean") {
88 if (this->typeName ==
"byte") {
93 if (this->typeName ==
"char") {
98 if (this->typeName ==
"clob") {
103 if (this->typeName ==
"date") {
108 if (this->typeName ==
"datetime") {
110 this->type = DATETIME;
113 if (this->typeName ==
"decimal") {
118 if (this->typeName ==
"float") {
123 if (this->typeName ==
"int8") {
128 if (this->typeName ==
"integer") {
133 if (this->typeName ==
"interval") {
135 this->type = INTERVAL;
138 if (this->typeName ==
"lvarchar") {
143 if (this->typeName ==
"money") {
148 if (this->typeName ==
"serial") {
153 if (this->typeName ==
"smallfloat") {
158 if (this->typeName ==
"smallint") {
163 if (this->typeName ==
"text") {
168 if (this->typeName ==
"varchar") {
175 this->typeName =
"row";
180 if (ti->IsCollection()) {
181 this->typeName =
"collection";
182 this->type = COLLECTION;
186 if (ti->IsConstructed()) {
187 this->typeName =
"constructed";
188 this->type = CONSTRUCTED;
196 nodejs_db_informix::Result::Column::~Column() {
201 bool nodejs_db_informix::Result::Column::isBinary()
const {
207 std::string nodejs_db_informix::Result::Column::getName()
const {
213 nodejs_db::Result::Column::type_t
214 nodejs_db_informix::Result::Column::getType()
const {
221 nodejs_db_informix::Result::Column::getTypeName()
const {
222 return this->typeName;
227 nodejs_db_informix::Result::Result(ITBool b,
long re)
259 if (rs == NULL || cti == NULL) {
266 this->resultSet = rs;
267 this->totalColumns =
static_cast<uint16_t
>(cti->ColumnCount());
269 if (this->totalColumns > 0) {
271 for (uint16_t c = 0; c < this->totalColumns; ++c) {
272 std::string n = cti->ColumnName(c).Data();
276 this->columns.push_back(col);
277 this->columnNames.push_back(n);
283 this->nextRow = this->row();
312 this->resultSet = rs;
313 this->nextRow = this->row();
318 nodejs_db_informix::Result::~Result() {
324 void nodejs_db_informix::Result::free() throw() {
330 void nodejs_db_informix::Result::release() throw() {
331 this->columns.clear();
332 this->columnNames.clear();
337 bool nodejs_db_informix::Result::hasNext()
const throw() {
338 return (this->nextRow != NULL);
343 std::vector<std::string>*
344 nodejs_db_informix::Result::next() throw(nodejs_db::Exception&) {
345 if (this->nextRow == NULL) {
350 this->previousRow = this->nextRow;
351 this->nextRow = this->row();
353 return this->previousRow;
358 unsigned long* nodejs_db_informix::Result::columnLengths() throw(nodejs_db::Exception&) {
359 return this->colLengths;
364 std::vector<std::string>*
365 nodejs_db_informix::Result::row() throw(nodejs_db::Exception&) {
366 std::vector<std::string> *row =
new std::vector<std::string>();
368 ITValue *v = this->resultSet->Fetch();
375 if (v->QueryInterface(ITRowIID, (
void**) &r) == IT_QUERYINTERFACE_FAILED) {
378 long nc = r->NumColumns();
380 this->colLengths =
new unsigned long[nc];
381 for (
long i = 0; i < nc; ++i) {
382 ITValue *cv = r->Column(i);
385 row->push_back(std::string(
"null"));
386 this->colLengths[i] = std::string(
"null").length();
388 row->push_back(std::string(cv->Printable().Data()));
389 this->colLengths[i] = cv->Printable().Length();
399 uint64_t nodejs_db_informix::Result::index()
const throw(std::out_of_range&) {
400 if (this->rowNumber == 0) {
401 throw std::out_of_range(
"Not standing on a row");
403 return (this->rowNumber - 1);
409 nodejs_db_informix::Result::column(uint16_t i)
const throw(std::out_of_range&) {
410 if (i >= this->totalColumns) {
411 throw std::out_of_range(
"Wrong column index");
415 std::cout << *(this->columns[i]) << std::endl;
418 return this->columns[i];
423 uint64_t nodejs_db_informix::Result::insertId()
const throw() {
429 uint64_t nodejs_db_informix::Result::affectedCount()
const throw() {
435 uint16_t nodejs_db_informix::Result::warningCount()
const throw() {
441 uint16_t nodejs_db_informix::Result::columnCount()
const throw() {
442 return this->totalColumns;
447 uint64_t nodejs_db_informix::Result::count()
const throw(nodejs_db::Exception&) {
448 if (!this->isBuffered()) {
456 bool nodejs_db_informix::Result::isBuffered()
const throw() {
462 bool nodejs_db_informix::Result::isEmpty()
const throw() {