forked from ifxdb/RIfxDB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSample1.R
More file actions
34 lines (24 loc) · 881 Bytes
/
Sample1.R
File metadata and controls
34 lines (24 loc) · 881 Bytes
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
# Rscript Sample1.R
library(IfxR)
ch <- IfxConnect( "SERVER=ids0;DATABASE=db1;HOST=127.0.0.1;SERVICE=9088;UID=informix;PWD=xxxx;" )
sql <- c( "create table t1 ( c1 int, c2 char(20), c3 int, c4 int ) ",
"insert into t1 values( 1, 'Sunday', 101, 201 );",
"insert into t1 values( 2, 'Monday', 102, 202 );",
"insert into t1 values( 3, 'Tuesday', 103, 203 );",
"insert into t1 values( 4, 'Wednesday', 104, 204 );",
"insert into t1 values( 5, 'Thursday', 105, 2005 );",
"insert into t1 values( 6, 'Friday', 106, 206 );",
"insert into t1 values( 7, 'Saturday', 107, 207 );" )
rc <- IfxQuery( ch, "drop table t1;" )
x <- sprintf( " DROP TABLE returns [%d] ", rc)
print( x )
for(s in sql)
{
rc <- IfxQuery(ch, s)
print( s )
}
rc <- IfxQuery(ch, "select * from t1")
res <- IfxFetchRows(ch)
print ( "****** The Select Output is ********" )
print (res)
IfxClose(ch)