Subject | Re: FirebirdDatabaseMetaData |
---|---|
Author | mirom_2005 |
Post date | 2005-05-24T20:25:55Z |
Hi Roman,
the problem to create the patch was the firewall :-(
Now I have created a patch against FBDatabaseMetaData.java and
FirebirdDatabaseMetaData.java (I don't know, if you need this too. It
is included in the FBDatabaseMetaData.java - patch. But I have append
it too).
I hope that all works right!
Mike
Index: FBDatabaseMetaData.java
===================================================================
RCS file:
/cvsroot/firebird/client-java/src/main/org/firebirdsql/jdbc/FBDatabaseMetaData.java,v
retrieving revision 1.45
diff -u -r1.45 FBDatabaseMetaData.java
--- FBDatabaseMetaData.java 18 May 2005 07:05:46 -0000 1.45
+++ FBDatabaseMetaData.java 24 May 2005 20:16:20 -0000
@@ -2271,6 +2271,58 @@
+ " and RDB$RELATION_NAME || '" + SPACES + "' like ? escape
'\\' "
+ " order by 3 ";
+ /* (non-Javadoc)
+ * @see
org.firebirdsql.jdbc.FirebirdDatabaseMetaData#getProcedureSourceCode(java.lang.String)
+ */
+ public String getProcedureSourceCode(String procedureName) throws
SQLException {
+ String sResult = null;
+ String sql = "Select RDB$PROCEDURE_SOURCE From RDB$PROCEDURES Where " +
+ "RDB$PROCEDURE_NAME = ?";
+ ArrayList params = new ArrayList();
+ params.add(procedureName);
+ ResultSet rs = doQuery(sql, params);
+ if (rs.next())
+ sResult = rs.getString(1);
+ rs.close();
+
+ return sResult;
+ } // public String getProcedureSourceCode(String procedureName)
throws SQLException
+
+
+ /* (non-Javadoc)
+ * @see
org.firebirdsql.jdbc.FirebirdDatabaseMetaData#getTriggerSourceCode(java.lang.String)
+ */
+ public String getTriggerSourceCode(String triggerName) throws
SQLException {
+ String sResult = null;
+ String sql = "Select RDB$TRIGGER_SOURCE From RDB$TRIGGERS Where " +
+ "RDB$TRIGGER_NAME = ?";
+ ArrayList params = new ArrayList();
+ params.add(triggerName);
+ ResultSet rs = doQuery(sql, params);
+ if (rs.next())
+ sResult = rs.getString(1);
+ rs.close();
+
+ return sResult;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.firebirdsql.jdbc.FirebirdDatabaseMetaData#getViewSourceCode(java.lang.String)
+ */
+ public String getViewSourceCode(String viewName) throws SQLException {
+ String sResult = null;
+ String sql = "Select RDB$VIEW_SOURCE From RDB$RELATIONS Where " +
+ "RDB$RELATION_NAME = ?";
+ ArrayList params = new ArrayList();
+ params.add(viewName);
+ ResultSet rs = doQuery(sql, params);
+ if (rs.next())
+ sResult = rs.getString(1);
+ rs.close();
+
+ return sResult;
+ }
+
/**
* Gets a description of tables available in a catalog.
*
Index: FirebirdDatabaseMetaData.java
===================================================================
RCS file: FirebirdDatabaseMetaData.java
diff -N FirebirdDatabaseMetaData.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ FirebirdDatabaseMetaData.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*
+ * Firebird Open Source J2ee connector - jdbc driver, public
Firebird-specific
+ * JDBC extensions.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
are met:
+ * 1. Redistributions of source code must retain the above
copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
copyright
+ * notice, this list of conditions and the following disclaimer
in the
+ * documentation and/or other materials provided with the
distribution.
+ * 3. The name of the author may not be used to endorse or promote
products
+ * derived from this software without specific prior written
permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.firebirdsql.jdbc;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+/**
+ * Extension of {@link DatabaseMetaData} interface providing access
to Firebird
+ * specific features.
+ *
+ * @author <a href="mailto:mirommail@...">Michael Romankiewicz</a>
+ */
+public interface FirebirdDatabaseMetaData extends DatabaseMetaData {
+
+ /**
+ * Get the source of a stored procedure.
+ * @param procedureName name of the stored procedure.
+ * @return source of the stored procedure.
+ * @throws SQLException if specified procedure cannot be found.
+ */
+ public String getProcedureSourceCode(String procedureName) throws
SQLException;
+
+ /**
+ * Get the source of a trigger.
+ * @param triggerName name of the trigger.
+ * @return source of the trigger.
+ * @throws SQLException if specified trigger cannot be found.
+ */
+ public String getTriggerSourceCode(String triggerName) throws
SQLException;
+
+ /**
+ * Get the source of a view.
+ * @param viewName name of the view.
+ * @return source of the view.
+ * @throws SQLException if specified view cannot be found.
+ */
+ public String getViewSourceCode(String viewName) throws SQLException;
+} // public interface FirebirdDatabaseMetaData extends DatabaseMetaData
Index: FirebirdDatabaseMetaData.java
===================================================================
RCS file: FirebirdDatabaseMetaData.java
diff -N FirebirdDatabaseMetaData.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ FirebirdDatabaseMetaData.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*
+ * Firebird Open Source J2ee connector - jdbc driver, public
Firebird-specific
+ * JDBC extensions.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
are met:
+ * 1. Redistributions of source code must retain the above
copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
copyright
+ * notice, this list of conditions and the following disclaimer
in the
+ * documentation and/or other materials provided with the
distribution.
+ * 3. The name of the author may not be used to endorse or promote
products
+ * derived from this software without specific prior written
permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.firebirdsql.jdbc;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+/**
+ * Extension of {@link DatabaseMetaData} interface providing access
to Firebird
+ * specific features.
+ *
+ * @author <a href="mailto:mirommail@...">Michael Romankiewicz</a>
+ */
+public interface FirebirdDatabaseMetaData extends DatabaseMetaData {
+
+ /**
+ * Get the source of a stored procedure.
+ * @param procedureName name of the stored procedure.
+ * @return source of the stored procedure.
+ * @throws SQLException if specified procedure cannot be found.
+ */
+ public String getProcedureSourceCode(String procedureName) throws
SQLException;
+
+ /**
+ * Get the source of a trigger.
+ * @param triggerName name of the trigger.
+ * @return source of the trigger.
+ * @throws SQLException if specified trigger cannot be found.
+ */
+ public String getTriggerSourceCode(String triggerName) throws
SQLException;
+
+ /**
+ * Get the source of a view.
+ * @param viewName name of the view.
+ * @return source of the view.
+ * @throws SQLException if specified view cannot be found.
+ */
+ public String getViewSourceCode(String viewName) throws SQLException;
+} // public interface FirebirdDatabaseMetaData extends DatabaseMetaData
the problem to create the patch was the firewall :-(
Now I have created a patch against FBDatabaseMetaData.java and
FirebirdDatabaseMetaData.java (I don't know, if you need this too. It
is included in the FBDatabaseMetaData.java - patch. But I have append
it too).
I hope that all works right!
Mike
Index: FBDatabaseMetaData.java
===================================================================
RCS file:
/cvsroot/firebird/client-java/src/main/org/firebirdsql/jdbc/FBDatabaseMetaData.java,v
retrieving revision 1.45
diff -u -r1.45 FBDatabaseMetaData.java
--- FBDatabaseMetaData.java 18 May 2005 07:05:46 -0000 1.45
+++ FBDatabaseMetaData.java 24 May 2005 20:16:20 -0000
@@ -2271,6 +2271,58 @@
+ " and RDB$RELATION_NAME || '" + SPACES + "' like ? escape
'\\' "
+ " order by 3 ";
+ /* (non-Javadoc)
+ * @see
org.firebirdsql.jdbc.FirebirdDatabaseMetaData#getProcedureSourceCode(java.lang.String)
+ */
+ public String getProcedureSourceCode(String procedureName) throws
SQLException {
+ String sResult = null;
+ String sql = "Select RDB$PROCEDURE_SOURCE From RDB$PROCEDURES Where " +
+ "RDB$PROCEDURE_NAME = ?";
+ ArrayList params = new ArrayList();
+ params.add(procedureName);
+ ResultSet rs = doQuery(sql, params);
+ if (rs.next())
+ sResult = rs.getString(1);
+ rs.close();
+
+ return sResult;
+ } // public String getProcedureSourceCode(String procedureName)
throws SQLException
+
+
+ /* (non-Javadoc)
+ * @see
org.firebirdsql.jdbc.FirebirdDatabaseMetaData#getTriggerSourceCode(java.lang.String)
+ */
+ public String getTriggerSourceCode(String triggerName) throws
SQLException {
+ String sResult = null;
+ String sql = "Select RDB$TRIGGER_SOURCE From RDB$TRIGGERS Where " +
+ "RDB$TRIGGER_NAME = ?";
+ ArrayList params = new ArrayList();
+ params.add(triggerName);
+ ResultSet rs = doQuery(sql, params);
+ if (rs.next())
+ sResult = rs.getString(1);
+ rs.close();
+
+ return sResult;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.firebirdsql.jdbc.FirebirdDatabaseMetaData#getViewSourceCode(java.lang.String)
+ */
+ public String getViewSourceCode(String viewName) throws SQLException {
+ String sResult = null;
+ String sql = "Select RDB$VIEW_SOURCE From RDB$RELATIONS Where " +
+ "RDB$RELATION_NAME = ?";
+ ArrayList params = new ArrayList();
+ params.add(viewName);
+ ResultSet rs = doQuery(sql, params);
+ if (rs.next())
+ sResult = rs.getString(1);
+ rs.close();
+
+ return sResult;
+ }
+
/**
* Gets a description of tables available in a catalog.
*
Index: FirebirdDatabaseMetaData.java
===================================================================
RCS file: FirebirdDatabaseMetaData.java
diff -N FirebirdDatabaseMetaData.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ FirebirdDatabaseMetaData.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*
+ * Firebird Open Source J2ee connector - jdbc driver, public
Firebird-specific
+ * JDBC extensions.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
are met:
+ * 1. Redistributions of source code must retain the above
copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
copyright
+ * notice, this list of conditions and the following disclaimer
in the
+ * documentation and/or other materials provided with the
distribution.
+ * 3. The name of the author may not be used to endorse or promote
products
+ * derived from this software without specific prior written
permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.firebirdsql.jdbc;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+/**
+ * Extension of {@link DatabaseMetaData} interface providing access
to Firebird
+ * specific features.
+ *
+ * @author <a href="mailto:mirommail@...">Michael Romankiewicz</a>
+ */
+public interface FirebirdDatabaseMetaData extends DatabaseMetaData {
+
+ /**
+ * Get the source of a stored procedure.
+ * @param procedureName name of the stored procedure.
+ * @return source of the stored procedure.
+ * @throws SQLException if specified procedure cannot be found.
+ */
+ public String getProcedureSourceCode(String procedureName) throws
SQLException;
+
+ /**
+ * Get the source of a trigger.
+ * @param triggerName name of the trigger.
+ * @return source of the trigger.
+ * @throws SQLException if specified trigger cannot be found.
+ */
+ public String getTriggerSourceCode(String triggerName) throws
SQLException;
+
+ /**
+ * Get the source of a view.
+ * @param viewName name of the view.
+ * @return source of the view.
+ * @throws SQLException if specified view cannot be found.
+ */
+ public String getViewSourceCode(String viewName) throws SQLException;
+} // public interface FirebirdDatabaseMetaData extends DatabaseMetaData
Index: FirebirdDatabaseMetaData.java
===================================================================
RCS file: FirebirdDatabaseMetaData.java
diff -N FirebirdDatabaseMetaData.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ FirebirdDatabaseMetaData.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,62 @@
+/*
+ * Firebird Open Source J2ee connector - jdbc driver, public
Firebird-specific
+ * JDBC extensions.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
are met:
+ * 1. Redistributions of source code must retain the above
copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
copyright
+ * notice, this list of conditions and the following disclaimer
in the
+ * documentation and/or other materials provided with the
distribution.
+ * 3. The name of the author may not be used to endorse or promote
products
+ * derived from this software without specific prior written
permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.firebirdsql.jdbc;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+/**
+ * Extension of {@link DatabaseMetaData} interface providing access
to Firebird
+ * specific features.
+ *
+ * @author <a href="mailto:mirommail@...">Michael Romankiewicz</a>
+ */
+public interface FirebirdDatabaseMetaData extends DatabaseMetaData {
+
+ /**
+ * Get the source of a stored procedure.
+ * @param procedureName name of the stored procedure.
+ * @return source of the stored procedure.
+ * @throws SQLException if specified procedure cannot be found.
+ */
+ public String getProcedureSourceCode(String procedureName) throws
SQLException;
+
+ /**
+ * Get the source of a trigger.
+ * @param triggerName name of the trigger.
+ * @return source of the trigger.
+ * @throws SQLException if specified trigger cannot be found.
+ */
+ public String getTriggerSourceCode(String triggerName) throws
SQLException;
+
+ /**
+ * Get the source of a view.
+ * @param viewName name of the view.
+ * @return source of the view.
+ * @throws SQLException if specified view cannot be found.
+ */
+ public String getViewSourceCode(String viewName) throws SQLException;
+} // public interface FirebirdDatabaseMetaData extends DatabaseMetaData