Overview

Namespaces

  • cli_db
    • propel
      • map
      • om
  • cli_import
  • LoggedPDO
  • None
  • PHP
  • webservices
    • cart
    • combisearch
    • details
      • annotations
        • feature
    • graphs
      • barplot
      • genome
    • listing
    • queue

Classes

  • Console_CommandLine_Action_ExtendedHelp
  • LightOpenID
  • Log_firebugJSON
  • WebService

Interfaces

  • CLI_Command

Functions

  • acquire_database
  • cli_error_handler
  • connect_queue_db
  • create_job
  • display_feature
  • display_feature_by_id
  • display_isoform_by_id
  • display_unigene_by_id
  • download
  • execute_command
  • execute_job
  • execute_query_dir
  • get_db_connection
  • get_job_results
  • get_program_databases
  • myErrorHandler
  • pdo_connect
  • report_results_cleanup
  • requestVal
  • smarty_function_call_webservice
  • smarty_function_dbxreflink
  • smarty_function_interprolink
  • smarty_function_publink
  • smarty_modifier_clean_id
  • split_fasta
  • unzip
  • Overview
  • Namespace
  • Function
  • Tree
 1: <?php
 2: 
 3: global $db;
 4: $db = get_db_connection(DB_CONNSTR, DB_USERNAME, DB_PASSWORD);
 5: 
 6: function connect_queue_db() {
 7:     return get_db_connection(QUEUE_DB_CONNSTR, QUEUE_DB_USERNAME, QUEUE_DB_PASSWORD);
 8: }
 9: 
10: function get_db_connection($connstr, $username, $password) {
11:     try {
12:         if (defined('DEBUG') && DEBUG) {
13:             require_once 'loggedPDO/PDO.php';
14:             require_once 'loggedPDO/Log_firebugJSON.php';
15: 
16:             if (PHP_SAPI == 'cli') {
17:                 $logtype = 'console';
18:             } else {
19:                 if (in_array('Content-type: application/json', headers_list())) {
20:                     $logtype = 'console';
21:                 } else {
22:                     $logtype = 'firebugJSON';
23:                 }
24:             }
25:             $logger = Log::factory($logtype, '', 'PDO');
26:             $db = new \LoggedPDO\PDO($connstr, $username, $password, null, $logger);
27:             //$db->log_replace_params = false;
28:         } else {
29:             $db = new PDO($connstr, $username, $password, array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_EMULATE_PREPARES => false));
30:         }
31:         #usually stop execution on DB error
32:         $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
33:         
34:         return $db;
35:     } catch (\PDOException $e) {
36:         print "Error!: " . $e->getMessage() . "<br/>";
37:         die();
38:     }
39: }
40: 
41: ?>
42: 
tbro API documentation generated by ApiGen 2.8.0