FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodejs-driver/samples/ElicitFile.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
/
ElicitFile.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (29 loc) · 1.21 KB
Breadcrumbs
nodejs-driver
/
samples
/
ElicitFile.ts
Copy path
File metadata and controls
36 lines (29 loc) · 1.21 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
// Copyright 2023 by Teradata Corporation. All rights reserved.
// This sample program demonstrates how to use the Elicit File feature of the Teradata SQL Driver for Node.js
// to upload the C source file to the Teradata Database and create a User-Defined Function (UDF).
// This sample program requires the udfinc.c source file to be located in the current directory.
//
@ts
-ignore
import
*
as
teradatasql
from
"teradatasql"
;
type
Row
=
any
[
]
|
null
;
const
con
:
teradatasql
.
TeradataConnection
=
teradatasql
.
connect
(
{
host
:
"whomooz"
,
user
:
"guest"
,
password
:
"please"
}
)
;
try
{
const
cur
:
teradatasql
.
TeradataCursor
=
con
.
cursor
(
)
;
try
{
console
.
log
(
"Create function"
)
;
cur
.
execute
(
"create function myudfinc(integer) returns integer language c no sql parameter style sql external name 'CS!udfinc!udfinc.c!F!udfinc'"
)
;
console
.
log
(
"Execute function"
)
;
cur
.
execute
(
"select myudfinc(1)"
)
;
const
row
:
Row
=
cur
.
fetchone
(
)
;
if
(
row
)
{
console
.
log
(
"Function returned"
,
row
[
0
]
)
;
}
console
.
log
(
"Drop function"
)
;
cur
.
execute
(
"drop function myudfinc"
)
;
}
finally
{
cur
.
close
(
)
;
}
}
finally
{
con
.
close
(
)
;
}
Back
|
FazBrowse Home
|
New Git URL