01: package net.sourceforge.squirrel_sql.plugins.SybaseASE.tokenizer;
02:
03: /*
04: * Copyright (C) 2007 Rob Manning
05: * manningr@users.sourceforge.net
06: *
07: * Based on initial work from Johan Compagner.
08: *
09: * This library is free software; you can redistribute it and/or
10: * modify it under the terms of the GNU Lesser General Public
11: * License as published by the Free Software Foundation; either
12: * version 2.1 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * Lesser General Public License for more details.
18: *
19: * You should have received a copy of the GNU Lesser General Public
20: * License along with this library; if not, write to the Free Software
21: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22: */
23: import net.sourceforge.squirrel_sql.fw.preferences.IQueryTokenizerPreferenceBean;
24: import net.sourceforge.squirrel_sql.fw.sql.IQueryTokenizer;
25: import net.sourceforge.squirrel_sql.fw.sql.ITokenizerFactory;
26: import net.sourceforge.squirrel_sql.fw.sql.QueryTokenizer;
27: import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
28: import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
29:
30: /**
31: *
32: * At the moment, the only purpose this serves is to provide another bucket for
33: * configuration, allowing Sybase plugin to store separator preferences separately
34: * from other plugins. This will be expanded to handle stored procedures at a
35: * later time.
36: *
37: * @author manningr
38: */
39: public class SybaseQueryTokenizer extends QueryTokenizer implements
40: IQueryTokenizer {
41: /** Logger for this class. */
42: @SuppressWarnings("unused")
43: private final static ILogger s_log = LoggerController
44: .createLogger(SybaseQueryTokenizer.class);
45:
46: /** the preference bean */
47: private IQueryTokenizerPreferenceBean _prefs = null;
48:
49: public SybaseQueryTokenizer(IQueryTokenizerPreferenceBean prefs) {
50: super (prefs);
51: _prefs = prefs;
52: }
53:
54: public void setScriptToTokenize(String script) {
55: super .setScriptToTokenize(script);
56: _queryIterator = _queries.iterator();
57: }
58:
59: /**
60: * Sets the ITokenizerFactory which is used to create additional instances
61: * of the IQueryTokenizer - this is used for handling file includes
62: * recursively.
63: */
64: protected void setFactory() {
65: _tokenizerFactory = new ITokenizerFactory() {
66: public IQueryTokenizer getTokenizer() {
67: return new SybaseQueryTokenizer(_prefs);
68: }
69: };
70: }
71: }
|