本文整理汇总了Java中com.healthmarketscience.jackcess.Column.AUTO_NUMBER属性的典型用法代码示例。如果您正苦于以下问题:Java Column.AUTO_NUMBER属性的具体用法?Java Column.AUTO_NUMBER怎么用?Java Column.AUTO_NUMBER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.healthmarketscience.jackcess.Column
的用法示例。
在下文中一共展示了Column.AUTO_NUMBER属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInputAutoNumberRowValue
/**
* Optionally get the input autonumber row value for the given column from
* the given row if one was provided.
*/
private static Object getInputAutoNumberRowValue(
boolean enableInsert, ColumnImpl col, Object[] row)
{
if(!enableInsert) {
return null;
}
Object inRowValue = col.getRowValue(row);
if((inRowValue == Column.KEEP_VALUE) || (inRowValue == Column.AUTO_NUMBER)) {
// these "special" values both behave like nothing was given
inRowValue = null;
}
return inRowValue;
}
示例2: testAutoNumberGuid
public void testAutoNumberGuid() throws Exception
{
for (final FileFormat fileFormat : SUPPORTED_FILEFORMATS) {
Database db = createMem(fileFormat);
Table table = new TableBuilder("test")
.addColumn(new ColumnBuilder("a", DataType.GUID)
.setAutoNumber(true))
.addColumn(new ColumnBuilder("b", DataType.TEXT))
.toTable(db);
Object[] row = {null, "row1"};
assertSame(row, table.addRow(row));
assertTrue(ColumnImpl.isGUIDValue(row[0]));
row = table.addRow(13, "row2");
assertTrue(ColumnImpl.isGUIDValue(row[0]));
row = table.addRow("flubber", "row3");
assertTrue(ColumnImpl.isGUIDValue(row[0]));
Object[] smallRow = {Column.AUTO_NUMBER};
row = table.addRow(smallRow);
assertNotSame(row, smallRow);
assertTrue(ColumnImpl.isGUIDValue(row[0]));
db.close();
}
}
示例3: initComplex
private void initComplex() {
for (int i = 0; i < newRow.length; ++i) {
if (newRow[i] instanceof ComplexBase) {
newRow[i] = Column.AUTO_NUMBER;
}
}
}
示例4: doTestAutoNumber
private static void doTestAutoNumber(Table table) throws Exception
{
Object[] row = {null, "row1"};
assertSame(row, table.addRow(row));
assertEquals(1, ((Integer)row[0]).intValue());
row = table.addRow(13, "row2");
assertEquals(2, ((Integer)row[0]).intValue());
row = table.addRow("flubber", "row3");
assertEquals(3, ((Integer)row[0]).intValue());
table.reset();
row = table.addRow(Column.AUTO_NUMBER, "row4");
assertEquals(4, ((Integer)row[0]).intValue());
row = table.addRow(Column.AUTO_NUMBER, "row5");
assertEquals(5, ((Integer)row[0]).intValue());
Object[] smallRow = {Column.AUTO_NUMBER};
row = table.addRow(smallRow);
assertNotSame(row, smallRow);
assertEquals(6, ((Integer)row[0]).intValue());
table.reset();
List<? extends Map<String, Object>> expectedRows =
createExpectedTable(
createExpectedRow(
"a", 1,
"b", "row1"),
createExpectedRow(
"a", 2,
"b", "row2"),
createExpectedRow(
"a", 3,
"b", "row3"),
createExpectedRow(
"a", 4,
"b", "row4"),
createExpectedRow(
"a", 5,
"b", "row5"),
createExpectedRow(
"a", 6,
"b", null));
assertTable(expectedRows, table);
}