Beispiel #1
0
inline void command::close_request()
{
  if (lib::error(m_req)) return;
  m_cols.clear();
  int req(CCI_ER_REQ_HANDLE); std::swap(m_req, req);
  lib::singleton().p_cci_close_req_handle(req);
}
Beispiel #2
0
inline void command::close_stmt()
{
  if (!m_stmt) return;
  m_binds.clear();
  m_cols.clear();
  MYSQL_STMT* stmt(0); std::swap(stmt, m_stmt);
  lib::singleton().p_mysql_stmt_close(stmt);
}
Beispiel #3
0
void dumpImageProperties( boost::ptr_vector<sp::FileObject>& listing )
{
	BOOST_FOREACH( const sp::FileObject& sequence, listing )
	{
		switch( sequence.getMaskType () )
		{
			case sp::eMaskTypeSequence	: dumpImageProperties( static_cast<const sp::Sequence&>( sequence ) ); break;
			case sp::eMaskTypeFile		: dumpImageProperties( static_cast<const sp::File&>( sequence ) ); break;
			case sp::eMaskTypeDirectory	: break;
			case sp::eMaskTypeUndefined	: break;
		}
	}
	listing.clear();
}
Beispiel #4
0
inline std::vector<std::string> command::columns()
{
  using namespace std;
  using namespace brig::unicode;

  vector<string> cols;
  if (0 == m_hnd.stmt) return cols;
  m_cols.clear();
  ub4 count(0);
  m_hnd.check(lib::singleton().p_OCIAttrGet(m_hnd.stmt, OCI_HTYPE_STMT, &count, 0, OCI_ATTR_PARAM_COUNT, m_hnd.err));
  for (ub4 i(0); i < count; ++i)
  {
    OCIParam *dsc(0);
    m_hnd.check(lib::singleton().p_OCIParamGet(m_hnd.stmt, OCI_HTYPE_STMT, m_hnd.err, (void**)&dsc, i + 1));
    try
    {

      ub2 data_type(0), size(0);
      sb2 precision(0);
      sb1 scale(-1);
      ub1 charset_form(SQLCS_NCHAR);
      utext *name(0), *nty_schema(0), *nty(0);
      ub4 name_len(0), nty_schema_len(0), nty_len(0);

      m_hnd.check(lib::singleton().p_OCIAttrGet(dsc, OCI_DTYPE_PARAM, &name, &name_len, OCI_ATTR_NAME, m_hnd.err));
      m_hnd.check(lib::singleton().p_OCIAttrGet(dsc, OCI_DTYPE_PARAM, &data_type, 0, OCI_ATTR_DATA_TYPE, m_hnd.err));
      m_hnd.check(lib::singleton().p_OCIAttrGet(dsc, OCI_DTYPE_PARAM, &size, 0, OCI_ATTR_DATA_SIZE, m_hnd.err));
      m_hnd.check(lib::singleton().p_OCIAttrGet(dsc, OCI_DTYPE_PARAM, &precision, 0, OCI_ATTR_PRECISION, m_hnd.err));
      m_hnd.check(lib::singleton().p_OCIAttrGet(dsc, OCI_DTYPE_PARAM, &scale, 0, OCI_ATTR_SCALE, m_hnd.err));
      m_hnd.check(lib::singleton().p_OCIAttrGet(dsc, OCI_DTYPE_PARAM, &charset_form, 0, OCI_ATTR_CHARSET_FORM, m_hnd.err));
      m_hnd.check(lib::singleton().p_OCIAttrGet(dsc, OCI_DTYPE_PARAM, &nty_schema, &nty_schema_len, OCI_ATTR_SCHEMA_NAME, m_hnd.err));
      m_hnd.check(lib::singleton().p_OCIAttrGet(dsc, OCI_DTYPE_PARAM, &nty, &nty_len, OCI_ATTR_TYPE_NAME, m_hnd.err));

      identifier nty_lcase = { transform<char>(nty_schema, lower_case), transform<char>(nty, lower_case), "" };

      m_cols.push_back(define_factory(&m_hnd, i + 1, data_type, size, precision, scale, charset_form, nty_lcase));
      cols.push_back(transform<char>(name));

    }
    catch (const exception&)  { handles::free_descriptor((void**)&dsc, OCI_DTYPE_PARAM); throw; }
    handles::free_descriptor((void**)&dsc, OCI_DTYPE_PARAM);
  }

  ub4 rows = ub4(PageSize);
  m_hnd.check(lib::singleton().p_OCIAttrSet(m_hnd.stmt, OCI_HTYPE_STMT, &rows, 0, OCI_ATTR_PREFETCH_ROWS, m_hnd.err));
  return cols;
}
Beispiel #5
0
void GetAll(boost::ptr_vector<acl::Group>& groups)
{
  groups.clear();

  QueryResults results;
  mongo::Query query;
  boost::unique_future<bool> future;
  TaskPtr task(new db::Select("groups", query, results, future));
  Pool::Queue(task);

  future.wait();

  if (results.size() == 0) return;

  for (auto& obj: results)
    groups.push_back(bson::Group::Unserialize(obj));
}
Beispiel #6
0
inline std::vector<std::string> command::columns()
{
  std::vector<std::string> cols;
  if (lib::error(m_req)) return cols;

  m_cols.clear();
  T_CCI_SQLX_CMD cmd_type;
  int col_count(0);
  T_CCI_COL_INFO* col_info(lib::singleton().p_cci_get_result_info(m_req, &cmd_type, &col_count));
  if (!col_info) throw std::runtime_error("CUBRID error");

  for (int i(1); i <= col_count; ++i)
  {
    m_cols.push_back(get_data_factory(CCI_GET_RESULT_INFO_TYPE(col_info, i)));
    cols.push_back(CCI_GET_RESULT_INFO_NAME(col_info, i));
  }
  return cols;
}
Beispiel #7
0
inline std::vector<std::string> command::columns()
{
  std::vector<std::string> cols;
  if (!m_stmt) return cols;
  m_binds.clear();
  m_cols.clear();

  MYSQL_RES* res(lib::singleton().p_mysql_stmt_result_metadata(m_stmt));
  check(res != 0);
  const unsigned int count(lib::singleton().p_mysql_num_fields(res));
  m_binds.resize(count);
  memset(m_binds.data(), 0, m_binds.size() * sizeof(MYSQL_BIND));
  for (unsigned int i(0); i < count; ++i)
  {
    MYSQL_FIELD* field(lib::singleton().p_mysql_fetch_field_direct(res, i));
    m_cols.push_back(bind_result_factory(field, m_binds[i]));
    cols.push_back(field->name);
  }
  lib::singleton().p_mysql_free_result(res);
  check(lib::singleton().p_mysql_stmt_bind_result(m_stmt, m_binds.data()) == 0);
  return cols;
}
Beispiel #8
0
inline void command::close_stmt()
{
  m_cols.clear();
  handles::free_handle((void**)&m_hnd.stmt, OCI_HTYPE_STMT);
}
Beispiel #9
0
 void CreateProcesses(void)
 {
     process_list.clear();
     boost::mpl::for_each<ProcessList>(boost::ref(*this));
 }