Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

ユーティリティ・クラスのリファレンス

この章では、便利ではあるものの Caché のデータ型に対応せず、プロキシによって自動的に継承されないクラスについて説明します。

  • データ処理クラス — Light C++ バインディングを使用したトランザクション制御やバッチ挿入、および標準クエリを実行します。

  • エラー・クラス — エラー報告を行います。

データ処理クラス

  • Transaction — プログラムで例外が発生した場合に、自動的にロールバックを行います。

  • LC_Batch — Light C++ バインディング用のバッチ挿入クラスです。

  • d_query — SQL 文の作成、パラメータの結合、クエリの実行、および結果セットの検索の各メソッドを提供します。

InterSystems::Transaction クラス

このクラスでは、例外発生時の自動的なロールバック動作が保証されます。commit() または rollback() のいずれも呼び出されていないときに、Transaction オブジェクトが範囲外になると、そのトランザクションはロールバックされます。Database トランザクション・メソッドと異なり、このクラスでは、入れ子になったトランザクションは許可されません。両タイプのトランザクションの詳細は、"トランザクションの使用法" を参照してください。

コンストラクタ

Transaction()

クラス・コンストラクタがトランザクションを開始します (Database::tstart() の呼び出しを必要とする Database オブジェクトとは異なります)。

   InterSystems::Transaction::Transaction
   (  Database * _db ) [inline]

メンバ・リスト

commit()

トランザクションをコミットします。

   void InterSystems::Transaction::commit
   ( ) [inline]

同じ Transaction オブジェクトに対して commit() を複数回呼び出しても何も実行されません (入れ子になったトランザクションの複数レベルでロールバックを実行するために繰り返し呼び出すことのできる Database::tcommit() とは異なります)。

rollback()

現在のトランザクションをロールバックします。

   void InterSystems::Transaction::rollback
   ( ) [inline]

トランザクションがコミットまたはロールバックされる前に Transaction オブジェクトが範囲外になると、自動的に呼び出されます。

InterSystems::LC_Batch クラス

このクラスは、Light C++ バインディングを使用したバッチ挿入のメソッドを提供します。詳細は、"LCB バッチ挿入の使用法" を参照してください。

コンストラクタ

LC_Batch()

   InterSystems::LC_Batch::LC_Batch
   (  LC_Database * _db,
      int _concurrency = 1,
      bool _return_ids = false,
      bool _throw_errs = true,
      size_t reserve_size = 32768,
      bool _do_tx = false
   ) [inline]

メンバ・リスト

clear()

バッチに追加されているオブジェクトを保存しないようにするには、clear() を呼び出します。

   void InterSystems::LC_Batch::clear
   ( ) [inline]
clear_errors()

   void InterSystems::LC_Batch::clear_errors
   ( ) [inline]
clear_ids()

   void InterSystems::LC_Batch::clear_ids
   ( ) [inline]
close()

   void LC_Batch::close
   ( )
flush()

オブジェクトをデータベースに保存するには、flush()、close() を呼び出すか、バッチ・オブジェクトを破棄します。

   void LC_Batch::flush
   ( )
get_errors()

エラーのリストが返されます。

   const std::vector< std::pair<d_status, d_binary> >& 
      InterSystems::LC_Batch::get_errors
   ( ) const [inline]

flush() の実行後、get_errors() によって以下のリストが返されます。

  • エラーがない場合、リストの size() は 0 になります。

  • エラーがある場合、各リストのエントリは、エラー・ステータスとオブジェクト・シリアル化の組み合わせになります。

  • プロジェクション・オブジェクトには set_from_err_list() メンバ関数があり、エラーの発生したオブジェクトのプロパティを検証できます。

get_ids()

   const std::vector<d_string>& InterSystems::LC_Batch::get_ids
   ( ) const [inline]
operator <<

   template<typename T>
   LC_Batch& InterSystems::LC_Batch::operator<<
   (  const d_ref< T > & obj) [inline] 

   template<typename T>
   LC_Batch& InterSystems::LC_Batch::operator<<
   (  const lc_d_ref< T > & obj) [inline]
   template<typename T> 
   LC_Batch& InterSystems::LC_Batch::operator<<
   (  T * obj) [inline]

InterSystems::d_query クラス

SQL 文の作成、パラメータの結合、クエリの実行、および結果セットの検索の各メソッドを提供します。このクラスの詳細は、"クエリの使用法" を参照してください。

コンストラクタ

d_query()

   InterSystems::d_query::d_query
   ( ) [inline]
   InterSystems::d_query::d_query
   (  Database * db) [inline]

メンバ・リスト

close()

   bool abs_d_query::close
   ( ) [inherited] 
execute()

   void abs_d_query::execute
   ( ) [inherited] 
   void InterSystems::abs_d_query::execute
   (  const wchar_t * sql_query) [inline, inherited] 
fetch()

   bool InterSystems::d_seq_query::fetch
   ( ) [inline, inherited] 
get_col_name()

   const SQLWCHAR* InterSystems::abs_d_query::get_col_name
   (  int idx) const [inline, inherited] 
get_col_name_len()

   SQLSMALLINT InterSystems::abs_d_query::get_col_name_len
   (  int idx) const [inline, inherited] 
get_col_sql_type()

   SQLSMALLINT InterSystems::abs_d_query::get_col_sql_type
   (  int idx) const [inline, inherited] 
get_cur_idx()

   int InterSystems::d_seq_query::get_cur_idx
   ( ) const [inline, inherited] 
get_data()

   void d_seq_query::get_data
   (  char * buf, 
      int * size, 
      int cap, 
      bool * is_null = 0 
   ) [inherited] 
   void d_seq_query::get_data
   (  d_binary * val) [inherited] 
   void d_seq_query::get_data
   (  d_bool * val) [inherited] 
   void d_seq_query::get_data
   (  d_currency * val) [inherited] 
   void d_seq_query::get_data
   (  d_date * val) [inherited] 
   void d_seq_query::get_data
   (  d_double * val) [inherited] 
   void d_seq_query::get_data
   (  d_int * val) [inherited] 
   void d_seq_query::get_data
   (  d_string * val, 
      str_conv_t conv = NO_CONV 
   ) [inherited] 
   void d_seq_query::get_data
   (  d_time * val) [inherited] 
   void d_seq_query::get_data
   (  d_timestamp * val) [inherited] 
   void d_seq_query::get_data
   (  D_type * val) [inherited] 
   void d_seq_query::get_data
   (  d_wstring * val) [inherited] 
   void d_seq_query::get_data
   (  DATE_STRUCT * val, 
      bool * is_null = 0 
   ) [inherited] 
   void d_seq_query::get_data
   (  double * val, 
      bool * is_null = 0 
   ) [inherited] 
   void d_seq_query::get_data
   (  long * val, 
      bool * is_null = 0 
   ) [inherited] 
   void d_seq_query::get_data
   (  std::string * val, 
      bool * is_null = 0 
   ) [inherited] 
   void d_seq_query::get_data
   (  std::wstring * val, 
      bool * is_null = 0 
   ) [inherited] 
   void d_seq_query::get_data
   (  TIME_STRUCT * val, 
      bool * is_null = 0 
   ) [inherited] 
   void d_seq_query::get_data
   (  TIMESTAMP_STRUCT * val, 
      bool * is_nuol = 0 
   ) [inherited] 
   void d_seq_query::get_data
   (  void * buf, 
      int * size, 
      int cap, 
      bool * is_null = 0 
   ) [inherited] 
   void d_seq_query::get_data
   (  wchar_t * buf, 
      int * size, 
      int cap, 
      bool * is_null = 0 
   ) [inherited] 
   void InterSystems::d_seq_query::get_data
   (  bool * val, 
      bool * is_null = 0 
   ) [inline, inherited] 
get_job_id()

   int InterSystems::abs_d_query::get_job_id
   ( ) [inline, inherited] 
get_num_cols()

   int InterSystems::abs_d_query::get_num_cols
   ( ) const [inline, inherited] 
get_num_pars()

   int InterSystems::abs_d_query::get_num_pars
   ( ) const [inline, inherited] 
get_par_col_size()

   SQLUINTEGER InterSystems::abs_d_query::get_par_col_size
   (  int idx) const [inline, inherited] 
get_par_num_dec_digits()

   SQLSMALLINT InterSystems::abs_d_query::get_par_num_dec_digits
   (  int idx) const [inline, inherited] 
get_par_sql_type()

   SQLSMALLINT InterSystems::abs_d_query::get_par_sql_type
   (  int idx) const [inline, inherited] 
is_par_nullable()

   SQLSMALLINT InterSystems::abs_d_query::is_par_nullable
   (  int idx) const [inline, inherited] 
is_par_unbound()

   bool InterSystems::abs_d_query::is_par_unbound
   (  int idx) const [inline, inherited] 
prepare()

   void abs_d_query::prepare
   (  const char * cl_name, 
      const char * proc_name 
   ) [inherited] 
   void abs_d_query::prepare
   (  const char * sql_query, 
      int len 
   ) [inherited] 
   void abs_d_query::prepare
   (  const wchar_t * cl_name, 
      const wchar_t * proc_name 
   ) [inherited] 
   void abs_d_query::prepare
   (  const wchar_t * sql_query, 
      int len 
   ) [inherited] 
   void abs_d_query::prepare
   (  d_string & sql_name, 
      int num_pars 
   ) [inherited] 
   void InterSystems::abs_d_query::prepare
   (  const char * sql_query) [inline, inherited] 
   void InterSystems::abs_d_query::prepare
   (  const wchar_t * sql_query) [inline, inherited] 
set_cur_idx()

   void InterSystems::d_query::set_cur_idx
   (  int idx) [inline] 
set_par()

   void abs_d_query::set_par
   (  int idx) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const char * buf, 
      char_size_t size 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_binary & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_bool & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_currency & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_date & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_double & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_int & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_string & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_time & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_timestamp & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const D_type & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const d_wstring & val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const void * buf, 
      byte_size_t size 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      const wchar_t * buf, 
      char_size_t size 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      double val 
   ) [inherited] 
   void abs_d_query::set_par
   (  int idx, 
      int val 
   ) [inherited] 
   void InterSystems::abs_d_query::set_par
   (  int idx, 
      const char * val 
   ) [inline, inherited] 
   void InterSystems::abs_d_query::set_par
   (  int idx, 
      const std::string & val 
   ) [inline, inherited] 
   void InterSystems::abs_d_query::set_par
   (  int idx, 
      const std::wstring & val 
   ) [inline, inherited] 
   void InterSystems::abs_d_query::set_par
   (  int idx, 
      const wchar_t * val 
   ) [inline, inherited] 
set_par_default()

   void abs_d_query::set_par_default
   (  int idx) [inherited] 
set_stored_proc()

   void InterSystems::abs_d_query::set_stored_proc
   (  bool is_stored_proc) [inline, inherited] 
skip()

   void InterSystems::d_seq_query::skip
   (  unsigned int num_cols = 1) [inline, inherited] 
throw_err()

   void abs_d_query::throw_err
   (  SQLSMALLINT err_src, 
      SQLHANDLE handle 
   ) [static, inherited] 
unbind_pars()

   void abs_d_query::unbind_pars
   ( ) [inherited] 

エラー・クラス

エラー報告を行います。

InterSystems::Db_err クラス

このクラスの使用例は、"C++ バインディング・アプリケーションのサンプル" を参照してください。

コンストラクタ

Db_err()

   InterSystems::Db_err::Db_err
   ( ) [inline] 
   InterSystems::Db_err::Db_err
   (  int c) [inline] 
   InterSystems::Db_err::Db_err
   (  int c, 
      const char * m, 
      int l, 
      const char * s 
   ) [inline] 
   InterSystems::Db_err::Db_err
   (  int c, 
      const std::string & m 
   ) [inline] 
   InterSystems::Db_err::Db_err
   (  int c, 
      const std::string & m, 
      const char * s 
   ) [inline] 

メンバ・リスト

clear()

   void InterSystems::Db_err::clear
   ( ) [inline] 
get()

   void Db_err::get
   (  t_istream & in) 
get_code()

   int InterSystems::Db_err::get_code
   ( ) const [inline] 
get_msg()

   const std::string& InterSystems::Db_err::get_msg
   ( ) const [inline] 
get_src()

   const std::string& InterSystems::Db_err::get_src
   ( ) const [inline] 
log()

   void Db_err::log
   ( ) const 
make_err_msg()

   std::string Db_err::make_err_msg
   (  const char * msg, 
      const char * arg1 = 0, 
      const char * arg2 = 0, 
      const char * arg3 = 0, 
      const char * arg4 = 0, 
      const char * arg5 = 0 
   ) [static] 
   std::string Db_err::make_err_msg
   (  const char * msg, 
      const wchar_t * arg1 = 0, 
      const wchar_t * arg2 = 0, 
      const wchar_t * arg3 = 0, 
      const wchar_t * arg4 = 0, 
      const wchar_t * arg5 = 0 
   ) [static] 
operator bool()

   InterSystems::Db_err::operator-bool
   ( ) const [inline] 
reset()

   void InterSystems::Db_err::reset
   (  int c, 
      const char * m 
   ) [inline] 
set_code()

   void InterSystems::Db_err::set_code
   (  int code) [inline] 
set_msg()

   void InterSystems::Db_err::set_msg
   (  const char * m) [inline] 
   void InterSystems::Db_err::set_msg
   (  const char * m, 
      int l 
   ) [inline] 
set_src()

   void InterSystems::Db_err::set_src
   (  const char * s) [inline] 
to_xml()

   void Db_err::to_xml
   (  xml_writer & out) const 
FeedbackOpens in a new tab