For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > September 2005 > [PEAR] MDB2_Schema : how to specify auto_increment ? (and other questions)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [PEAR] MDB2_Schema : how to specify auto_increment ? (and other questions)
Lassiege Hugo

2005-09-30, 6:57 pm

I try to use MDB2_Schema for alter, create and generate schema files. =
But there is no end user documentation so I try to ask my questions =
here.
The dump operation succeed. I try with :
'portability' =3D> (MDB2_PORTABILITY_ALL ^ =
MDB2_PORTABILITY_EMPTY_TO_NULL)
and=20
'portability' =3D> (MDB2_PORTABILITY_ALL )

But when I try to reload the xml file, I encounter several problems :
- the fields with auto_increment property lost this property. How can I =
keep auto_increment property ?
- In my database, I had 'not null' fields but no default value. The =
generated files describe :=20
in the first case=20
<field>
<name>idh</name>
<type>integer</type>
</field>
in the second case =20
<field>
<name>idh</name>
<type>integer</type>
<notnull>1</notnull>
</field>

In the first case I lost "not null" properties. In the second case I =
can't reload with MDB2_schema, the message is :=20

[userinfo] =3D> Parser error: if field is "notnull", it needs a =
default value - No error - Byte: 198; Line: 17; Col: 100

If I use :=20
<default></default> (for empty)
I get another errors :
[userinfo] =3D> [Last query: CREATE TABLE histo (idh INT DEFAULT =
NULL NOT NULL,dateCol DATETIME DEFAULT '0000-00-00 00:00:00',nom CHAR =
(50) DEFAULT NULL NOT NULL,type CHAR (1) DEFAULT 'D' NOT NULL,result =
CHAR (1) DEFAULT 'D' NOT NULL,perte INT DEFAULT 0 NOT NULL)]
[Native code: 1067]
[Native message: Valeur par d=E9faut invalide pour 'idh']

You can note the DEFAULT NULL NOT NULL that cause the problem.

In conclusion, I don't know how to generate a correct schema files.=20
Any idea ?
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com