[Opensource] addIndex?? AutoIncremented??? (they don't
work for me)
Michael Rimov
rimovm at centercomp.com
Sat Aug 3 00:20:43 PDT 2002
At 06:25 PM 8/2/2002 -0300, you wrote:
>public void setupFields() throws DBException {
> setTargetTable("operador");
> setDescription("Operadores");
> addField("idOperador","int",0,false,"Id deste operador");
> setAutoIncremented("idOperador");
> addKey("idOperador");
> addField("login","varchar",16,false,"Nome de usuario");
> addIndex("login","login",true);
> addField("senha","varchar",16,false,"Senha do usuario");
>}
>
>
>When we look at the created tables structure, the keys are there, but
>the indexes aren't. And the "idOperador" field isn't "auto increment".
1 - Index... you have to have createTableIndicies="true" in your
expresso-config.xml file for the index to be created. Be aware that it
uses the CREATE INDEX function currently so it's a global index (and thus
names must be unique). If you wish to modify the Index bean in
com.jcorporate.expresso.core.dbobj so that it generates better code I'll be
happy to submit a patch to CVS.
2 - AutoInc... if you start adding fields you fill find that the fields ARE
autoincremented, but by Expresso, not the DB. This accomplishes several
things:
a) Database independence. Most databases have very different data
types and semantics for their auto-increment data types. Auto-inc takes
care of that.
b) As soon as you add the record, the autoinc field is filled out
with the value that was written to the database. This way you can find out
the key value without having to requery the database.
Hope these answers clarify things!
-Mike
More information about the Opensource
mailing list