/*
 * blancoDb
 * Copyright (C) 2004-2005 Yasuo Nakanishi
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 */
package blanco.db.expander.query;

import blanco.db.util.BlancoDbObjectStorage;
import blanco.ig.expander.Type;
import blanco.ig.expander.implementor.Implementor;
import blanco.ig.expander.method.MethodExpander;

/**
 * @author Yasuo Nakanishi
 */
public class PrepareStatementMethod extends MethodExpander {
    public PrepareStatementMethod(final BlancoDbObjectStorage storage) {
        super("prepareStatement");
    }

    public void setupSignature() {
        getJavaDoc().addException(new Type("java.sql.SQLException"),
                "SQL例外が発生した場合。");
        addException(new Type("java.sql.SQLException"));

        getJavaDoc().addLine("SQL定義書から与えられたSQL文をもちいてプリコンパイルを実施します。");
        getJavaDoc().addLine("");
        getJavaDoc().addLine("内部的にConnection.prepareStatementを呼び出します。<br>");
    }

    public void implement() {
        final Implementor implementor = new Implementor(getData());
        implementor.addStatement("close()");
        implementor.addStatement("prepareStatement(getQuery())");
    }
}