[ 
https://issues.apache.org/jira/browse/DBUTILS-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14165621#comment-14165621
 ] 

Benedikt Ritter commented on DBUTILS-120:
-----------------------------------------

Hello [~Alex K.],

After a second iteration I've found some more things, I'd like to discuss with 
you.

* If one does not know which might be the best initial capacity for a 
collection, it is best to use the default, since the core libraries collections 
are already optimized. 
* InputMismatchException seems to be tightly connected to java.util.Scanner so 
I won't recommend using it in this context. I would recommend to throw an 
IllegalArgumentException.
* The code expects the input file to be encoded in UTF-8. The problem is, that 
this is not necessary the case. For XML and properties files the specs define 
the encoding. I'm not aware of a spec for SQL query files. We should at least 
document this restriction. OTOH it may make sense to create a specific method 
for reading SQL files that takes as second argument the encodig. Reading files 
on basis of a user provided path to the file in general is not a good idea 
because of this, but that's who dbutils works currently :-)
* Tests! We sould add some more tests covering corner cases, like the exception 
being thrown for invalid queries.
* The JavaDoc example should clearify that the first query with the comment on 
after the semicolon will throw an exception.

Thanks for your interest in dbutils!


> Add loading from SQL file to QueryLoader
> ----------------------------------------
>
>                 Key: DBUTILS-120
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-120
>             Project: Commons DbUtils
>          Issue Type: Improvement
>            Reporter: Aleksei Kovura
>              Labels: patch
>         Attachments: dbutilsQueryLoader.diff, dbutilsQueryLoader_2.diff, 
> dbutilsQueryLoader_3.diff
>
>
> See comments for proposed formats.
> Initially it was this:
> ---queryName1:
> SELECT * FROM "APP"."TABLE1";
> ---queryName2:
> SELECT column1, column2 FROM "APP"."TABLE2" WHERE column1=?;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to