當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。