| 1 | 1 <html> | 
|  | 2 <head> | 
|  | 3 <title>MayaChemTools:Documentation:DBUtil.pm</title> | 
|  | 4 <meta http-equiv="content-type" content="text/html;charset=utf-8"> | 
|  | 5 <link rel="stylesheet" type="text/css" href="../../css/MayaChemTools.css"> | 
|  | 6 </head> | 
|  | 7 <body leftmargin="20" rightmargin="20" topmargin="10" bottommargin="10"> | 
|  | 8 <br/> | 
|  | 9 <center> | 
|  | 10 <a href="http://www.mayachemtools.org" title="MayaChemTools Home"><img src="../../images/MayaChemToolsLogo.gif" border="0" alt="MayaChemTools"></a> | 
|  | 11 </center> | 
|  | 12 <br/> | 
|  | 13 <div class="DocNav"> | 
|  | 14 <table width="100%" border=0 cellpadding=0 cellspacing=2> | 
|  | 15 <tr align="left" valign="top"><td width="33%" align="left"><a href="./ConversionsUtil.html" title="ConversionsUtil.html">Previous</a>  <a href="./index.html" title="Table of Contents">TOC</a>  <a href="./FileIO.html" title="FileIO.html">Next</a></td><td width="34%" align="middle"><strong>DBUtil.pm</strong></td><td width="33%" align="right"><a href="././code/DBUtil.html" title="View source code">Code</a> | <a href="./../pdf/DBUtil.pdf" title="PDF US Letter Size">PDF</a> | <a href="./../pdfgreen/DBUtil.pdf" title="PDF US Letter Size with narrow margins: www.changethemargins.com">PDFGreen</a> | <a href="./../pdfa4/DBUtil.pdf" title="PDF A4 Size">PDFA4</a> | <a href="./../pdfa4green/DBUtil.pdf" title="PDF A4 Size with narrow margins: www.changethemargins.com">PDFA4Green</a></td></tr> | 
|  | 16 </table> | 
|  | 17 </div> | 
|  | 18 <p> | 
|  | 19 </p> | 
|  | 20 <h2>NAME</h2> | 
|  | 21 <p>DBUtil</p> | 
|  | 22 <p> | 
|  | 23 </p> | 
|  | 24 <h2>SYNOPSIS</h2> | 
|  | 25 <p>use DBUtil;</p> | 
|  | 26 <p>use DBUtil qw(:all);</p> | 
|  | 27 <p> | 
|  | 28 </p> | 
|  | 29 <h2>DESCRIPTION</h2> | 
|  | 30 <p><strong>DBUtil</strong> module provides the following functions:</p> | 
|  | 31 <p> <a href="#dbconnect">DBConnect</a>, <a href="#dbdisconnect">DBDisconnect</a>, <a href="#dbfetchschematablenames">DBFetchSchemaTableNames</a>, <a href="#dbsqltotextfile">DBSQLToTextFile</a> | 
|  | 32 , <a href="#dbsetupdescribesql">DBSetupDescribeSQL</a>, <a href="#dbsetupselectsql">DBSetupSelectSQL</a> | 
|  | 33 </p><p>DBUtil package uses Perl DBI for interacting with MySQL Oracle, and PostgreSQL | 
|  | 34 databases.</p> | 
|  | 35 <p> | 
|  | 36 </p> | 
|  | 37 <h2>FUNCTIONS</h2> | 
|  | 38 <dl> | 
|  | 39 <dt><strong><a name="dbconnect" class="item"><strong>DBConnect</strong></a></strong></dt> | 
|  | 40 <dd> | 
|  | 41 <div class="OptionsBox"> | 
|  | 42     $DBHandle = DBConnect($DBDriver, $DBName, $DBHost, $DBUser, $DBPassword);</div> | 
|  | 43 <p>Connects to a database using specified parameters and returns a <strong>DBHandle</strong>.</p> | 
|  | 44 </dd> | 
|  | 45 <dt><strong><a name="dbdisconnect" class="item"><strong>DBDisconnect</strong></a></strong></dt> | 
|  | 46 <dd> | 
|  | 47 <div class="OptionsBox"> | 
|  | 48     DBDisconnect($DBHandle);</div> | 
|  | 49 <p>Disconnects from a database specified by <em>DBHandle</em>.</p> | 
|  | 50 </dd> | 
|  | 51 <dt><strong><a name="dbfetchschematablenames" class="item"><strong>DBFetchSchemaTableNames</strong></a></strong></dt> | 
|  | 52 <dd> | 
|  | 53 <div class="OptionsBox"> | 
|  | 54     @SchemaTableNames = DBFetchSchemaTableNames($DBDriver, $DBHandle, | 
|  | 55                        $SchemaName);</div> | 
|  | 56 <p>Returns an array of all the table names in a database <em>SchemaName</em>.</p> | 
|  | 57 </dd> | 
|  | 58 <dt><strong><a name="dbsetupdescribesql" class="item"><strong>DBSetupDescribeSQL</strong></a></strong></dt> | 
|  | 59 <dd> | 
|  | 60 <div class="OptionsBox"> | 
|  | 61     $DescribeSQL = DBSetupDescribeSQL($DBDriver, $TableName, [$SchemaName]);</div> | 
|  | 62 <p>Sets up and returns a SQL statement to describe a table for MySQ, Oracle or PostgreSQL.</p> | 
|  | 63 </dd> | 
|  | 64 <dt><strong><a name="dbsetupselectsql" class="item"><strong>DBSetupSelectSQL</strong></a></strong></dt> | 
|  | 65 <dd> | 
|  | 66 <div class="OptionsBox"> | 
|  | 67     $SelectSQL = DBSetupSelectSQL($DBDriver, $TableName, $SchemaName);</div> | 
|  | 68 <p>Sets up and returns a SQL statement to retrieve all columns from a table for MySQL, | 
|  | 69 Oracle, or PostgreSQL.</p> | 
|  | 70 </dd> | 
|  | 71 <dt><strong><a name="dbsqltotextfile" class="item"><strong>DBSQLToTextFile</strong></a></strong></dt> | 
|  | 72 <dd> | 
|  | 73 <div class="OptionsBox"> | 
|  | 74     $Status = DBSQLToTextFile($DBHandle, $SQL, \*TEXTFILE, $OutDelim, | 
|  | 75               $OutQuote, [$ExportDataLabels, $ExportLOBs, | 
|  | 76               $ReplaceNullStr]);</div> | 
|  | 77 <p>Executes a <em>SQL</em> statement and export all data into a text file.</p> | 
|  | 78 </dd> | 
|  | 79 </dl> | 
|  | 80 <p> | 
|  | 81 </p> | 
|  | 82 <h2>AUTHOR</h2> | 
|  | 83 <p><a href="mailto:msud@san.rr.com">Manish Sud</a></p> | 
|  | 84 <p> | 
|  | 85 </p> | 
|  | 86 <h2>COPYRIGHT</h2> | 
|  | 87 <p>Copyright (C) 2015 Manish Sud. All rights reserved.</p> | 
|  | 88 <p>This file is part of MayaChemTools.</p> | 
|  | 89 <p>MayaChemTools is free software; you can redistribute it and/or modify it under | 
|  | 90 the terms of the GNU Lesser General Public License as published by the Free | 
|  | 91 Software Foundation; either version 3 of the License, or (at your option) | 
|  | 92 any later version.</p> | 
|  | 93 <p> </p><p> </p><div class="DocNav"> | 
|  | 94 <table width="100%" border=0 cellpadding=0 cellspacing=2> | 
|  | 95 <tr align="left" valign="top"><td width="33%" align="left"><a href="./ConversionsUtil.html" title="ConversionsUtil.html">Previous</a>  <a href="./index.html" title="Table of Contents">TOC</a>  <a href="./FileIO.html" title="FileIO.html">Next</a></td><td width="34%" align="middle"><strong>March 29, 2015</strong></td><td width="33%" align="right"><strong>DBUtil.pm</strong></td></tr> | 
|  | 96 </table> | 
|  | 97 </div> | 
|  | 98 <br /> | 
|  | 99 <center> | 
|  | 100 <img src="../../images/h2o2.png"> | 
|  | 101 </center> | 
|  | 102 </body> | 
|  | 103 </html> |