All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kawanfw.sql.servlet.sql.ServerSqlUtilCallable Maven / Gradle / Ivy

/*
 * This file is part of AceQL. 
 * AceQL: Remote JDBC access over HTTP.                                     
 * Copyright (C) 2015,  KawanSoft SAS
 * (http://www.kawansoft.com). All rights reserved.                                
 *                                                                               
 * AceQL 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.            
 *                                                                               
 * AceQL 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             
 * Lesser General Public License for more details.                               
 *                                                                               
 * You should have received a copy of the GNU Lesser General Public              
 * License along with this library; if not, write to the Free Software           
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
 * 02110-1301  USA
 *
 * Any modifications to this file must keep this entire header
 * intact.
 */
package org.kawanfw.sql.servlet.sql;

import java.sql.CallableStatement;
import java.sql.SQLException;
import java.util.logging.Level;

import org.kawanfw.commons.server.util.ServerLogger;
import org.kawanfw.commons.util.FrameworkDebug;
import org.kawanfw.sql.json.no_obfuscation.CallableStatementHolder;

/**
 * 
 * Utility class to use for SQL on the server side:
 * 
    *
  • setConnectionProperties: set the Connection properties on the server * side.
  • *
  • decryptSqlOrder: decrypt the SQL orders on the server.
  • *
* * @author Alexandre Becquereau */ public class ServerSqlUtilCallable { private static boolean DEBUG = FrameworkDebug .isSet(ServerSqlUtilCallable.class); /** * Protected constructor */ protected ServerSqlUtilCallable() { } /** * * Set the callable statement properties: maxRows, fetchSize, queryTimeOut * * @param statement * the CallableStatement to set the properties * @param statementHolder * the CallableStatementHolder that contains the properties to * set * @throws SQLException */ public static void setCallableStatementProperties( CallableStatement statement, CallableStatementHolder statementHolder) throws SQLException { if (statementHolder.getMaxRows() != 0) { statement.setMaxRows(statementHolder.getMaxRows()); } if (statementHolder.getFetchSize() != 0) { statement.setFetchSize(statementHolder.getFetchSize()); } if (statementHolder.getQueryTimeout() != 0) { statement.setQueryTimeout(statementHolder.getQueryTimeout()); } // Default escape processing is not set (-1 value). Set it if // it's 0 or 1 if (statementHolder.isEscapeProcessingSet()) { statement.setEscapeProcessing(statementHolder.isEscapeProcessing()); } } /** * @param s */ public static void debug(String s) { if (DEBUG) { ServerLogger.getLogger().log(Level.WARNING, s); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy