Net_CDDB
[ class tree: Net_CDDB ] [ index: Net_CDDB ] [ all elements ]

Class: Net_CDDB_Protocol_Mdb2

Source Location: /Net_CDDB-0.3.0/CDDB/Protocol/Mdb2.php

Class Overview

Net_CDDB_Protocol
   |
   --Net_CDDB_Protocol_Mdb2

Connection protocol for querying a database import of FreeDB data


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: Net_CDDB_Protocol

Net_CDDB_Protocol::remote()
Tell whether or not a protocol acts on a remote resource

Class Details

[line 66]
Connection protocol for querying a database import of FreeDB data

You probably don't want to use this protocol unless you have a very specific need for it. This protocol doesn't support a large chunk of the CDDB protocol and chances are your local CDDB data won't be as up-to-date as the FreeDB.org database servers.

To use this protocol to access disc information from an SQL database of FreeDB.org data, you need to first load your SQL database. The CDDB_Importer.php script included with the package can do this for you, or you can download and run a .SQL database dump from http://www.uglysug.com/ After that's all set, use a DSN string like this when you instantiate your {@see Net_CDDB_Client} class:

  1.      $client = new Net_CDDB_Client('mdb2.mysql://user:pass@host/db_name'...);

The DSN string is a standard PEAR MDB2-style DSN string used to connect to a database, except that the string 'mdb2.' is appended to the beginning of the MDB2 DSN string.

  • Todo: Finish implementing all of the CDDB commands
  • Todo: Support more than one protocol level (and the proto command...?)


[ Top ]


Class Variables

$_buffer =

[line 98]

String buffer containing protocol data
  • Access: protected

Type:   string


[ Top ]

$_dsn =

[line 90]

DSN string to the MDB2 database connection
  • Access: protected

Type:   string


[ Top ]

$_mdb2 =

[line 74]

Database MDB2 instance
  • Access: protected

Type:   object


[ Top ]

$_options =

[line 82]

Array of MDB2 options
  • Access: protected

Type:   array


[ Top ]

$_status_buffer =

[line 106]

Integer buffer containing protocol status information
  • Access: protected

Type:   integer


[ Top ]



Method Detail

__construct (Constructor)   [line 126]

Net_CDDB_Protocol_Mdb2 __construct( [string $dsn = 'mysql://root:@localhost:3306/cddb'], array $options)

Constructor (PHP v5.x)
  • Access: public

Parameters:

string   $dsn     A PEAR MDB2 style database connection string
array   $options     

[ Top ]

Net_CDDB_Protocol_Mdb2 (Constructor)   [line 114]

Net_CDDB_Protocol_Mdb2 Net_CDDB_Protocol_Mdb2( [ $dsn = 'mysql://root:@localhost:3306/cddb'], $options)

Constructor (PHP v4.x)

Parameters:

   $dsn     
   $options     

[ Top ]

connect   [line 141]

boolean connect( )

Connect to the database
  • Access: public

[ Top ]

connected   [line 153]

boolean connected( )

Check if we've connected to the database or not
  • Access: public

[ Top ]

disconnect   [line 533]

void disconnect( )

Disconnect from the database
  • Access: public

[ Top ]

recieve   [line 511]

string recieve( )

Read data from the protocol buffer
  • Access: public

[ Top ]

remote   [line 547]

boolean remote( )

Report this class as *not* accessing remote resources for protocol output

Overrides Net_CDDB_Protocol::remote() (Tell whether or not a protocol acts on a remote resource)
[ Top ]

send   [line 174]

void send( string $query)

Send a query to the Net_CDDB_Protocol_Mdb2 object, the query will be parsed and the buffers will be filled with the response

Not all CDDB commands are implemented for this protocol, some don't make sense in the context of a database-based protocol and some just havn't been implemented yet.

This method basically parses and dispatches the query to other protected methods of the class for further processing.


Parameters:

string   $query     

[ Top ]

status   [line 522]

int status( )

Read the status of the last executed command from the protocol buffer
  • Access: public

[ Top ]

_cddbLscat   [line 307]

void _cddbLscat( string $cmd, string $query)

Handle a 'cddb lscat' (Display disc categories) query and fill the buffer with a response
  • Access: protected

Parameters:

string   $cmd     
string   $query     

[ Top ]

_cddbQuery   [line 245]

void _cddbQuery( string $cmd, string $query)

Handle a 'cddb query' (Find possible disc matches by disc id) and fill the buffer with a response
  • Access: protected

Parameters:

string   $cmd     
string   $query     

[ Top ]

_cddbRead   [line 334]

void _cddbRead( string $cmd, string $query)

Handle a 'cddb read ...' (read a complete disc entry) query and fill the buffer with a response
  • Access: protected

Parameters:

string   $cmd     
string   $query     

[ Top ]

_discid   [line 226]

void _discid( string $cmd, string $query)

Handle a CDDB 'discid' (Calculate a Disc ID) query and fill the buffer with a response
  • Access: protected

Parameters:

string   $cmd     
string   $query     

[ Top ]

_motd   [line 422]

void _motd( string $cmd, string $query)

Handle a 'motd' (Message Of The Day) query and fill the buffers with the repsonse
  • Access: protected

Parameters:

string   $cmd     
string   $query     

[ Top ]

_stat   [line 456]

void _stat( string $cmd, string $query)

Handle a cddb 'stat' (get server statistics) and fill the buffers with the response
  • Access: protected

Parameters:

string   $cmd     
string   $query     

[ Top ]

_ver   [line 442]

void _ver( string $cmd, string $query)

Handle a 'ver' (get CDDB server version) command and fill the buffers with a response
  • Access: protected

Parameters:

string   $cmd     
string   $query     

[ Top ]


Documentation generated on Sun, 25 Feb 2007 14:00:18 -0500 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.