This has nothing to do with NoSQL databases, this is just a pure relational
database connection


On Wed, Mar 27, 2013 at 2:03 PM, Cauan Cabral <notifications@github.com>wrote:

> In lib/Cake/Model/Datasource/Database/Connection.php:
>
> > @@ -427,4 +427,52 @@ public function lastInsertId($table) {
> >  		return $this->_driver->lastInsertId($table);
> >  	}
> >
> > +/**
> > + * Get the list of tables available in the current connection.
> > + *
> > + * @return array The list of tables in the connected database/schema.
> > + */
> > +	public function listTables() {
> > +		list($sql, $params) = $this->_driver->listTablesSql($this->_config);
> > +		$result = [];
> > +		$statement = $this->execute($sql, $params);
> > +		while ($row = $statement->fetch()) {
> > +			$result[] = $row[0];
> > +		}
> > +		return $result;
>
> I think how this will work for databases like MongoDb where collections
> are created 'on demand'.
>
> Just for listing (like for Fixture management) that work fine, but for
> check database existence before initialize Model will generate unecessary
> errors.
>
> Maybe we can add a property to indicate if some driver need pre-existent
> table before initialize respective model.
> What do you think?
>
> I know that is not Model related code for now, but will be in a near
> future ;]
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/cakephp/cakephp/pull/1195/files#r3549921>
> .
>