1 11 12 package com.nilostep.xlsql.sql; 13 14 import com.nilostep.xlsql.database.xlDatabase; 15 import com.nilostep.xlsql.database.*; 16 17 import java.sql.*; 18 19 24 public class xlSqlInsert implements xlSqlCommand { 25 27 protected com.nilostep.xlsql.database.xlDatabase db; 28 protected String _schema; 29 protected String _table; 30 31 39 public xlSqlInsert(com.nilostep.xlsql.database.xlDatabase database, 40 String schema, 41 String table) { 42 if (database == null) { 43 throw new NullPointerException ("xlSQL: database null"); 44 } else { 45 db = database; 46 } 47 48 if (schema == null) { 49 throw new NullPointerException ("xlSQL: schema null"); 50 } else { 51 _schema = schema; 52 } 53 54 if (table == null) { 55 throw new NullPointerException ("xlSQL: table null"); 56 } else { 57 _table = table; 58 } 59 } 60 61 68 public boolean execAllowed() throws SQLException { 69 boolean ret = true; 70 if (db.getRows(_schema, _table) > 65535) { 71 ret = false; 72 } 73 return ret; 74 } 75 76 81 public void execute() throws SQLException { 82 db.addRow(_schema, _table); 83 db.touchSchema(_schema); 84 db.touchTable(_schema, _table); 85 } 86 } | Popular Tags |