Ejemplo n.º 1
0
 /**
  * Sets the parameters of a prepared statement.
  *
  * @param params parameters
  * @param stmt prepared statement
  * @throws QueryException query exception
  */
 private void setParameters(final AxisMoreIter params, final PreparedStatement stmt)
     throws QueryException {
   int i = 0;
   for (ANode next; (next = params.next()) != null; ) {
     // Check name
     if (!next.qname().eq(E_PARAM)) PARWHICH.thrw(input, next.qname());
     final AxisIter attrs = next.attributes();
     byte[] paramType = null;
     boolean isNull = false;
     for (ANode attr; (attr = attrs.next()) != null; ) {
       // Attribute "type"
       if (eq(attr.nname(), TYPE)) paramType = attr.atom();
       // Attribute "null"
       else if (eq(attr.nname(), NULL))
         isNull = attr.atom() != null && Bln.parse(attr.atom(), input);
       // Not expected attribute
       else throw NOTEXPATTR.thrw(input, string(attr.nname()));
     }
     if (paramType == null) NOPARAMTYPE.thrw(input);
     final byte[] v = next.atom();
     isNull |= v.length == 0;
     setParam(++i, stmt, paramType, isNull ? null : string(v), isNull);
   }
 }
Ejemplo n.º 2
0
 /**
  * Adds children of a sub node.
  *
  * @param ch child nodes
  * @param nc node cache
  */
 protected final void addDesc(final AxisMoreIter ch, final NodeCache nc) {
   for (ANode n; (n = ch.next()) != null; ) {
     nc.add(n.finish());
     addDesc(n.children(), nc);
   }
 }