|
| 1 | +/* |
| 2 | + * #%L JSQLParser library %% Copyright (C) 2004 - 2017 JSQLParser %% This program is free software: |
| 3 | + * you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License |
| 4 | + * as published by the Free Software Foundation, either version 2.1 of the License, or (at your |
| 5 | + * option) any later version. This program is distributed in the hope that it will be useful, but |
| 6 | + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 7 | + * PARTICULAR PURPOSE. See the GNU General Lesser Public License for more details. You should have |
| 8 | + * received a copy of the GNU General Lesser Public License along with this program. If not, see |
| 9 | + * <http://www.gnu.org/licenses/lgpl-2.1.html>. #L% |
| 10 | + */ |
| 11 | +package net.sf.jsqlparser.statement.select; |
| 12 | + |
| 13 | +/** |
| 14 | + * A timeout applied to SELECT to specify how long to wait for the row on the |
| 15 | + * lock to be released. |
| 16 | + * |
| 17 | + * @author janmonterrubio |
| 18 | + */ |
| 19 | +public class Wait { |
| 20 | + private long timeout; |
| 21 | + |
| 22 | + /** |
| 23 | + * Returns the number of seconds specified for the WAIT command |
| 24 | + * |
| 25 | + * @return the number of seconds specified for the WAIT command |
| 26 | + */ |
| 27 | + public long getTimeout() { |
| 28 | + return timeout; |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * Sets the number of seconds to WAIT for this {@link Wait} |
| 33 | + * |
| 34 | + * @param timeout |
| 35 | + * the number of seconds to WAIT for this {@link Wait} |
| 36 | + */ |
| 37 | + public void setTimeout(long timeout) { |
| 38 | + this.timeout = timeout; |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Returns a String containing the WAIT clause and its timeout, where |
| 43 | + * TIMEOUT is specified by {@link #getTimeout()}. The returned string will |
| 44 | + * be:<code> |
| 45 | + * " WAIT <TIMEOUT>" |
| 46 | + * </code> |
| 47 | + */ |
| 48 | + @Override |
| 49 | + public String toString() { |
| 50 | + return " WAIT " + timeout; |
| 51 | + } |
| 52 | +} |
0 commit comments