Re: File::CSV patch
| From: | Yavor Shahpasov | Date: | Wed, 11 Dec 2002 15:27:09 +0000 |
| Subject: | Re: File::CSV patch | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-11556@lists.php.net to get a copy of this message | ||
> It would seem even more logical to have an optional parameter specifying
the
> mode like in the File class
>
> FILE_MODE_WRITE
> FILE_MODE_APPEND
>
> Arnaud.
>
> > * @return bool True on success false otherwise
> > */
> > - function write($file, $fields, &$conf, $mode = FILE_MODE_APPEND)
> > + function write($file, $fields, &$conf)
> > {
> > - if (!$fp = File_CSV::getPointer($file, $conf, $mode)) {
> > + if (!$fp = File_CSV::getPointer($file, $conf,
> > FILE_MODE_WRITE)) {
> > return false;
> > }
That is exactly what the patch does, I just think that it is more reasonable
to have append as the default mode. Attachment should be there now
Yavor
--- CSV.php Wed Dec 11 13:44:16 2002 +++ CSV.php.orig Fri Nov 22 19:26:00 2002 @@ -108,7 +108,7 @@ * * @param string $file The name of the file * @param array &$conf The configuration - * @param string $mode The open node (ex: FILE_MODE_READ or FILE_MODE_WRITE or FILE_MODE_APPEND) + * @param string $mode The open node (ex: FILE_MODE_READ or FILE_MODE_WRITE) * * @return mixed A file resource or false */ @@ -312,13 +312,12 @@ * @param string $file The filename where to write the data * @param array $fields Ordered array with the data * @param array &$conf The configuration of the dest CSV - * @param string $mode The open node (ex: FILE_MODE_READ or FILE_MODE_WRITE or FILE_MODE_APPEND) * * @return bool True on success false otherwise */ - function write($file, $fields, &$conf, $mode = FILE_MODE_APPEND) + function write($file, $fields, &$conf) { - if (!$fp = File_CSV::getPointer($file, $conf, $mode)) { + if (!$fp = File_CSV::getPointer($file, $conf, FILE_MODE_WRITE)) { return false; } if (count($fields) != $conf['fields']) {
--- CSV.php Wed Dec 11 13:44:16 2002 +++ CSV.php.orig Fri Nov 22 19:26:00 2002 @@ -108,7 +108,7 @@ * * @param string $file The name of the file * @param array &$conf The configuration - * @param string $mode The open node (ex: FILE_MODE_READ or FILE_MODE_WRITE or FILE_MODE_APPEND) + * @param string $mode The open node (ex: FILE_MODE_READ or FILE_MODE_WRITE) * * @return mixed A file resource or false */ @@ -312,13 +312,12 @@ * @param string $file The filename where to write the data * @param array $fields Ordered array with the data * @param array &$conf The configuration of the dest CSV - * @param string $mode The open node (ex: FILE_MODE_READ or FILE_MODE_WRITE or FILE_MODE_APPEND) * * @return bool True on success false otherwise */ - function write($file, $fields, &$conf, $mode = FILE_MODE_APPEND) + function write($file, $fields, &$conf) { - if (!$fp = File_CSV::getPointer($file, $conf, $mode)) { + if (!$fp = File_CSV::getPointer($file, $conf, FILE_MODE_WRITE)) { return false; } if (count($fields) != $conf['fields']) {