Example #1
0
 /** SQL INSERT statement */
 public Integer insert(HplsqlParser.Insert_stmtContext ctx) {
   exec.stmtConnList.clear();
   if (ctx.select_stmt() != null) {
     return insertSelect(ctx);
   }
   return insertValues(ctx);
 }
Example #2
0
 /** SQL INSERT SELECT statement */
 public Integer insertSelect(HplsqlParser.Insert_stmtContext ctx) {
   trace(ctx, "INSERT SELECT");
   String table = evalPop(ctx.table_name()).toString();
   String select = evalPop(ctx.select_stmt()).toString();
   String sql = "INSERT INTO TABLE " + table + " " + select;
   trace(ctx, sql);
   Query query = exec.executeSql(ctx, sql, exec.conf.defaultConnection);
   if (query.error()) {
     exec.signal(query);
     return 1;
   }
   exec.setSqlSuccess();
   exec.closeQuery(query, exec.conf.defaultConnection);
   return 0;
 }