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


Java UpdateDatabaseDdlMetadata类代码示例

本文整理汇总了Java中com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata的典型用法代码示例。如果您正苦于以下问题:Java UpdateDatabaseDdlMetadata类的具体用法?Java UpdateDatabaseDdlMetadata怎么用?Java UpdateDatabaseDdlMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UpdateDatabaseDdlMetadata类属于com.google.spanner.admin.database.v1包,在下文中一共展示了UpdateDatabaseDdlMetadata类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mockOperation

import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata; //导入依赖的package包/类
private Operation<Void, UpdateDatabaseDdlMetadata> mockOperation(boolean error)
{
	@SuppressWarnings("unchecked")
	Operation<Void, UpdateDatabaseDdlMetadata> op = mock(Operation.class);
	when(op.getName()).then(new Returns("TEST_OPERATION"));
	when(op.isDone()).then(new Answer<Boolean>()
	{
		@Override
		public Boolean answer(InvocationOnMock invocation) throws Throwable
		{
			return reportDone;
		}
	});
	when(op.reload()).then(new Returns(op));
	if (error)
		when(op.getResult()).thenThrow(
				SpannerExceptionFactory.newSpannerException(ErrorCode.INVALID_ARGUMENT, "Some exception"));
	else
		when(op.getResult()).then(new Returns(null));
	UpdateDatabaseDdlMetadata metadata = UpdateDatabaseDdlMetadata.getDefaultInstance();
	when(op.getMetadata()).then(new Returns(metadata));

	return op;
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:25,代码来源:RunningOperationsStoreTest.java

示例2: DdlOperation

import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata; //导入依赖的package包/类
private DdlOperation(Timestamp timeStarted, List<String> sql,
		Operation<Void, UpdateDatabaseDdlMetadata> operation)
{
	this.timeStarted = timeStarted;
	this.sql = new ArrayList<>(sql);
	this.operation = operation;
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:8,代码来源:RunningOperationsStore.java

示例3: executeDDL

import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata; //导入依赖的package包/类
/**
 * Execute one or more DDL-statements on the database and wait for it to
 * finish or return after syntax check (when running in async mode). Calling
 * this method will also automatically commit the currently running
 * transaction.
 * 
 * @param sql
 *            The DDL-statement(s) to execute
 * @return Nothing
 * @throws SQLException
 *             If an error occurs during the execution of the statement.
 */
public Void executeDDL(List<String> sql) throws SQLException
{
	if (!getAutoCommit())
		commit();
	try
	{
		Operation<Void, UpdateDatabaseDdlMetadata> operation = adminClient.updateDatabaseDdl(database.instance,
				database.database, sql, null);
		if (asyncDdlOperations)
		{
			operations.addOperation(sql, operation);
		}
		else
		{
			do
			{
				operation = operation.waitFor();
			}
			while (!operation.isDone());
		}
		return operation.getResult();
	}
	catch (SpannerException e)
	{
		throw new CloudSpannerSQLException(
				"Could not execute DDL statement(s) " + String.join("\n;\n", sql) + ": " + e.getMessage(), e);
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:41,代码来源:CloudSpannerConnection.java

示例4: addMarketingBudgetColumnToAlbums

import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata; //导入依赖的package包/类
private static void addMarketingBudgetColumnToAlbums(PrintWriter pw) {
  Operation<Void, UpdateDatabaseDdlMetadata> op =
      SpannerClient.getDatabaseAdminClient()
          .updateDatabaseDdl(
              SpannerClient.getInstanceId(),
              SpannerClient.getDatabaseId(),
              Arrays.asList("ALTER TABLE Albums ADD COLUMN MarketingBudget INT64"),
              null);
  op.waitFor();
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:11,代码来源:SpannerTasks.java

示例5: addIndex

import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata; //导入依赖的package包/类
private static void addIndex() {
  Operation<Void, UpdateDatabaseDdlMetadata> op =
      SpannerClient.getDatabaseAdminClient()
          .updateDatabaseDdl(
              SpannerClient.getInstanceId(),
              SpannerClient.getDatabaseId(),
              Arrays.asList("CREATE INDEX AlbumsByAlbumTitle ON Albums(AlbumTitle)"),
              null);
  op.waitFor();
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:11,代码来源:SpannerTasks.java

示例6: addStoringIndex

import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata; //导入依赖的package包/类
private static void addStoringIndex() {
  Operation<Void, UpdateDatabaseDdlMetadata> op =
      SpannerClient.getDatabaseAdminClient()
          .updateDatabaseDdl(
              SpannerClient.getInstanceId(),
              SpannerClient.getDatabaseId(),
              Arrays.asList(
                  "CREATE INDEX AlbumsByAlbumTitle2 "
                      + "ON Albums(AlbumTitle) STORING (MarketingBudget)"),
              null);
  op.waitFor();
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:13,代码来源:SpannerTasks.java

示例7: addOperation

import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata; //导入依赖的package包/类
void addOperation(List<String> sql, Operation<Void, UpdateDatabaseDdlMetadata> operation)
{
	operations.add(new DdlOperation(Timestamp.now(), sql, operation));
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:5,代码来源:RunningOperationsStore.java


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