pluf2

pluf2 Commit Details


Date:2011-11-05 18:34:18 (13 years 1 month ago)
Author:Thomas Keller
Branch:master
Commit:4121ca463fa4f6f8da878aba9a9288b52743087d
Parents: e32248025529ba03e8ff4b8dbe8badafbe12a12a
Message:Add basic introspection for MySQL as well.

Changes:

File differences

src/Pluf/DB/Introspect/MySQL.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of Plume Framework, a simple PHP Application Framework.
# Copyright (C) 2001-2007 Loic d'Anterroches and contributors.
#
# Plume Framework is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Plume Framework is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
class Pluf_DB_Introspect_MySQL
{
protected $db = null;
public function __construct($db)
{
$this->db = $db;
}
/**
* Get the list of tables in the current database.
*
* @param object DB connection.
* @return array List of tables.
*/
function listTables()
{
$sql = 'SHOW TABLES';
$res = $this->db->select($sql);
$tables = array();
foreach ($res as $t) {
$tables[] = array_pop($t);
}
return $tables;
}
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05444s using 13 queries.