Em Sáb, 2005-11-12 às 16:58 +0100, Bogusław Brandys escreveu:
> Luiz Americo Pereira Camara wrote:
> > Em Qui, 2005-11-10 Ă s 14:39 -0600, Matt Henley escreveu:
> >
> >>Luiz,
> >>
> >>Thanks for the quick response. I have installed it and it seems to be
> >>okay. I tried to open a database file generated with SQLite Database
> >>Browser (I think.. it may be SQLiteSpy.. I put them into the same
> >>directory..) its called World.db3 and its openable by both of the
> >>above programs. When i try to make the database active in lazarus, I
> >>get the following error:
> >>
> >>Field Type "TEXT" not recognised. Does this mean that it calls
> >>character data something else?
> >
> >
> > Sqlite is typeless: ignores the type of the field (you can add any name
> > to a field or none).
> >
> > In the recent versions of TSqliteDataset, if a field type is not one of
> > the used internally (VARCHAR-> String, INTEGER -> Integer, etc ) it will
> > not be loaded (your case). Before it was loaded as a String field. It
> > was done to avoid inconsistencies/ambiquosity. For example, if you have
> > a table with type NUM and you load in fpc/TSqliteDataset, you'd expect
> > to be treated as a Integer or Float field. Other example: you have a
> > field TEXT and expect to be treated as a Memo field.
> >
> > I'm finishing an app that converts a table created elsewhere to use the
> > syntax used by TSqliteDataset. I'll post when it's done.
> >
> > The other solution, if you are creating table outside the class (using
> > CreateTable function), is to name a field using the names recognised by
> > TSqliteDataset: VARCHAR->StringField, the others are straight forward
> > (MEMO ->MemoField, AUTOINC->AutoIncField etc)
> >
> > FYI: The tables created with the fpc class can be manipulated by other
> > programs without problems. Only ensure that you dont insert incompatible
> > data,e.g. Characters in Integer fields.
> >
> > Luiz
>
> Woudn't be better for TSqlitedataset to recognize VARCHAR(X) , CHAR(X),
> NUMERCI(X) and other standard types and revert to string type when it is
> not recognized ?
It would add an overhead without a clear advantage.
The only drawback i see in the current approach is when you already have
a file with data and you want to use in fpc/TDataset. This situation
will be comtempled with the tool i'm developing.
Please keep in mind somethings:
- VARCHAR(X), CHAR(X), NUMERIC(X), whatever has the same meaning for
sqlite
- Most of the cases an application will create the table structure at
runtime (also can be created inside the Lazarus IDE)
- The table created with fpc/TSqliteDataset.CreateTable can be
manipullated in any sqlite tool
Luiz
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives