Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package io.lightlink.facades;
/*
* #%L
* lightlink-core
* %%
* Copyright (C) 2015 Vitaliy Shevchuk
* %%
* This program 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
import io.lightlink.core.RunnerContext;
import io.lightlink.output.ObjectBufferResponseStream;
import io.lightlink.output.ResponseStream;
import io.lightlink.sql.SQLHandler;
import jdk.nashorn.api.scripting.JSObject;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.script.ScriptException;
import javax.sql.DataSource;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class SQLFacade {
private int fetchSize = 100;
private Integer maxRows = null;
private Integer queryTimeout = null;
boolean autoCommit = true;
DataSource dataSource;
Connection connection;
RunnerContext runnerContext;
private SQLHandler sqlHandler = new SQLHandler(this);
private List updateCount;
private List childInstances = new ArrayList();
public SQLFacade(RunnerContext runnerContext) {
this.runnerContext = runnerContext;
}
public SQLFacade newInstance() throws SQLException {
SQLFacade newFacade = new SQLFacade(runnerContext);
newFacade.setAutoCommit(autoCommit);
childInstances.add(newFacade);
return newFacade;
}
public boolean getAutoCommit() {
return autoCommit;
}
public void setAutoCommit(boolean autoCommit) throws SQLException {
this.autoCommit = autoCommit;
if (connection!=null)
connection.setAutoCommit(autoCommit);
}
public void queryForValue(String propertyName) throws SQLException, IOException, ScriptException {
ResponseStream resp = runnerContext.getResponseStream();
List