-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmultiRow.c
34 lines (29 loc) · 831 Bytes
/
multiRow.c
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
/* File name: multiRow.c */
#include "common.h"
int main() {
int i, n= 3;
I handle;
I portnumber= 5010;
S hostname= "localhost";
S usernamePassword= "kdb:pass";
S symbols[]= { "ABC", "DEF", "GHI" };
K result;
handle= khpu(hostname, portnumber, usernamePassword);
if(!handleOk(handle))
return EXIT_FAILURE;
K multipleRow= knk(3, ktn(KS, n), ktn(KF, n), ktn(KJ, n));
for(i= 0; i < n; i++) {
kS(kK(multipleRow)[0])[i]= ss(symbols[i % n]);
kF(kK(multipleRow)[1])[i]= 10.0 * i;
kJ(kK(multipleRow)[2])[i]= i;
}
// Perform multiple row insert, tickerplant will add timestamp column itself
result= k(handle, ".u.upd", ks((S) "trade"), multipleRow, (K) 0);
if(isRemoteErr(result)) {
kclose(handle);
return EXIT_FAILURE;
}
r0(result);
kclose(handle);
return EXIT_SUCCESS;
}