source: branches/rsr.v5.1/web/app/data/sql.php @ 7

Last change on this file since 7 was 1, checked in by dj3c1t, 13 years ago

import initial

File size: 827 bytes
Line 
1<?php
2
3  class sql
4  {
5    protected $db;
6
7    public $prefix_code;
8    public $prefix_value;
9
10    function __construct($db, $prefix_code = "", $prefix_value = "")
11    { $this->db = $db;
12      $this->prefix_code = $prefix_code;
13      $this->prefix_value = $prefix_value;
14    }
15
16    function query($sql)
17    { $rst = $this->db->query($this->prefix_code ? str_replace($this->prefix_code, $this->prefix_value, $sql) : $sql);
18      if($rst) return $rst;
19      throw new Exception("  [erreur] sql : erreur dans une requete");
20    }
21
22    function insert_id()
23    { return $this->db->insert_id();
24    }
25
26    function fetch_assoc($rst)
27    { return $this->db->fetch_assoc($rst);
28    }
29
30    function free_result($rst)
31    { return $this->db->free_result($rst);
32    }
33
34    function close()
35    { return $this->db->close();
36    }
37
38  }
39
40?>
Note: See TracBrowser for help on using the repository browser.