You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Folashade Adeyosoye <sh...@gmail.com> on 2005/06/25 02:16:19 UTC

suggestion please, newbie to sqlmaps....

I have a method that dynamically sends a table name to a method to back up
the table, I am trying to replicate this using iBatis.

 

 

  <select id="systemDatabaseBackup" resultClass="java.util.HashMap"
parameterClass="string">

    SELECT * FROM #value#

  </select>

 

 

Question is: What would be the best resultClass or resultMap.

 

 

This is what I currently have in my current code..

 

sql.append("SELECT * FROM " + tableName.trim());

    resultSet = statement.executeQuery();

      ResultSetMetaData rsmd = resultSet.getMetaData();

      int colType[] = new int[rsmd.getColumnCount()];

 

 

 

dynamically pull the column name and its value and write this out to a
file...

 

 

Thanks

 

 


Re: suggestion please, newbie to sqlmaps....

Posted by Nathan Maves <Na...@Sun.COM>.
I think what you are looking for is ....

   <select id="systemDatabaseBackup" resultClass="java.util.HashMap"  
parameterClass="string">
     SELECT * FROM $value$
   </select>

the # try and use a setParameter call and the $ do a simple string  
substitution before the prepared statement.

Nathan


On Jun 24, 2005, at 6:16 PM, Folashade Adeyosoye wrote:

> I have a method that dynamically sends a table name to a method to  
> back up the table, I am trying to replicate this using iBatis…
>
>
>
>
>
>   <select id="systemDatabaseBackup" resultClass="java.util.HashMap"  
> parameterClass="string">
>
>     SELECT * FROM #value#
>
>   </select>
>
>
>
>
>
> Question is: What would be the best resultClass or resultMap.
>
>
>
>
>
> This is what I currently have in my current code….
>
>
>
> sql.append("SELECT * FROM " + tableName.trim());
>
>     resultSet = statement.executeQuery();
>
>       ResultSetMetaData rsmd = resultSet.getMetaData();
>
>       int colType[] = new int[rsmd.getColumnCount()];
>
>
>
>
>
>
>
> dynamically pull the column name and its value and write this out  
> to a file…..
>
>
>
>
>
> Thanks
>
>
>
>
>
>