1 22 23 package org.xquark.extractor.sql; 24 25 26 public class SqlTable extends SqlExpression 27 { 28 29 private static final String RCSRevision = "$Revision: 1.4 $"; 30 private static final String RCSName = "$Name: $"; 31 32 33 protected String _catalogName = null; 34 protected String _schemaName = null; 35 protected String _name = null;; 36 37 38 41 public SqlTable() 42 { 43 44 } 45 46 50 public SqlTable(String name) 51 { 52 setName ( name ) ; 53 } 54 55 public SqlTable(String catalogName, String schemaName, String tableName) 56 { 57 setCatalogName(catalogName); 58 setSchemaName(schemaName); 59 setName(tableName); 60 } 61 62 public void setSchemaName(String schemaName) { 63 _schemaName = schemaName; 64 } 65 66 public String getSchemaName() 67 { 68 return _schemaName; 69 } 70 71 72 public void setCatalogName(String catalogName) { 73 _catalogName = catalogName; 74 } 75 76 public String getCatalogName() 77 { 78 return _catalogName; 79 } 80 81 86 public String getName() 87 { 88 return _name; 89 } 90 91 96 public void setName(String aName) 97 { 98 _name = aName; 100 } 101 102 public String toSql(Context context) { 103 return toSql(context,true); 104 } 105 106 public String toSql(Context context, boolean putQuotes) 107 { 108 StringBuffer retVal = new StringBuffer (); 109 110 String step = null; 111 step = getCatalogName(); 112 if (null != step) { 113 if (putQuotes) retVal.append('"'); 114 retVal.append(step); 115 if (putQuotes) retVal.append('"'); 116 retVal.append('.'); 117 } 118 119 step = getSchemaName(); 120 if (null != step) { 121 if (putQuotes) retVal.append('"'); 122 retVal.append(step); 123 if (putQuotes) retVal.append('"'); 124 retVal.append('.'); 125 } 126 127 step = getName(); 128 if (putQuotes) retVal.append('"'); 129 retVal.append(step); 130 if (putQuotes) retVal.append('"'); 131 132 return retVal.toString(); 133 } 134 } 135 | Popular Tags |