01: package net.sourceforge.squirrel_sql.plugins.mssql.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: public class MSSQLQueryTokenizer extends QueryTokenizer implements
31: IQueryTokenizer {
32: /** Logger for this class. */
33: @SuppressWarnings("unused")
34: private final static ILogger s_log = LoggerController
35: .createLogger(MSSQLQueryTokenizer.class);
36:
37: /** the preference bean */
38: private IQueryTokenizerPreferenceBean _prefs = null;
39:
40: public MSSQLQueryTokenizer(IQueryTokenizerPreferenceBean prefs) {
41: super (prefs);
42: _prefs = prefs;
43: }
44:
45: public void setScriptToTokenize(String script) {
46: super .setScriptToTokenize(script);
47:
48: _queryIterator = _queries.iterator();
49: }
50:
51: /**
52: * Sets the ITokenizerFactory which is used to create additional instances
53: * of the IQueryTokenizer - this is used for handling file includes
54: * recursively.
55: */
56: protected void setFactory() {
57: _tokenizerFactory = new ITokenizerFactory() {
58: public IQueryTokenizer getTokenizer() {
59: return new MSSQLQueryTokenizer(_prefs);
60: }
61: };
62: }
63: }
|