Mercurial > hg > monetdb-java
comparison src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java @ 186:4767b005a531
Making variables private where possible.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 12 Oct 2017 18:33:54 +0200 (2017-10-12) |
parents | e0f76fedafc8 |
children | 1296dbcc4958 |
comparison
equal
deleted
inserted
replaced
185:91f2bab75b9b | 186:4767b005a531 |
---|---|
125 | 125 |
126 /** The number of results we receive from the server at once */ | 126 /** The number of results we receive from the server at once */ |
127 private int curReplySize = -1; // the server by default uses -1 (all) | 127 private int curReplySize = -1; // the server by default uses -1 (all) |
128 | 128 |
129 /** A template to apply to each query (like pre and post fixes), filled in constructor */ | 129 /** A template to apply to each query (like pre and post fixes), filled in constructor */ |
130 final String[] queryTempl = new String[3]; // pre, post, sep | 130 public final String[] queryTempl = new String[3]; // pre, post, sep |
131 | 131 |
132 /** A template to apply to each command (like pre and post fixes), filled in constructor */ | 132 /** A template to apply to each command (like pre and post fixes), filled in constructor */ |
133 final String[] commandTempl = new String[3]; // pre, post, sep | 133 private final String[] commandTempl = new String[3]; // pre, post, sep |
134 | 134 |
135 /** the SQL language */ | 135 /** the SQL language */ |
136 final static int LANG_SQL = 0; | 136 private static final int LANG_SQL = 0; |
137 /** the MAL language (officially *NOT* supported) */ | 137 /** the MAL language (officially *NOT* supported) */ |
138 final static int LANG_MAL = 3; | 138 private static final int LANG_MAL = 3; |
139 /** an unknown language */ | 139 /** an unknown language */ |
140 final static int LANG_UNKNOWN = -1; | 140 private static final int LANG_UNKNOWN = -1; |
141 /** The language which is used */ | 141 /** The language which is used */ |
142 final int lang; | 142 private final int lang; |
143 | 143 |
144 /** Whether or not BLOB is mapped to Types.VARBINARY instead of Types.BLOB within this connection */ | 144 /** Whether or not BLOB is mapped to Types.VARBINARY instead of Types.BLOB within this connection */ |
145 private boolean treatBlobAsVarBinary = false; | 145 private boolean treatBlobAsVarBinary = false; |
146 /** Whether or not CLOB is mapped to Types.VARCHAR instead of Types.CLOB within this connection */ | 146 /** Whether or not CLOB is mapped to Types.VARCHAR instead of Types.CLOB within this connection */ |
147 private boolean treatClobAsVarChar = false; | 147 private boolean treatClobAsVarChar = false; |
1752 * appended to the current warning. | 1752 * appended to the current warning. |
1753 * | 1753 * |
1754 * @param reason the warning message | 1754 * @param reason the warning message |
1755 */ | 1755 */ |
1756 void addWarning(String reason, String sqlstate) { | 1756 void addWarning(String reason, String sqlstate) { |
1757 SQLWarning warng = new SQLWarning(reason, sqlstate); | |
1757 if (warnings == null) { | 1758 if (warnings == null) { |
1758 warnings = new SQLWarning(reason, sqlstate); | 1759 warnings = warng; |
1759 } else { | 1760 } else { |
1760 warnings.setNextWarning(new SQLWarning(reason, sqlstate)); | 1761 warnings.setNextWarning(warng); |
1761 } | 1762 } |
1762 } | 1763 } |
1763 | 1764 |
1764 /** the default number of rows that are (attempted to) read at once */ | 1765 /** the default number of rows that are (attempted to) read at once */ |
1765 private final static int DEF_FETCHSIZE = 250; | 1766 private static final int DEF_FETCHSIZE = 250; |
1766 /** The sequence counter */ | 1767 /** The sequence counter */ |
1767 private static int seqCounter = 0; | 1768 private static int seqCounter = 0; |
1768 | 1769 |
1769 /** An optional thread that is used for sending large queries */ | 1770 /** An optional thread that is used for sending large queries */ |
1770 private SendThread sendThread = null; | 1771 private SendThread sendThread = null; |
1863 private int blockOffset = 0; | 1864 private int blockOffset = 0; |
1864 | 1865 |
1865 /** A parser for header lines */ | 1866 /** A parser for header lines */ |
1866 HeaderLineParser hlp; | 1867 HeaderLineParser hlp; |
1867 | 1868 |
1868 private final static int NAMES = 0; | 1869 private static final int NAMES = 0; |
1869 private final static int TYPES = 1; | 1870 private static final int TYPES = 1; |
1870 private final static int TABLES = 2; | 1871 private static final int TABLES = 2; |
1871 private final static int LENS = 3; | 1872 private static final int LENS = 3; |
1872 | 1873 |
1873 | 1874 |
1874 /** | 1875 /** |
1875 * Sole constructor, which requires a MonetConnection parent to | 1876 * Sole constructor, which requires a MonetConnection parent to |
1876 * be given. | 1877 * be given. |
2002 * @param chrLine a character array holding the input data | 2003 * @param chrLine a character array holding the input data |
2003 * @param start where the relevant data starts | 2004 * @param start where the relevant data starts |
2004 * @param stop where the relevant data stops | 2005 * @param stop where the relevant data stops |
2005 * @return an array of Strings | 2006 * @return an array of Strings |
2006 */ | 2007 */ |
2007 final private String[] getValues(char[] chrLine, int start, int stop) { | 2008 private final String[] getValues(char[] chrLine, int start, int stop) { |
2008 int elem = 0; | 2009 int elem = 0; |
2009 String[] values = new String[columncount]; | 2010 String[] values = new String[columncount]; |
2010 | 2011 |
2011 for (int i = start; i < stop; i++) { | 2012 for (int i = start; i < stop; i++) { |
2012 if (chrLine[i] == '\t' && chrLine[i - 1] == ',') { | 2013 if (chrLine[i] == '\t' && chrLine[i - 1] == ',') { |
2455 * responsibility to the caller to prevent concurrent access. | 2456 * responsibility to the caller to prevent concurrent access. |
2456 */ | 2457 */ |
2457 // {{{ ResponseList class implementation | 2458 // {{{ ResponseList class implementation |
2458 class ResponseList { | 2459 class ResponseList { |
2459 /** The cache size (number of rows in a DataBlockResponse object) */ | 2460 /** The cache size (number of rows in a DataBlockResponse object) */ |
2460 final int cachesize; | 2461 private final int cachesize; |
2461 /** The maximum number of results for this query */ | 2462 /** The maximum number of results for this query */ |
2462 final int maxrows; | 2463 private final int maxrows; |
2463 /** The ResultSet type to produce */ | 2464 /** The ResultSet type to produce */ |
2464 final int rstype; | 2465 private final int rstype; |
2465 /** The ResultSet concurrency to produce */ | 2466 /** The ResultSet concurrency to produce */ |
2466 final int rsconcur; | 2467 private final int rsconcur; |
2467 /** The sequence number of this ResponseList */ | 2468 /** The sequence number of this ResponseList */ |
2468 final int seqnr; | 2469 private final int seqnr; |
2469 /** A list of the Responses associated with the query, | 2470 /** A list of the Responses associated with the query, |
2470 * in the right order */ | 2471 * in the right order */ |
2471 private List<Response> responses; | 2472 private List<Response> responses; |
2472 /** A map of ResultSetResponses, used for additional | 2473 /** A map of ResultSetResponses, used for additional |
2473 * DataBlockResponse mapping */ | 2474 * DataBlockResponse mapping */ |
2875 */ | 2876 */ |
2876 // {{{ SendThread class implementation | 2877 // {{{ SendThread class implementation |
2877 static class SendThread extends Thread { | 2878 static class SendThread extends Thread { |
2878 /** The state WAIT represents this thread to be waiting for | 2879 /** The state WAIT represents this thread to be waiting for |
2879 * something to do */ | 2880 * something to do */ |
2880 private final static int WAIT = 0; | 2881 private static final int WAIT = 0; |
2881 /** The state QUERY represents this thread to be executing a query */ | 2882 /** The state QUERY represents this thread to be executing a query */ |
2882 private final static int QUERY = 1; | 2883 private static final int QUERY = 1; |
2883 /** The state SHUTDOWN is the final state that ends this thread */ | 2884 /** The state SHUTDOWN is the final state that ends this thread */ |
2884 private final static int SHUTDOWN = -1; | 2885 private static final int SHUTDOWN = -1; |
2885 | 2886 |
2886 private String[] templ; | 2887 private String[] templ; |
2887 private String query; | 2888 private String query; |
2888 private BufferedMCLWriter out; | 2889 private BufferedMCLWriter out; |
2889 private String error; | 2890 private String error; |