Skip to content

Commit

Permalink
Merge branch 'main' into owl-bot-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
surbhigarg92 authored Jul 19, 2024
2 parents 9844b26 + 7e4a8e9 commit 0f6820e
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1533,23 +1533,39 @@ class Database extends common.GrpcServiceObject {
): void;
async getDatabaseDialect(
optionsOrCallback?: CallOptions | GetDatabaseDialectCallback,
cb?: GetDatabaseDialectCallback
callback?: GetDatabaseDialectCallback
): Promise<
| EnumKey<typeof databaseAdmin.spanner.admin.database.v1.DatabaseDialect>
| undefined
> {
const gaxOptions =
typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
typeof optionsOrCallback === 'object'
? (optionsOrCallback as CallOptions)
: {};

if (
this.databaseDialect === 'DATABASE_DIALECT_UNSPECIFIED' ||
this.databaseDialect === null ||
this.databaseDialect === undefined
) {
const [metadata] = await this.getMetadata(gaxOptions);
this.databaseDialect = metadata.databaseDialect;
const cb =
typeof optionsOrCallback === 'function'
? (optionsOrCallback as GetDatabaseDialectCallback)
: callback;

try {
if (
this.databaseDialect === 'DATABASE_DIALECT_UNSPECIFIED' ||
this.databaseDialect === null ||
this.databaseDialect === undefined
) {
const [metadata] = await this.getMetadata(gaxOptions);
this.databaseDialect = metadata.databaseDialect;
}
if (cb) {
cb(null, this.databaseDialect);
return;
}
return this.databaseDialect || undefined;
} catch (err) {
cb!(err as grpc.ServiceError);
return;
}
return this.databaseDialect || undefined;
}

/**
Expand Down Expand Up @@ -3665,6 +3681,7 @@ callbackifyAll(Database, {
'delete',
'exists',
'get',
'getDatabaseDialect',
'getMetadata',
'getSchema',
'getSessions',
Expand Down

0 comments on commit 0f6820e

Please sign in to comment.