-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFastBCP_Wizard.html
More file actions
701 lines (618 loc) · 23.8 KB
/
FastBCP_Wizard.html
File metadata and controls
701 lines (618 loc) · 23.8 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>FastBCP Command Builder</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>FastBCP Command Builder</h1>
<h2>Set parameters and collect the built command line at the bottom of the page</h2>
<!-- Platform (Windows or Linux) -->
<label for="platform">Platform:</label>
<select id="platform" onchange="updateCommand()">
<option value="windows">Windows (FastBCP.exe)</option>
<option value="linux">Linux (FastBCP)</option>
</select>
<!-- ==================== CONNECTION PARAMETERS SECTION ==================== -->
<div class="section">
<h2>Connection Parameters</h2>
<table>
<thead>
<tr>
<th>Short Description</th>
<th>Value</th>
<th>Parameter</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<!-- connectiontype -->
<tr>
<td>Connection Type *</td>
<td>
<select id="connectiontype" onchange="onConnectionTypeChange(); updateCommand()">
<option value="">-- choose --</option>
<option value="clickhouse">clickhouse</option>
<option value="hana">hana</option>
<option value="odbc">odbc</option>
<option value="oledb">oledb</option>
<option value="mssql">mssql</option>
<option value="mysql">mysql</option>
<option value="msoledbsql">msoledbsql</option>
<option value="nzoledb">netezza (nzoledb)</option>
<option value="nzsql">netezza (nzsql)</option>
<option value="oraodp">oracle (oraodp)</option>
<option value="pgcopy">postgresql (pgcopy)</option>
<option value="pgsql">postgresql (pgsql)</option>
<option value="teradata">teradata</option>
<!-- more if needed -->
</select>
</td>
<td>--connectiontype</td>
<td>[none]</td>
</tr>
<!-- dsn (only if connectiontype == odbc) -->
<tr id="tr-dsn">
<td>ODBC DSN</td>
<td><input type="text" id="dsn" oninput="updateCommand()"></td>
<td>--dsn</td>
<td>[none]</td>
</tr>
<!-- provider (only if connectiontype == oledb) -->
<tr id="tr-provider">
<td>OLE DB Provider</td>
<td><input type="text" id="provider" oninput="updateCommand()"></td>
<td>--provider</td>
<td>[none]</td>
</tr>
<!-- server (for other connection types) -->
<tr id="tr-server">
<td>Server</td>
<td><input type="text" id="server" oninput="updateCommand()"></td>
<td>--server</td>
<td>[none]</td>
</tr>
<!-- sourceconnectstring -->
<tr>
<td>Conn. String</td>
<td><input type="text" id="sourceconnectstring" oninput="updateCommand()"></td>
<td>--sourceconnectstring</td>
<td>[none]</td>
</tr>
<!-- trusted -->
<tr>
<td>Trusted Auth?</td>
<td><input type="checkbox" id="trusted" onchange="updateCommand()"></td>
<td>--trusted</td>
<td>false</td>
</tr>
<!-- user -->
<tr>
<td>Username</td>
<td><input type="text" id="user" oninput="updateCommand()"></td>
<td>--user</td>
<td>[none]</td>
</tr>
<!-- password -->
<tr>
<td>Password</td>
<td><input type="text" id="password" oninput="updateCommand()"></td>
<td>--password</td>
<td>[none]</td>
</tr>
<!-- database -->
<tr>
<td>Database *</td>
<td><input type="text" id="database" oninput="updateCommand()"></td>
<td>--database</td>
<td>[none]</td>
</tr>
</tbody>
</table>
</div>
<!-- ==================== SOURCE QUERY / TABLE SECTION ==================== -->
<div class="section">
<h2>Source Query/Table</h2>
<table>
<thead>
<tr>
<th>Short Description</th>
<th>Value</th>
<th>Parameter</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<!-- fileinput -->
<tr>
<td>File Input</td>
<td><input type="text" id="fileinput" onchange="updateCommand()"></td>
<td>--fileinput</td>
<td>[none]</td>
</tr>
<!-- query -->
<tr>
<td>SQL Query</td>
<td><input type="text" id="query" oninput="updateCommand()"></td>
<td>--query</td>
<td>[none]</td>
</tr>
<!-- sourceschema -->
<tr>
<td>Source Schema</td>
<td><input type="text" id="sourceschema" oninput="updateCommand()"></td>
<td>--sourceschema</td>
<td>[none]</td>
</tr>
<!-- sourcetable -->
<tr>
<td>Source Table</td>
<td><input type="text" id="sourcetable" oninput="updateCommand()"></td>
<td>--sourcetable</td>
<td>[none]</td>
</tr>
</tbody>
</table>
</div>
<!-- ==================== OUTPUT OPTIONS SECTION ==================== -->
<div class="section">
<h2>Output Options</h2>
<table>
<thead>
<tr>
<th>Short Description</th>
<th>Value</th>
<th>Parameter</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<!-- fileoutput -->
<tr>
<td>File Output * (extension will define the filetype : csv , json, parquet, xlsx or binary)</td>
<td><input type="text" id="fileoutput" onchange="updateCommand()"></td>
<td>--fileoutput</td>
<td>[none]</td>
</tr>
<!-- directory -->
<tr>
<td>Output Directory *</td>
<td><input type="text" id="directory" oninput="updateCommand()"></td>
<td>--directory</td>
<td>[none]</td>
</tr>
<!-- timestamped -->
<tr>
<td>Timestamped ?</td>
<td><input type="checkbox" id="timestamped" onchange="updateCommand()"></td>
<td>--timestamped</td>
<td>false</td>
</tr>
</tbody>
</table>
<!-- ==================== FORMAT OPTIONS SECTION ==================== -->
<div class="section">
<h2>Format Options</h2>
<table>
<thead>
<tr>
<th>Short Description</th>
<th>Value</th>
<th>Parameter</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<!-- delimiter -->
<tr>
<td>Delimiter</td>
<td><input type="text" id="delimiter" value="" oninput="updateCommand()"></td>
<td>--delimiter</td>
<td>|</td>
</tr>
<!-- quotes -->
<tr>
<td>Use Quotes ?</td>
<td><input type="checkbox" id="quotes" onchange="updateCommand()"></td>
<td>--quotes</td>
<td>false</td>
</tr>
<!-- dateformat -->
<tr>
<td>Date and DateTime Format</td>
<td><input type="text" id="dateformat" value="yyyy-MM-dd HH:mm:ss" oninput="updateCommand()"></td>
<td>--dateformat</td>
<td>yyyy-MM-dd</td>
</tr>
<!-- decimalseparator -->
<tr>
<td>Decimal Separator</td>
<td><input type="text" id="decimalseparator" value="." oninput="updateCommand()"></td>
<td>--decimalseparator</td>
<td>.</td>
</tr>
<!-- boolformat -->
<tr>
<td>Boolean Format</td>
<td>
<select id="boolformat" onchange="updateCommand()">
<option value="">-- choose --</option>
<option value="automatic">automatic</option>
<option value="true/false">true/false</option>
<option value="1/0">1/0</option>
<option value="t/f">t/f</option>
</select>
</td>
<td>--boolformat</td>
<td>automatic</td>
</tr>
<!-- encoding -->
<tr>
<td>Encoding</td>
<td><input type="text" id="encoding" value="" oninput="updateCommand()"></td>
<td>--encoding</td>
<td>UTF-8</td>
</tr>
<!-- noheader -->
<tr>
<td>Remove Header?</td>
<td><input type="checkbox" id="noheader" onchange="updateCommand()"></td>
<td>--noheader</td>
<td>false</td>
</tr>
</tbody>
</table>
</div>
<!-- ==================== CLOUD OPTION SECTION ==================== -->
<div class="section">
<h2> Cloud Options</h2>
<table>
<thead>
<tr>
<th>Short Description</th>
<th>Value</th>
<th>Parameter</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<!-- cloudprofile -->
<tr id="tr-cloudprofile">
<td>Cloud Profile</td>
<td><input type="text" id="cloudprofile" oninput="updateCommand()"></td>
<td>--cloudprofile</td>
<td>[none]</td>
</tr></td>
</tr>
</tbody>
</table>
</div>
<!-- ==================== ADVANCED PARAMETERS SECTION ==================== -->
<div class="section">
<h2>Advanced Parameters</h2>
<table>
<thead>
<tr>
<th>Short Description</th>
<th>Value</th>
<th>Parameter</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<!-- method -->
<tr>
<td>Parallel Method</td>
<td>
<select id="method" onchange="onMethodChange(); updateCommand()">
<option value="None">None</option>
<option value="Random">Random</option>
<option value="DataDriven">DataDriven</option>
<option value="Ctid">Ctid</option>
<option value="Rowid">Rowid</option>
<option value="RangeId">RangeId</option>
<option value="Ntile">Ntile</option>
</select>
</td>
<td>--method</td>
<td>None</td>
</tr>
<!-- paralleldegree (only if method != None) -->
<tr id="tr-paralleldegree">
<td>Parallel Degree</td>
<td><input type="number" id="paralleldegree" value="-2" min="-32" max="1024" oninput="updateCommand()"></td>
<td>--paralleldegree</td>
<td>-2</td>
</tr>
<!-- distributekeycolumn -->
<tr id="tr-distributekeycolumn">
<td>Distribute Key Column</td>
<td><input type="text" id="distributekeycolumn" oninput="updateCommand()"></td>
<td>--distributekeycolumn</td>
<td>[none]</td>
</tr>
<!-- merge -->
<tr>
<td>Merge Temp Files</td>
<td><input type="checkbox" id="merge" checked onchange="updateCommand()"></td>
<td>--merge</td>
<td>true</td>
</tr>
<!-- runid -->
<tr>
<td>Run ID</td>
<td><input type="text" id="runid" oninput="updateCommand()"></td>
<td>--runid</td>
<td>[none]</td>
</tr>
<!-- settingsfile -->
<tr>
<td>Settings File</td>
<td><input type="text" id="settingsfile" value="FastBCP_Settings.json" oninput="updateCommand()"></td>
<td>--settingsfile</td>
<td>FastBCP_Settings.json</td>
</tr>
</tbody>
</table>
</div>
<!-- =================== LICENSE SECTION =================== -->
<div class="section">
<h2>License</h2>
<table>
<thead>
<tr>
<th>Short Description</th>
<th>Value</th>
<th>Parameter</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<!-- license -->
<tr>
<td>License file, url or content</td>
<td><input type="text" id="license" oninput="updateCommand()"></td>
<td>--license</td>
<td>[none] if not provided, will use FastBCP.lic</td>
</tr>
</tbody>
</table>
</div>
<!-- BUTTONS & RESULT -->
<button type="button" onclick="copyCommand()">Copy Command</button>
<button type="button" onclick="updateCommand()">Refresh</button>
<pre id="result"></pre>
<script>
// --- Show/Hide logic based on connection type ---
function onConnectionTypeChange() {
const ctype = document.getElementById('connectiontype').value;
// If ctype = "odbc" => show tr-dsn, hide tr-provider, hide tr-server
// If ctype = "oledb" => show tr-provider, hide tr-dsn, hide tr-server
// Else => show tr-server, hide tr-dsn, hide tr-provider
if (ctype === 'odbc') {
document.getElementById('tr-dsn').style.display = 'table-row';
document.getElementById('tr-provider').style.display = 'none';
document.getElementById('tr-server').style.display = 'none';
}
else if (ctype === 'oledb') {
document.getElementById('tr-dsn').style.display = 'none';
document.getElementById('tr-provider').style.display = 'table-row';
document.getElementById('tr-server').style.display = 'table-row';
}
else {
// e.g. mssql, pgsql, mysql, ...
document.getElementById('tr-dsn').style.display = 'none';
document.getElementById('tr-provider').style.display = 'none';
document.getElementById('tr-server').style.display = 'table-row';
}
}
// --- Show/Hide logic based on method ---
function onMethodChange() {
const method = document.getElementById('method').value;
// If method == "None", hide paralleldegree
if (method === 'None') {
document.getElementById('tr-paralleldegree').style.display = 'none';
} else {
document.getElementById('tr-paralleldegree').style.display = 'table-row';
}
// Hide distributekeycolumn if the method is ctid or rowid
if (method === 'Ctid' || method === 'Rowid') {
document.getElementById('tr-distributekeycolumn').style.display = 'none';
} else {
document.getElementById('tr-distributekeycolumn').style.display = 'table-row';
}
}
// --- Build the final command ---
function updateCommand() {
const platform = document.getElementById('platform').value;
let baseCmd = (platform === 'windows') ? '.\\FastBCP.exe' : './FastBCP';
let args = [];
// --connectiontype
const connectiontype = document.getElementById('connectiontype').value;
if (connectiontype) {
args.push(`--connectiontype "${connectiontype}"`);
}
// Condition-based rows: check if they're visible before adding the parameter
if (document.getElementById('tr-dsn').style.display !== 'none') {
const dsn = document.getElementById('dsn').value.trim();
if (dsn) {
args.push(`--dsn "${dsn}"`);
}
}
if (document.getElementById('tr-provider').style.display !== 'none') {
const provider = document.getElementById('provider').value.trim();
if (provider) {
args.push(`--provider "${provider}"`);
}
}
if (document.getElementById('tr-server').style.display !== 'none') {
const server = document.getElementById('server').value.trim();
if (server) {
args.push(`--server "${server}"`);
}
}
// --sourceconnectstring
const scs = document.getElementById('sourceconnectstring').value.trim();
if (scs) {
args.push(`--sourceconnectstring "${scs}"`);
}
// --trusted vs user/password
const trusted = document.getElementById('trusted').checked;
if (trusted) {
args.push(`--trusted`);
} else {
const user = document.getElementById('user').value.trim();
const password = document.getElementById('password').value.trim();
if (user) {
args.push(`--user "${user}"`);
}
if (password) {
args.push(`--password "${password}"`);
}
}
// --database
const database = document.getElementById('database').value.trim();
if (database) {
args.push(`--database "${database}"`);
}
// --fileinput vs --query
const fileinput = document.getElementById('fileinput').value.trim();
const query = document.getElementById('query').value.trim();
if (fileinput) {
args.push(`--fileinput "${fileinput.name}"`);
} else if (query) {
args.push(`--query "${query}"`);
}
// --sourceschema
const sourceschema = document.getElementById('sourceschema').value.trim();
if (sourceschema) {
args.push(`--sourceschema "${sourceschema}"`);
}
// --sourcetable
const sourcetable = document.getElementById('sourcetable').value.trim();
if (sourcetable) {
args.push(`--sourcetable "${sourcetable}"`);
}
// --fileoutput
const fileoutput = document.getElementById('fileoutput').value.trim();
if (fileoutput) {
args.push(`--fileoutput "${fileoutput}"`);
}
// --directory
const directory = document.getElementById('directory').value.trim();
if (directory) {
args.push(`--directory "${directory}"`);
}
// --delimiter
const delimiter = document.getElementById('delimiter').value;
if (delimiter) {
args.push(`--delimiter "${delimiter}"`);
}
// --quotes
const quotes = document.getElementById('quotes').checked;
if (quotes) {
args.push(`--quotes true`);
}
// --dateformat
const dateformat = document.getElementById('dateformat').value.trim();
if (dateformat) {
args.push(`--dateformat "${dateformat}"`);
}
// --encoding
const encoding = document.getElementById('encoding').value.trim();
if (encoding) {
args.push(`--encoding "${encoding}"`);
}
// --timestamped
const timestamped = document.getElementById('timestamped').checked;
if (timestamped) {
args.push(`--timestamped`);
}
// --noheader
const noheader = document.getElementById('noheader').checked;
if (noheader) {
args.push(`--noheader`);
}
// --decimalseparator
const decimalseparator = document.getElementById('decimalseparator').value.trim();
if (decimalseparator) {
args.push(`--decimalseparator "${decimalseparator}"`);
}
// --method
const method = document.getElementById('method').value;
if (method) {
args.push(`--method "${method}"`);
}
// --paralleldegree (only if visible => method != None)
if (document.getElementById('tr-paralleldegree').style.display !== 'none') {
const pd = document.getElementById('paralleldegree').value;
if (pd) {
args.push(`--paralleldegree ${pd}`);
}
}
// --cloudprofile
const cp = document.getElementById('cloudprofile').value.trim();
if (cp) {
args.push(`--cloudprofile "${cp}"`);
}
// --distributekeycolumn
const dkc = document.getElementById('distributekeycolumn').value.trim();
if (dkc) {
args.push(`--distributekeycolumn "${dkc}"`);
}
// --merge
const merge = document.getElementById('merge').checked;
if (!merge) {
args.push(`--merge false`);
}
// --boolformat
const boolformat = document.getElementById('boolformat').value;
if (boolformat) {
args.push(`--boolformat "${boolformat}"`);
}
// --runid
const runid = document.getElementById('runid').value.trim();
if (runid) {
args.push(`--runid "${runid}"`);
}
// --settingsfile
const settingsfile = document.getElementById('settingsfile').value.trim();
if (settingsfile) {
args.push(`--settingsfile "${settingsfile}"`);
}
// license
const license = document.getElementById('license').value.trim();
if (license) {
args.push(` --license "${license}"`);
}
// Build final command
let cmd = baseCmd;
if (args.length > 0) {
cmd += " " + args.join(" ");
}
document.getElementById('result').textContent = cmd;
}
// Copy to clipboard
function copyCommand() {
const cmd = document.getElementById('result').textContent;
navigator.clipboard.writeText(cmd)
.then(() => alert('Command copied!'))
.catch(() => alert('Failed to copy.'));
}
// Initialize display states
function initDisplayStates() {
// Hide DSN, Provider, or Server initially
document.getElementById('tr-dsn').style.display = 'none';
document.getElementById('tr-provider').style.display = 'none';
// By default, let's show server (but if connectiontype is empty, we might hide it)
document.getElementById('tr-server').style.display = 'table-row';
// By default, method is None => hide paralleldegree
document.getElementById('tr-paralleldegree').style.display = 'none';
}
// On load
initDisplayStates();
updateCommand();
</script>
</body>
</html>