RE: [PEAR] Question about MDB2 Schema and why it does not work
| From: | Ryan Sims | Date: | Thu, 10 Jan 2008 00:34:45 +0000 |
| Subject: | RE: [PEAR] Question about MDB2 Schema and why it does not work | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28423@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Dmitri [mailto:email12@sharedlog.com]
> Sent: Wednesday, January 09, 2008 5:40 PM
> To: PEAR general list
> Subject: [PEAR] Question about MDB2 Schema and why it does not work
>
> Hello!
>
> I am trying to create new tables in an empty database with MDB2 Schema
>
> It works this way:
> $hdlSchema =& MDB2_Schema::factory($strDSN, $options);
> $definition =
> $hdlSchema-
> >parseDatabaseDefinitionFile('/usr/local/apache/sites/schema.xml');
>
> $intCreatedTables = 0;
> foreach ($definition['tables'] as $table_name => $table)
> {
> $result = $hdlSchema->createTable($table_name,
> $table, false, array());
>
> if (PEAR::isError($result))
> {
> print_r($result);
> break;
> }
>
> $intCreatedTables++;
>
> }
>
> Tables are created fine.
>
> But it does not work this way:
>
> $op = $hdlSchema->updateDatabase('/usr/local/apache/sites/schema.xml');
>
> I get error $op is Pear error:
>
> string 'MDB2 Error: insufficient permissions'
>
>
That error message corresponds to MDB2_ERROR_ACCESS_VIOLATION, which is
thrown whenever MySQL raises a 1044 or 1142 error message. In either case,
it sounds like your MySQL user has privileges for CREATE, but not ALTER.
Grant ALTER permissions on your MySQL user and the updateDatabase() method
should work.