001/* 002MIT License 003 004Copyright (c) 2020 FBSQL Team 005 006Permission is hereby granted, free of charge, to any person obtaining a copy 007of this software and associated documentation files (the "Software"), to deal 008in the Software without restriction, including without limitation the rights 009to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 010copies of the Software, and to permit persons to whom the Software is 011furnished to do so, subject to the following conditions: 012 013The above copyright notice and this permission notice shall be included in all 014copies or substantial portions of the Software. 015 016THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 017IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 018FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 019AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 020LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 021OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 022SOFTWARE. 023 024Home: https://fbsql.github.io 025E-Mail: fbsql.team@gmail.com 026*/ 027 028package org.fbsql.servlet; 029 030/** 031 * DTO (Data Transfer Object) that represent SQL DQL statement abstraction 032 * combined with result set format 033 * 034 */ 035public class StaticStatement { 036 037 /** 038 * SQL statement 039 */ 040 String sql; 041 042 /** 043 * Result set JSON format 044 */ 045 int resultSetFormat; 046 047 /** 048 * Constructs StaticStatement object 049 * @param sql - SQL statement 050 * @param resultSetFormat - result set JSON format 051 */ 052 public StaticStatement(String sql, int resultSetFormat) { 053 this.sql = sql; 054 this.resultSetFormat = resultSetFormat; 055 } 056 057 @Override 058 public int hashCode() { 059 final int prime = 31; 060 int result = 1; 061 result = prime * result + resultSetFormat; 062 result = prime * result + ((sql == null) ? 0 : sql.hashCode()); 063 return result; 064 } 065 066 @Override 067 public boolean equals(Object obj) { 068 if (this == obj) 069 return true; 070 if (obj == null) 071 return false; 072 if (getClass() != obj.getClass()) 073 return false; 074 StaticStatement other = (StaticStatement) obj; 075 if (resultSetFormat != other.resultSetFormat) 076 return false; 077 if (sql == null) { 078 if (other.sql != null) 079 return false; 080 } else if (!sql.equals(other.sql)) 081 return false; 082 return true; 083 084 } 085 086 @Override 087 public String toString() { 088 return "StaticStatement [resultSetFormat=" + resultSetFormat + ", sql=" + sql + "]"; 089 } 090 091} 092 093/* 094Please contact FBSQL Team by E-Mail fbsql.team@gmail.com 095or visit https://fbsql.github.io if you need additional 096information or have any questions. 097*/ 098 099/* EOF */ 100