01: /*
02: * BlobMode.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db.exporter;
13:
14: import java.util.ArrayList;
15: import java.util.List;
16:
17: /**
18: *
19: * @author support@sql-workbench.net
20: */
21: public enum BlobMode {
22: /**
23: * Use a DBMS specific literals for BLOBs in SQL statements.
24: * @see workbench.storage.BlobFormatterFactory#createInstance(workbench.db.DbMetadata meta)
25: * @see workbench.db.exporter.DataExporter#setBlobMode(String)
26: */
27: DbmsLiteral,
28:
29: /**
30: * Use ANSI literals for BLOBs in SQL statements.
31: * @see workbench.storage.BlobFormatterFactory#createAnsiFormatter()
32: * @see workbench.db.exporter.DataExporter#setBlobMode(String)
33: */
34: AnsiLiteral,
35:
36: /**
37: * Generate WB Specific {$blobfile=...} statements
38: * @see workbench.db.exporter.DataExporter#setBlobMode(String)
39: */
40: SaveToFile,
41:
42: None;
43:
44: /**
45: * Convert a user-supplied mode keyword to the matching BlobMode
46: * @param type the type as entered by the user
47: * @return null if the type was invalid, the corresponding BlobMode otherwise
48: */
49: public static BlobMode getMode(String type) {
50: if (type == null)
51: return BlobMode.None;
52: if ("none".equalsIgnoreCase(type))
53: return BlobMode.None;
54: if ("ansi".equalsIgnoreCase(type))
55: return BlobMode.AnsiLiteral;
56: if ("dbms".equalsIgnoreCase(type))
57: return BlobMode.DbmsLiteral;
58: if ("file".equalsIgnoreCase(type))
59: return BlobMode.SaveToFile;
60: return null;
61: }
62:
63: public static List<String> getTypes() {
64: ArrayList<String> l = new ArrayList(3);
65: l.add("file");
66: l.add("ansi");
67: l.add("dbms");
68: return l;
69: }
70:
71: }
|