<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />

    <!--
    <link rel="stylesheet" type="text/css" href="/oscar/css/main.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="/oscar/stylesheets/github-dark.css" media="screen">
    <link rel="stylesheet" type="text/css" href="/oscar/stylesheets/print.css" media="print">
    -->
    <link rel="shortcut icon" type="image/x-icon" href="/oscar/favicon.ico?" />
    <link rel="stylesheet" type="text/css" href="/oscar/stylesheets/stylesheet.css" media="screen" />

    <title>OSCAR: DevODA_oda.pm</title>
  </head>

  <body>

    <div id="header_wrap" class="outer">
        <header class="inner">
		<a id="forkme_banner" href="https://github.com/oscar-cluster/oscar">View on GitHub</a>

        <div id="project_tagline">
          <img src="/oscar/images/oscar-logo.jpg" width="130" />
        </div>
          <h2 id="project_tagline1">Open Source Cluster Application Resources</h2>

            <section id="downloads">
		    <a class="zip_download_link" href="https://github.com/oscar-cluster//oscar/zipball/master">Download this project as a .zip file</a>
		    <a class="tar_download_link" href="https://github.com/oscar-cluster/oscar/tarball/master">Download this project as a tar.gz file</a>
            </section>
        </header>
    </div>
    <div class="container">
      <section id="main_content">

    <!-- MAIN CONTENT -->
    <div id="main_content_wrap" class="outer">
        <div class="middle">
               <div class="sidebox">
        <ul>
            <li><a href="/oscar/" title="home" class="" ><span>Main Page</span></a></li>
            <li><a href="/oscar/wiki/Status" title="home" class="" ><span>Current Status</span></a></li>
            <li><a href="/oscar/wiki/Download" title="download" class="" ><span>Download</span></a></li>
            <li><a href="/oscar/wiki/Document" title="document" class="current" ><span>Documentations</span></a></li>
            <li><a href="/oscar/wiki/Contact" title="contact" class="" ><span>Contact</span></a></li>
            <li><a href="/oscar/blog.html" title="blog" class="" ><span>Blog</span></a></li>
            <!--
            <li><a href="/oscar/publications" title="contact" class="" ><span>Publications</span></a></li>
            -->
        </ul>
       </div>


      <section id="main_content" class="inner">
<!-- Name: DevODA_oda.pm -->
<!-- Version: 12 -->
<!-- Author: dikim -->

<p>[DevelDocs] &gt; <a href="DevODA">ODA</a> &gt; oda.pm</p>
<h2 id="odapm">oda.pm</h2>

<p>The highest level of ODA hierarchy is <code class="language-plaintext highlighter-rouge">oda.pm</code>, which implements[[BR]]
the direct database connection and main database queries for the OSCAR[[BR]]
database.  The database connection is performed by Perl DBI. DBI[[BR]]
requires data source, username, password, and option arguments for the[[BR]]
DBI module, <em>connect</em>. So, the database handler is created by calling[[BR]]
the <em>connect</em> module of DBI.  For example,[[BR]]</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$dbh = DBI-&gt;connect( $data_source, $username,
                     $password, %attr ); The main database queries consist of the two Perl subroutines on `oda.pm`:[[BR]] _do_query_ and _do_sql_command_.[[BR]] These subroutines can only be executed with the database connection of DBI[[BR]] described above.[[BR]]
</code></pre></div></div>

<p>The <em>do_query</em> takes any SQL string with several other arguments,[[BR]]
executes the SQL commands with given arguments, and then returns the[[BR]]
query results. It is designed to return all the possible format values[[BR]]
by generating general data format. Any statement calling the subroutine[[BR]]
<em>do_query</em> takes return values with a consistent data format and can[[BR]]
set up the same routine of codes to handle the return values. The[[BR]]
<em>do_sql_command</em> takes any SQL string and executes it with the DBI[[BR]]
database connection. The command does not have any return values to[[BR]]
transfer but returns the flag to determine whether the SQL string has[[BR]]
been successfully executed or not. The <em>do_query</em> routine does not[[BR]]
call <em>do_sql_command</em> to execute its SQL command. Instead, it[[BR]]
executes the command by its own internal codes since <em>do_sql_command</em>[[BR]]
can not treat the return values that <em>do_query</em> needs to transfer.[[BR]]</p>

<p>The source is available on the following link: [[BR]]
[https://svn.oscar.openclustergroup.org/trac/oscar/browser/trunk/lib/OSCAR/oda.pm]
—-</p>
<ul>
  <li><a href="DevODA_Database.pm">Database.pm</a></li>
  <li><a href="DevODA_architecture">Architecture</a></li>
  <li><a href="DevODA_maintenance">Maintenance</a> of ODA</li>
</ul>


      </section>
        </div>
    </div>


    <!-- FOOTER  -->
        <div id="footer_wrap" class="outer">
          <footer class="inner">
            <p class="copyright">Oscar maintained by <a href="https://github.com/oscar-cluster">oscar-cluster</a></p>
            <p class="copyright">Oscar package repository and downloads/ are hosted by <a href="http://www.usablesecurity.net/">UsableSecurity</a></p>
            <p>Published with <a href="https://pages.github.com">GitHub Pages</a></p>
          </footer>
        </div>
    </div>
  </body>
</html>
