diff --git a/examples/basic-example-v2-with-query-service/index.ts b/examples/basic-example-v2-with-query-service/index.ts index 3c964961..70ab6fed 100644 --- a/examples/basic-example-v2-with-query-service/index.ts +++ b/examples/basic-example-v2-with-query-service/index.ts @@ -143,6 +143,10 @@ async function selectWithParameters(driver: Driver, data: ThreeIds[], logger: Lo '$episodeId': episode.getTypedValue('episodeId') }, text: ` + DECLARE $seriesId AS Uint64; + DECLARE $seasonId AS Uint64; + DECLARE $episodeId AS Uint64; + SELECT title, air_date FROM episodes @@ -173,6 +177,10 @@ async function explicitTcl(driver: Driver, ids: ThreeIds, logger: Logger) { '$episodeId': episode.getTypedValue('episodeId') }, text: ` + DECLARE $seriesId AS Uint64; + DECLARE $seasonId AS Uint64; + DECLARE $episodeId AS Uint64; + UPDATE episodes SET air_date = CurrentUtcDate() WHERE series_id = $seriesId @@ -200,6 +208,10 @@ async function transactionPerWholeDo(driver: Driver, ids: ThreeIds, logger: Logg '$episodeId': episode.getTypedValue('episodeId') }, text: ` + DECLARE $seriesId AS Uint64; + DECLARE $seasonId AS Uint64; + DECLARE $episodeId AS Uint64; + UPDATE episodes SET air_date = CurrentUtcDate() WHERE series_id = $seriesId @@ -221,6 +233,10 @@ async function fillTablesWithData(driver: Driver, _logger: Logger) { '$episodesData': getEpisodesData() }, text: ` + DECLARE $seriesData AS List>; + DECLARE $seasonsData AS List>; + DECLARE $episodesData AS List>; + REPLACE INTO ${SERIES_TABLE} diff --git a/src/__tests__/e2e/query-service/method-execute.ts b/src/__tests__/e2e/query-service/method-execute.ts index 81a8fad4..b541e5a4 100644 --- a/src/__tests__/e2e/query-service/method-execute.ts +++ b/src/__tests__/e2e/query-service/method-execute.ts @@ -156,8 +156,9 @@ describe('Query.execute()', () => { await session.execute({ text: ` + DECLARE $table AS List>; UPSERT INTO ${TABLE_NAME} (id, title, time) - SELECT id, title, time FROM AS_TABLE($table) + SELECT id, title, time FROM AS_TABLE($table); `, parameters: { '$table': Row.asTypedCollection([...dataGenerator(generatedRowsCount)]), @@ -196,9 +197,15 @@ describe('Query.execute()', () => { '$title1': TypedValues.text('Some title1'), '$id2': TypedValues.uint64(2), '$title2': TypedValues.text('Some title2'), - '$timestamp': TypedValues.timestamp(new Date()), + '$timestamp': TypedValues.datetime(new Date()), }, text: ` + DECLARE $id1 AS Uint64; + DECLARE $title1 AS Utf8; + DECLARE $id2 AS Uint64; + DECLARE $title2 AS Utf8; + DECLARE $timestamp AS Datetime; + INSERT INTO ${TABLE_NAME} (id, title, time) VALUES ($id1, $title1, $timestamp); INSERT INTO ${TABLE_NAME} (id, title, time) diff --git a/src/__tests__/e2e/query-service/rows-conversion.ts b/src/__tests__/e2e/query-service/rows-conversion.ts index 148d05f1..5310d414 100644 --- a/src/__tests__/e2e/query-service/rows-conversion.ts +++ b/src/__tests__/e2e/query-service/rows-conversion.ts @@ -115,9 +115,15 @@ describe('Rows conversion', () => { '$title1': TypedValues.text('Some title1'), '$id2': TypedValues.uint64(2), '$title2': TypedValues.text('Some title2'), - '$timestamp': TypedValues.timestamp(new Date()), + '$timestamp': TypedValues.datetime(new Date()), }, text: ` + DECLARE $id1 AS Uint64; + DECLARE $title1 AS Utf8; + DECLARE $id2 AS Uint64; + DECLARE $title2 AS Utf8; + DECLARE $timestamp AS Datetime; + INSERT INTO ${TABLE_NAME} (id, row_title, time) VALUES ($id1, $title1, $timestamp); INSERT INTO ${TABLE_NAME} (id, row_title, time) diff --git a/src/__tests__/e2e/table-service/types.test.ts b/src/__tests__/e2e/table-service/types.test.ts index 2c4065ae..0413904f 100644 --- a/src/__tests__/e2e/table-service/types.test.ts +++ b/src/__tests__/e2e/table-service/types.test.ts @@ -16,7 +16,7 @@ describe('Types', () => { describe('Convert from native to YDB value', () => { describe('Primitive values', () => { - it.only('Numeric values', () => { + it('Numeric values', () => { expect(TypedValues.bool(true)).toEqual({ type: {typeId: Ydb.Type.PrimitiveTypeId.BOOL}, value: {boolValue: true},