Search in sources :

Example 46 with ConfigImpl

use of lucee.runtime.config.ConfigImpl in project Lucee by lucee.

the class LitStringImpl method _writeOut.

/**
 * @see lucee.transformer.expression.Expression#_writeOut(org.objectweb.asm.commons.GeneratorAdapter, int)
 */
private static Type _writeOut(BytecodeContext bc, int mode, String str) throws TransformerException {
    // write to a file instead to the bytecode
    // str(0,10);
    // print.ds(str);
    int externalizeStringGTE = ((ConfigImpl) bc.getConfig()).getExternalizeStringGTE();
    if (externalizeStringGTE > -1 && str.length() > externalizeStringGTE && StringUtil.indexOfIgnoreCase(bc.getMethod().getName(), "call") != -1) {
        try {
            GeneratorAdapter ga = bc.getAdapter();
            Page page = bc.getPage();
            Range range = page.registerString(bc, str);
            if (range != null) {
                ga.visitVarInsn(Opcodes.ALOAD, 0);
                ga.visitVarInsn(Opcodes.ALOAD, 1);
                ga.push(range.from);
                ga.push(range.to);
                ga.visitMethodInsn(Opcodes.INVOKEVIRTUAL, bc.getClassName(), "str", "(Llucee/runtime/PageContext;II)Ljava/lang/String;");
                return Types.STRING;
            }
        } catch (Throwable t) {
            ExceptionUtil.rethrowIfNecessary(t);
        }
    }
    if (toBig(str)) {
        _toExpr(bc.getFactory(), str).writeOut(bc, mode);
    } else {
        bc.getAdapter().push(str);
    }
    return Types.STRING;
}
Also used : GeneratorAdapter(org.objectweb.asm.commons.GeneratorAdapter) Page(lucee.transformer.bytecode.Page) Range(lucee.transformer.bytecode.Range) ConfigImpl(lucee.runtime.config.ConfigImpl)

Example 47 with ConfigImpl

use of lucee.runtime.config.ConfigImpl in project Lucee by lucee.

the class DatasourceResourceProvider method getManager.

private DatasourceManagerImpl getManager() {
    if (_manager == null) {
        Config config = ThreadLocalPageContext.getConfig();
        _manager = new DatasourceManagerImpl((ConfigImpl) config);
    }
    return _manager;
}
Also used : Config(lucee.runtime.config.Config) DatasourceManagerImpl(lucee.runtime.db.DatasourceManagerImpl) ConfigImpl(lucee.runtime.config.ConfigImpl)

Aggregations

ConfigImpl (lucee.runtime.config.ConfigImpl)47 PageException (lucee.runtime.exp.PageException)15 Log (lucee.commons.io.log.Log)14 DatasourceConnection (lucee.runtime.db.DatasourceConnection)10 ApplicationException (lucee.runtime.exp.ApplicationException)8 Struct (lucee.runtime.type.Struct)8 StructImpl (lucee.runtime.type.StructImpl)8 DataSource (lucee.runtime.db.DataSource)7 DatasourceConnectionPool (lucee.runtime.db.DatasourceConnectionPool)7 SQLExecutor (lucee.runtime.type.scope.storage.db.SQLExecutor)7 SQLException (java.sql.SQLException)6 Resource (lucee.commons.io.res.Resource)6 PageContextImpl (lucee.runtime.PageContextImpl)6 PageSource (lucee.runtime.PageSource)6 QueryImpl (lucee.runtime.type.QueryImpl)5 ArrayList (java.util.ArrayList)4 ConfigWebImpl (lucee.runtime.config.ConfigWebImpl)4 DatabaseException (lucee.runtime.exp.DatabaseException)4 Key (lucee.runtime.type.Collection.Key)4 IOException (java.io.IOException)3