| 505 | } // end of GetResult |
| 506 | |
| 507 | public int ExecuteQuery(String query) { |
| 508 | int ncol = 0; |
| 509 | |
| 510 | if (DEBUG) |
| 511 | System.out.println("Executing query '" + query + "'"); |
| 512 | |
| 513 | try { |
| 514 | if (rs != null) |
| 515 | rs.close(); |
| 516 | rs = stmt.executeQuery(query); |
| 517 | rsmd = rs.getMetaData(); |
| 518 | ncol = rsmd.getColumnCount(); |
| 519 | |
| 520 | if (DEBUG) { |
| 521 | System.out.println("Query '" + query + "' executed successfully"); |
| 522 | System.out.println("Result set has " + rsmd.getColumnCount() + " column(s)"); |
| 523 | } // endif DEBUG |
| 524 | |
| 525 | } catch (SQLException se) { |
| 526 | SetErrmsg(se); |
| 527 | ncol = -1; |
| 528 | } catch (Exception e) { |
| 529 | SetErrmsg(e); |
| 530 | ncol = -2; |
| 531 | } //end try/catch |
| 532 | |
| 533 | return ncol; |
| 534 | } // end of ExecuteQuery |
| 535 | |
| 536 | public int ExecuteUpdate(String query) { |
| 537 | int n = 0; |