Direct csv import into Base table

Zolnai Tamás zolnaitamas2000 at gmail.com
Mon Jun 3 05:57:47 PDT 2013


Hi Lionel,

2013/6/3 Lionel Elie Mamane <lionel at mamane.lu>

> Hi,
>
> Would you mind if I included the developer's mailing list in CC in our
> discussion?


Of course not. :)



> On Mon, Jun 03, 2013 at 12:05:56PM +0200, Zolnai Tamás wrote:
>
> >    I'm working on a new feature in Base again. It's just a little
> > user helper feature to make available the direct import of an csv
> > file into table, without open Calc and copy&paste the content from
> > it to Base.
>
> Base can already do that without resorting to Calc:
>
> 1) Menu File / New / Database
>
> 2) Connect to existing database / Text
>
> 3) Fill in needed configuration
>
> 3) Open the just created .odb file in window 1
>
> 4) Open the destination .odb file in window 2
>
> 5) Drag'n drop (or copy/paste) from window 1 to window 2.
>
> And it works for any supported database type, not only CSV, as long as
> the destination database driver supports SDBCX (that is, table
> creation).
>
> If you intend to put an easier / faster / ... UI on this procedure,
> sure, that seems nice.
>

 The usability of this method is the same as which I mentioned. Have to
open an other window and use copy&paste (additionally make a useless file).
So yes, my primary aim is to add an easier way.


> > already have the plan to implement it and it seems to me that it
> > will work not just with csv files but all Calc compatible format (in
> > this case only the first sheet will be imported, but later it can be
> > extended).
>
> This starts to look like you want to reimplement a different way to
> achieve the same as the above, and not only slap a different / better
> UI on it. Unless there is a good reason (which one?), I'd rather
> not. Two implementations = more code, two sets of bugs, confusion for
> the user, ...
>
> Note that the above works "for any calc compatible format" by using
> "Spreadsheet" instead of "Text". And many other sources...
>
> Again, slapping a better UI on it, that would e.g. avoid the need to
> create an .odb file which the user will delete right after, would be
> nice. I imagine it would work like this: reuse the database wizard
> open existing database and "connect to existing database" stuff to
> setup a SDBC URL, but do *not* create a .odb file connecting to that
> URL. Instead, connect to that URL in code, list the tables, ask the
> user which tables to import, and import them into the current
> database. Bonus points for reusing the same codepath as a paste in the
> the copy/paste case (one time for each table).


I didn't know about this feature up to now, but for the first blush it is
not the same feature, at least from the users point of view. As I see these
connection is a readonly access to a bunch of csv/text files (or sheets of
one spreadsheet file) with openning an alone database to them. The feature
which I intend to implement is making a new table and insert into the
already opened database. With this I just say that for the user it can be
looked as a different thing and so not make confusion.
(It's really an readonly access? Because copy&paste all the tables not a
usefull method to make them modifyable.)

Implementation is an other part. Of course I will look up the code of this
connection thing and reuse all the usefull code. But the implementation
which I planed is not means real new code, but intentse use of UNO API. The
Writer OLE-object feature use the XEmbeddedObject and other class linked
with it. One advantage of using this XEmbeddedObject is that it uses
implicitly the same file import as Calc do. So in case of csv/text files
the Calc's csv import dialog will be opened, which more usefull than the
page with the same aim in Base. More usefull means more options and a table
showing the expected result.

I don't know the underlying code of this connection feature yet, but I
would not suprise if it uses the same XEmbeddedObject.


> > I will use up the code which lies under the OLE-object feature of
> > Writer, which already contains the csv import.
>
> Why would that be any better than what I outlined above?
>

Because of the mentioned csv import dialog.


> >    The only question is where this feature would be reachable. I have two
> > ideas and I think all of these two places should be used:
> >    1. Table view -> "Tasks". Add a 4th option like "Import Table From
> > File...". This point contains all other places which are almost the
> > duplicates of this "Tables" list (e.g. Insert menu with label "Table
> > (Import)..." ).
> >    2. Table view -> "Tables" -> context menu. The label can be "Import
> > Table...".
>
> The context menu does not make that much sense to me, unless we *also*
> add the other tasks to it (and then also in Queries, Forms and Reports).


It comes in my mind just because the commonly used method is the copy&paste
and so people get to use the context menu. :)
But of course the first point will be enough too.


Best Regards,
Tamás
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130603/e7e2e290/attachment-0001.html>


More information about the LibreOffice mailing list