RDBMS tests and init of the new module

The tests to check some Expressions to SQL statement conversion and started the new module which will provide a tool to generate the RDBMS module configuration by reverse engineering  
On Tue, Sep 9, 2014 at 8:33 AM, Naveen Malik <notifications@github.com>
wrote:

> In
> metadata/src/main/java/com/redhat/lightblue/metadata/rdbms/converter/Translator.java:
>
> > +        queryStr.append("FROM ");
> > +        for (String table : fromTables) {
> > +            queryStr.append(table).append(" ,");
> > +        }
> > +        queryStr.deleteCharAt(queryStr.length()-1); //remove the last ','
> > +    }
> > +
> > +    protected void generateWhere(SelectStmt s, StringBuilder queryStr, LinkedList<String> whereConditionals) {
> > +        queryStr.append("WHERE ");
> > +        for (String where : whereConditionals) {
> > +            queryStr.append(where).append(" AND ");
> > +        }
> > +        queryStr.deleteCharAt(queryStr.length()-1); //remove the last 'AND'
> > +        queryStr.deleteCharAt(queryStr.length()-1); //remove the last 'AND'
> > +        queryStr.deleteCharAt(queryStr.length()-1); //remove the last 'AND'
> > +        queryStr.deleteCharAt(queryStr.length()-1); //remove the last 'AND'
>
>
This isn't good code. Assumes list is non-empty. Instead,

boolean first=true;
for(...) {
    if(first)
      first=false;
    else
       queryStr.append(" AND ");
   queryStr.append(...)
}



> Why not change removal of ' AND ' to use StringBuilder#delete(start:int,
> end:int) ?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/lightblue-platform/lightblue-rdbms/pull/9/files#r17303684>
> .
>