/*
Creates a logging version of a Statement

@param stmt - the statement
@return - the proxy
160797
public static Statement newInstance(Statement stmt, Log statementLog, int queryStack) {
    InvocationHandler handler = new StatementLogger(stmt, statementLog, queryStack);
    ClassLoader cl = Statement.class.getClassLoader();
    return (Statement) Proxy.newProxyInstance(cl, new Class[]{Statement.class}, handler);
  }
981211
def _leaf_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        node = LeafNode()
        node.type = DataType._resolve_type(
            stmt.find1("type", required=True), sctx)
        self._handle_child(node, stmt, sctx)
962517
protected static Statement memorize(final Statement target, final ConnectionHandle connectionHandle) {
		return (Statement) Proxy.newProxyInstance(
				StatementProxy.class.getClassLoader(),
				new Class[] {StatementProxy.class},
				new MemorizeTransactionProxy(target, connectionHandle));
	}
47552
def _get_filtered_stmts(self, _, node, _stmts, mystmt):
        """"""
        if self.statement() is mystmt:
            # original node's statement is the assignment, only keep
            # current node (gen exp, list comp)
            return [node], True
        return _stmts, False
1032054
def _infer_stmts(stmts, context, frame=None):
    """"""
    inferred = False
    if context is not None:
        name = context.lookupname
        context = context.clone()
    else:
        name = None
        context = contextmod.InferenceContext()

    for stmt in stmts:
        if stmt is util.Uninferable:
            yield stmt
            inferred = True
            continue
        context.lookupname = stmt._infer_name(frame, name)
        try:
            for inferred in stmt.infer(context=context):
                yield inferred
                inferred = True
        except exceptions.NameInferenceError:
            continue
        except exceptions.InferenceError:
            yield util.Uninferable
            inferred = True
    if not inferred:
        raise exceptions.InferenceError(
            "Inference failed for all members of {stmts!r}.",
            stmts=stmts,
            frame=frame,
            context=context,
        )
1302930
public function addStmt($stmt)
    {
        if (!$this->block) {
            $this->block = new CodeBlock($this->stmts);
            $this->stmts = & $this->block->stmts;
        }
        $stmt = $this->normalizeNode($stmt);
        $this->stmts[] = $stmt;
        return $this;
    }
1099727
public static int queryForInt(Statement stmt, String sql, int nullvalue) {
    try {
      ResultSet rs = stmt.executeQuery(sql);
      try {
        if (!rs.next())
          return nullvalue;
        
        return rs.getInt(1);
      } finally {
        rs.close();
      }
    } catch (SQLException e) {
      throw new DukeException(e);
    }
  }
678234
public static InsertStmt get(final IInsertStatement _insertStmt)
    {
        final InsertStmt ret = new InsertStmt();
        ret.setEQLStmt(_insertStmt);
        return ret;
    }
1285174
public static void main(String args[]) {
        Statement stmts[] = null;
        try {
            stmts = getStatements(args[0]);
        } catch (Throwable e) {
            System.out.println(e.getMessage());
            return;
        }
        for (Statement s : stmts) {
            System.out.print(s.statement);
        }
    }
841961
public static long firstLong(PreparedStatement stmt) throws SQLException {
		ResultSet rs = stmt.executeQuery();
		long l = rs.next() ? rs.getLong(1) : Long.MIN_VALUE;
		stmt.close();
		return l;
	}
560490
@Nullable
	public static String firstString(PreparedStatement stmt) throws SQLException {
		ResultSet rs = stmt.executeQuery();
		String s = rs.next() ? rs.getString(1) : null;
		stmt.close();
		return s;
	}
772928
def _uses_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        if not sctx.schema_data.if_features(stmt, sctx.text_mid):
            return
        grp, gid = sctx.schema_data.get_definition(stmt, sctx)
        if stmt.find1("when"):
            sn = GroupNode()
            self._add_child(sn)
        else:
            sn = self
        sn._handle_substatements(grp, gid)
        for augst in stmt.find_all("augment"):
            sn._augment_stmt(augst, sctx)
        for refst in stmt.find_all("refine"):
            sn._refine_stmt(refst, sctx)
1283906
public static LogRecord create(SitLogger logger, LogLevelVo logLevel, TestStep testStep,
            String messageKey, Object... params) {

        String msg = MessageManager.getMessage(messageKey, params);

        switch (logLevel) {
            case INFO:
                logger.infoMsg(msg);
                break;
            case DEBUG:
                logger.debugMsg(msg);
                break;
            case ERROR:
                logger.errorMsg(msg);
                break;
            case WARN:
                logger.warnMsg(msg);
                break;
            default:
                logger.infoMsg(msg);
        }

        String testStepNo = testStep == null ? "xxx" : testStep.getNo();

        return new LogRecord(testStepNo, msg);
    }
1215042
def fixup_simple_stmt(parent, i, stmt_node):
    
    for semi_ind, node in enumerate(stmt_node.children):
        if node.type == token.SEMI: # *sigh*
            break
    else:
        return

    node.remove() # kill the semicolon
    new_expr = Node(syms.expr_stmt, [])
    new_stmt = Node(syms.simple_stmt, [new_expr])
    while stmt_node.children[semi_ind:]:
        move_node = stmt_node.children[semi_ind]
        new_expr.append_child(move_node.clone())
        move_node.remove()
    parent.insert_child(i, new_stmt)
    new_leaf1 = new_stmt.children[0].children[0]
    old_leaf1 = stmt_node.children[0].children[0]
    new_leaf1.prefix = old_leaf1.prefix
1360171
def _anydata_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        self._handle_child(AnydataNode(), stmt, sctx)
530282
public static void close(Statement stmt) {
        if (stmt != null) {
            try {
                stmt.close();
            } catch (SQLException ex) {
                logger.error("", ex);
            }
        }
    }
116126
def type_stmt(self, stmt, p_elem, pset):
        
        typedef = stmt.i_typedef
        if typedef and not stmt.i_is_derived: # just ref
            uname, dic = self.unique_def_name(typedef)
            if uname not in dic:
                self.install_def(uname, typedef, dic)
            SchemaNode("ref", p_elem).set_attr("name", uname)
            defst = typedef.search_one("default")
            if defst:
                dic[uname].default = defst.arg
                occur = 1
            else:
                occur = dic[uname].occur
            if occur > 0: self.propagate_occur(p_elem, occur)
            return
        chain = [stmt]
        tdefault = None
        while typedef:
            type_ = typedef.search_one("type")
            chain.insert(0, type_)
            if tdefault is None:
                tdef = typedef.search_one("default")
                if tdef:
                    tdefault = tdef.arg
            typedef = type_.i_typedef
        if tdefault and p_elem.occur == 0:
            p_elem.default = tdefault
            self.propagate_occur(p_elem, 1)
        self.type_handler[chain[0].arg](chain, p_elem)