FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodejs-driver/samples/ShowCommand.ts at develop · Teradata/nodejs-driver · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
Teradata
/
nodejs-driver
Public
Notifications
You must be signed in to change notification settings
Fork
13
Star
15
Code
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
nodejs-driver
/
samples
/
ShowCommand.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (40 loc) · 1.43 KB
Breadcrumbs
nodejs-driver
/
samples
/
ShowCommand.ts
Copy path
File metadata and controls
45 lines (40 loc) · 1.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2023 by Teradata Corporation. All rights reserved.
// This sample program demonstrates how to display the output from a show command.
// The show command output includes embedded carriage returns as line terminators,
// which typically must be changed to newlines in order to display properly.
// The show command output may include multiple result sets, and the cursor nextset
// function must be called to advance to subsequent result sets.
//
@ts
-ignore
import
*
as
teradatasql
from
"teradatasql"
;
type
Rows
=
any
[
]
;
function
ShowCommand
(
cur
:
teradatasql
.
TeradataCursor
,
s
:
string
)
:
void
{
console
.
log
(
"-- "
+
s
)
;
cur
.
execute
(
s
)
;
let
n
:
number
=
1
;
while
(
true
)
{
console
.
log
(
`-- result set
${
n
}
`
)
;
const
rows
:
Rows
=
cur
.
fetchall
(
)
;
for
(
const
row
of
rows
)
{
const
s
:
string
=
JSON
.
stringify
(
row
)
.
split
(
"\\r"
)
.
join
(
"\n"
)
;
console
.
log
(
s
.
slice
(
2
,
s
.
length
-
2
)
)
;
}
if
(
cur
.
nextset
(
)
)
{
n
+=
1
;
}
else
{
break
;
}
}
}
const
con
:
teradatasql
.
TeradataConnection
=
teradatasql
.
connect
(
{
host
:
"whomooz"
,
user
:
"guest"
,
password
:
"please"
}
)
;
try
{
const
cur
:
teradatasql
.
TeradataCursor
=
con
.
cursor
(
)
;
try
{
ShowCommand
(
cur
,
"show view DBC.DBCInfo"
)
;
console
.
log
(
)
;
ShowCommand
(
cur
,
"show select * from DBC.DBCInfo"
)
;
}
finally
{
cur
.
close
(
)
;
}
}
finally
{
con
.
close
(
)
;
}
Back
|
FazBrowse Home
|
New Git URL