/**
  * Method setDBAccess set the database connection
  *
  * @param string $type # the database type
  *
  * @return void
  */
 public function setDBAccess($type = 'normal')
 {
     switch ($type) {
         case 'normal':
             $this->db_obj = LMDBAccess::getInstance();
             break;
         default:
             $this->db_obj = LMDBAccess::getInstance();
             break;
     }
     // end switch($type)
 }
<?php

/**
 * word_feature_matrix_genereate.php
 *
 * PHP version 5
 *
 * @category PHP
 * @package  /p-schedule/
 * @author   Fukuball Lin <*****@*****.**>
 * @license  No Licence
 * @version  Release: <1.0>
 * @link     http://sarasti.cs.nccu.edu.tw
 */
require_once dirname(dirname(__FILE__)) . "/p-config/application-setter.php";
$db_obj = LMDBAccess::getInstance();
$row_song_id = "";
$lyrics_feature = "";
$matirx = "[";
$select_sql = "SELECT song_id,lyrics_term_vector,lyrics_term_vector_readable FROM lyrics_feature WHERE lyrics_term_vector!='' ORDER BY song_id";
$query_result = $db_obj->selectCommand($select_sql);
$count = 0;
foreach ($query_result as $query_result_data) {
    $song_id = $query_result_data['song_id'];
    $row_song_id = $row_song_id . $song_id . ',';
    $matirx = $matirx . '[' . $query_result_data['lyrics_term_vector'] . '],';
    if ($count == 0) {
        $lyrics_feature = $query_result_data['lyrics_term_vector_readable'];
    }
    $count++;
    echo "combine {$song_id} \n";
Esempio n. 3
0
 /**
  * Method init to initial db connection
  *
  * @return void
  */
 public static function init()
 {
     if (!self::$db_obj || !isset(self::$db_obj) || empty(self::$db_obj)) {
         self::$db_obj = new LMDBAccess();
     }
 }