本文整理汇总了Java中com.healthmarketscience.jackcess.Table.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getName方法的具体用法?Java Table.getName怎么用?Java Table.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.healthmarketscience.jackcess.Table
的用法示例。
在下文中一共展示了Table.getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadTable
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private void loadTable(Table t, boolean systemTable) throws SQLException, IOException {
String tn = t.getName();
if (tn.indexOf(" ") > 0) {
SQLConverter.addWhiteSpacedTableNames(tn);
}
String ntn = SQLConverter.escapeIdentifier(tn);
if (ntn == null)
return;
createSyncrTable(t,systemTable);
loadTableData(t,systemTable);
if(!systemTable){
defaultValues(t);
triggersGenerator.synchronisationTriggers(ntn,
hasAutoNumberColumn(t),hasAppendOnly(t));
loadedTables.add(ntn);
}
}
示例2: sqlInsert
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private PreparedStatement sqlInsert(Table t, Map<String, Object> row,boolean systemTable)
throws IOException, SQLException {
String tn = t.getName();
String ntn = schema(SQLConverter.escapeIdentifier(tn),systemTable);
String comma = "";
StringBuffer sbI = new StringBuffer(" INSERT INTO ").append(ntn)
.append(" (");
StringBuffer sbE = new StringBuffer(" VALUES( ");
Set<Entry<String, Object>> se = row.entrySet();
comma = "";
for (Entry<String, Object> en : se) {
sbI.append(comma).append(
SQLConverter.escapeIdentifier(en.getKey()));
sbE.append(comma).append(" ? ");
comma = ",";
}
sbI.append(") ");
sbE.append(")");
sbI.append(sbE);
return conn.prepareStatement(sbI.toString());
}
示例3: importResultSet
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
/**
* Copy an existing JDBC ResultSet into a new (or optionally existing) table
* in this database.
*
* @param name Name of the new table to create
* @param source ResultSet to copy from
* @param filter valid import filter
* @param useExistingTable if {@code true} use current table if it already
* exists, otherwise, create new table with unique
* name
*
* @return the name of the imported table
*
* @see Builder
*/
public static String importResultSet(ResultSet source, Database db,
String name, ImportFilter filter,
boolean useExistingTable)
throws SQLException, IOException
{
ResultSetMetaData md = source.getMetaData();
name = TableBuilder.escapeIdentifier(name);
Table table = null;
if(!useExistingTable || ((table = db.getTable(name)) == null)) {
List<ColumnBuilder> columns = toColumns(md);
table = createUniqueTable(db, name, columns, md, filter);
}
List<Object[]> rows = new ArrayList<Object[]>(COPY_TABLE_BATCH_SIZE);
int numColumns = md.getColumnCount();
while (source.next()) {
Object[] row = new Object[numColumns];
for (int i = 0; i < row.length; i++) {
row[i] = source.getObject(i + 1);
}
row = filter.filterRow(row);
if(row == null) {
continue;
}
rows.add(row);
if (rows.size() == COPY_TABLE_BATCH_SIZE) {
table.addRows(rows);
rows.clear();
}
}
if (rows.size() > 0) {
table.addRows(rows);
}
return table.getName();
}
示例4: ComplexColumnInfoImpl
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
protected ComplexColumnInfoImpl(Column column, int complexTypeId,
Table typeObjTable, Table flatTable)
throws IOException
{
_column = column;
_complexTypeId = complexTypeId;
_flatTable = flatTable;
// the flat table has all the "value" columns and 2 extra columns, a
// primary key for each row, and a LONG value which is essentially a
// foreign key to the main table.
List<Column> typeCols = new ArrayList<Column>();
List<Column> otherCols = new ArrayList<Column>();
diffFlatColumns(typeObjTable, flatTable, typeCols, otherCols);
_typeCols = Collections.unmodifiableList(typeCols);
Column pkCol = null;
Column complexValFkCol = null;
for(Column col : otherCols) {
if(col.isAutoNumber()) {
pkCol = col;
} else if(col.getType() == DataType.LONG) {
complexValFkCol = col;
}
}
if((pkCol == null) || (complexValFkCol == null)) {
throw new IOException("Could not find expected columns in flat table " +
flatTable.getName() + " for complex column with id "
+ complexTypeId);
}
_pkCol = pkCol;
_complexValFkCol = complexValFkCol;
}
示例5: findRow
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private static void findRow(final TestDB testDB, Table t, Index index,
Row expectedRow,
Cursor.Position expectedPos)
throws Exception
{
Object[] idxRow = ((IndexImpl)index).constructIndexRow(expectedRow);
Cursor cursor = CursorBuilder.createCursor(index, idxRow, idxRow);
Cursor.Position startPos = cursor.getSavepoint().getCurrentPosition();
cursor.beforeFirst();
while(cursor.moveToNextRow()) {
Row row = cursor.getCurrentRow();
if(expectedRow.equals(row)) {
// verify that the entries are indeed equal
Cursor.Position curPos = cursor.getSavepoint().getCurrentPosition();
assertEquals(entryToString(expectedPos), entryToString(curPos));
return;
}
}
// TODO long rows not handled completely yet in V2010
// seems to truncate entry at 508 bytes with some trailing 2 byte seq
if(testDB.getExpectedFileFormat() == Database.FileFormat.V2010) {
String rowId = expectedRow.getString("name");
String tName = t.getName();
if(("Table11".equals(tName) || "Table11_desc".equals(tName)) &&
("row10".equals(rowId) || "row11".equals(rowId) ||
"row12".equals(rowId))) {
System.out.println(
"TODO long rows not handled completely yet in V2010: " + tName +
", " + rowId);
return;
}
}
fail("testDB: " + testDB + ";\nCould not find expected row " + expectedRow + " starting at " +
entryToString(startPos));
}
示例6: InsertCommand
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
public InsertCommand(Table table, Object[] newRow, String execId) {
super();
this.table = table;
this.tableName = table.getName();
this.newRow = newRow;
this.execId = execId;
}
示例7: createSyncrTable
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private void createSyncrTable(Table t,boolean systemTable) throws SQLException, IOException {
String tn = t.getName();
String ntn =schema( SQLConverter.escapeIdentifier(tn),systemTable);
StringBuffer sbC = new StringBuffer("CREATE CACHED TABLE ").append(
ntn).append("(");
List<? extends Column> lc = t.getColumns();
String comma = "";
ArrayList<String> arTrigger = new ArrayList<String>();
for (Column cl : lc) {
String htype = cl.getType().equals(DataType.TEXT) ? "VARCHAR("
+ cl.getLengthInUnits() + ")" : TypesMap.map2hsqldb(cl
.getType());
sbC.append(comma)
.append(SQLConverter.escapeIdentifier(cl.getName()))
.append(" ").append(htype);
PropertyMap pm = cl.getProperties();
Object required = pm.getValue(PropertyMap.REQUIRED_PROP);
if (required != null && ((Boolean) required)) {
sbC.append(" NOT NULL ");
}
comma = ",";
}
sbC.append(")");
execCreate(sbC.toString(),true);
for (String trigger : arTrigger) {
execCreate(trigger,true);
}
}
示例8: createTable
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
@Override
public String createTable(Table table, List<Relationship> relationships) {
final StringBuilder stmtBuilder = new StringBuilder();
List<? extends Index.Column> primaryKeyColumns = getPrimaryKeyColumns(table);
String tableName = table.getName();
stmtBuilder.append("CREATE TABLE ");
stmtBuilder.append(createStringConstant(tableName));
stmtBuilder.append(" (");
List<? extends Column> columns = table.getColumns();
for (Iterator<? extends Column> iterator = columns.iterator(); iterator.hasNext(); ) {
Column column = iterator.next();
stmtBuilder.append(createStringConstant(column.getName()));
stmtBuilder.append(" ");
stmtBuilder.append(mapDatatype(column));
if (isPrimaryKeyColumn(primaryKeyColumns, column)) {
stmtBuilder.append(" PRIMARY KEY");
}
if (iterator.hasNext()) {
stmtBuilder.append(", ");
}
}
if (hasMultiplePrimaryKeyColumns(primaryKeyColumns)) {
stmtBuilder.append(", ");
stmtBuilder.append(createPrimaryKeyTableConstraint(primaryKeyColumns));
}
for (Relationship relationship : relationships) {
if (!relationship.getToTable().equals(table)) {
continue;
}
stmtBuilder.append(", ");
stmtBuilder.append(createForeignKeyTableConstraint(relationship));
}
stmtBuilder.append(")");
return stmtBuilder.toString();
}
示例9: defaultValues
import com.healthmarketscience.jackcess.Table; //导入方法依赖的package包/类
private void defaultValues(Table t) throws SQLException, IOException {
String tn = t.getName();
String ntn = SQLConverter.escapeIdentifier(tn);
List<? extends Column> lc = t.getColumns();
ArrayList<String> arTrigger = new ArrayList<String>();
for (Column cl : lc) {
PropertyMap pm = cl.getProperties();
String ncn = SQLConverter.escapeIdentifier(cl.getName());
Object defaulT = pm.getValue(PropertyMap.DEFAULT_VALUE_PROP);
if (defaulT != null) {
String cdefaulT = SQLConverter.convertSQL(" "
+ defaulT.toString());
if (cdefaulT.trim().startsWith("=")) {
cdefaulT = cdefaulT.trim().substring(1);
}
if (cl.getType().equals(DataType.BOOLEAN)
&& ("=yes".equalsIgnoreCase(cdefaulT) || "yes"
.equalsIgnoreCase(cdefaulT)))
cdefaulT = "true";
if (cl.getType().equals(DataType.BOOLEAN)
&& ("=no".equalsIgnoreCase(cdefaulT) || "no"
.equalsIgnoreCase(cdefaulT)))
cdefaulT = "false";
if(
(cl.getType().equals(DataType.MEMO)||
cl.getType().equals(DataType.TEXT))&&
(!defaulT.toString().startsWith("\"")||
!defaulT.toString().endsWith("\"")
)
){
cdefaulT="'"+cdefaulT.replaceAll("'","''")+"'";
}
String guidExp = "GenGUID()";
if (!guidExp.equals(defaulT)) {
if (!tryDefault(cdefaulT)) {
Logger.logWarning("Unknown expression:" + defaulT
+ " default value of column "
+ cl.getName() + " table "
+ cl.getTable().getName());
} else {
if (cdefaulT.endsWith(")")) {
arTrigger
.add("CREATE TRIGGER DEFAULT_TRIGGER"
+ (namingCounter++)
+ " BEFORE INSERT ON "
+ ntn
+ " REFERENCING NEW ROW AS NEW FOR EACH ROW IF NEW."
+ ncn + " IS NULL THEN "
+ "SET NEW." + ncn + "= "
+ cdefaulT + " ; END IF");
} else
arTrigger.add("alter table " + ntn
+ " alter column " + ncn
+ " set default " + cdefaulT);
}
}
}
}
for (String trigger : arTrigger) {
execCreate(trigger,true);
}
}