| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- class Core_Database {
- var $_conn;
- var $_errors;
- function __construct($host, $user, $password, $database, $names = '', $params = array()) {
- $this->_conn = null;
- $this->_errors = array();
- $this->_database_name = $database;
- if(!empty($params['zasob_id'])) $this->_zasob_id=$params['zasob_id'];
- }
- public function getDatabaseName() {
- return $this->_database_name;
- }
- /**
- * Wykonuje podane zapytanie i zwraca wynik mysql_query().
- */
- function query($query, $msg = 'Query ERROR.') {
- return null;
- }
- function fetch($res) {
- return null;
- }
- function _($str) {
- return $str;
- }
- function error() {
- return "#unknown";
- }
- function _set_error($err) {
- $this->_errors[] = $err;
- }
- function get_errors() {
- return $this->_errors;
- }
- function has_errors() {
- return !empty($this->_errors);
- }
- function get_last_error() {
- return end($this->_errors);
- }
- function get_by_id($table, $id) {
- return null;
- }
-
- /* @2015-04-01 - funkcja nie skonczona - gdzies jest piotrowa, ktora generuje schematy
-
- function STRUCTURE_GENERATE_to_xsd($TABLES_IMPORT,$CONNREMOTE,$schema_folder) {
- //
- // $TABLES_IMPORT - is array of tables used by $CONNREMOTE->STRUCTURE_GENERATE($TABLES_STRUCTURE,null,$TABLES_STRUCTURE_DATA)
- // $CONNREMOTE - is $conn of database from which we will detect its name
- //
-
- DEBUG_S(-3,'TABLES_IMPORT',$TABLES_IMPORT,__FILE__,__FUNCTION__,__LINE__);
-
- foreach($TABLES_IMPORT as $TABLES_IMPORT_NAME=>$TABLE_IMPORT_ARR) {
- if($TABLE_IMPORT_ARR['Table_type']=='BASE TABLE') {
-
-
- $xml = new SimpleXMLElement('<xml/>');
-
- $schema = $xml->addChild('xs:schema',null,'http://www.w3.org/2001/XMLSchema');
-
- $schema->addAttribute('xmlns:xmlns:'.$CONNREMOTE->getDatabaseName(), 'http://biuro.biall-net.pl/xmlschema_procesy5/default_db/'.$CONNREMOTE->getDatabaseName());
- $complexType = $schema->addChild('complexType');
- $complexType->addAttribute('name',$TABLES_IMPORT_NAME);
- $element = $complexType->addChild('element');
-
- DEBUG_S(-3,'xml output ',$xml->asXML(),__FILE__,__FUNCTION__,__LINE__);
-
- $fp = fopen($schema_folder.'/'.$TABLES_IMPORT_NAME.'.xsd', 'w');
- fwrite($fp, $xml->asXML());
- fclose($fp);
-
- }
- unset($xml);
- }
-
- }
- */
-
- }
|