KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > h2 > index > FunctionIndex


1 /*
2  * Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
3  * Initial Developer: H2 Group
4  */

5 package org.h2.index;
6
7 import java.sql.SQLException JavaDoc;
8
9 import org.h2.engine.Session;
10 import org.h2.expression.FunctionCall;
11 import org.h2.message.Message;
12 import org.h2.result.LocalResult;
13 import org.h2.result.Row;
14 import org.h2.result.SearchRow;
15 import org.h2.table.Column;
16 import org.h2.table.FunctionTable;
17 import org.h2.value.Value;
18
19 public class FunctionIndex extends Index {
20     
21     private FunctionTable functionTable;
22     private LocalResult result;
23     
24     public FunctionIndex(FunctionTable functionTable, Column[] columns, FunctionCall function) {
25         super(functionTable, 0, null, columns, IndexType.createNonUnique(true));
26         this.functionTable = functionTable;
27     }
28
29     public void close(Session session) throws SQLException JavaDoc {
30     }
31
32     public void add(Session session, Row row) throws SQLException JavaDoc {
33         throw Message.getUnsupportedException();
34     }
35
36     public void remove(Session session, Row row) throws SQLException JavaDoc {
37         throw Message.getUnsupportedException();
38     }
39
40     public Cursor find(Session session, SearchRow first, SearchRow last) throws SQLException JavaDoc {
41         if(result == null) {
42             result = functionTable.getResult(session);
43         } else {
44             result.reset();
45         }
46         return new FunctionCursor(result);
47     }
48
49     public int getCost(int[] masks) throws SQLException JavaDoc {
50         if(masks != null) {
51             throw Message.getUnsupportedException();
52         }
53         return Integer.MAX_VALUE;
54     }
55
56     public void remove(Session session) throws SQLException JavaDoc {
57         throw Message.getUnsupportedException();
58     }
59
60     public void truncate(Session session) throws SQLException JavaDoc {
61         throw Message.getUnsupportedException();
62     }
63
64     public boolean needRebuild() {
65         return false;
66     }
67
68     public void checkRename() throws SQLException JavaDoc {
69         throw Message.getUnsupportedException();
70     }
71
72     public boolean canGetFirstOrLast(boolean first) {
73         return false;
74     }
75
76     public Value findFirstOrLast(Session session, boolean first) throws SQLException JavaDoc {
77         throw Message.getUnsupportedException();
78     }
79
80 }
81
Popular Tags