Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Sql.php « PluginsFunctions « core - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5cd5ff678489af9e4ddc5fff62f8929575711b0c (plain)
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
51
52
53
54
55
56
<?php
/**
 * Piwik - Open source web analytics
 * 
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
 * @version $Id$
 * 
 * @category Piwik
 * @package PluginsFunctions
 */

/**
 * @package PluginsFunctions
 */
class Piwik_Sql
{
}

function Piwik_Exec( $sqlQuery )
{
	return Zend_Registry::get('db')->exec( $sqlQuery );
}

/**
 * Executes a SQL query on the DB and returns the Zend_Db_Statement object
 * If you want to fetch data from the DB you should use the function Piwik_FetchAll()
 * 
 * See also http://framework.zend.com/manual/en/zend.db.statement.html
 *
 * @param string $sqlQuery
 * @param array Parameters to bind in the query, array( param1 => value1, param2 => value2)
 * @return Zend_Db_Statement
 */
function Piwik_Query( $sqlQuery, $parameters = array())
{
	return Zend_Registry::get('db')->query( $sqlQuery, $parameters);
}

/**
 * Executes the SQL Query and fetches all the rows from the database
 *
 * @param string $sqlQuery
 * @param array Parameters to bind in the query, array( param1 => value1, param2 => value2)
 * @return array (one row in the array per row fetched in the DB)
 */
function Piwik_FetchAll( $sqlQuery, $parameters = array())
{
	return Zend_Registry::get('db')->fetchAll( $sqlQuery, $parameters );
}

function Piwik_FetchOne( $sqlQuery, $parameters = array())
{
	return Zend_Registry::get('db')->fetchOne( $sqlQuery, $parameters );
}