Skip to content

Commit

Permalink
Merge branch 'MDL-67371-master' of git://github.com/rezaies/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Dec 10, 2019
2 parents d10d00a + 5bd8f1d commit c865cce
Show file tree
Hide file tree
Showing 103 changed files with 442 additions and 743 deletions.
File renamed without changes.
103 changes: 103 additions & 0 deletions lib/adodb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
ADOdb Library for PHP5
======================

[![Join chat on Gitter](https://img.shields.io/gitter/room/form-data/form-data.svg)](https://gitter.im/adodb/adodb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Download ADOdb](https://img.shields.io/sourceforge/dm/adodb.svg)](https://sourceforge.net/projects/adodb/files/latest/download)

(c) 2000-2013 John Lim (jlim@natsoft.com)
(c) 2014 Damien Regad, Mark Newnham and the
[ADOdb community](https://github.com/ADOdb/ADOdb/graphs/contributors)

The ADOdb Library is dual-licensed, released under both the
[BSD 3-Clause](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md#bsd-3-clause-license)
and the
[GNU Lesser General Public Licence (LGPL) v2.1](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md#gnu-lesser-general-public-license)
or, at your option, any later version.
This means you can use it in proprietary products;
see [License](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md) for details.

Home page: http://adodb.org/


Introduction
============

PHP's database access functions are not standardized. This creates a
need for a database class library to hide the differences between the
different databases (encapsulate the differences) so we can easily
switch databases.

The library currently supports MySQL, Interbase, Sybase, PostgreSQL, Oracle,
Microsoft SQL server, Foxpro ODBC, Access ODBC, Informix, DB2,
Sybase SQL Anywhere, generic ODBC and Microsoft's ADO.

We hope more people will contribute drivers to support other databases.


Installation
============

Unpack all the files into a directory accessible by your web server.

To test, try modifying some of the tutorial examples.
Make sure you customize the connection settings correctly.

You can debug using:

``` php
<?php
include('adodb/adodb.inc.php');

$db = ADONewConnection($driver); # eg. 'mysql' or 'oci8'
$db->debug = true;
$db->Connect($server, $user, $password, $database);
$rs = $db->Execute('select * from some_small_table');
print "<pre>";
print_r($rs->GetRows());
print "</pre>";
```


Documentation and Examples
==========================

Refer to the [ADOdb website](http://adodb.org/) for library documentation and examples. The documentation can also be [downloaded for offline viewing](https://sourceforge.net/projects/adodb/files/Documentation/).

- [Main documentation](http://adodb.org/dokuwiki/doku.php?id=v5:userguide:userguide_index): Query, update and insert records using a portable API.
- [Data dictionary](http://adodb.org/dokuwiki/doku.php?id=v5:dictionary:dictionary_index) describes how to create database tables and indexes in a portable manner.
- [Database performance monitoring](http://adodb.org/dokuwiki/doku.php?id=v5:performance:performance_index) allows you to perform health checks, tune and monitor your database.
- [Database-backed sessions](http://adodb.org/dokuwiki/doku.php?id=v5:session:session_index).

There is also a [tutorial](http://adodb.org/dokuwiki/doku.php?id=v5:userguide:mysql_tutorial) that contrasts ADOdb code with PHP native MySQL code.


Files
=====

- `adodb.inc.php` is the library's main file. You only need to include this file.
- `adodb-*.inc.php` are the database specific driver code.
- `adodb-session.php` is the PHP4 session handling code.
- `test.php` contains a list of test commands to exercise the class library.
- `testdatabases.inc.php` contains the list of databases to apply the tests on.
- `Benchmark.php` is a simple benchmark to test the throughput of a SELECT
statement for databases described in testdatabases.inc.php. The benchmark
tables are created in test.php.


Support
=======

To discuss with the ADOdb development team and users, connect to our
[Gitter chatroom](https://gitter.im/adodb/adodb) using your Github credentials.

Please report bugs, issues and feature requests on Github:

https://github.com/ADOdb/ADOdb/issues

You may also find legacy issues in

- the old [ADOdb forums](http://phplens.com/lens/lensforum/topics.php?id=4) on phplens.com
- the [SourceForge tickets section](http://sourceforge.net/p/adodb/_list/tickets)

However, please note that they are not actively monitored and should
only be used as reference.
33 changes: 17 additions & 16 deletions lib/adodb/adodb-active-record.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
@version v5.20.14 06-Jan-2019
@version v5.20.15 24-Nov-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Latest version is available at http://adodb.org/
Expand Down Expand Up @@ -120,7 +120,7 @@ public function __set($name, $value)
// php5 constructor
function __construct($table = false, $pkeyarr=false, $db=false)
{
global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS;
global $_ADODB_ACTIVE_DBS;

if ($db == false && is_object($pkeyarr)) {
$db = $pkeyarr;
Expand Down Expand Up @@ -374,7 +374,7 @@ function LoadRelations($name, $whereOrderBy='', $offset=-1,$limit=-1)
// update metadata
function UpdateActiveTable($pkeys=false,$forceUpdate=false)
{
global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS , $ADODB_CACHE_DIR, $ADODB_ACTIVE_CACHESECS;
global $_ADODB_ACTIVE_DBS , $ADODB_CACHE_DIR, $ADODB_ACTIVE_CACHESECS;
global $ADODB_ACTIVE_DEFVALS,$ADODB_FETCH_MODE;

$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
Expand Down Expand Up @@ -463,8 +463,8 @@ function UpdateActiveTable($pkeys=false,$forceUpdate=false)
$attr = array();
$keys = array();

switch($ADODB_ASSOC_CASE) {
case 0:
switch (ADODB_ASSOC_CASE) {
case ADODB_ASSOC_CASE_LOWER:
foreach($cols as $name => $fldobj) {
$name = strtolower($name);
if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
Expand All @@ -480,7 +480,7 @@ function UpdateActiveTable($pkeys=false,$forceUpdate=false)
}
break;

case 1:
case ADODB_ASSOC_CASE_UPPER:
foreach($cols as $name => $fldobj) {
$name = strtoupper($name);

Expand Down Expand Up @@ -927,8 +927,6 @@ function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array())
// returns 0 on error, 1 on update, 2 on insert
function Replace()
{
global $ADODB_ASSOC_CASE;

$db = $this->DB();
if (!$db) {
return false;
Expand Down Expand Up @@ -968,14 +966,17 @@ function Replace()
$pkey = array($pkey);
}

if ($ADODB_ASSOC_CASE == 0) {
foreach($pkey as $k => $v)
$pkey[$k] = strtolower($v);
}
elseif ($ADODB_ASSOC_CASE == 1) {
foreach($pkey as $k => $v) {
$pkey[$k] = strtoupper($v);
}
switch (ADODB_ASSOC_CASE) {
case ADODB_ASSOC_CASE_LOWER:
foreach ($pkey as $k => $v) {
$pkey[$k] = strtolower($v);
}
break;
case ADODB_ASSOC_CASE_UPPER:
foreach ($pkey as $k => $v) {
$pkey[$k] = strtoupper($v);
}
break;
}

$ok = $db->Replace($this->_table,$arr,$pkey);
Expand Down
16 changes: 7 additions & 9 deletions lib/adodb/adodb-active-recordx.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
@version v5.20.14 06-Jan-2019
@version v5.20.15 24-Nov-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Latest version is available at http://adodb.org/
Expand Down Expand Up @@ -137,7 +137,7 @@ public function __set($name, $value)
// if $options['new'] is true, we forget all relations
function __construct($table = false, $pkeyarr=false, $db=false, $options=array())
{
global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS;
global $_ADODB_ACTIVE_DBS;

if ($db == false && is_object($pkeyarr)) {
$db = $pkeyarr;
Expand Down Expand Up @@ -410,7 +410,7 @@ function LoadRelations($name, $whereOrderBy, $offset=-1, $limit=-1)
// update metadata
function UpdateActiveTable($pkeys=false,$forceUpdate=false)
{
global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS , $ADODB_CACHE_DIR, $ADODB_ACTIVE_CACHESECS;
global $_ADODB_ACTIVE_DBS , $ADODB_CACHE_DIR, $ADODB_ACTIVE_CACHESECS;
global $ADODB_ACTIVE_DEFVALS, $ADODB_FETCH_MODE;

$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
Expand Down Expand Up @@ -491,8 +491,8 @@ function UpdateActiveTable($pkeys=false,$forceUpdate=false)
$attr = array();
$keys = array();

switch($ADODB_ASSOC_CASE) {
case 0:
switch (ADODB_ASSOC_CASE) {
case ADODB_ASSOC_CASE_LOWER:
foreach($cols as $name => $fldobj) {
$name = strtolower($name);
if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
Expand All @@ -508,7 +508,7 @@ function UpdateActiveTable($pkeys=false,$forceUpdate=false)
}
break;

case 1:
case ADODB_ASSOC_CASE_UPPER:
foreach($cols as $name => $fldobj) {
$name = strtoupper($name);

Expand Down Expand Up @@ -1060,8 +1060,6 @@ function packageFind($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array()
// returns 0 on error, 1 on update, 2 on insert
function Replace()
{
global $ADODB_ASSOC_CASE;

$db = $this->DB();
if (!$db) {
return false;
Expand Down Expand Up @@ -1097,7 +1095,7 @@ function Replace()
}


switch ($ADODB_ASSOC_CASE == 0) {
switch (ADODB_ASSOC_CASE) {
case ADODB_ASSOC_CASE_LOWER:
foreach($pkey as $k => $v) {
$pkey[$k] = strtolower($v);
Expand Down
2 changes: 1 addition & 1 deletion lib/adodb/adodb-csvlib.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/*
@version v5.20.14 06-Jan-2019
@version v5.20.15 24-Nov-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
Expand Down
2 changes: 1 addition & 1 deletion lib/adodb/adodb-datadict.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
@version v5.20.14 06-Jan-2019
@version v5.20.15 24-Nov-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
Expand Down
2 changes: 1 addition & 1 deletion lib/adodb/adodb-error.inc.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @version v5.20.14 06-Jan-2019
* @version v5.20.15 24-Nov-2019
* @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
* @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
* Released under both BSD license and Lesser GPL library license.
Expand Down
2 changes: 1 addition & 1 deletion lib/adodb/adodb-errorhandler.inc.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @version v5.20.14 06-Jan-2019
* @version v5.20.15 24-Nov-2019
* @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
* @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
* Released under both BSD license and Lesser GPL library license.
Expand Down
2 changes: 1 addition & 1 deletion lib/adodb/adodb-errorpear.inc.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @version v5.20.14 06-Jan-2019
* @version v5.20.15 24-Nov-2019
* @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
* @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
* Released under both BSD license and Lesser GPL library license.
Expand Down
2 changes: 1 addition & 1 deletion lib/adodb/adodb-exceptions.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* @version v5.20.14 06-Jan-2019
* @version v5.20.15 24-Nov-2019
* @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
* @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
* Released under both BSD license and Lesser GPL library license.
Expand Down
2 changes: 1 addition & 1 deletion lib/adodb/adodb-iterator.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
@version v5.20.14 06-Jan-2019
@version v5.20.15 24-Nov-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
Expand Down
Loading

0 comments on commit c865cce

Please sign in to comment.