=encoding euc-jp =head1 名前 Class::DBI::Query - Class::DBIのためのSQL管理 =head1 概要 my $sth = Class::DBI::Query ->new({ owner => $class, sqlname => $type, essential => \@columns, where_columns => \@where_cols, }) ->run($val); =head1 説明 This abstracts away many of the details of the Class::DBI underlying SQL mechanism. For the most part you probably don't want to be interfacing directly with this. このモジュールは、SQLメカニズムに基づくClass::DBIの詳細を抽象化する。 大部分において、あなたは恐らく直接このモジュールを使ってインタフェース化 しようとは思わないだろう。 The underlying mechanisms are not yet stable, and are subject to change at any time. 基礎をなしている仕組みはまだ安定していない。いつでも変更の対象となる。 =head1 オプション A Query can have many options set before executing. Most can either be passed as an option to new(), or set later if you are building the query up dynamically: Queryモジュールは実行前にセットする多くのオプションを持つ。ほとんどは new()にオプションとして渡すか、あるいは動的に問い合わせを構築する 場合、後からセットするかできる。 =head2 owner The Class::DBI subclass that 'owns' this query. In the vast majority of cases a query will return objects - the owner is the class of which instances will be returned. Class::DBIのサブクラスがこの問い合わせを'所有'する。大概の場合に おいて、問い合わせはオブジェクト―インスタンスが返えされるクラスが その所有者となる―を返す。 =head2 sqlname This should be the name of a query set up using set_sql. set_sqlを使って設定される問い合わせの名前。 =head2 where_clause This is the raw SQL that will substituted into the 'WHERE %s' in your query. If you have multiple %s's in your query then you should supply a listref of where_clauses. This SQL can include placeholders, which will be used when you call run(). これは生のSQL文であり、あなたの問い合わせの中で'WHERE %s'に置換される。 問い合わせの中で複数の%sを使った場合、where_clausesのリストリファレンスを 用意しなければならない。 =head2 essential When retrieving rows from the database that match the WHERE clause of the query, these are the columns that we fetch back and pre-load the resulting objects with. By default this is the Essential column group of the owner class. データベースから問い合わせのWHERE句にマッチする行を取り出すとき、 それらは我々が取り出し、結果オブジェクトをプリロードするカラムである。 デフォルトでは、これはその所有クラスのEssentialカラムグループである。 =head1 メソッド =head2 where() $query->where($match, @columns); This will extend your 'WHERE' clause by adding a 'AND $column = ?' (or whatever $match is, isntead of "=") for each column passed. If you have multiple WHERE clauses this will extend the last one. このメソッドは、渡された各カラムに対応した'AND $column = ?'(あるいは "="の代わりに$matchであればなんでも)を加えることで、'WHERE'句を拡張する。 複数のWHERE句がある場合、このメソッドは最後の一つを拡張する。