Hello Frank, hello people,

I've been a good boy ;-) , and I've been testing on Sunday.
These are the results trying to copy *FROM* a flat file (comma separated
values) *TO* an HSQLDB embedded / MySQL database [obviously the other
way around is not possible], in Linux with Java UNO bridge.


1. only "ConnectionResource" = "sdbc:flat:file:///home/ariel/myfile.csv"

RESULT: CopyTableWizard.createWithInteractionHandler() throws
com.sun.star.lang.IllegalArgumentException: "Only tables and queries are
supported at the moment."



2. * "ConnectionResource" = "sdbc:flat:file:///home/ariel/myfile.csv"
   * "CommandType" = com.sun.star.sdb.CommandType.TABLE
   * "Command" = "myfile" == the file name without extension,
               as it is used in SELECT SQL statements to execute queries
               against the flat file

RESULT: the constructor returns an XCopyTableWizard reference, but
XExecutableDialog.execute() makes OOo crash (without crash report -- at
least here in Linux)



3. only "ActiveConnection" = XDriverManager.getConnectionWithInfo(URL,
info), where
   URL = "sdbc:flat:file:///home/ariel/myfile.csv"
   info = PropertyValue[] including all the needed info. to get connect
          to a flat datasource (CSV): Extension, Charset, FixedLength,
          HeaderLine, FieldDelimiter, StringDelimiter, DecimalDelimiter,
          ThousandDelimiter

RESULT: CopyTableWizard.createWithInteractionHandler() throws
com.sun.star.lang.IllegalArgumentException: "Only tables and queries are
supported at the moment."



4. Finally, 3 arguments:
  * "ActiveConnection" = XDriverManager.getConnectionWithInfo(URL, info)
      where
      URL = "sdbc:flat:file:///home/ariel/myfile.csv"
      info = PropertyValue[] including all the needed info. to get
             connect to a flat datasource (CSV): Extension, Charset,
             FixedLength, HeaderLine, FieldDelimiter, StringDelimiter,
             DecimalDelimiter, ThousandDelimiter
  * "CommandType" = com.sun.star.sdb.CommandType.TABLE
  * "Command" = "myfile" == the file name without extension,
                 as it is used in SELECT SQL statements to execute
                 queries against the flat file

RESULT: this is the one that works!

Conclusion: in order to implement this in an extension, it's not enough
to execute a FilePicker to choose a CSV file; all other options like the
field delimiter, etc. must be decided before trying to instantiate the
wizard.
So I see no other option than executing a wizard dialog (and also a
table like control would help to show to the user the results of his/her
CSV configuration [field delimiter, etc]).
I'm not an User Experience expert, but a wizard to trigger another
wizard does not seem very straight-forward.

So, is this plausible to import form a flat source? can you imagine a
better way than a "wizard to a wizard"?


Regards
Ariel.



--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.arielconstenlahaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to