⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cursor.cpp

📁 在动态库中实现异步导出大数据量的oracle数据
💻 CPP
📖 第 1 页 / 共 3 页
字号:
  \a val may be supplied by having \a null_value point to this value.

  \sa int getInt(int,bool *,const int *) const,
      void getInt(const string &,int &,bool *,const int *) const,
      int getInt(const string &,bool *, const int *) const
 */
void OCICPP::Cursor::getInt(int col,int &val,bool *isNull,const int *null_value) const {
	if(!canFetch || col<0 || col>=nCols) throw OraError(CELL_NOT_EXISTS);
	if(row[col]->getType()!=SQLT_NUM) throw OraError("OCICPPLIB: Trying to get Int from non-number column",OCICPPERROR);
	if(row[col]->isNull(curRow)) {
		if (isNull) *isNull = true;
		val = null_value ? *null_value : 0;
    } else {
		if (isNull) *isNull = false;
		((OraNumber *)row[col])->getInt(val,curRow);
	}
}

/*!
  Read an integer value \a val from the column named \a colName . Unless
  pointing to 0, \a *isNull is set to \c TRUE if the retreived value is NULL
  in the sence of the database server. A client-specific value to be returned
  as \a val may be supplied by having \a null_value point to this value.

  \sa void getInt(int,int &,bool *,const int *) const,
      int getInt(int,bool *,const int *) const,
      int getInt(const string &,bool *, const int *) const
 */
void OCICPP::Cursor::getInt(const std::string &colName,int &val,bool *isNull,const int *null_value) const {
	map<string,int>::const_iterator iter=cols_map.find(colName);
	if(iter!=cols_map.end()) {
		getInt(iter->second,val,isNull,null_value);
	} else {
		throw OraError(CELL_NOT_EXISTS);
	}
}

/*!
  Read a double value \a val from the column indexed by \a col . Unless
  pointing to 0, \a *isNull is set to \c TRUE if the retreived value is NULL
  in the sence of the database server. A client-specific value to be returned
  as \a val may be supplied by having \a null_value point to this value.

  \sa double getDouble(int,bool *,const double *) const,
      void getDouble(const string &,double &,bool *,const double *) const,
      double getDouble(const string &,bool *, const double *) const
*/
void OCICPP::Cursor::getDouble(int col,double &val,bool *isNull,const double *null_value) const {
	if(!canFetch || col<0 || col>=nCols) throw OraError(CELL_NOT_EXISTS);
	if(row[col]->getType()!=SQLT_NUM) throw OraError("OCICPPLIB: Trying to get Double from non-number column",OCICPPERROR);
	if(row[col]->isNull(curRow)) {
		if (isNull) *isNull = true;
		val = null_value ? *null_value: 0;
	} else {
		if (isNull) *isNull = false;
			((OraNumber *)row[col])->getDouble(val,curRow);
	}
}

/*!
  Read a double value \a val from the column named \a colName . Unless pointing
  to 0, \a *isNull set to \c TRUE if a NULL-value is retreived in this way. The
  value returned to the application may be specified by having \a null_value
  pointing to it.

  \sa void getDouble(int,double &,bool *,const double *) const,
      double getDouble(int,bool *,const double *) const,
      double getDouble(const string &,bool *, const double *) const
*/
void OCICPP::Cursor::getDouble(const std::string &colName,double &val,bool *isNull,const double *null_value) const {
	map<string,int>::const_iterator iter=cols_map.find(colName);
	if(iter!=cols_map.end()) {
		getDouble(iter->second,val,isNull,null_value);
	} else {
		throw OraError(CELL_NOT_EXISTS);
	}
}

/* date-related functions ------------------------------------------------------------ */

/*!
  Reads the month from a date column \a col and returns the value as \a mon .
  \a mon will be one of the following:
  \arg "JAN"
  \arg "FEB"
  \arg "MAR"
  \arg "APR"
  \arg "MAY"
  \arg "JUN"
  \arg "JUL"
  \arg "AUG"
  \arg "SEP"
  \arg "OCT"
  \arg "NOV"
  \arg "DEC"

  \sa void getMonth(const std::string &,int &) const,
      void getMonth(int,int &) const,
      void getStrMon(const std::string &,std::string &) const
*/
void OCICPP::Cursor::getStrMon(int col,std::string &mon) const {
	if(!canFetch || col<0 || col>=nCols) throw OraError(CELL_NOT_EXISTS);
	if(row[col]->getType()!=SQLT_DAT) throw OraError("OCICPPLIB: Trying to get Month from non-date column",OCICPPERROR);
	if(row[col]->isNull(curRow)) mon="";
	else ((OraDate *)row[col])->getStrMon(mon,curRow);
}

/*!
  Reads the month from a date column named \a colName and returns the value as
  \a mon . \a mon will be one of the following:
  \arg "JAN"
  \arg "FEB"
  \arg "MAR"
  \arg "APR"
  \arg "MAY"
  \arg "JUN"
  \arg "JUL"
  \arg "AUG"
  \arg "SEP"
  \arg "OCT"
  \arg "NOV"
  \arg "DEC"

  \sa void getMonth(const std::string &,int &) const,
      void getMonth(int,int &) const,
      void getStrMon(int col,std::string &mon) const
*/
void OCICPP::Cursor::getStrMon(const std::string &colName,std::string &val) const {
	map<string,int>::const_iterator iter=cols_map.find(colName);
	if(iter!=cols_map.end()) {
		getStrMon(iter->second,val);
	} else {
		throw OraError(CELL_NOT_EXISTS);
	}
}

/*!
  If used for a Date-Column \a col, this function reads the seconds \a sec
  stored within this date.

  \sa void getSec(const std::string &,int &) const
      int getSec(int col) const
      int getSec(const string &col) const
 */
void OCICPP::Cursor::getSec(int col,int &sec) const {
	if(!canFetch || col<0 || col>=nCols) throw OraError(CELL_NOT_EXISTS);
	if(row[col]->getType()!=SQLT_DAT) throw OraError("OCICPPLIB: Trying to get Month from non-date column",OCICPPERROR);
	if(row[col]->isNull(curRow)) sec=0;
	else ((OraDate *)row[col])->getSec(sec,curRow);
}

/*!
  If used for a Date-Column named \a colName, this function reads the seconds
  \a val stored within this date.

  \sa void getSec(int,int &) const
      int getSec(int col) const
      int getSec(const string &col) const
 */
void OCICPP::Cursor::getSec(const std::string &colName,int &val) const {
	map<string,int>::const_iterator iter=cols_map.find(colName);
	if(iter!=cols_map.end()) {
		getSec(iter->second,val);
	} else {
		throw OraError(CELL_NOT_EXISTS);
	}
}

/*! \fn int OCICPP::Cursor::getSec(const string &col) const
  If used for a Date-Column named \a colName, this function returns the seconds
  stored within this date.

  \sa void getSec(const std::string &,int &) const
      void getSec(int,int &) const
      int getSec(const string &col) const
 */
/*! \fn int OCICPP::Cursor::getSec(int col) const
  If used for a Date-Column \a col, this function returns the seconds
  stored within this date.

  \sa void getSec(const std::string &,int &) const
      void getSec(int,int &) const
      int getSec(int col) const
 */

/*!
  If used for a Date-Column \a col, this function reads the minutes \a min
  stored within this date.

  \sa void getMin(const std::string &,int &) const
      int getMin(int col) const
      int getMin(const string &col) const
 */
void OCICPP::Cursor::getMin(int col,int &min) const {
	if(!canFetch || col<0 || col>=nCols) throw OraError(CELL_NOT_EXISTS);
	if(row[col]->getType()!=SQLT_DAT) throw OraError("OCICPPLIB: Trying to get Month from non-date column",OCICPPERROR);
	if(row[col]->isNull(curRow)) min=0;
	else ((OraDate *)row[col])->getMin(min,curRow);
}

/*!
  If used for a Date-Column named \a colName, this function reads the minutes
  \a min stored within this date.

  \sa void getMin(int,int &) const
      int getMin(int col) const
      int getMin(const string &col) const
 */
void OCICPP::Cursor::getMin(const std::string &colName,int &val) const {
	map<string,int>::const_iterator iter=cols_map.find(colName);
	if(iter!=cols_map.end()) {
		getMin(iter->second,val);
	} else {
		throw OraError(CELL_NOT_EXISTS);
	}
}

/*! \fn int OCICPP::Cursor::getMin(int col) const
  If used for a Date-Column \a col, this function returns the minutes
  stored within this date.

  \sa void getMin(const std::string &,int &) const
      void getMin(int,int &) const
      int getMin(const string &col) const
 */

/*! \fn int OCICPP::Cursor::getMin(const string &col) const
  If used for a Date-Column named \a colName, this function returns the minutes
  stored within this date.

  \sa void getMin(const std::string &,int &) const
      void getMin(int,int &) const
      int getMin(int col) const
 */

/*!
  If used for a Date-Column \a col, this function reads the hours \a hour
  stored within this date.

  \sa void getHour(const std::string &,int &) const
      int getHour(int col) const
      int getHour(const string &col) const
 */
void OCICPP::Cursor::getHour(int col,int &hour) const {
	if(!canFetch || col<0 || col>=nCols) throw OraError(CELL_NOT_EXISTS);
	if(row[col]->getType()!=SQLT_DAT) throw OraError("OCICPPLIB: Trying to get Month from non-date column",OCICPPERROR);
	if(row[col]->isNull(curRow)) hour=0;
	else ((OraDate *)row[col])->getHour(hour,curRow);
}

/*!
  If used for a Date-Column \a col, this function reads the hours \a hour
  stored within this date.

  \sa void getHour(int,int &) const
      int getHour(int col) const
      int getHour(const string &col) const
 */
void OCICPP::Cursor::getHour(const std::string &colName,int &val) const {
	map<string,int>::const_iterator iter=cols_map.find(colName);
	if(iter!=cols_map.end()) {
		getHour(iter->second,val);
	} else {
		throw OraError(CELL_NOT_EXISTS);
	}
}

/*! \fn int OCICPP::Cursor::getHour(int col) const
  If used for a Date-Column \a col, this function returns the hours
  stored within this date.

  \sa void getHour(const std::string &,int &) const
      void getHour(int,int &) const
      int getHour(int col) const
      int getHour(const string &col) const
 */

/*! \fn int OCICPP::Cursor::getHour(const string &col) const
  If used for a Date-Column \a col, this function returns the hours
  stored within this date.

  \sa void getHour(const std::string &,int &) const
      void getHour(int,int &) const
      int getHour(int col) const
      int getHour(const string &col) const
 */

/*!
  If used for a Date-Column \a col, this function reads the \a day (day of
  month) from this date.

  \sa void getDay(const std::string &,int &) const
      int getDay(int col) const
      int getDay(const string &col) const
 */
void OCICPP::Cursor::getDay(int col,int &day) const {
	if(!canFetch || col<0 || col>=nCols) throw OraError(CELL_NOT_EXISTS);
	if(row[col]->getType()!=SQLT_DAT) throw OraError("OCICPPLIB: Trying to get Month from non-date column",OCICPPERROR);
	if(row[col]->isNull(curRow)) day=0;
	else ((OraDate *)row[col])->getDay(day,curRow);
}

/*!
  If used for a Date-Column named \a colName, this function reads the \a day
  (day of month) from this date.

  \sa void getDay(int,int &) const
      int getDay(int col) const
      int getDay(const string &col) const
 */
void OCICPP::Cursor::getDay(const std::string &colName,int &val) const {
	map<string,int>::const_iterator iter=cols_map.find(colName);
	if(iter!=cols_map.end()) {
		getDay(iter->second,val);
	} else {
		throw OraError(CELL_NOT_EXISTS);
	}
}

/*! \fn int OCICPP::Cursor::getDay(int col) const
  If used for a Date-Column \a col, this function returns the day (day of
  month) from this date.

  \sa void getDay(int,int &) const
      void getDay(const std::string &,int &) const
      int getDay(const string &col) const
 */

/*! \fn int OCICPP::Cursor::getDay(const string &col) const
  If used for a Date-Column named \a colName, this function returns the day
  (day of month) from this date.

  \sa void getDay(int,int &) const
      void getDay(const std::string &,int &) const
      int getDay(int col) const
 */

/*!
  If used for a Date-Column \a col, this function reads the month \a mon
  (month of the year) from this date.

  \sa void getMonth(const std::string &,int &) const
      int getMonth(int col) const
      int getMonth(const string &col) const
      void getStrMon(int col,std::string &mon) const
      void getStrMon(const std::string &,std::string &) const
 */
void OCICPP::Cursor::getMonth(int col,int &mon) const {
	if(!canFetch || col<0 || col>=nCols) throw OraError(CELL_NOT_EXISTS);
	if(row[col]->getType()!=SQLT_DAT) throw OraError("OCICPPLIB: Trying to get Month from non-date column",OCICPPERROR);
	if(row[col]->isNull(curRow)) mon=0;
	else ((OraDate *)row[col])->getMonth(mon,curRow);
}

/*!
  If used for a Date-Column named \a colName, this function reads the month
  \a val (month of the year) from this date.

  \sa void getMonth(int,int &) const,
      int getMonth(int col) const
      int getMonth(const string &col) const
      void getStrMon(int col,std::string &mon) const,
      void getStrMon(const std::string &,std::string &) const
 */
void OCICPP::Cursor::getMonth(const std::string &colName,int &val) const {
	map<string,int>::const_iterator iter=cols_map.find(colName);
	if(iter!=cols_map.end()) {
		getMonth(iter->second,val);
	} else {
		throw OraError(CELL_NOT_EXISTS);
	}
}

/*! \fn int OCICPP::Cursor::getMonth(int col) const
  If used for a Date-Column \a col, this function returns the month
  (month of the year) from this date.

  \sa void getMonth(int,int &) const,
      void getMonth(const std::string &,int &) const
      int getMonth(const string &col) const
      void getStrMon(int col,std::string &mon) const
      void getStrMon(const std::string &,std::string &) const
 */

/*! \fn int OCICPP::Cursor::getMonth(const string &col) const
  If used for a Date-Column named \a colName, this function returns the month
  (month of the year) from this date.

  \sa void getMonth(int,int &) const,
      void getMonth(const std::string &,int &) const
      int getMonth(int col) const
      int getMonth(const string &col) const
      void getStrMon(int col,std::string &mon) const,
      void getStrMon(const std::string &,std::string &) const
 */

/*!
  If used for a Date-Column \a col, this function reads the \a year from this
  date.

  \sa void getYear(const std::string &,int &) const
      int getYear(int col) const

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -