Tuesday, October 28, 2008

Re: CSV file as DataSource

Seems interesting. Problem is I do not have access to MySQL 5.1(beta).
I will have an eye on it though.

Alex

On Oct 27, 10:38 pm, teknoid <teknoid.cake...@gmail.com> wrote:
> If you are using MySQL you might consider this:http://dev.mysql.com/tech-resources/articles/csv-storage-engine.html
>
> On Oct 27, 12:44 pm, su6z3r0 <a.rebh...@gmail.com> wrote:
>
> > Hello,
>
> > I am trying to setup a csv file as data source. But I do not know how/
> > where I could dynamically change the file name of the csv file. In my
> > below example the name "email.csv" should actually be a file name
> > which can be set up in the controller.
>
> > the database.php contains:
> >     var $csv = array(
> >         'datasource' => 'Csv',
> >         'file' => 'email.csv'     <- this should be a variable file
> > name set up in the controller
> >     );
>
> > In my model I connect to the source like this:
>
> >     function csvFindAll() {
> >         $this->setDataSource('csv');
> >         $csv = $this->getDataSource();
> >         return $csv->findAll();
> >     }
>
> > the Csv_source.php file opens the file:
>
> >     function connect() {
> >         $this->File    = fopen(WWW_ROOT . 'files/' . $this->config['file'], "r");
>
> >         if (!$this->File) {
> >             return false;
> >         }else {
> >             return true;
> >         }
> >     }
>
> > Any ideas, hints how I could achieve that?
>
> > TIA,
> > Alex
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: