当前位置: 首页>>代码示例>>Java>>正文


Java Column.AUTO_NUMBER属性代码示例

本文整理汇总了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;
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:18,代码来源:TableImpl.java

示例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();
  }
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:27,代码来源:AutoNumberTest.java

示例3: initComplex

private void initComplex() {
	for (int i = 0; i < newRow.length; ++i) {
		if (newRow[i] instanceof ComplexBase) {
			newRow[i] = Column.AUTO_NUMBER;
		}
	}
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:7,代码来源:InsertCommand.java

示例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);    
}
 
开发者ID:jahlborn,项目名称:jackcess,代码行数:47,代码来源:AutoNumberTest.java


注:本文中的com.healthmarketscience.jackcess.Column.AUTO_NUMBER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。