1 package org.apache.ojb.broker.accesslayer.sql; 2 3 17 18 import org.apache.ojb.broker.util.logging.Logger; 19 20 26 public class SqlInsertMNStatement extends SqlMNStatement 27 { 28 29 34 public SqlInsertMNStatement(String table, String [] columns, Logger logger) 35 { 36 super (table, columns, logger); 37 } 38 39 43 private void appendListOfValues(StringBuffer stmt) 44 { 45 int cnt = getColumns().length; 46 47 stmt.append(" VALUES ("); 48 49 for (int i = 0; i < cnt; i++) 50 { 51 if (i > 0) 52 { 53 stmt.append(','); 54 } 55 stmt.append('?'); 56 } 57 stmt.append(')'); 58 } 59 60 63 public String getStatement() 64 { 65 StringBuffer stmt = new StringBuffer (1024); 66 67 stmt.append("INSERT INTO "); 68 appendTable(getTable(),stmt); 69 stmt.append(" ("); 70 appendListOfColumns(getColumns(),stmt); 71 stmt.append(")"); 72 appendListOfValues(stmt); 73 return stmt.toString(); 74 } 75 76 } 77 78 | Popular Tags |