Search in sources :

Example 6 with Bind_parameterContext

use of com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Bind_parameterContext in project kripton by xcesco.

the class JQLChecker method extractPlaceHolders.

private <L extends Collection<JQLPlaceHolder>> L extractPlaceHolders(final JQLContext jqlContext, String jql, final L result) {
    final One<Boolean> valid = new One<>();
    valid.value0 = false;
    analyzeInternal(jqlContext, jql, new JqlBaseListener() {

        @Override
        public void enterBind_parameter(Bind_parameterContext ctx) {
            String value;
            if (ctx.bind_parameter_name() != null) {
                value = ctx.bind_parameter_name().getText();
            } else {
                value = ctx.getText();
            }
            result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, value));
        }

        @Override
        public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) {
            result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText()));
        }
    });
    return result;
}
Also used : One(com.abubusoft.kripton.common.One) Bind_dynamic_sqlContext(com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Bind_dynamic_sqlContext) JqlBaseListener(com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlBaseListener) Bind_parameterContext(com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Bind_parameterContext)

Example 7 with Bind_parameterContext

use of com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Bind_parameterContext in project kripton by xcesco.

the class JQLChecker method extractPlaceHoldersFromVariableStatement.

private <L extends Collection<JQLPlaceHolder>> L extractPlaceHoldersFromVariableStatement(final JQLContext jqlContext, String jql, final L result) {
    final One<Boolean> valid = new One<>();
    if (!StringUtils.hasText(jql))
        return result;
    valid.value0 = false;
    analyzeVariableStatementInternal(jqlContext, jql, new JqlBaseListener() {

        @Override
        public void enterBind_parameter(Bind_parameterContext ctx) {
            String parameter;
            if (ctx.bind_parameter_name() != null) {
                parameter = ctx.bind_parameter_name().getText();
            } else {
                parameter = ctx.getText();
            }
            result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, parameter));
        }

        @Override
        public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) {
            result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText()));
        }
    });
    return result;
}
Also used : One(com.abubusoft.kripton.common.One) Bind_dynamic_sqlContext(com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Bind_dynamic_sqlContext) JqlBaseListener(com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlBaseListener) Bind_parameterContext(com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Bind_parameterContext)

Aggregations

JqlBaseListener (com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlBaseListener)7 Bind_parameterContext (com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Bind_parameterContext)7 One (com.abubusoft.kripton.common.One)4 SQLiteDaoDefinition (com.abubusoft.kripton.processor.sqlite.model.SQLiteDaoDefinition)4 Bind_dynamic_sqlContext (com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Bind_dynamic_sqlContext)3 Conflict_algorithmContext (com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Conflict_algorithmContext)2 Projected_columnsContext (com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Projected_columnsContext)2 Where_stmtContext (com.abubusoft.kripton.processor.sqlite.grammars.jsql.JqlParser.Where_stmtContext)2 BaseProcessorTest (base.BaseProcessorTest)1 BindSqlDelete (com.abubusoft.kripton.android.annotation.BindSqlDelete)1 BindSqlInsert (com.abubusoft.kripton.android.annotation.BindSqlInsert)1 BindSqlSelect (com.abubusoft.kripton.android.annotation.BindSqlSelect)1 BindSqlUpdate (com.abubusoft.kripton.android.annotation.BindSqlUpdate)1 InsertType (com.abubusoft.kripton.processor.sqlite.SqlInsertBuilder.InsertType)1 ModifyType (com.abubusoft.kripton.processor.sqlite.SqlModifyBuilder.ModifyType)1 JQL (com.abubusoft.kripton.processor.sqlite.grammars.jql.JQL)1 JQLDynamicStatementType (com.abubusoft.kripton.processor.sqlite.grammars.jql.JQL.JQLDynamicStatementType)1 JQLChecker (com.abubusoft.kripton.processor.sqlite.grammars.jql.JQLChecker)1 JQLContext (com.abubusoft.kripton.processor.sqlite.grammars.jql.JQLContext)1 JQLReplacerListenerImpl (com.abubusoft.kripton.processor.sqlite.grammars.jql.JQLReplacerListenerImpl)1