Ariel Constenla-Haile wrote:
Hi Andreas,


'***************************************************************************
Option Explicit

PRIVATE CONST DRIVER_SETTINGS_NODE_PATH = "org.openoffice.Office.DataAccess/DriverSettings"
PRIVATE CONST HSQLDB_DRIVER = "com.sun.star.sdbcx.comp.hsqldb.Driver"
PRIVATE CONST METHODS = "PermittedJavaMethods"

Sub HSQLDB_StoredProcedures

Dim oConfig as Object oConfig = getConfigurationAccess(DRIVER_SETTINGS_NODE_PATH, true) Dim oHsqlDriver as Object
    oHsqlDriver = oConfig.getByName(HSQLDB_DRIVER)
Dim oJavaMethods as Object 'Of course, simpler is to use the hierarchical mane directly ;-) '"/org.openoffice.Office.DataAccess/DriverSettings/com.sun.star.sdbcx.comp.hsqldb.Driver/PermittedJavaMethods"
    oJavaMethods = oHsqlDriver.getByName(METHODS)
Dim oNewMethod as Variant, sMethods$
    sMethods = "My Own HSQLDB StoredProcedures"
oNewMethod = "ar.com.arielconstenlahaile.dbextras.funcsql.Fechas.*" 'wow, wow, this is an any! oJavaMethods.insertByName(sMethods, oNewMethod) oConfig.commitChanges()
End Sub


Function getConfigurationAccess( _
                                    sNodePath$,_
                                    bUpdate as Boolean,_
                                    Optional aLocale$ _
                                )
REM Param. aLocale es STRING, NO com.sun.star.lang.Locale
'    p.e.    "es", "es-AR"
'            "*" para TODAS
    On Error GoTo getConfigurationAccessErrorHandler

    Dim sConfigurationProvider$, oConfigurationProvider as Object
Dim sConfigurationAccess$, sConfigurationUpdateAccess$, sConfiguration$
    Dim oConfigurationAccess as Object
sConfigurationProvider = "com.sun.star.configuration.ConfigurationProvider"
    oConfigurationProvider = createUNOService(sConfigurationProvider)
Dim oParametros(0) As New com.sun.star.beans.PropertyValue
    oParametros(0).Name = "nodepath"
    oParametros(0).Value = sNodePath
sConfigurationAccess = "com.sun.star.configuration.ConfigurationAccess" sConfigurationUpdateAccess = "com.sun.star.configuration.ConfigurationUpdateAccess" if bUpdate then
        ReDim Preserve oParametros(1)
        oParametros(1).Name = "EnableAsync"
        oParametros(1).Value = FALSE
        sConfiguration = sConfigurationUpdateAccess
    else
        sConfiguration = sConfigurationAccess
    end if
if NOT IsMissing(aLocale) then
        Dim n%
        n = UBound(oParametros)+1
        ReDim Preserve oParametros(n)
        oParametros(n).Name = "Locale"
        oParametros(n).Value = aLocale
    end if
oConfigurationAccess = oConfigurationProvider.createInstanceWithArguments(_
                                        sConfiguration, oParametros())
getConfigurationAccessCleanUp: getConfigurationAccess() = oConfigurationAccess
        Exit Function
        getConfigurationAccessErrorHandler:
            Resume getConfigurationAccessCleanUp
End Function
'********************************************************************************



that will create


 <node oor:name="DriverSettings">
  <node oor:name="com.sun.star.sdbcx.comp.hsqldb.Driver">
   <node oor:name="PermittedJavaMethods">
<prop oor:name="My Own HSQLDB StoredProcedures" oor:op="replace" oor:type="xs:string">
     <value>ar.com.arielconstenlahaile.dbextras.funcsql.Fechas.*</value>
    </prop>
   </node>
  </node>
 </node>


I've tried this and worked.
Hope it works for you too.

Regards
Ariel.


WOW this is much better then just copying down a third party library, setting the path in Options and adding an alias....and so much safer...no one would ever think to distribute malware as an extension...after all doing it as an extension the whole thing could be automated...one click and poof - too late - yes much safer this way.

--
OpenOffice.org User Community Forum: http://user.services.openoffice.org
United States PostgreSQL Association: http://www.postgresql.us/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to