[Phpmyadmin-devel] [Fwd: csv -> mysql]
Marc Delisle
Marc.Delisle at cegepsherbrooke.qc.ca
Mon Jun 12 17:40:54 CEST 2006
Michal Čihař a écrit :
> Hi
>
> On Mon, 12 Jun 2006 09:59:20 +0200
> Sebastian Mendel <lists at sebastianmendel.de> wrote:
>
>> in english: is it possible to automatically create a table from CSV
>> file? in other words: auto detect field type by content?
>
> IMHO it could be possible, however there could be several problems:
>
> - what length should be char fields? text or varchar?
This reminds me: in MySQL 5.0.3+, a VARCHAR can be 65532 bytes! So for
this feature we probably could use VARCHAR instead of TEXT if the MySQL
version is recent enough.
Marc
>
> - detecting field type from whole file can take very long, so you need
> to scan only few lines and then somehow handle error when your
> expectation fails later
>
> We might simply choose to import everything to text fields and then
> let MySQL create 'optimal' structure by SELECT * FROM `table`
> PROCEDURE ANALYSE (). But it tends to create ENUMs for small set of
> values.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Phpmyadmin-devel mailing list
> Phpmyadmin-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
More information about the Developers
mailing list