Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
    * Copyright 2004 - 2011 Brian McCallister
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    *
    * http://www.apache.org/licenses/LICENSE-2.0
    *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.skife.jdbi.v2;
  
  
  import java.io.Reader;
  import java.net.URL;
  import java.sql.Blob;
  import java.sql.Clob;
  import java.sql.Time;
  import java.sql.Types;
  import java.util.Map;

This class provides the common functions between Query and Update. It defines most of the argument binding functions used by its subclasses.
  
  public abstract class SQLStatement<SelfType extends SQLStatement<SelfType>> extends BaseStatement
  {
      private final Binding          params;
      private final Handle           handle;
      private final String           sql;
      private final StatementBuilder statementBuilder;
      private final Collection<StatementCustomizercustomizers = new ArrayList<StatementCustomizer>();
  
      private StatementLocator  locator;
      private StatementRewriter rewriter;

    
This will be set on execution, not before
  
      private       RewrittenStatement rewritten;
      private       PreparedStatement  stmt;
      private final SQLLog             log;
      private final TimingCollector    timingCollector;
  
      SQLStatement(Binding params,
                   StatementLocator locator,
                   StatementRewriter rewriter,
                   Handle handle,
                   StatementBuilder statementBuilder,
                   String sql,
                   ConcreteStatementContext ctx,
                   SQLLog log,
                   TimingCollector timingCollector,
                   Collection<StatementCustomizerstatementCustomizers,
                   Foreman foreman,
                   ContainerFactoryRegistry containerFactoryRegistry)
      {
          super(ctxforeman);
          assert (verifyOurNastyDowncastIsOkay());
  
          addCustomizers(statementCustomizers);
  
          this. = log;
          this. = statementBuilder;
          this. = rewriter;
          this. = handle;
          this. = sql;
          this. = timingCollector;
          this. = params;
          this. = locator;
          this. = containerFactoryRegistry.createChild();
 
         ctx.setConnection(handle.getConnection());
         ctx.setRawSql(sql);
         ctx.setBinding(params);
     }
 
     {
         return ;
     }
 
     public SelfType registerContainerFactory(ContainerFactory<?> containerFactory) {
         this.getContainerMapperRegistry().register(containerFactory);
         return (SelfType) this;
     }
 
 
     public SelfType registerArgumentFactory(ArgumentFactory<?> argumentFactory)
     {
         getForeman().register(argumentFactory);
         return (SelfType) this;
     }

    
Override the statement locator used for this statement
 
     public void setStatementLocator(StatementLocator locator)
     {
         this. = locator;
     }

    
Exactly the same as setStatementLocator but returns self.
 
     public SelfType setStatementLocator2(StatementLocator locator) {
         setStatementLocator(locator);
         return (SelfType) this;
     }

    
Override the statement rewriter used for this statement
 
     public void setStatementRewriter(StatementRewriter rewriter)
     {
         this. = rewriter;
     }

    
Exactly the same as setStatementRewriter but returns self
 
     public SelfType setStatementRewriter2(StatementRewriter rewriter) {
         setStatementRewriter(rewriter);
         return (SelfType) this;
     }

    
Define a value on the StatementContext.

Parameters:
key Key to access this value from the StatementContext
value Value to setAttribute on the StatementContext
Returns:
this
 
     @SuppressWarnings("unchecked")
     public SelfType define(String keyObject value)
     {
         getContext().setAttribute(keyvalue);
         return (SelfType) this;
     }

    
Adds all key/value pairs in the Map to the StatementContext.

Parameters:
values containing key/value pairs.
Returns:
this
 
     @SuppressWarnings("unchecked")
     public SelfType define(final Map<String, ? extends Objectvalues)
     {
         final StatementContext context = getContext();
 
         if (values != null) {
             for (Map.Entry<String, ? extends Objectentry : values.entrySet()) {
                 context.setAttribute(entry.getKey(), entry.getValue());
             }
         }
         return (SelfType) this;
     }

    
Provides a means for custom statement modification. Common cusotmizations have their own methods, such as Query.setMaxRows(int)

Parameters:
customizer instance to be used to cstomize a statement
Returns:
modified statement
 
     @SuppressWarnings("unchecked")
     public SelfType addStatementCustomizer(StatementCustomizer customizer)
     {
         super.addCustomizer(customizer);
         return (SelfType) this;
     }
 
     private boolean verifyOurNastyDowncastIsOkay()
     {
         if (this.getClass().getTypeParameters().length == 0) {
             return true;
         }
         else {
             Class<?> parameterized_type = this.getClass().getTypeParameters()[0].getGenericDeclaration();
             return parameterized_type.isAssignableFrom(this.getClass());
         }
     }
 
     {
         return ;
     }
 
     {
         return this.;
     }
 
     protected StatementRewriter getRewriter()
     {
         return ;
     }
 
     protected Binding getParams()
     {
         return ;
     }
 
     protected Handle getHandle()
     {
         return ;
     }

    
The un-translated SQL used to create this statement
 
     protected String getSql()
     {
         return ;
     }
 
     protected Binding getParameters()
     {
         return ;
     }

    
Set the query timeout, in seconds, on the prepared statement

Parameters:
seconds number of seconds before timing out
Returns:
the same instance
 
     public SelfType setQueryTimeout(final int seconds)
     {
     }

    
Close the handle when the statement is closed.
 
     @SuppressWarnings("unchecked")
     public SelfType cleanupHandle()
     {
         super.addCleanable(Cleanables.forHandle(.));
         return (SelfType) this;
     }

    
Force transaction state when the statement is cleaned up.
 
     public SelfType cleanupHandle(final TransactionState state)
     {
         super.addCleanable(Cleanables.forHandle(state));
         return (SelfType) this;
     }


    
Used if you need to have some exotic parameter bound.

Parameters:
position position to bindBinaryStream this argument, starting at 0
argument exotic argument factory
Returns:
the same Query instance
 
     @SuppressWarnings("unchecked")
     public SelfType bind(int positionArgument argument)
     {
         getParams().addPositional(positionargument);
         return (SelfType) this;
     }

    
Used if you need to have some exotic parameter bound.

Parameters:
name name to bindBinaryStream this argument
argument exotic argument factory
Returns:
the same Query instance
 
     @SuppressWarnings("unchecked")
     public SelfType bind(String nameArgument argument)
     {
         getParams().addNamed(nameargument);
         return (SelfType) this;
     }

    
Binds named parameters from JavaBean properties on o.

Parameters:
o source of named parameter values to use as arguments
Returns:
modified statement
 
     public SelfType bindFromProperties(Object o)
     {
         return bindNamedArgumentFinder(new BeanPropertyArguments(ogetContext(), getForeman()));
     }

    
Binds named parameters from a map of String to Object instances

Parameters:
args map where keys are matched to named parameters in order to bind arguments. Can be null, in this case, the binding has no effect.
Returns:
modified statement
 
     @SuppressWarnings("unchecked")
     public SelfType bindFromMap(Map<String, ? extends Objectargs)
     {
         if (args != null) {
             return bindNamedArgumentFinder(new MapArguments(args));
         }
         else {
             return (SelfType) this;
         }
     }

    
Binds a new org.skife.jdbi.v2.tweak.NamedArgumentFinder.

Parameters:
namedArgumentFinder A NamedArgumentFinder to bind. Can be null.
 
     @SuppressWarnings("unchecked")
     public SelfType bindNamedArgumentFinder(final NamedArgumentFinder namedArgumentFinder)
     {
         if (namedArgumentFinder != null) {
             getParams().addNamedArgumentFinder(namedArgumentFinder);
         }
 
         return (SelfType) this;
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionCharacter value)
     {
         return bind(positiongetForeman().waffle(Character.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the parameter to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameCharacter value)
     {
         return bind(namegetForeman().waffle(Character.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionString value)
     {
         return bind(positiongetForeman().waffle(String.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameString value)
     {
         return bind(namegetForeman().waffle(String.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionint value)
     {
         return bind(positiongetForeman().waffle(int.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionInteger value)
     {
         return bind(positiongetForeman().waffle(Integer.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameint value)
     {
         return bind(namegetForeman().waffle(int.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameInteger value)
     {
         return bind(namegetForeman().waffle(Integer.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionchar value)
     {
         return bind(positiongetForeman().waffle(char.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String namechar value)
     {
         return bind(namegetForeman().waffle(char.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
length how long is the stream being bound?
Returns:
the same Query instance
 
     public final SelfType bindASCIIStream(int positionInputStream valueint length)
     {
         return bind(positionnew InputStreamArgument(valuelengthtrue));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
length bytes to read from value
Returns:
the same Query instance
 
     public final SelfType bindASCIIStream(String nameInputStream valueint length)
     {
         return bind(namenew InputStreamArgument(valuelengthtrue));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionBigDecimal value)
     {
         return bind(positiongetForeman().waffle(BigDecimal.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameBigDecimal value)
     {
         return bind(namegetForeman().waffle(BigDecimal.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bindBinaryStream(int positionInputStream valueint length)
     {
         return bind(positionnew InputStreamArgument(valuelengthfalse));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
length bytes to read from value
Returns:
the same Query instance
 
     public final SelfType bindBinaryStream(String nameInputStream valueint length)
     {
         return bind(namenew InputStreamArgument(valuelengthfalse));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionBlob value)
     {
         return bind(positiongetForeman().waffle(Blob.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameBlob value)
     {
         return bind(namegetForeman().waffle(Blob.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionboolean value)
     {
         return bind(positiongetForeman().waffle(boolean.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionBoolean value)
     {
         return bind(positiongetForeman().waffle(Boolean.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameboolean value)
     {
         return bind(namegetForeman().waffle(boolean.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameBoolean value)
     {
         return bind(namegetForeman().waffle(Boolean.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bindAsInt(int positionboolean value)
     {
         return bind(positionnew BooleanIntegerArgument(value));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bindAsInt(int positionBoolean value)
     {
         if (value != null) {
             return bind(positionnew BooleanIntegerArgument(value));
         }
         else {
             return bind(positionnew NullArgument(.));
         }
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bindAsInt(String nameboolean value)
     {
         return bind(namenew BooleanIntegerArgument(value));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bindAsInt(String nameBoolean value)
     {
         if (value != null) {
             return bind(namenew BooleanIntegerArgument(value));
         }
         else {
             return bind(namenew NullArgument(.));
         }
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionbyte value)
     {
         return bind(positiongetForeman().waffle(byte.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionByte value)
     {
         return bind(positiongetForeman().waffle(Byte.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String namebyte value)
     {
         return bind(namegetForeman().waffle(byte.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameByte value)
     {
         return bind(namegetForeman().waffle(Byte.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionbyte[] value)
     {
         return bind(positiongetForeman().waffle(byte[].classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String namebyte[] value)
     {
         return bind(namegetForeman().waffle(byte[].classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
length number of characters to read
Returns:
the same Query instance
 
     public final SelfType bind(int positionReader valueint length)
     {
 
         return bind(positionnew CharacterStreamArgument(valuelength));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
length number of characters to read
Returns:
the same Query instance
 
     public final SelfType bind(String nameReader valueint length)
     {
         return bind(namenew CharacterStreamArgument(valuelength));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionClob value)
     {
         return bind(positiongetForeman().waffle(Clob.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameClob value)
     {
         return bind(namegetForeman().waffle(Clob.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionjava.sql.Date value)
     {
         return bind(positiongetForeman().waffle(java.sql.Date.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String namejava.sql.Date value)
     {
         return bind(namegetForeman().waffle(java.sql.Date.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionjava.util.Date value)
     {
         return bind(positiongetForeman().waffle(java.util.Date.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String namejava.util.Date value)
     {
         return bind(namegetForeman().waffle(java.util.Date.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positiondouble value)
     {
         return bind(positiongetForeman().waffle(double.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionDouble value)
     {
         return bind(positiongetForeman().waffle(Double.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String namedouble value)
     {
         return bind(namegetForeman().waffle(double.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameDouble value)
     {
         return bind(namegetForeman().waffle(Double.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionfloat value)
     {
         return bind(positiongetForeman().waffle(float.classvaluegetContext()));
     }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(int positionFloat value)
     {
         return bind(positiongetForeman().waffle(Float.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String namefloat value)
     {
         return bind(namegetForeman().waffle(float.classvaluegetContext()));
     }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
 
     public final SelfType bind(String nameFloat value)
     {
         return bind(namegetForeman().waffle(Float.classvaluegetContext()));
    }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
    public final SelfType bind(int positionlong value)
    {
        return bind(positiongetForeman().waffle(long.classvaluegetContext()));
    }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
    public final SelfType bind(int positionLong value)
    {
        if (value != null) {
            return bind(positiongetForeman().waffle(Long.classvaluegetContext()));
        }
        else {
            return bind(positionnew NullArgument(.));
        }
    }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
    public final SelfType bind(String namelong value)
    {
        return bind(namegetForeman().waffle(long.classvaluegetContext()));
    }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
    public final SelfType bind(String nameLong value)
    {
        return bind(namegetForeman().waffle(Long.classvaluegetContext()));
    }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
    public final SelfType bind(int positionShort value)
    {
        return bind(positiongetForeman().waffle(Short.classvaluegetContext()));
    }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
    public final SelfType bind(int positionshort value)
    {
        return bind(positiongetForeman().waffle(short.classvaluegetContext()));
    }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
    public final SelfType bind(String nameshort value)
    {
        return bind(namegetForeman().waffle(short.classvaluegetContext()));
    }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
    public final SelfType bind(String nameShort value)
    {
        return bind(namegetForeman().waffle(short.classvaluegetContext()));
    }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
    public final SelfType bind(int positionObject value)
    {
        return bind(positiongetForeman().waffle(Object.classvaluegetContext()));
    }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
    public final SelfType bind(String nameObject value)
    {
        return bind(namegetForeman().waffle(Object.classvaluegetContext()));
    }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
    public final SelfType bind(int positionTime value)
    {
        return bind(positiongetForeman().waffle(Time.classvaluegetContext()));
    }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
    public final SelfType bind(String nameTime value)
    {
        return bind(namegetForeman().waffle(Time.classvaluegetContext()));
    }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
    public final SelfType bind(int positionTimestamp value)
    {
        return bind(positiongetForeman().waffle(Timestamp.classvaluegetContext()));
    }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
    public final SelfType bind(String nameTimestamp value)
    {
        return bind(namegetForeman().waffle(Timestamp.classvaluegetContext()));
    }

    
Bind an argument positionally

Parameters:
position position to bind the paramater at, starting at 0
value to bind
Returns:
the same Query instance
    public final SelfType bind(int positionURL value)
    {
        return bind(positiongetForeman().waffle(URL.classvaluegetContext()));
    }

    
Bind an argument by name

Parameters:
name token name to bind the paramater to
value to bind
Returns:
the same Query instance
    public final SelfType bind(String nameURL value)
    {
        return bind(namegetForeman().waffle(URL.classvaluegetContext()));
    }

    
Bind NULL to be set for a given argument.

Parameters:
name Named parameter to bind to
sqlType The sqlType must be set and is a value from java.sql.Types
Returns:
the same statement instance
    public final SelfType bindNull(String nameint sqlType)
    {
        return bind(namenew NullArgument(sqlType));
    }

    
Bind NULL to be set for a given argument.

Parameters:
position position to bind NULL to, starting at 0
sqlType The sqlType must be set and is a value from java.sql.Types
Returns:
the same statement instance
    public final SelfType bindNull(int positionint sqlType)
    {
        return bind(positionnew NullArgument(sqlType));
    }

    
Bind a value using a specific type from java.sql.Types via PreparedStatement#setObject(int, Object, int)

Parameters:
name Named parameter to bind at
value Value to bind
sqlType The sqlType from java.sql.Types
Returns:
self
    public final SelfType bindBySqlType(String nameObject valueint sqlType)
    {
        return bind(namenew SqlTypeArgument(valuesqlType));
    }

    
Bind a value using a specific type from java.sql.Types via PreparedStatement#setObject(int, Object, int)

Parameters:
position position to bind NULL to, starting at 0
value Value to bind
sqlType The sqlType from java.sql.Types
Returns:
self
    public final SelfType bindBySqlType(int positionObject valueint sqlType)
    {
        return bind(positionnew SqlTypeArgument(valuesqlType));
    }
    private String wrapLookup(String sql)
    {
        try {
            return .locate(sqlthis.getContext());
        }
        catch (Exception e) {
            throw new UnableToCreateStatementException("Exception thrown while looking for statement"egetContext());
        }
    }
    protected <Result> Result internalExecute(final QueryResultMunger<Result> munger)
    {
        final String located_sql = wrapLookup();
        getConcreteContext().setLocatedSql(located_sql);
         = .rewrite(located_sqlgetParameters(), getContext());
        try {
            if (getClass().isAssignableFrom(Call.class)) {
                 = .createCall(.getConnection(), .getSql(), getContext());
            }
            else {
                 = .create(.getConnection(), .getSql(), getContext());
            }
        }
        catch (SQLException e) {
            throw new UnableToCreateStatementException(egetContext());
        }
        // The statement builder might (or might not) clean up the statement when called. E.g. the
        // caching statement builder relies on the statement *not* being closed.
        try {
            .bind(getParameters(), );
        }
        catch (SQLException e) {
            throw new UnableToExecuteStatementException("Unable to bind parameters to query"egetContext());
        }
        beforeExecution();
        try {
            final long start = System.nanoTime();
            .execute();
            final long elapsedTime = System.nanoTime() - start;
            .logSQL(elapsedTime / 1000000L, .getSql());
            .collect(elapsedTimegetContext());
        }
        catch (SQLException e) {
            throw new UnableToExecuteStatementException(egetContext());
        }
        afterExecution();
        try {
            return munger.munge();
        }
        catch (SQLException e) {
            throw new ResultSetException("Exception thrown while attempting to traverse the result set"egetContext());
        }
    }
    protected SQLLog getLog()
    {
        return ;
    }
    {
        return ;
    }
    public void setFetchDirection(final int value)
    {
    }
    public SelfType setFetchDirection2(final int value)
    {
        setFetchDirection(value);
        return (SelfType) this;
    }
New to GrepCode? Check out our FAQ X