This file is indexed.

/usr/lib/R/site-library/RPostgreSQL/devTests/transactionManagement.r is in r-cran-rpostgresql 0.4-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
#!/usr/bin/R

cat("Testing the working of Transaction Management\n")

## Create a database
tempdb <- "tempdbase123"
system(paste("createdb", tempdb))

library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname=tempdb)

## Test the numeric mapping
dbSendQuery(con, "create table book123list (intcolumn integer, floatcolumn float);")

## insert four rows into the table
dbSendQuery(con, "insert into book123list values(12,13.21);")
dbSendQuery(con, "insert into book123list values(50,11.21);")
dbSendQuery(con, "insert into book123list values(100,200.1);")
dbSendQuery(con, "insert into book123list values(5,3.56);")

cat("Table book123list contains the following records\n")
dbGetQuery(con, "select * from book123list")

cat("Test Run 1:\n")

dbBeginTransaction(con);
cat("Begin Transaction\n")
rs <- dbSendQuery(con, "DELETE from book123list WHERE intcolumn >= 50");
dbClearResult(rs);
cat("After Deletion\n");
dbGetQuery(con, "select * from book123list")
dbRollback(con)
cat("After Rolling back\n")

cat("Table book123list contains the following records\n")
dbGetQuery(con, "select * from book123list")

cat("Test Run 2:\n")

dbBeginTransaction(con);
cat("Begin Transaction\n")
dbGetQuery(con, "select * from book123list")[1, ];
rs <- dbSendQuery(con, "DELETE from book123list WHERE intcolumn >= 50");
dbClearResult(rs);
cat("After Deletion\n");
dbGetQuery(con, "select * from book123list")
dbCommit(con);
cat("After commiting the transaction\n")
dbGetQuery(con, "select * from book123list")

dbDisconnect(con)
dbUnloadDriver(drv)

system(paste("dropdb", tempdb))

cat("DONE\n")