a b/archives/RadETL/docs/reference/DBMSIO.html
1
<!-- Generated by pkgdown: do not edit by hand -->
2
<!DOCTYPE html>
3
<html lang="en">
4
  <head>
5
  <meta charset="utf-8">
6
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8
9
<title>DBMSIO Class — DBMSIO • RadETL</title>
10
11
<!-- jquery -->
12
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
13
<!-- Bootstrap -->
14
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/cerulean/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous" />
15
16
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
17
18
<!-- Font Awesome icons -->
19
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
20
21
<!-- clipboard.js -->
22
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
23
24
<!-- sticky kit -->
25
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
26
27
<!-- pkgdown -->
28
<link href="../pkgdown.css" rel="stylesheet">
29
<script src="../pkgdown.js"></script>
30
31
32
33
<meta property="og:title" content="DBMSIO Class — DBMSIO" />
34
35
<meta property="og:description" content="This class is a DBMS I/O class created using the DatabaseConnector package." />
36
<meta name="twitter:card" content="summary" />
37
38
39
40
<!-- mathjax -->
41
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
42
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
43
44
<!--[if lt IE 9]>
45
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
46
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
47
<![endif]-->
48
49
50
  </head>
51
52
  <body>
53
    <div class="container template-reference-topic">
54
      <header>
55
      <div class="navbar navbar-default navbar-fixed-top" role="navigation">
56
  <div class="container">
57
    <div class="navbar-header">
58
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
59
        <span class="sr-only">Toggle navigation</span>
60
        <span class="icon-bar"></span>
61
        <span class="icon-bar"></span>
62
        <span class="icon-bar"></span>
63
      </button>
64
      <span class="navbar-brand">
65
        <a class="navbar-link" href="../index.html">RadETL</a>
66
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.1</span>
67
      </span>
68
    </div>
69
70
    <div id="navbar" class="navbar-collapse collapse">
71
      <ul class="nav navbar-nav">
72
        <li>
73
  <a href="../index.html">
74
    <span class="fa fa-home fa-lg"></span>
75
     
76
  </a>
77
</li>
78
<li>
79
  <a href="../reference/index.html">Reference</a>
80
</li>
81
      </ul>
82
      
83
      <ul class="nav navbar-nav navbar-right">
84
        
85
      </ul>
86
      
87
    </div><!--/.nav-collapse -->
88
  </div><!--/.container -->
89
</div><!--/.navbar -->
90
91
      
92
      </header>
93
94
<div class="row">
95
  <div class="col-md-9 contents">
96
    <div class="page-header">
97
    <h1>DBMSIO Class</h1>
98
    
99
    <div class="hidden name"><code>DBMSIO.Rd</code></div>
100
    </div>
101
102
    <div class="ref-description">
103
    
104
    <p>This class is a DBMS I/O class created using the DatabaseConnector package.</p>
105
    
106
    </div>
107
108
    <pre class="usage"><span class='no'>DBMSIO</span></pre>
109
    
110
    <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
111
    <table class="ref-arguments">
112
    <colgroup><col class="name" /><col class="desc" /></colgroup>
113
    <tr>
114
      <th>server</th>
115
      <td><p>Enter the server address to access (See http://ohdsi.github.io/DatabaseConnector/reference/connect.html)</p></td>
116
    </tr>
117
    <tr>
118
      <th>user</th>
119
      <td><p>Enter the user ID of the DBMS you want to access</p></td>
120
    </tr>
121
    <tr>
122
      <th>pw</th>
123
      <td><p>Enter the password for the DBMS you want to access.</p></td>
124
    </tr>
125
    <tr>
126
      <th>dbms</th>
127
      <td><p>Enter the DBMS type. ex: sql server, oracle</p></td>
128
    </tr>
129
    </table>
130
    
131
    <h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2>
132
133
    <p>An object of class <code>R6ClassGenerator</code> of length 24.</p>
134
    
135
136
    <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
137
    <pre class="examples"><span class='co'># NOT RUN {</span>
138
<span class='co'>############################# Example Code: Data frame transfer RDBMS.. #############################</span>
139
140
<span class='co'># First, connect RDBMS</span>
141
<span class='co'># I'm not recommend to input server information in programming code (Security issues)</span>
142
<span class='co'># So, I recommend to use environment variables in operating system</span>
143
<span class='no'>dbms</span> <span class='kw'>&lt;-</span> <span class='st'>"sql server"</span>
144
<span class='no'>user</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/Sys.getenv'>Sys.getenv</a></span>(<span class='st'>"user"</span>)
145
<span class='no'>pw</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/Sys.getenv'>Sys.getenv</a></span>(<span class='st'>"pw"</span>)
146
<span class='no'>server</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/Sys.getenv'>Sys.getenv</a></span>(<span class='st'>"dbServer"</span>)
147
148
<span class='co'># Choose Database name</span>
149
<span class='no'>databaseSchema</span> <span class='kw'>&lt;-</span> <span class='st'>'Radiology_CDM_QUER.dbo'</span>
150
151
<span class='co'># Using DatabaseConnector package</span>
152
<span class='no'>io</span> <span class='kw'>&lt;-</span> <span class='no'>DBMSIO</span>$<span class='fu'>new</span>(<span class='kw'>server</span> <span class='kw'>=</span> <span class='no'>server</span>, <span class='kw'>user</span> <span class='kw'>=</span> <span class='no'>user</span>, <span class='kw'>pw</span> <span class='kw'>=</span> <span class='no'>pw</span>, <span class='kw'>dbms</span> <span class='kw'>=</span> <span class='no'>dbms</span>)
153
154
<span class='co'># df is radiology Data frame,,</span>
155
<span class='co'># The insertDB method checks the row in the data frame and automatically inserts the table name.</span>
156
<span class='co'># If the data frame does not fit the R-CDM, an error occurs.</span>
157
<span class='co'># You can also inherit the insertTable from the DatabaseConnector package to accept the options for that function.</span>
158
<span class='co'># e.q dropTableIfExists etc.</span>
159
<span class='no'>io</span>$<span class='fu'>insertDB</span>(<span class='kw'>dbS</span> <span class='kw'>=</span> <span class='no'>databaseSchema</span>, <span class='kw'>df</span> <span class='kw'>=</span> <span class='no'>df</span>)
160
161
<span class='co'>################################## Example Code: Get data for RDBMS.... #############################</span>
162
163
<span class='co'># Using DBMSIO class in RadETL package</span>
164
<span class='co'># table schema names are Radiology_Image and Radiology_Occurrence</span>
165
<span class='no'>tbSchema</span> <span class='kw'>&lt;-</span> <span class='st'>"Radiology_Occurrence"</span>
166
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='no'>io</span>$<span class='fu'>dbGetdtS</span>(<span class='kw'>dbS</span> <span class='kw'>=</span> <span class='no'>databaseSchema</span>, <span class='kw'>tbS</span> <span class='kw'>=</span> <span class='no'>tbSchema</span>)
167
168
<span class='co'># include conditions....</span>
169
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='no'>io</span>$<span class='fu'>dbGetdtS</span>(<span class='kw'>dbS</span> <span class='kw'>=</span> <span class='no'>databaseSchema</span>, <span class='kw'>tbS</span> <span class='kw'>=</span> <span class='no'>tbSchema</span>, <span class='kw'>condition</span> <span class='kw'>=</span> <span class='st'>"Image_total_count &lt; 20"</span>)
170
<span class='no'>df</span>$<span class='no'>RADIOLOGY_OCCURRENCE_ID</span>
171
172
<span class='co'># if want disconnect (required)</span>
173
<span class='no'>io</span>$<span class='fu'>finalize</span>()
174
175
<span class='co'>######################################## Example Code: END ##########################################</span>
176
<span class='co'># }</span></pre>
177
  </div>
178
  <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
179
    <h2>Contents</h2>
180
    <ul class="nav nav-pills nav-stacked">
181
      <li><a href="#arguments">Arguments</a></li>
182
      
183
      <li><a href="#format">Format</a></li>
184
      
185
      <li><a href="#examples">Examples</a></li>
186
    </ul>
187
188
    <h2>Author</h2>
189
    <p>Neon K.I.D</p>
190
  </div>
191
</div>
192
193
      <footer>
194
      <div class="copyright">
195
  <p>Developed by K.I.D Neon.</p>
196
</div>
197
198
<div class="pkgdown">
199
  <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.9000.</p>
200
</div>
201
      </footer>
202
   </div>
203
204
  
205
206
  </body>
207
</html>
208