/plugins/SQL/tags/v_1_04/sql/serverTypes/oracle/OracleTableObjectType.java

# · Java · 83 lines · 49 code · 12 blank · 22 comment · 0 complexity · 7dc575719b7e13c9a0256fdd7d1abf30 MD5 · raw file

  1. /**
  2. * OracleTableObjectType.java - Sql Plugin
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. *
  5. * Copyright (C) 2001 Sergey V. Udaltsov
  6. * svu@users.sourceforge.net
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. */
  23. package sql.serverTypes.oracle;
  24. import java.io.*;
  25. import java.sql.*;
  26. import java.text.*;
  27. import java.util.*;
  28. import org.gjt.sp.jedit.*;
  29. import org.gjt.sp.util.*;
  30. import sql.*;
  31. import sql.serverTypes.OracleVFS;
  32. public class OracleTableObjectType extends TableObjectType
  33. {
  34. public OracleTableObjectType()
  35. {
  36. super("selectTablesInGroup");
  37. objectActions.put("Extract to DDL", new ExtractToDDLAction());
  38. }
  39. public static class ExtractToDDLAction extends SqlSubVFS.ObjectAction
  40. {
  41. public ExtractToDDLAction()
  42. {
  43. super(false);
  44. }
  45. public String getText(String path,
  46. SqlServerRecord rec,
  47. String userName,
  48. String objName)
  49. {
  50. Connection conn = null;
  51. try
  52. {
  53. conn = rec.allocConnection();
  54. Log.log(Log.DEBUG, OracleTableObjectType.class,
  55. "Getting DDL for " + userName + "." + objName);
  56. return SqlUtils.loadObjectText(conn,
  57. rec, "selectTableDDL", userName, objName, null);
  58. } catch (SQLException ex)
  59. {
  60. Log.log(Log.ERROR, OracleTableObjectType.class,
  61. "Error extracting table data");
  62. Log.log(Log.ERROR, OracleTableObjectType.class,
  63. ex);
  64. } finally
  65. {
  66. rec.releaseConnection(conn);
  67. }
  68. return null;
  69. }
  70. }
  71. }