hirokawa Sat Apr 14 03:39:46 2001 EDT Added files: /phpdoc/ja/functions dbx.xml Modified files: /phpdoc/ja Translators /phpdoc/ja/functions image.xml Log: added dbx.xml update translation.
Index: phpdoc/ja/Translators diff -u phpdoc/ja/Translators:1.21 phpdoc/ja/Translators:1.22 --- phpdoc/ja/Translators:1.21 Thu Apr 5 08:09:14 2001 +++ phpdoc/ja/Translators Sat Apr 14 03:39:45 2001 @@ -45,6 +45,7 @@ functions/dba.xml Rui Hirokawa functions/dbase.xml Rui Hirokawa functions/dbm.xml Michihide Hotta +functions/dbx.xml Rui Hirokawa functions/dir.xml Rui Hirokawa functions/dl.xml Chihiro Higuchi functions/domxml.xml Rui Hirokawa Index: phpdoc/ja/functions/image.xml diff -u phpdoc/ja/functions/image.xml:1.21 phpdoc/ja/functions/image.xml:1.22 --- phpdoc/ja/functions/image.xml:1.21 Sat Feb 3 17:05:22 2001 +++ phpdoc/ja/functions/image.xml Sat Apr 14 03:39:45 2001 @@ -118,6 +118,41 @@ </refsect1> </refentry> + <refentry id="function.imagealphablending"> + <refnamediv> + <refname>ImageAlphaBlending</refname> + <refpurpose>イメージをblendingモードに設定する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imagealphablending</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + <paramdef>bool <parameter>blendmode</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageAlphaBlending</function> によりTrueColorイメージに + +二つの異なる描画モードを使用可能となります。blendingモードでは、 + +全ての描画関数に指定される色のalphaチャネル要素として使用され、 + 例えば<function>ImageSetPixel</function>では背景色の透過割合を定 + 義します。結果として、gd +は描画色に関してその点に存在する色を自動 + +的にブレンドし、イメージに結果を保存します。結果のピクセルは、透 + +明になります。ブレンドモードでない場合、描画色は形式的にそのアル + +ファチャネル情報にコピーされ、出力ピクセルを置換します。ブレンド + +モードは、パレットイメージを描画している際には使用できません。 + <parameter>blendmode</parameter> がtrueの場合、blendingモードが有 + 効になり、そうでない場合は無効となります。 + </para> + <note> + <para> + この関数は、PHP 4.0.6で追加され、GD 2.0.1を必要をします。 + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.imagearc"> <refnamediv> <refname>ImageArc</refname> @@ -139,10 +174,11 @@ </funcprototype> </funcsynopsis> <para> - <function>ImageArc</function>は、imで示す画像上に<parameter>cx</parameter>、 - <parameter>cy</parameter>を中心(左上が0,0)とする部分楕円を描画します。 - <parameter>w</parameter>と<parameter>h</parameter>はそれぞれ楕円の幅と - 高さを指定します。一方、始点と終点は引数<parameter>s</parameter>と + <function>ImageArc</function>は、imで示す画像上に + <parameter>cx</parameter>、<parameter>cy</parameter>を中心(左上が + 0,0)とする部分楕円を描画します。<parameter>w</parameter>と + +<parameter>h</parameter>はそれぞれ楕円の幅と高さを指定します。一 + 方、始点と終点は引数<parameter>s</parameter>と <parameter>e</parameter>により度(deg)で指定します。 </para> </refsect1> @@ -167,9 +203,10 @@ </funcprototype> </funcsynopsis> <para> - <function>ImageChar</function>は、画像<parameter>im</parameter>上の - 座標<parameter>x</parameter>,<parameter>y</parameter>(左上が0,0) に - <parameter>col</parameter>色で<parameter>c</parameter>の最初の文字を描画します。 + <function>ImageChar</function>は、画像<parameter>im</parameter>上 + の座標<parameter>x</parameter>,<parameter>y</parameter>(左上が + 0,0) に <parameter>col</parameter>色で<parameter>c</parameter>の + 最初の文字を描画します。 font が、1, 2, 3, 4 , 5 の場合は組込みフォントが使用されます。 (より大きな数字はより大きなフォントに対応します) </para> @@ -335,6 +372,40 @@ </refsect1> </refentry> + <refentry id="function.imagecolorclosestalpha"> + <refnamediv> + <refname>ImageColorClosestAlpha</refname> + <refpurpose> + Get the index of the closest color to the specified color + alpha + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imagecolorclosestalpha</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + <paramdef>int <parameter>red</parameter></paramdef> + <paramdef>int <parameter>green</parameter></paramdef> + <paramdef>int <parameter>blue</parameter></paramdef> + <paramdef>int <parameter>alpha</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Returns the index of the color in the palette of the image which + is "closest" to the specified <acronym>RGB</acronym> value and +<parameter>alpha</parameter> level. + </para> + <para> + See also <function>imagecolorexactalpha</function>. + </para> + <note> + <para> + This function was added in PHP 4.0.6 and requires GD 2.0.1 + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.imagecolorexact"> <refnamediv> <refname>ImageColorExact</refname> @@ -360,9 +431,46 @@ <para> <function>imagecolorclosest</function> も参照下さい。 </para> - </refsect1> - </refentry> + </refsect1> + </refentry> + <refentry id="function.imagecolorexactalpha"> + <refnamediv> + <refname>ImageColorExactAlpha</refname> + <refpurpose>Get the index of the specified color + alpha</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imagecolorexactalpha</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + <paramdef>int <parameter>red</parameter></paramdef> + <paramdef>int <parameter>green</parameter></paramdef> + <paramdef>int <parameter>blue</parameter></paramdef> + <paramdef>int <parameter>alpha</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Returns the index of the specified color+alpha in the palette of the + image. + </para> + <para> + If the color does not exist in the image's palette, -1 is + returned. + </para> + <para> + See also <function>imagecolorclosestalpha</function>. + </para> + <note> + <para> + This function was added in PHP 4.0.6 and requires GD 2.0.1 or + later + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.imagecolorresolve"> <refnamediv> <refname>ImageColorResolve</refname> @@ -391,6 +499,164 @@ </refsect1> </refentry> + <refentry id="function.imageellipse"> + <refnamediv> + <refname>ImageEllipse</refname> + <refpurpose>Draw an ellipse</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imageellipse</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + <paramdef>int <parameter>cx</parameter></paramdef> + <paramdef>int <parameter>cy</parameter></paramdef> + <paramdef>int <parameter>w</parameter></paramdef> + <paramdef>int <parameter>h</parameter></paramdef> + <paramdef>int <parameter>col</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageEllipse</function> draws an ellipse centered at + <parameter>cx</parameter>, <parameter>cy</parameter> (top left is + 0, 0) in the image represented by <parameter>im</parameter>. + <parameter>W</parameter> and <parameter>h</parameter> specifies the + ellipse's width and height respectively. The color of the ellipse is + specified by <parameter>color</parameter>. + </para> + <note> + <para> + This function was added in PHP 4.0.6 and requires GD 2.0.2 or + later + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.imagefilledarc"> + <refnamediv> + <refname>ImageFilledArc</refname> + <refpurpose>Draw a partial ellipse and fill it</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imagefilledarc</function></funcdef> + <paramdef>int <parameter>im</parameter></paramdef> + <paramdef>int <parameter>cx</parameter></paramdef> + <paramdef>int <parameter>cy</parameter></paramdef> + <paramdef>int <parameter>w</parameter></paramdef> + <paramdef>int <parameter>h</parameter></paramdef> + <paramdef>int <parameter>s</parameter></paramdef> + <paramdef>int <parameter>e</parameter></paramdef> + <paramdef>int <parameter>col</parameter></paramdef> + <paramdef>int <parameter>style</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageFilledArc</function> draws a partial ellipse centered at + <parameter>cx</parameter>, <parameter>cy</parameter> (top left is + 0, 0) in the image represented by im. <parameter>W</parameter> + and <parameter>h</parameter> specifies the ellipse's width and + height respectively while the start and end points are specified + in degrees indicated by the <parameter>s</parameter> and + <parameter>e</parameter>. arguments. + <parameter>style</parameter> is a bitwise OR of the following possibilities: + <orderedlist> + <listitem><simpara>IMG_ARC_PIE</simpara></listitem> + <listitem><simpara>IMG_ARC_CHORD</simpara></listitem> + <listitem><simpara>IMG_ARC_NOFILL</simpara></listitem> + <listitem><simpara>IMG_ARC_EDGED</simpara></listitem> + </orderedlist> + IMG_ARC_PIE and IMG_ARC_CHORD are mutually exclusive; IMG_ARC_CHORD just + connects the starting and ending angles with a straight line, while + IMG_ARC_PIE produces a rounded edge. IMG_ARC_NOFILL indicates that the arc + or chord should be outlined, not filled. IMG_ARC_EDGED, used together with + IMG_ARC_NOFILL, indicates that the beginning and ending angles should be + connected to the center - this is a good way to outline (rather than fill) + a 'pie slice'. + </para> + <note> + <para> + This function was added in PHP 4.0.6 and requires GD 2.0.1 + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.imagefilledellipse"> + <refnamediv> + <refname>ImageFilledEllipse</refname> + <refpurpose>Draw a filled ellipse</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imagefilledellipse</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + <paramdef>int <parameter>cx</parameter></paramdef> + <paramdef>int <parameter>cy</parameter></paramdef> + <paramdef>int <parameter>w</parameter></paramdef> + <paramdef>int <parameter>h</parameter></paramdef> + <paramdef>int <parameter>col</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageFilledEllipse</function> draws an ellipse centered at + <parameter>cx</parameter>, <parameter>cy</parameter> (top left is + 0, 0) in the image represented by <parameter>im</parameter>. + <parameter>W</parameter> and <parameter>h</parameter> specifies the + ellipse's width and height respectively. The ellipse is filled using + <parameter>color</parameter> + </para> + <note> + <para> + This function was added in PHP 4.0.6 and requires GD 2.0.1 or + later + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.imagecolorresolvealpha"> + <refnamediv> + <refname>ImageColorResolveAlpha</refname> + <refpurpose> + Get the index of the specified color + alpha or its closest possible + alternative + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imagecolorresolvealpha</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + <paramdef>int <parameter>red</parameter></paramdef> + <paramdef>int <parameter>green</parameter></paramdef> + <paramdef>int <parameter>blue</parameter></paramdef> + <paramdef>int <parameter>alpha</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function is guaranteed to return a color index for a + requested color, either the exact color or the closest possible + alternative. + </para> + <para> + See also <function>imagecolorclosestalpha</function>. + </para> + <note> + <para> + This function was added in PHP 4.0.6 and requires GD 2.0.1 + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.imagegammacorrect"> <refnamediv> <refname>ImageGammaCorrect</refname> @@ -586,6 +852,95 @@ </refsect1> </refentry> + <refentry id="function.imagecopymerge"> + <refnamediv> + <refname>ImageCopyMerge</refname> + <refpurpose> + Copy and merge part of an image + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>ImageCopyMerge</function> </funcdef> + <paramdef>int <parameter>dst_im</parameter> </paramdef> + <paramdef>int <parameter>src_im</parameter> </paramdef> + <paramdef>int <parameter>dst_x</parameter> </paramdef> + <paramdef>int <parameter>dst_y</parameter> </paramdef> + <paramdef>int <parameter>src_x</parameter> </paramdef> + <paramdef>int <parameter>src_y</parameter> </paramdef> + <paramdef>int <parameter>src_w</parameter> </paramdef> + <paramdef>int <parameter>src_h</parameter> </paramdef> + <paramdef>int <parameter>pct</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + Copy a part of <parameter>src_im</parameter> onto + <parameter>dst_im</parameter> starting at the x,y coordinates + <parameter>src_x</parameter>, <parameter>src_y </parameter> with + a width of <parameter>src_w</parameter> and a height of + <parameter>src_h</parameter>. The portion defined will be copied + onto the x,y coordinates, <parameter>dst_x</parameter> and + <parameter>dst_y</parameter>. + The two images will be merged according to <parameter>pct</parameter> + which can range from 0 to 100. When <parameter>pct</parameter> = 0, + no action is taken, when 100 this function behaves identically + to <function>ImageCopy</function>. + </para> + </refsect1> + </refentry> + + <refentry id="function.imagecopymergegray"> + <refnamediv> + <refname>ImageCopyMergeGray</refname> + <refpurpose> + Copy and merge part of an image with gray scale + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>ImageCopyMergeGray</function> </funcdef> + <paramdef>int <parameter>dst_im</parameter> </paramdef> + <paramdef>int <parameter>src_im</parameter> </paramdef> + <paramdef>int <parameter>dst_x</parameter> </paramdef> + <paramdef>int <parameter>dst_y</parameter> </paramdef> + <paramdef>int <parameter>src_x</parameter> </paramdef> + <paramdef>int <parameter>src_y</parameter> </paramdef> + <paramdef>int <parameter>src_w</parameter> </paramdef> + <paramdef>int <parameter>src_h</parameter> </paramdef> + <paramdef>int <parameter>pct</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function is identical to <function>ImageCopyMerge</function> except + that when merging it preservese the hue of the source by converting + the destination pixels to gray scale before the copy operation. + </para> + <para> + Copy a part of <parameter>src_im</parameter> onto + <parameter>dst_im</parameter> starting at the x,y coordinates + <parameter>src_x</parameter>, <parameter>src_y </parameter> with + a width of <parameter>src_w</parameter> and a height of + <parameter>src_h</parameter>. The portion defined will be copied + onto the x,y coordinates, <parameter>dst_x</parameter> and + <parameter>dst_y</parameter>. + The two images will be merged according to <parameter>pct</parameter> + which can range from 0 to 100. When <parameter>pct</parameter> = 0, + no action is taken, when 100 this function behaves identically + to <function>ImageCopy</function>. + </para> + <para> + This function is identical to <function>ImageCopyMerge</function> except + that when merging it preservese the hue of the source by converting + the destination pixels to gray scale before the copy operation. + </para> + <note><para>This function was added in PHP 4.0.6</para></note> + </refsect1> + </refentry> + <refentry id="function.imagecopyresized"> <refnamediv> <refname>ImageCopyResized</refname> @@ -618,13 +973,65 @@ 同一であれば)関数は領域のコピーに使うことができますが、 領域が重なったときの結果は予測できません。 </para> + <para> + <function>ImageCopyResampled</function>も参照下さい。 + </para> </refsect1> </refentry> + <refentry id="function.imagecopyresampled"> + <refnamediv> + <refname>ImageCopyResampled</refname> + <refpurpose>Copy and resize part of an image with resampling</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imagecopyresampled</function></funcdef> + <paramdef>resource <parameter>dst_im</parameter></paramdef> + <paramdef>resource <parameter>src_im</parameter></paramdef> + <paramdef>int <parameter>dstX</parameter></paramdef> + <paramdef>int <parameter>dstY</parameter></paramdef> + <paramdef>int <parameter>srcX</parameter></paramdef> + <paramdef>int <parameter>srcY</parameter></paramdef> + <paramdef>int <parameter>dstW</parameter></paramdef> + <paramdef>int <parameter>dstH</parameter></paramdef> + <paramdef>int <parameter>srcW</parameter></paramdef> + <paramdef>int <parameter>srcH</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageCopyResampled</function> copies a rectangular + portion of one image to another image, smoothly interpolating pixel + values so that, in particular, reducing the size of an image still + retains a great deal of clarity. + <parameter>Dst_im</parameter> is the destination image, + <parameter>src_im</parameter> is the source image identifier. If + the source and destination coordinates and width and heights + differ, appropriate stretching or shrinking of the image fragment + will be performed. The coordinates refer to the upper left + corner. This function can be used to copy regions within the + same image (if <parameter>dst_im</parameter> is the same as + <parameter>src_im</parameter>) but if the regions overlap the + results will be unpredictable. + </para> + <para> + See also <function>ImageCopyResized</function>. + </para> + <note> + <para> + This function was added in PHP 4.0.6 and requires GD 2.0.1 or + later + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.imagecreate"> <refnamediv> <refname>ImageCreate</refname> - <refpurpose>新規画像の作成</refpurpose> + <refpurpose>パレットを使用する新規画像の作成</refpurpose> </refnamediv> <refsect1> <title>説明</title> @@ -658,6 +1065,58 @@ </refsect1> </refentry> + <refentry id="function.imagecreatetruecolor"> + <refnamediv> + <refname>ImageCreateTrueColor</refname> + <refpurpose>Create a new true color image</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>resource <function>imagecreatetruecolor</function></funcdef> + <paramdef>int <parameter>x_size</parameter></paramdef> + <paramdef>int <parameter>y_size</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageCreateTrueColor</function> returns an image identifier + representing a black image of size <parameter>x_size</parameter> + by <parameter>y_size</parameter>. + </para> + <note><para>This function was added in PHP 4.0.6</para></note> + <note><para>This function requires GD 2.0.1 or later</para></note> + </refsect1> + </refentry> + + <refentry id="function.imagetruecolortopalette"> + <refnamediv> + <refname>ImageTrueColorToPalette</refname> + <refpurpose>Convert a true color image to a palette image</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>imagetruecolortopalette</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageTrueColorToPalette</function> converts a truecolor image + to a palette image. The code for this function was originally drawn from + the Independent JPEG Group library code, which is excellent. The code + has been modified to preserve as much alpha channel information as + possible in the resulting palette, in addition to preserving colors as + well as possible. This does not work as well as might be hoped. It is + usually best to simply produce a truecolor output image instead, which + guarantees the highest output quality. + </para> + <note><para>This function was added in PHP 4.0.6</para></note> + <note><para>This function requires GD 2.0.1 or later</para></note> + </refsect1> + </refentry> + <refentry id="function.imagecreatefromgif"> <refnamediv> <refname>ImageCreateFromGif</refname> @@ -1898,6 +2357,106 @@ <function>imagecreate</function>および <function>imagecolorallocate</function>も参考にしてください。 </para> + </refsect1> + </refentry> + + <refentry id="function.imagesetbrush"> + <refnamediv> + <refname>ImageSetBrush</refname> + <refpurpose>Set the brush image for line drawing</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imagesetbrush</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + <paramdef>resource <parameter>brush</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageSetBrush</function> sets the brush image to be + used by all line drawing functions (such as <function>ImageLine</function> + and <function>ImagePolygon</function>) when drawing with the special + colors IMG_COLOR_BRUSHED or IMG_COLOR_STYLEDBRUSHED. + </para> + <note> + <para> + You need not take special action when you are finished with a + brush, but if you + destroy the brush image, you must not use the IMG_COLOR_BRUSHED + or IMG_COLOR_STYLEDBRUSHED + colors until you have set a new brush image! + </para> + </note> + <note> + <para> + この関数は、PHP 4.0.6 で追加されました。 + </para> + </note> + </refsect1> + </refentry> + + <refentry id="function.imagesettile"> + <refnamediv> + <refname>ImageSetTile</refname> + <refpurpose>Set the tile image for filling</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>imagesettile</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + <paramdef>resource <parameter>tile</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageSetTile</function> sets the tile image to be + used by all region filling functions (such as <function>ImageFill</function> + and <function>ImageFilledPolygon</function>) when filling with the special + color IMG_COLOR_TILED. + </para> + <para> + A tile is an image used to fill an area with a repeated pattern. +<emphasis>Any</emphasis> + GD image can be used as a tile, and by setting the transparent color index +of the tile + image with <function>ImageColorTransparent</function>, a tile allows certain +parts + of the underlying area to shine through can be created. + </para> + <note> + <para>You need not take special action when you are finished with a tile, +but if you + destroy the tile image, you must not use the IMG_COLOR_TILED color until you +have + set a new tile image!</para> + </note> + <note><para>This function was added in PHP 4.0.6</para></note> + </refsect1> + </refentry> + + <refentry id="function.imagesetthickness"> + <refnamediv> + <refname>ImageSetThickness</refname> + <refpurpose>Set the thickness for line drawing</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>imagesetthickness</function></funcdef> + <paramdef>resource <parameter>im</parameter></paramdef> + <paramdef>int <parameter>thickness</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>ImageSetThickness</function> sets the thickness of the lines + drawn when drawing rectangles, polygons, ellipses etc. etc. to + <parameter>thickness</parameter> pixels. + </para> + <note> + <para> + This function was added in PHP 4.0.6 and requires GD 2.0.1 or + later + </para> + </note> </refsect1> </refentry> Index: phpdoc/ja/functions/dbx.xml +++ phpdoc/ja/functions/dbx.xml <reference id="ref.dbx"> <title>dbx 関数</title> <titleabbrev>dbx</titleabbrev> <partintro> <simpara> dbx モジュールは、データベース抽象化レイヤ (db 'X'、ただし 'X' は サポートされるデータベースの一つを意味します)のことです。dbx 関数 により、サポートされる全てのデータベースを単一の呼出表記によりアク セスすることが可能になります。これらの関数を利用可能にするには、 <option role="configure">--enable-dbx</option> オプションを使用し てdbxサポートを有効にし、また、使用するデータベースに関するオプショ ン、例えば、MySQL の場合は <option role="configure">--with-mysql</option> も指定して PHPをコンパイル する必要があります。dbx 関数自体は、データベースへの直接のインター フェイスを有しませんが、それらのデータベースをサポートするために使 用されるモジュールへのインターフェイスを有します。dbxモジュールで データベースを使用可能とするには、そのモジュールが PHPにリンクされ るかロードされる必要があり、そのデータベースのモジュールは、dbxモ ジュールにサポートされている必要があります。現在、MySQL、 PostgreSQL、ODBCがサポートされており、その他についても(希望的観測 だとまもなく)追加される予定です。 </simpara> <simpara> dbx にデータベースのサポートを追加するためのドキュメントは、 <ulink url="&url.dbx.docs;">&url.dbx.docs;</ulink> にあります。 </simpara> </partintro> <refentry id="function.dbx-close"> <refnamediv> <refname>dbx_close</refname> <refpurpose>オープンされた接続/データベースを閉じる</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>dbx_close</function></funcdef> <paramdef>dbx_link_object <parameter>link_identifier</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> 成功時に<literal>TRUE</literal>、エラーの際に <literal>FALSE</literal>を返します。 </para> <example> <title><function>dbx_close</function> の例</title> <programlisting role="php"> <?php $link = dbx_connect ("mysql", "localhost", "db", "username", "password") or die ("Could not connect"); print("Connected successfully"); dbx_close($link); ?> </programlisting> </example> <note> <para> モジュール毎のドキュメントも参照下さい。 </para> </note> <para> <function>dbx_connect</function>も参照下さい。 </para> </refsect1> </refentry> <refentry id="function.dbx-connect"> <refnamediv> <refname>dbx_connect</refname> <refpurpose>接続/データベースをオープンする</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>dbx_link_object <function>dbx_connect</function></funcdef> <paramdef>string <parameter>module</parameter></paramdef> <paramdef>string <parameter>host</parameter></paramdef> <paramdef>string <parameter>database</parameter></paramdef> <paramdef>string <parameter>username</parameter></paramdef> <paramdef>string <parameter>password</parameter></paramdef> <paramdef>int <parameter><optional>persistent</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> 返り値: 成功時にdbx_link_object、エラー時に <literal>FALSE</literal>。接続が確立されたが、データベースが選択 できない場合でも、この関数は dbx_link_object を返します。パラメー タ<parameter>persistent</parameter>にDBX_PERSISTENTを設定すること ができ、この場合には、持続的接続が作成されます。 </para> <para> 使用可能なモジュール名を以下に示します。ただし、モジュールが実際 にロードされている場合にのみ動作することに注意して下さい。 </para> <para> <itemizedlist> <listitem> <simpara> モジュール 1: "mysql" </simpara> </listitem> <listitem> <simpara> モジュール 2: "odbc" </simpara> </listitem> <listitem> <simpara> モジュール 3: "pgsql" </simpara> </listitem> </itemizedlist> </para> <para> pgsql サポートは、まだ実験的であり、ソースファイルの一つを自分で 修正した後で pgsql モジュールをコンパイルする必要があります。修正 を行わないとクエリ毎に PostgreSQLの警告が発生してしまいます。 </para> <para> dbx_link_object は、3つのメンバ 'handle'、'module'、'database' を 有します。メンバ 'database'は、現在選択されているデータベースの名 前です。メンバ'module'は、dbxの内部のみで使用され、上記の有効なモ ジュール番号です。メンバ 'handle' は、データベース接続に関する有 効なハンドルで、(必要に応じて)モジュール専用関数で使用されます。 例えば、 </para> <para> <informalexample> <programlisting role="php"> <?php $link = dbx_connect ("mysql", "localhost", "db", "username", "password"); mysql_close ($link->handle); // dbx_close($link) の方が良いかもしれません ?> </programlisting> </informalexample> </para> <para> パラメータhost、database、username、passwordが必要ですが、常に抽 象化モジュールで使用されるわけではありません。 </para> <para> <example> <title><function>dbx_connect</function> の例</title> <programlisting role="php"> <?php $link = dbx_connect ("odbc", "", "db", "username", "password", DBX_PERSISTENT) or die ("接続できません"); print ("接続に成功しました"); dbx_close ($link); ?> </programlisting> </example> <note> <para> モジュール毎のドキュメントも参照下さい。 </para> </note> </para> <para> <function>dbx_close</function>も参照下さい。 </para> </refsect1> </refentry> <refentry id="function.dbx-error"> <refnamediv> <refname>dbx_error</refname> <refpurpose> (接続時だけでなく)使用するモジュールの最新の関数コールにおけるエ ラーメッセージを出力する </refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>string <function>dbx_error</function></funcdef> <paramdef>dbx_link_object <parameter>link_identifier</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> モジュール(例えば mysql-module)の直近の関数コールからエラーメッセー ジを有する文字列を返します。同じモジュールに複数の接続がある場合、 最後のエラーのみが取得されます。別のモジュールに接続がある場合、 (リンクパラメータで)指定したモジュールに関する直近のエラーのみが 返されます。ODBCモジュールは現在エラー出力関数をサポートしていな いことに注意して下さい。 </para> <example> <title><function>dbx_error</function>の例</title> <programlisting role="php"> <?php $link = dbx_connect ("mysql", "localhost", "db", "username", "password") or die ("接続できません"); $result = dbx_query ($link, "select id from nonexistingtbl"); if ($result==0) { echo dbx_error ($link); } dbx_close ($link); ?> </programlisting> </example> <note> <para> モジュール毎のドキュメントも参照下さい。 </para> </note> </refsect1> </refentry> <refentry id="function.dbx-query"> <refnamediv> <refname>dbx_query</refname> <refpurpose>クエリを送信し、(ある場合には)結果を全て取得する</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>dbx_result_object <function>dbx_query</function></funcdef> <paramdef>dbx_link_object <parameter>link_identifier</parameter> </paramdef> <paramdef>string <parameter>sql_statement</parameter></paramdef> <paramdef>long <parameter><optional>flags</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> 成功時にdbx_result_objectまたは1を返します。結果オブジェクトは、 SQL命令が結果を返す場合にのみ返されます。エラーの場合には、0を返 します。パラメータ <parameter>flags</parameter> は、返される情報 の量を制御するために使用されます。定数 DBX_RESULT_INFO, DBX_RESULT_INDEX, DBX_RESULT_ASSOC またはこれらの論理和を組み合わ せることが可能です。DBX_RESULT_INFO を指定するとフィールド名およ びフィールド型のようなカラムに関する情報が提供されます。 DBX_RESULT_INDEX により、結果は(data[2][3]のような、ただし、2はレ コード番号、3はカラム番号)2次元の配列で返されます。ただし、最初の レコードおよびカラム番号は0から始まります。 DBX_RESULT_ASSOC により、フィールド名にカラム添字が関連付けられま す。パラメータ<parameter>flags</parameter> によらず DBX_RESULT_INDEXは常に返されることに注意して下さい。 DBX_RESULT_ASSOC が指定された場合、DBX_RESULT_INFOは指定されない 場合でも返されます。これは、DBX_RESULT_INDEX,DBX_RESULT_INDEX | DBX_RESULT_INFO および DBX_RESULT_INDEX | DBX_RESULT_INFO | DBX_RESULT_ASSOC の組み合わせのみが結果的に使用可能であることを意 味します。 <parameter>flags</parameter> が指定されない場合、この 最後の組み合わせがデフォルトです。連想配列で参照される結果は、添 字番号の結果へのリファレンスです。このため、 <literal>data[0][0]</literal> を修正した場合、 <literal>data[0]['fieldnameforfirstcolumn']</literal> も同時に修 正されます。 </para> <para> dbx_result_object には、5つのメンバがあります。 (<parameter>flags</parameter>によっては4つの場合もあります)これら は、'handle', 'cols', 'rows', 'info'(オプション), 'data'です。 handle は、指定したモジュールに関する有効な結果IDであり、次のよう にモジュール専用関数で使用可能です。 </para> <para> <informalexample role="php"> <programlisting> $result = dbx_query ($link, "SELECT id FROM tbl"); mysql_field_len ($result->handle, 0); </programlisting> </informalexample> </para> <para> メンバ cols および rows は、それぞれカラム(またはフィールド)番号 および行(またはレコード)番号です。例えば、 </para> <para> <informalexample> <programlisting role="php"> $result = dbx_query ($link, "SELECT id FROM tbl"); echo "結果のサイズ: " . $result->rows . " x " . $result->cols . "<br>\n"; </programlisting> </informalexample> </para> <para> メンバinfoは、DBX_RESULT_INFOまたはDBX_RESULT_ASSOCが <parameter>flags</parameter>パラメータで指定された場合のみ返され ます。このメンバは2次元配列で、カラム情報を取得するために二つのレ コード("name"と"type")を有しています。例えば、 </para> <para> <informalexample> <programlisting role="php"> $result = dbx_query ($link, "SELECT id FROM tbl"); echo "カラム名: " . $result->info["name"][0] . "<br>\n"; echo "カラム型: " . $result->info["type"][0] . "<br>\n"; </programlisting> </informalexample> </para> <para> メンバdataには、実際の結果が含まれます。そして、カラム名も同様に 関連しています。DBX_RESULT_ASSOCが設定された場合、 <literal>$result->data[2]["fieldname"]</literal>を使用することが 可能です。 </para> <example> <title><function>dbx_query</function> の例</title> <programlisting role="php"> <?php $link = dbx_connect ("odbc", "", "db", "username", "password") or die ("接続できません"); $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl"); if ($result==0) echo "クエリに失敗しました\n<br>"; elseif ($result==1) { echo "クエリの実行に成功しました\n<br>"; } else { $rows=$result->rows; $cols=$result->cols; echo "<p>テーブル次元: {$result->rows} x {$result->cols}<br><table border=1>\n"; echo "<tr>"; for ($col=0; $col<$cols; ++$col) { echo "<td>-{$result->info["name"][$col]}-<br>-{$result->info["type"][$col]}-</td>"; } echo "</tr>\n"; for ($row=0; $row<$rows; ++$row){ echo "<tr>"; for ($col=0; $col<$cols; ++$col) { echo "<td>-{$result->data[$row][$col]}-</td>"; } echo "</tr>\n"; } echo "</table><p>\n"; echo "テーブル次元: {$result->rows} x id, parentid, description<br><table border=1>\n"; for ($row=0; $row<$rows; ++$row) { echo "<tr>"; echo "<td>-{$result->data[$row]["id"]}-</td>"; echo "<td>-{$result->data[$row]["parentid"]}-</td>"; echo "<td>-{$result->data[$row]["description"]}-</td>"; echo "</tr>\n"; } echo "</table><p>\n"; } dbx_close($link); ?> </programlisting> </example> <note> <para> モジュール毎のドキュメントも参照下さい。 </para> </note> <para> <function>dbx_connect</function>も参照下さい。 </para> </refsect1> </refentry> <refentry id="function.dbx-sort"> <refnamediv> <refname>dbx_sort</refname> <refpurpose> カスタマイズされたsort関数により、dbx_queryから結果をソートする </refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>dbx_sort</function></funcdef> <paramdef>dbx_result_object <parameter>result</parameter></paramdef> <paramdef>string <parameter>user_compare_function</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> 成功時に<literal>TRUE</literal>、エラー時に <literal>FALSE</literal>を返します。 </para> <example> <title><function>dbx_sort</function>の例</title> <programlisting role="php"> <?php function user_re_order ($a, $b) { $rv = dbx_cmp_asc ($a, $b, "parentid"); if (!$rv) $rv = dbx_cmp_asc ($a, $b, "id"); return $rv; } $link = dbx_connect ("odbc", "", "db", "username", "password") or die ("接続できません"); $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl ORDER BY id"); echo "結果は、idでソートされています<br>"; dbx_query ($result, "user_re_order"); echo "結果はparentidでソートされ、続いて、idでソートされます<br>"; dbx_close ($link); ?> </programlisting> </example> <para> <function>dbx_cmp_asc</function> および <function>dbx_cmp_desc</function> も参照下さい。 </para> </refsect1> </refentry> <refentry id="function.dbx-cmp-asc"> <refnamediv> <refname>dbx_cmp_asc</refname> <refpurpose> 昇順にソートするために二つのレコードを比較する </refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>int <function>dbx_cmp_asc</function></funcdef> <paramdef>array <parameter>row_a</parameter></paramdef> <paramdef>array <parameter>row_b</parameter></paramdef> <paramdef>string <parameter>columnname_or_index</parameter></paramdef> </funcprototype> </funcsynopsis> <para> row_a[$columnname_or_index] が row_b[$columnname_or_index] に等し い場合に 0、より大きい場合に 1、より小さい場合に -1 を返します。 </para> <example> <title><function>dbx_cmp_asc</function>の例</title> <programlisting role="php"> <?php function user_re_order ($a, $b) { $rv = dbx_cmp_asc ($a, $b, "parentid"); if (!$rv) { $rv = dbx_cmp_asc ($a, $b, "id"); return $rv; } } $link = dbx_connect ("odbc", "", "db", "username", "password") or die ("接続できません"); $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl ORDER BY id"); echo "結果はidでソートされました<br>"; dbx_query ($result, "user_re_order"); echo "結果はparentidそしてidでソートされました<br>"; dbx_close ($link); ?> </programlisting> </example> <para> <function>dbx_sort</function>および <function>dbx_cmp_desc</function>も参照下さい。 </para> </refsect1> </refentry> <refentry id="function.dbx-cmp-desc"> <refnamediv> <refname>dbx_cmp_desc</refname> <refpurpose> 降順にソートするために二つのレコードを比較する </refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> <funcdef>int <function>dbx_cmp_desc</function></funcdef> <paramdef>array <parameter>row_a</parameter></paramdef> <paramdef>array <parameter>row_b</parameter></paramdef> <paramdef>string <parameter>columnname_or_index</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> row_a[$columnname_or_index] が row_b[$columnname_or_index] に等し い場合に 0、より大きい場合に-1、より小さい場合に1を返します。 </para> <example> <title><function>dbx_cmp_desc</function>の例</title> <programlisting role="php"> <?php function user_re_order ($a, $b) { $rv = dbx_cmp_asc ($a, $b, "parentid"); if (!$rv) { $rv = dbx_cmp_asc($a, $b, "id"); return $rv; } } $link = dbx_connect ("odbc", "", "db", "username", "password") or die ("接続できません"); $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl ORDER BY id"); echo "結果はidでソートされました<br>"; dbx_query ($result, "user_re_order"); echo "結果はparentidそしてidでソートされました<br>"; dbx_close ($link); ?> </programlisting> </example> <para> <function>dbx_sort</function>および <function>dbx_cmp_asc</function>も参照下さい。 </para> </refsect1> </refentry> </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: -->