mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
update to CodeIgniter 3.1.0
This commit is contained in:
parent
70e43b0fe8
commit
3572dda318
@ -1,4 +1,17 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Display Debug backtrace
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If set to TRUE, a backtrace will be displayed along with php errors. If
|
||||
| error_reporting is disabled, the backtrace will not display, regardless
|
||||
| of this setting
|
||||
|
|
||||
*/
|
||||
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -13,10 +26,10 @@
|
||||
| always be used to set the mode correctly.
|
||||
|
|
||||
*/
|
||||
define('FILE_READ_MODE', 0644);
|
||||
define('FILE_WRITE_MODE', 0666);
|
||||
define('DIR_READ_MODE', 0755);
|
||||
define('DIR_WRITE_MODE', 0777);
|
||||
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
|
||||
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
|
||||
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
|
||||
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -26,16 +39,47 @@ define('DIR_WRITE_MODE', 0777);
|
||||
| These modes are used when working with fopen()/popen()
|
||||
|
|
||||
*/
|
||||
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
|
||||
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
|
||||
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
|
||||
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
|
||||
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
|
||||
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
||||
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
||||
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||
|
||||
define('FOPEN_READ', 'rb');
|
||||
define('FOPEN_READ_WRITE', 'r+b');
|
||||
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
|
||||
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
|
||||
define('FOPEN_WRITE_CREATE', 'ab');
|
||||
define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
||||
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
||||
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||
|
||||
|
||||
/* End of file constants.php */
|
||||
/* Location: ./application/config/constants.php */
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Exit Status Codes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Used to indicate the conditions under which the script is exit()ing.
|
||||
| While there is no universal standard for error codes, there are some
|
||||
| broad conventions. Three such conventions are mentioned below, for
|
||||
| those who wish to make use of them. The CodeIgniter defaults were
|
||||
| chosen for the least overlap with these conventions, while still
|
||||
| leaving room for others to be defined in future versions and user
|
||||
| applications.
|
||||
|
|
||||
| The three main conventions used for determining exit status codes
|
||||
| are as follows:
|
||||
|
|
||||
| Standard C/C++ Library (stdlibc):
|
||||
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
|
||||
| (This link also contains other GNU-specific conventions)
|
||||
| BSD sysexits.h:
|
||||
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
|
||||
| Bash scripting:
|
||||
| http://tldp.org/LDP/abs/html/exitcodes.html
|
||||
|
|
||||
*/
|
||||
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
|
||||
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
|
||||
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
|
||||
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
|
||||
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
||||
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
|
||||
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
|
||||
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
|
||||
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
||||
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||
|
133
htdocs/index.php
Normal file → Executable file
133
htdocs/index.php
Normal file → Executable file
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -91,25 +91,26 @@ switch (ENVIRONMENT)
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* SYSTEM FOLDER NAME
|
||||
* SYSTEM DIRECTORY NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "system" folder.
|
||||
* Include the path if the folder is not in the same directory
|
||||
* as this file.
|
||||
* This variable must contain the name of your "system" directory.
|
||||
* Set the path if it is not in the same directory as this file.
|
||||
*/
|
||||
$system_path = 'system';
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* APPLICATION FOLDER NAME
|
||||
* APPLICATION DIRECTORY NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* If you want this front controller to use a different "application"
|
||||
* folder than the default one you can set its name here. The folder
|
||||
* can also be renamed or relocated anywhere on your server. If
|
||||
* you do, use a full server path. For more info please see the user guide:
|
||||
* http://codeigniter.com/user_guide/general/managing_apps.html
|
||||
* directory than the default one you can set its name here. The directory
|
||||
* can also be renamed or relocated anywhere on your server. If you do,
|
||||
* use an absolute (full) server path.
|
||||
* For more info please see the user guide:
|
||||
*
|
||||
* https://codeigniter.com/user_guide/general/managing_apps.html
|
||||
*
|
||||
* NO TRAILING SLASH!
|
||||
*/
|
||||
@ -117,14 +118,14 @@ switch (ENVIRONMENT)
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* VIEW FOLDER NAME
|
||||
* VIEW DIRECTORY NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* If you want to move the view folder out of the application
|
||||
* folder set the path to the folder here. The folder can be renamed
|
||||
* If you want to move the view directory out of the application
|
||||
* directory, set the path to it here. The directory can be renamed
|
||||
* and relocated anywhere on your server. If blank, it will default
|
||||
* to the standard location inside your application folder. If you
|
||||
* do move this, use the full server path to this folder.
|
||||
* to the standard location inside your application directory.
|
||||
* If you do move this, use an absolute (full) server path.
|
||||
*
|
||||
* NO TRAILING SLASH!
|
||||
*/
|
||||
@ -150,8 +151,8 @@ switch (ENVIRONMENT)
|
||||
*
|
||||
* Un-comment the $routing array below to use this feature
|
||||
*/
|
||||
// The directory name, relative to the "controllers" folder. Leave blank
|
||||
// if your controller is not in a sub-folder within the "controllers" folder
|
||||
// The directory name, relative to the "controllers" directory. Leave blank
|
||||
// if your controller is not in a sub-directory within the "controllers" one
|
||||
// $routing['directory'] = '';
|
||||
|
||||
// The controller class file name. Example: mycontroller
|
||||
@ -197,12 +198,16 @@ switch (ENVIRONMENT)
|
||||
|
||||
if (($_temp = realpath($system_path)) !== FALSE)
|
||||
{
|
||||
$system_path = $_temp.'/';
|
||||
$system_path = $_temp.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensure there's a trailing slash
|
||||
$system_path = rtrim($system_path, '/').'/';
|
||||
$system_path = strtr(
|
||||
rtrim($system_path, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
).DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
// Is the system path correct?
|
||||
@ -221,66 +226,84 @@ switch (ENVIRONMENT)
|
||||
// The name of THIS file
|
||||
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
|
||||
|
||||
// Path to the system folder
|
||||
define('BASEPATH', str_replace('\\', '/', $system_path));
|
||||
// Path to the system directory
|
||||
define('BASEPATH', $system_path);
|
||||
|
||||
// Path to the front controller (this file)
|
||||
define('FCPATH', dirname(__FILE__).'/');
|
||||
// Path to the front controller (this file) directory
|
||||
define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
|
||||
|
||||
// Name of the "system folder"
|
||||
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
|
||||
// Name of the "system" directory
|
||||
define('SYSDIR', basename(BASEPATH));
|
||||
|
||||
// The path to the "application" folder
|
||||
// The path to the "application" directory
|
||||
if (is_dir($application_folder))
|
||||
{
|
||||
if (($_temp = realpath($application_folder)) !== FALSE)
|
||||
{
|
||||
$application_folder = $_temp;
|
||||
}
|
||||
|
||||
define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
|
||||
else
|
||||
{
|
||||
$application_folder = strtr(
|
||||
rtrim($application_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
}
|
||||
elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
$application_folder = BASEPATH.strtr(
|
||||
trim($application_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
define('APPPATH', BASEPATH.$application_folder.DIRECTORY_SEPARATOR);
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
// The path to the "views" folder
|
||||
if ( ! is_dir($view_folder))
|
||||
define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
|
||||
|
||||
// The path to the "views" directory
|
||||
if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
|
||||
$view_folder = APPPATH.'views';
|
||||
}
|
||||
elseif (is_dir($view_folder))
|
||||
{
|
||||
if (($_temp = realpath($view_folder)) !== FALSE)
|
||||
{
|
||||
$view_folder = APPPATH.$view_folder;
|
||||
}
|
||||
elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
||||
exit(3); // EXIT_CONFIG
|
||||
$view_folder = $_temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
$view_folder = APPPATH.'views';
|
||||
$view_folder = strtr(
|
||||
rtrim($view_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (($_temp = realpath($view_folder)) !== FALSE)
|
||||
elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
$view_folder = $_temp.DIRECTORY_SEPARATOR;
|
||||
$view_folder = APPPATH.strtr(
|
||||
trim($view_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$view_folder = rtrim($view_folder, '/\\').DIRECTORY_SEPARATOR;
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
define('VIEWPATH', $view_folder);
|
||||
define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -47,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/benchmark.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/benchmark.html
|
||||
*/
|
||||
class CI_Benchmark {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage CodeIgniter
|
||||
* @category Front-controller
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -55,7 +55,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @var string
|
||||
*
|
||||
*/
|
||||
define('CI_VERSION', '3.0.1');
|
||||
define('CI_VERSION', '3.1.0');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
@ -359,7 +359,7 @@ if ( ! is_php('5.4'))
|
||||
*
|
||||
* Returns current CI instance object
|
||||
*
|
||||
* @return object
|
||||
* @return CI_Controller
|
||||
*/
|
||||
function &get_instance()
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage CodeIgniter
|
||||
* @category Common Functions
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@ -355,7 +355,7 @@ if ( ! function_exists('is_https'))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
|
||||
elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -677,7 +677,7 @@ if ( ! function_exists('_shutdown_handler'))
|
||||
* of CodeIgniter.php. The main reason we use this is to simulate
|
||||
* a complete custom exception handler.
|
||||
*
|
||||
* E_STRICT is purposivly neglected because such events may have
|
||||
* E_STRICT is purposively neglected because such events may have
|
||||
* been caught. Duplication or none? None is preferred for now.
|
||||
*
|
||||
* @link http://insomanic.me.uk/post/229851073/php-trick-catching-fatal-errors-e-error-with-a
|
||||
@ -716,8 +716,8 @@ if ( ! function_exists('remove_invisible_characters'))
|
||||
// carriage return (dec 13) and horizontal tab (dec 09)
|
||||
if ($url_encoded)
|
||||
{
|
||||
$non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15
|
||||
$non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31
|
||||
$non_displayables[] = '/%0[0-8bcef]/i'; // url encoded 00-08, 11, 12, 14, 15
|
||||
$non_displayables[] = '/%1[0-9a-f]/i'; // url encoded 16-31
|
||||
}
|
||||
|
||||
$non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127
|
||||
@ -752,7 +752,12 @@ if ( ! function_exists('html_escape'))
|
||||
|
||||
if (is_array($var))
|
||||
{
|
||||
return array_map('html_escape', $var, array_fill(0, count($var), $double_encode));
|
||||
foreach (array_keys($var) as $key)
|
||||
{
|
||||
$var[$key] = html_escape($var[$key], $double_encode);
|
||||
}
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
return htmlspecialchars($var, ENT_QUOTES, config_item('charset'), $double_encode);
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/config.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/config.html
|
||||
*/
|
||||
class CI_Config {
|
||||
|
||||
@ -88,11 +88,18 @@ class CI_Config {
|
||||
// Set the base_url automatically if none was provided
|
||||
if (empty($this->config['base_url']))
|
||||
{
|
||||
// The regular expression is only a basic validation for a valid "Host" header.
|
||||
// It's not exhaustive, only checks for valid characters.
|
||||
if (isset($_SERVER['HTTP_HOST']) && preg_match('/^((\[[0-9a-f:]+\])|(\d{1,3}(\.\d{1,3}){3})|[a-z0-9\-\.]+)(:\d+)?$/i', $_SERVER['HTTP_HOST']))
|
||||
if (isset($_SERVER['SERVER_ADDR']))
|
||||
{
|
||||
$base_url = (is_https() ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST']
|
||||
if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE)
|
||||
{
|
||||
$server_addr = '['.$_SERVER['SERVER_ADDR'].']';
|
||||
}
|
||||
else
|
||||
{
|
||||
$server_addr = $_SERVER['SERVER_ADDR'];
|
||||
}
|
||||
|
||||
$base_url = (is_https() ? 'https' : 'http').'://'.$server_addr
|
||||
.substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
|
||||
}
|
||||
else
|
||||
@ -238,7 +245,15 @@ class CI_Config {
|
||||
|
||||
if (isset($protocol))
|
||||
{
|
||||
$base_url = $protocol.substr($base_url, strpos($base_url, '://'));
|
||||
// For protocol-relative links
|
||||
if ($protocol === '')
|
||||
{
|
||||
$base_url = substr($base_url, strpos($base_url, '//'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$base_url = $protocol.substr($base_url, strpos($base_url, '://'));
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($uri))
|
||||
@ -293,10 +308,18 @@ class CI_Config {
|
||||
|
||||
if (isset($protocol))
|
||||
{
|
||||
$base_url = $protocol.substr($base_url, strpos($base_url, '://'));
|
||||
// For protocol-relative links
|
||||
if ($protocol === '')
|
||||
{
|
||||
$base_url = substr($base_url, strpos($base_url, '//'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$base_url = $protocol.substr($base_url, strpos($base_url, '://'));
|
||||
}
|
||||
}
|
||||
|
||||
return $base_url.ltrim($this->_uri_string($uri), '/');
|
||||
return $base_url.$this->_uri_string($uri);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
@ -314,11 +337,8 @@ class CI_Config {
|
||||
{
|
||||
if ($this->item('enable_query_strings') === FALSE)
|
||||
{
|
||||
if (is_array($uri))
|
||||
{
|
||||
$uri = implode('/', $uri);
|
||||
}
|
||||
return trim($uri, '/');
|
||||
is_array($uri) && $uri = implode('/', $uri);
|
||||
return ltrim($uri, '/');
|
||||
}
|
||||
elseif (is_array($uri))
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -47,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/general/controllers.html
|
||||
* @link https://codeigniter.com/user_guide/general/controllers.html
|
||||
*/
|
||||
class CI_Controller {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Exceptions
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/exceptions.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/exceptions.html
|
||||
*/
|
||||
class CI_Exceptions {
|
||||
|
||||
@ -187,7 +187,7 @@ class CI_Exceptions {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function show_exception(Exception $exception)
|
||||
public function show_exception($exception)
|
||||
{
|
||||
$templates_path = config_item('error_views_path');
|
||||
if (empty($templates_path))
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/general/hooks.html
|
||||
* @link https://codeigniter.com/user_guide/general/hooks.html
|
||||
*/
|
||||
class CI_Hooks {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Input
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/input.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/input.html
|
||||
*/
|
||||
class CI_Input {
|
||||
|
||||
@ -153,6 +153,12 @@ class CI_Input {
|
||||
// Sanitize global arrays
|
||||
$this->_sanitize_globals();
|
||||
|
||||
// CSRF Protection check
|
||||
if ($this->_enable_csrf === TRUE && ! is_cli())
|
||||
{
|
||||
$this->security->csrf_verify();
|
||||
}
|
||||
|
||||
log_message('info', 'Input Class Initialized');
|
||||
}
|
||||
|
||||
@ -513,9 +519,9 @@ class CI_Input {
|
||||
if ($separator === ':')
|
||||
{
|
||||
$netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr));
|
||||
for ($i = 0; $i < 8; $i++)
|
||||
for ($j = 0; $j < 8; $j++)
|
||||
{
|
||||
$netaddr[$i] = intval($netaddr[$i], 16);
|
||||
$netaddr[$i] = intval($netaddr[$j], 16);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -600,7 +606,7 @@ class CI_Input {
|
||||
{
|
||||
$_GET = array();
|
||||
}
|
||||
elseif (is_array($_GET) && count($_GET) > 0)
|
||||
elseif (is_array($_GET))
|
||||
{
|
||||
foreach ($_GET as $key => $val)
|
||||
{
|
||||
@ -609,7 +615,7 @@ class CI_Input {
|
||||
}
|
||||
|
||||
// Clean $_POST Data
|
||||
if (is_array($_POST) && count($_POST) > 0)
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach ($_POST as $key => $val)
|
||||
{
|
||||
@ -618,7 +624,7 @@ class CI_Input {
|
||||
}
|
||||
|
||||
// Clean $_COOKIE Data
|
||||
if (is_array($_COOKIE) && count($_COOKIE) > 0)
|
||||
if (is_array($_COOKIE))
|
||||
{
|
||||
// Also get rid of specially treated cookies that might be set by a server
|
||||
// or silly application, that are of no use to a CI application anyway
|
||||
@ -647,12 +653,6 @@ class CI_Input {
|
||||
// Sanitize PHP_SELF
|
||||
$_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']);
|
||||
|
||||
// CSRF Protection check
|
||||
if ($this->_enable_csrf === TRUE && ! is_cli())
|
||||
{
|
||||
$this->security->csrf_verify();
|
||||
}
|
||||
|
||||
log_message('debug', 'Global POST, GET and COOKIE data sanitized');
|
||||
}
|
||||
|
||||
@ -760,30 +760,32 @@ class CI_Input {
|
||||
// If header is already defined, return it immediately
|
||||
if ( ! empty($this->headers))
|
||||
{
|
||||
return $this->headers;
|
||||
return $this->_fetch_from_array($this->headers, NULL, $xss_clean);
|
||||
}
|
||||
|
||||
// In Apache, you can simply call apache_request_headers()
|
||||
if (function_exists('apache_request_headers'))
|
||||
{
|
||||
return $this->headers = apache_request_headers();
|
||||
$this->headers = apache_request_headers();
|
||||
}
|
||||
|
||||
$this->headers['Content-Type'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : @getenv('CONTENT_TYPE');
|
||||
|
||||
foreach ($_SERVER as $key => $val)
|
||||
else
|
||||
{
|
||||
if (sscanf($key, 'HTTP_%s', $header) === 1)
|
||||
{
|
||||
// take SOME_HEADER and turn it into Some-Header
|
||||
$header = str_replace('_', ' ', strtolower($header));
|
||||
$header = str_replace(' ', '-', ucwords($header));
|
||||
isset($_SERVER['CONTENT_TYPE']) && $this->headers['Content-Type'] = $_SERVER['CONTENT_TYPE'];
|
||||
|
||||
$this->headers[$header] = $this->_fetch_from_array($_SERVER, $key, $xss_clean);
|
||||
foreach ($_SERVER as $key => $val)
|
||||
{
|
||||
if (sscanf($key, 'HTTP_%s', $header) === 1)
|
||||
{
|
||||
// take SOME_HEADER and turn it into Some-Header
|
||||
$header = str_replace('_', ' ', strtolower($header));
|
||||
$header = str_replace(' ', '-', ucwords($header));
|
||||
|
||||
$this->headers[$header] = $_SERVER[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->headers;
|
||||
return $this->_fetch_from_array($this->headers, NULL, $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -803,7 +805,7 @@ class CI_Input {
|
||||
|
||||
if ( ! isset($headers))
|
||||
{
|
||||
empty($this->headers) OR $this->request_headers();
|
||||
empty($this->headers) && $this->request_headers();
|
||||
foreach ($this->headers as $key => $value)
|
||||
{
|
||||
$headers[strtolower($key)] = $value;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Language
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/language.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/language.html
|
||||
*/
|
||||
class CI_Lang {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Loader
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/loader.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/loader.html
|
||||
*/
|
||||
class CI_Loader {
|
||||
|
||||
@ -285,13 +285,43 @@ class CI_Loader {
|
||||
$this->database($db_conn, FALSE, TRUE);
|
||||
}
|
||||
|
||||
// Note: All of the code under this condition used to be just:
|
||||
//
|
||||
// load_class('Model', 'core');
|
||||
//
|
||||
// However, load_class() instantiates classes
|
||||
// to cache them for later use and that prevents
|
||||
// MY_Model from being an abstract class and is
|
||||
// sub-optimal otherwise anyway.
|
||||
if ( ! class_exists('CI_Model', FALSE))
|
||||
{
|
||||
load_class('Model', 'core');
|
||||
$app_path = APPPATH.'core'.DIRECTORY_SEPARATOR;
|
||||
if (file_exists($app_path.'Model.php'))
|
||||
{
|
||||
require_once($app_path.'Model.php');
|
||||
if ( ! class_exists('CI_Model', FALSE))
|
||||
{
|
||||
throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model");
|
||||
}
|
||||
}
|
||||
elseif ( ! class_exists('CI_Model', FALSE))
|
||||
{
|
||||
require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php');
|
||||
}
|
||||
|
||||
$class = config_item('subclass_prefix').'Model';
|
||||
if (file_exists($app_path.$class.'.php'))
|
||||
{
|
||||
require_once($app_path.$class.'.php');
|
||||
if ( ! class_exists($class, FALSE))
|
||||
{
|
||||
throw new RuntimeException($app_path.$class.".php exists, but doesn't declare class ".$class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$model = ucfirst(strtolower($model));
|
||||
if ( ! class_exists($model))
|
||||
$model = ucfirst($model);
|
||||
if ( ! class_exists($model, FALSE))
|
||||
{
|
||||
foreach ($this->_ci_model_paths as $mod_path)
|
||||
{
|
||||
@ -688,9 +718,16 @@ class CI_Loader {
|
||||
{
|
||||
if (is_array($library))
|
||||
{
|
||||
foreach ($library as $driver)
|
||||
foreach ($library as $key => $value)
|
||||
{
|
||||
$this->driver($driver);
|
||||
if (is_int($key))
|
||||
{
|
||||
$this->driver($value, $params);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->driver($key, $params, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -899,6 +936,14 @@ class CI_Loader {
|
||||
*/
|
||||
if (is_array($_ci_vars))
|
||||
{
|
||||
foreach (array_keys($_ci_vars) as $key)
|
||||
{
|
||||
if (strncmp($key, '_ci_', 4) === 0)
|
||||
{
|
||||
unset($_ci_vars[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
|
||||
}
|
||||
extract($this->_ci_cached_vars);
|
||||
@ -1061,7 +1106,7 @@ class CI_Loader {
|
||||
* @used-by CI_Loader::_ci_load_library()
|
||||
* @uses CI_Loader::_ci_init_library()
|
||||
*
|
||||
* @param string $library Library name to load
|
||||
* @param string $library_name Library name to load
|
||||
* @param string $file_path Path to the library filename, relative to libraries/
|
||||
* @param mixed $params Optional parameters to pass to the class constructor
|
||||
* @param string $object_name Optional object name to assign to
|
||||
@ -1304,10 +1349,7 @@ class CI_Loader {
|
||||
// Autoload drivers
|
||||
if (isset($autoload['drivers']))
|
||||
{
|
||||
foreach ($autoload['drivers'] as $item)
|
||||
{
|
||||
$this->driver($item);
|
||||
}
|
||||
$this->driver($autoload['drivers']);
|
||||
}
|
||||
|
||||
// Load libraries
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Logging
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/general/errors.html
|
||||
* @link https://codeigniter.com/user_guide/general/errors.html
|
||||
*/
|
||||
class CI_Log {
|
||||
|
||||
@ -154,8 +154,8 @@ class CI_Log {
|
||||
*
|
||||
* Generally this function will be called using the global log_message() function
|
||||
*
|
||||
* @param string the error level: 'error', 'debug' or 'info'
|
||||
* @param string the error message
|
||||
* @param string $level The error level: 'error', 'debug' or 'info'
|
||||
* @param string $msg The error message
|
||||
* @return bool
|
||||
*/
|
||||
public function write_log($level, $msg)
|
||||
@ -191,6 +191,8 @@ class CI_Log {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
flock($fp, LOCK_EX);
|
||||
|
||||
// Instantiating DateTime with microseconds appended to initial date is needed for proper support of this format
|
||||
if (strpos($this->_date_fmt, 'u') !== FALSE)
|
||||
{
|
||||
@ -204,9 +206,7 @@ class CI_Log {
|
||||
$date = date($this->_date_fmt);
|
||||
}
|
||||
|
||||
$message .= $level.' - '.$date.' --> '.$msg."\n";
|
||||
|
||||
flock($fp, LOCK_EX);
|
||||
$message .= $this->_format_line($level, $date, $msg);
|
||||
|
||||
for ($written = 0, $length = strlen($message); $written < $length; $written += $result)
|
||||
{
|
||||
@ -227,4 +227,21 @@ class CI_Log {
|
||||
return is_int($result);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Format the log line.
|
||||
*
|
||||
* This is for extensibility of log formatting
|
||||
* If you want to change the log format, extend the CI_Log class and override this method
|
||||
*
|
||||
* @param string $level The error level
|
||||
* @param string $date Formatted date string
|
||||
* @param string $message The log message
|
||||
* @return string Formatted log line with a new line character '\n' at the end
|
||||
*/
|
||||
protected function _format_line($level, $date, $message)
|
||||
{
|
||||
return $level.' - '.$date.' --> '.$message."\n";
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/config.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/config.html
|
||||
*/
|
||||
class CI_Model {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Output
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/output.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/output.html
|
||||
*/
|
||||
class CI_Output {
|
||||
|
||||
@ -285,7 +285,7 @@ class CI_Output {
|
||||
/**
|
||||
* Get Header
|
||||
*
|
||||
* @param string $header_name
|
||||
* @param string $header
|
||||
* @return string
|
||||
*/
|
||||
public function get_header($header)
|
||||
@ -377,7 +377,7 @@ class CI_Output {
|
||||
/**
|
||||
* Set Cache
|
||||
*
|
||||
* @param int $time Cache expiration time in seconds
|
||||
* @param int $time Cache expiration time in minutes
|
||||
* @return CI_Output
|
||||
*/
|
||||
public function cache($time)
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/general/routing.html
|
||||
* @link https://codeigniter.com/user_guide/general/routing.html
|
||||
*/
|
||||
class CI_Router {
|
||||
|
||||
@ -118,6 +118,7 @@ class CI_Router {
|
||||
*
|
||||
* Runs the route mapping function.
|
||||
*
|
||||
* @param array $routing
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($routing = NULL)
|
||||
@ -153,6 +154,28 @@ class CI_Router {
|
||||
*/
|
||||
protected function _set_routing()
|
||||
{
|
||||
// Load the routes.php file. It would be great if we could
|
||||
// skip this for enable_query_strings = TRUE, but then
|
||||
// default_controller would be empty ...
|
||||
if (file_exists(APPPATH.'config/routes.php'))
|
||||
{
|
||||
include(APPPATH.'config/routes.php');
|
||||
}
|
||||
|
||||
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
|
||||
{
|
||||
include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
|
||||
}
|
||||
|
||||
// Validate & get reserved routes
|
||||
if (isset($route) && is_array($route))
|
||||
{
|
||||
isset($route['default_controller']) && $this->default_controller = $route['default_controller'];
|
||||
isset($route['translate_uri_dashes']) && $this->translate_uri_dashes = $route['translate_uri_dashes'];
|
||||
unset($route['default_controller'], $route['translate_uri_dashes']);
|
||||
$this->routes = $route;
|
||||
}
|
||||
|
||||
// Are query strings enabled in the config file? Normally CI doesn't utilize query strings
|
||||
// since URI segments are more search-engine friendly, but they can optionally be used.
|
||||
// If this feature is enabled, we will gather the directory/class/method a little differently
|
||||
@ -199,26 +222,6 @@ class CI_Router {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the routes.php file.
|
||||
if (file_exists(APPPATH.'config/routes.php'))
|
||||
{
|
||||
include(APPPATH.'config/routes.php');
|
||||
}
|
||||
|
||||
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
|
||||
{
|
||||
include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
|
||||
}
|
||||
|
||||
// Validate & get reserved routes
|
||||
if (isset($route) && is_array($route))
|
||||
{
|
||||
isset($route['default_controller']) && $this->default_controller = $route['default_controller'];
|
||||
isset($route['translate_uri_dashes']) && $this->translate_uri_dashes = $route['translate_uri_dashes'];
|
||||
unset($route['default_controller'], $route['translate_uri_dashes']);
|
||||
$this->routes = $route;
|
||||
}
|
||||
|
||||
// Is there anything to parse?
|
||||
if ($this->uri->uri_string !== '')
|
||||
{
|
||||
@ -372,26 +375,6 @@ class CI_Router {
|
||||
// Get HTTP verb
|
||||
$http_verb = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'cli';
|
||||
|
||||
// Is there a literal match? If so we're done
|
||||
if (isset($this->routes[$uri]))
|
||||
{
|
||||
// Is it an HTTP verb-based route?
|
||||
if (is_array($this->routes[$uri]))
|
||||
{
|
||||
$route = array_change_key_case($this->routes[$uri], CASE_LOWER);
|
||||
if (isset($route[$http_verb]))
|
||||
{
|
||||
$this->_set_request(explode('/', $route[$http_verb]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_set_request(explode('/', $this->routes[$uri]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Loop through the route array looking for wildcards
|
||||
foreach ($this->routes as $key => $val)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Security
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/security.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/security.html
|
||||
*/
|
||||
class CI_Security {
|
||||
|
||||
@ -436,7 +436,7 @@ class CI_Security {
|
||||
$words = array(
|
||||
'javascript', 'expression', 'vbscript', 'jscript', 'wscript',
|
||||
'vbs', 'script', 'base64', 'applet', 'alert', 'document',
|
||||
'write', 'cookie', 'window', 'confirm', 'prompt'
|
||||
'write', 'cookie', 'window', 'confirm', 'prompt', 'eval'
|
||||
);
|
||||
|
||||
foreach ($words as $word)
|
||||
@ -480,12 +480,8 @@ class CI_Security {
|
||||
}
|
||||
}
|
||||
while ($original !== $str);
|
||||
|
||||
unset($original);
|
||||
|
||||
// Remove evil attributes such as style, onclick and xmlns
|
||||
$str = $this->_remove_evil_attributes($str, $is_image);
|
||||
|
||||
/*
|
||||
* Sanitize naughty HTML elements
|
||||
*
|
||||
@ -495,8 +491,29 @@ class CI_Security {
|
||||
* So this: <blink>
|
||||
* Becomes: <blink>
|
||||
*/
|
||||
$naughty = 'alert|prompt|confirm|applet|audio|basefont|base|behavior|bgsound|blink|body|embed|expression|form|frameset|frame|head|html|ilayer|iframe|input|button|select|isindex|layer|link|meta|keygen|object|plaintext|style|script|textarea|title|math|video|svg|xml|xss';
|
||||
$str = preg_replace_callback('#<(/*\s*)('.$naughty.')([^><]*)([><]*)#is', array($this, '_sanitize_naughty_html'), $str);
|
||||
$pattern = '#'
|
||||
.'<((?<slash>/*\s*)(?<tagName>[a-z0-9]+)(?=[^a-z0-9]|$)' // tag start and name, followed by a non-tag character
|
||||
.'[^\s\042\047a-z0-9>/=]*' // a valid attribute character immediately after the tag would count as a separator
|
||||
// optional attributes
|
||||
.'(?<attributes>(?:[\s\042\047/=]*' // non-attribute characters, excluding > (tag close) for obvious reasons
|
||||
.'[^\s\042\047>/=]+' // attribute characters
|
||||
// optional attribute-value
|
||||
.'(?:\s*=' // attribute-value separator
|
||||
.'(?:[^\s\042\047=><`]+|\s*\042[^\042]*\042|\s*\047[^\047]*\047|\s*(?U:[^\s\042\047=><`]*))' // single, double or non-quoted value
|
||||
.')?' // end optional attribute-value group
|
||||
.')*)' // end optional attributes group
|
||||
.'[^>]*)(?<closeTag>\>)?#isS';
|
||||
|
||||
// Note: It would be nice to optimize this for speed, BUT
|
||||
// only matching the naughty elements here results in
|
||||
// false positives and in turn - vulnerabilities!
|
||||
do
|
||||
{
|
||||
$old_str = $str;
|
||||
$str = preg_replace_callback($pattern, array($this, '_sanitize_naughty_html'), $str);
|
||||
}
|
||||
while ($old_str !== $str);
|
||||
unset($old_str);
|
||||
|
||||
/*
|
||||
* Sanitize naughty scripting elements
|
||||
@ -510,9 +527,11 @@ class CI_Security {
|
||||
* For example: eval('some code')
|
||||
* Becomes: eval('some code')
|
||||
*/
|
||||
$str = preg_replace('#(alert|prompt|confirm|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si',
|
||||
'\\1\\2(\\3)',
|
||||
$str);
|
||||
$str = preg_replace(
|
||||
'#(alert|prompt|confirm|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si',
|
||||
'\\1\\2(\\3)',
|
||||
$str
|
||||
);
|
||||
|
||||
// Final clean up
|
||||
// This adds a bit of extra precaution in case
|
||||
@ -574,6 +593,22 @@ class CI_Security {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (function_exists('random_bytes'))
|
||||
{
|
||||
try
|
||||
{
|
||||
// The cast is required to avoid TypeError
|
||||
return random_bytes((int) $length);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
// If random_bytes() can't do the job, we can't either ...
|
||||
// There's no point in using fallbacks.
|
||||
log_message('error', $e->getMessage());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Unfortunately, none of the following PRNGs is guaranteed to exist ...
|
||||
if (defined('MCRYPT_DEV_URANDOM') && ($output = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)) !== FALSE)
|
||||
{
|
||||
@ -727,7 +762,14 @@ class CI_Security {
|
||||
*/
|
||||
public function strip_image_tags($str)
|
||||
{
|
||||
return preg_replace(array('#<img[\s/]+.*?src\s*=\s*["\'](.+?)["\'].*?\>#', '#<img[\s/]+.*?src\s*=\s*(.+?).*?\>#'), '\\1', $str);
|
||||
return preg_replace(
|
||||
array(
|
||||
'#<img[\s/]+.*?src\s*=\s*(["\'])([^\\1]+?)\\1.*?\>#i',
|
||||
'#<img[\s/]+.*?src\s*=\s*?(([^\s"\'=<>`]+)).*?\>#i'
|
||||
),
|
||||
'\\2',
|
||||
$str
|
||||
);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
@ -749,58 +791,6 @@ class CI_Security {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Remove Evil HTML Attributes (like event handlers and style)
|
||||
*
|
||||
* It removes the evil attribute and either:
|
||||
*
|
||||
* - Everything up until a space. For example, everything between the pipes:
|
||||
*
|
||||
* <code>
|
||||
* <a |style=document.write('hello');alert('world');| class=link>
|
||||
* </code>
|
||||
*
|
||||
* - Everything inside the quotes. For example, everything between the pipes:
|
||||
*
|
||||
* <code>
|
||||
* <a |style="document.write('hello'); alert('world');"| class="link">
|
||||
* </code>
|
||||
*
|
||||
* @param string $str The string to check
|
||||
* @param bool $is_image Whether the input is an image
|
||||
* @return string The string with the evil attributes removed
|
||||
*/
|
||||
protected function _remove_evil_attributes($str, $is_image)
|
||||
{
|
||||
$evil_attributes = array('on\w*', 'style', 'xmlns', 'formaction', 'form', 'xlink:href', 'FSCommand', 'seekSegmentTime');
|
||||
|
||||
if ($is_image === TRUE)
|
||||
{
|
||||
/*
|
||||
* Adobe Photoshop puts XML metadata into JFIF images,
|
||||
* including namespacing, so we have to allow this for images.
|
||||
*/
|
||||
unset($evil_attributes[array_search('xmlns', $evil_attributes)]);
|
||||
}
|
||||
|
||||
do {
|
||||
$count = $temp_count = 0;
|
||||
|
||||
// replace occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes)
|
||||
$str = preg_replace('/(<[^>]+)(?<!\w)('.implode('|', $evil_attributes).')\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is', '$1[removed]', $str, -1, $temp_count);
|
||||
$count += $temp_count;
|
||||
|
||||
// find occurrences of illegal attribute strings without quotes
|
||||
$str = preg_replace('/(<[^>]+)(?<!\w)('.implode('|', $evil_attributes).')\s*=\s*([^\s>]*)/is', '$1[removed]', $str, -1, $temp_count);
|
||||
$count += $temp_count;
|
||||
}
|
||||
while ($count);
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sanitize Naughty HTML
|
||||
*
|
||||
@ -812,9 +802,82 @@ class CI_Security {
|
||||
*/
|
||||
protected function _sanitize_naughty_html($matches)
|
||||
{
|
||||
return '<'.$matches[1].$matches[2].$matches[3] // encode opening brace
|
||||
// encode captured opening or closing brace to prevent recursive vectors:
|
||||
.str_replace(array('>', '<'), array('>', '<'), $matches[4]);
|
||||
static $naughty_tags = array(
|
||||
'alert', 'prompt', 'confirm', 'applet', 'audio', 'basefont', 'base', 'behavior', 'bgsound',
|
||||
'blink', 'body', 'embed', 'expression', 'form', 'frameset', 'frame', 'head', 'html', 'ilayer',
|
||||
'iframe', 'input', 'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object',
|
||||
'plaintext', 'style', 'script', 'textarea', 'title', 'math', 'video', 'svg', 'xml', 'xss'
|
||||
);
|
||||
|
||||
static $evil_attributes = array(
|
||||
'on\w+', 'style', 'xmlns', 'formaction', 'form', 'xlink:href', 'FSCommand', 'seekSegmentTime'
|
||||
);
|
||||
|
||||
// First, escape unclosed tags
|
||||
if (empty($matches['closeTag']))
|
||||
{
|
||||
return '<'.$matches[1];
|
||||
}
|
||||
// Is the element that we caught naughty? If so, escape it
|
||||
elseif (in_array(strtolower($matches['tagName']), $naughty_tags, TRUE))
|
||||
{
|
||||
return '<'.$matches[1].'>';
|
||||
}
|
||||
// For other tags, see if their attributes are "evil" and strip those
|
||||
elseif (isset($matches['attributes']))
|
||||
{
|
||||
// We'll store the already fitlered attributes here
|
||||
$attributes = array();
|
||||
|
||||
// Attribute-catching pattern
|
||||
$attributes_pattern = '#'
|
||||
.'(?<name>[^\s\042\047>/=]+)' // attribute characters
|
||||
// optional attribute-value
|
||||
.'(?:\s*=(?<value>[^\s\042\047=><`]+|\s*\042[^\042]*\042|\s*\047[^\047]*\047|\s*(?U:[^\s\042\047=><`]*)))' // attribute-value separator
|
||||
.'#i';
|
||||
|
||||
// Blacklist pattern for evil attribute names
|
||||
$is_evil_pattern = '#^('.implode('|', $evil_attributes).')$#i';
|
||||
|
||||
// Each iteration filters a single attribute
|
||||
do
|
||||
{
|
||||
// Strip any non-alpha characters that may preceed an attribute.
|
||||
// Browsers often parse these incorrectly and that has been a
|
||||
// of numerous XSS issues we've had.
|
||||
$matches['attributes'] = preg_replace('#^[^a-z]+#i', '', $matches['attributes']);
|
||||
|
||||
if ( ! preg_match($attributes_pattern, $matches['attributes'], $attribute, PREG_OFFSET_CAPTURE))
|
||||
{
|
||||
// No (valid) attribute found? Discard everything else inside the tag
|
||||
break;
|
||||
}
|
||||
|
||||
if (
|
||||
// Is it indeed an "evil" attribute?
|
||||
preg_match($is_evil_pattern, $attribute['name'][0])
|
||||
// Or does it have an equals sign, but no value and not quoted? Strip that too!
|
||||
OR (trim($attribute['value'][0]) === '')
|
||||
)
|
||||
{
|
||||
$attributes[] = 'xss=removed';
|
||||
}
|
||||
else
|
||||
{
|
||||
$attributes[] = $attribute[0][0];
|
||||
}
|
||||
|
||||
$matches['attributes'] = substr($matches['attributes'], $attribute[0][1] + strlen($attribute[0][0]));
|
||||
}
|
||||
while ($matches['attributes'] !== '');
|
||||
|
||||
$attributes = empty($attributes)
|
||||
? ''
|
||||
: ' '.implode(' ', $attributes);
|
||||
return '<'.$matches['slash'].$matches['tagName'].$attributes.'>';
|
||||
}
|
||||
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -834,12 +897,15 @@ class CI_Security {
|
||||
*/
|
||||
protected function _js_link_removal($match)
|
||||
{
|
||||
return str_replace($match[1],
|
||||
preg_replace('#href=.*?(?:(?:alert|prompt|confirm)(?:\(|&\#40;)|javascript:|livescript:|mocha:|charset=|window\.|document\.|\.cookie|<script|<xss|data\s*:)#si',
|
||||
'',
|
||||
$this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]))
|
||||
),
|
||||
$match[0]);
|
||||
return str_replace(
|
||||
$match[1],
|
||||
preg_replace(
|
||||
'#href=.*?(?:(?:alert|prompt|confirm)(?:\(|&\#40;)|javascript:|livescript:|mocha:|charset=|window\.|document\.|\.cookie|<script|<xss|data\s*:)#si',
|
||||
'',
|
||||
$this->_filter_attributes($match[1])
|
||||
),
|
||||
$match[0]
|
||||
);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -859,12 +925,15 @@ class CI_Security {
|
||||
*/
|
||||
protected function _js_img_removal($match)
|
||||
{
|
||||
return str_replace($match[1],
|
||||
preg_replace('#src=.*?(?:(?:alert|prompt|confirm)(?:\(|&\#40;)|javascript:|livescript:|mocha:|charset=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si',
|
||||
'',
|
||||
$this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]))
|
||||
),
|
||||
$match[0]);
|
||||
return str_replace(
|
||||
$match[1],
|
||||
preg_replace(
|
||||
'#src=.*?(?:(?:alert|prompt|confirm|eval)(?:\(|&\#40;)|javascript:|livescript:|mocha:|charset=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si',
|
||||
'',
|
||||
$this->_filter_attributes($match[1])
|
||||
),
|
||||
$match[0]
|
||||
);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category URI
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/uri.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/uri.html
|
||||
*/
|
||||
class CI_URI {
|
||||
|
||||
@ -294,7 +294,7 @@ class CI_URI {
|
||||
*
|
||||
* Do some final cleaning of the URI and return it, currently only used in self::_parse_request_uri()
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $uri
|
||||
* @return string
|
||||
*/
|
||||
protected function _remove_relative_directory($uri)
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category UTF-8
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/utf8.html
|
||||
* @link https://codeigniter.com/user_guide/libraries/utf8.html
|
||||
*/
|
||||
class CI_Utf8 {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link http://codeigniter.com/user_guide/
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
* @link http://php.net/hash
|
||||
*/
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link http://codeigniter.com/user_guide/
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
* @link http://php.net/mbstring
|
||||
*/
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link http://codeigniter.com/user_guide/
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
* @link http://php.net/password
|
||||
*/
|
||||
|
||||
@ -116,14 +116,22 @@ if ( ! function_exists('password_hash'))
|
||||
}
|
||||
elseif ( ! isset($options['salt']))
|
||||
{
|
||||
if (defined('MCRYPT_DEV_URANDOM'))
|
||||
if (function_exists('random_bytes'))
|
||||
{
|
||||
try
|
||||
{
|
||||
$options['salt'] = random_bytes(16);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
log_message('error', 'compat/password: Error while trying to use random_bytes(): '.$e->getMessage());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
elseif (defined('MCRYPT_DEV_URANDOM'))
|
||||
{
|
||||
$options['salt'] = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);
|
||||
}
|
||||
elseif (function_exists('openssl_random_pseudo_bytes'))
|
||||
{
|
||||
$options['salt'] = openssl_random_pseudo_bytes(16);
|
||||
}
|
||||
elseif (DIRECTORY_SEPARATOR === '/' && (is_readable($dev = '/dev/arandom') OR is_readable($dev = '/dev/urandom')))
|
||||
{
|
||||
if (($fp = fopen($dev, 'rb')) === FALSE)
|
||||
@ -148,6 +156,16 @@ if ( ! function_exists('password_hash'))
|
||||
|
||||
fclose($fp);
|
||||
}
|
||||
elseif (function_exists('openssl_random_pseudo_bytes'))
|
||||
{
|
||||
$is_secure = NULL;
|
||||
$options['salt'] = openssl_random_pseudo_bytes(16, $is_secure);
|
||||
if ($is_secure !== TRUE)
|
||||
{
|
||||
log_message('error', 'compat/password: openssl_random_pseudo_bytes() set the $cryto_strong flag to FALSE');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('error', 'compat/password: No CSPRNG available.');
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link http://codeigniter.com/user_guide/
|
||||
* @link https://codeigniter.com/user_guide/
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@ -62,7 +62,7 @@ if ( ! function_exists('array_column'))
|
||||
* array_column()
|
||||
*
|
||||
* @link http://php.net/array_column
|
||||
* @param string $array
|
||||
* @param array $array
|
||||
* @param mixed $column_key
|
||||
* @param mixed $index_key
|
||||
* @return array
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*
|
||||
* @param string|string[] $params
|
||||
* @param bool $query_builder_override
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_Cache {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
abstract class CI_DB_driver {
|
||||
|
||||
@ -504,6 +504,18 @@ abstract class CI_DB_driver {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Last error
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function error()
|
||||
{
|
||||
return array('code' => NULL, 'message' => NULL);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set client character set
|
||||
*
|
||||
@ -664,13 +676,15 @@ abstract class CI_DB_driver {
|
||||
// if transactions are enabled. If we don't call this here
|
||||
// the error message will trigger an exit, causing the
|
||||
// transactions to remain in limbo.
|
||||
if ($this->_trans_depth !== 0)
|
||||
while ($this->_trans_depth !== 0)
|
||||
{
|
||||
do
|
||||
$trans_depth = $this->_trans_depth;
|
||||
$this->trans_complete();
|
||||
if ($trans_depth === $this->_trans_depth)
|
||||
{
|
||||
$this->trans_complete();
|
||||
log_message('error', 'Database: Failure during an automated transaction commit/rollback!');
|
||||
break;
|
||||
}
|
||||
while ($this->_trans_depth !== 0);
|
||||
}
|
||||
|
||||
// Display errors
|
||||
@ -768,7 +782,10 @@ abstract class CI_DB_driver {
|
||||
{
|
||||
if ( ! $this->conn_id)
|
||||
{
|
||||
$this->initialize();
|
||||
if ( ! $this->initialize())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_execute($sql);
|
||||
@ -791,10 +808,13 @@ abstract class CI_DB_driver {
|
||||
|
||||
/**
|
||||
* Enable/disable Transaction Strict Mode
|
||||
*
|
||||
* When strict mode is enabled, if you are running multiple groups of
|
||||
* transactions, if one group fails all groups will be rolled back.
|
||||
* If strict mode is disabled, each group is treated autonomously, meaning
|
||||
* a failure of one group will not affect any others
|
||||
* transactions, if one group fails all subsequent groups will be
|
||||
* rolled back.
|
||||
*
|
||||
* If strict mode is disabled, each group is treated autonomously,
|
||||
* meaning a failure of one group will not affect any others
|
||||
*
|
||||
* @param bool $mode = TRUE
|
||||
* @return void
|
||||
@ -810,24 +830,16 @@ abstract class CI_DB_driver {
|
||||
* Start Transaction
|
||||
*
|
||||
* @param bool $test_mode = FALSE
|
||||
* @return void
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_start($test_mode = FALSE)
|
||||
{
|
||||
if ( ! $this->trans_enabled)
|
||||
{
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ($this->_trans_depth > 0)
|
||||
{
|
||||
$this->_trans_depth += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
$this->trans_begin($test_mode);
|
||||
$this->_trans_depth += 1;
|
||||
return $this->trans_begin($test_mode);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -844,25 +856,14 @@ abstract class CI_DB_driver {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ($this->_trans_depth > 1)
|
||||
{
|
||||
$this->_trans_depth -= 1;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_trans_depth = 0;
|
||||
}
|
||||
|
||||
// The query() function will set this flag to FALSE in the event that a query failed
|
||||
if ($this->_trans_status === FALSE OR $this->_trans_failure === TRUE)
|
||||
{
|
||||
$this->trans_rollback();
|
||||
|
||||
// If we are NOT running in strict mode, we will reset
|
||||
// the _trans_status flag so that subsequent groups of transactions
|
||||
// will be permitted.
|
||||
// the _trans_status flag so that subsequent groups of
|
||||
// transactions will be permitted.
|
||||
if ($this->trans_strict === FALSE)
|
||||
{
|
||||
$this->_trans_status = TRUE;
|
||||
@ -872,8 +873,7 @@ abstract class CI_DB_driver {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->trans_commit();
|
||||
return TRUE;
|
||||
return $this->trans_commit();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -890,6 +890,87 @@ abstract class CI_DB_driver {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
{
|
||||
if ( ! $this->trans_enabled)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
elseif ($this->_trans_depth > 0)
|
||||
{
|
||||
$this->_trans_depth++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
if ($this->_trans_begin())
|
||||
{
|
||||
$this->_trans_depth++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Commit Transaction
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
{
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth === 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
elseif ($this->_trans_depth > 1 OR $this->_trans_commit())
|
||||
{
|
||||
$this->_trans_depth--;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Rollback Transaction
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
{
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth === 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
elseif ($this->_trans_depth > 1 OR $this->_trans_rollback())
|
||||
{
|
||||
$this->_trans_depth--;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Compile Bindings
|
||||
*
|
||||
@ -1480,18 +1561,18 @@ abstract class CI_DB_driver {
|
||||
? '\s+'.preg_quote(trim(sprintf($this->_like_escape_str, $this->_like_escape_chr)), '/')
|
||||
: '';
|
||||
$_operators = array(
|
||||
'\s*(?:<|>|!)?=\s*', // =, <=, >=, !=
|
||||
'\s*<>?\s*', // <, <>
|
||||
'\s*>\s*', // >
|
||||
'\s+IS NULL', // IS NULL
|
||||
'\s+IS NOT NULL', // IS NOT NULL
|
||||
'\s+EXISTS\s*\([^\)]+\)', // EXISTS(sql)
|
||||
'\s+NOT EXISTS\s*\([^\)]+\)', // NOT EXISTS(sql)
|
||||
'\s+BETWEEN\s+\S+\s+AND\s+\S+', // BETWEEN value AND value
|
||||
'\s+IN\s*\([^\)]+\)', // IN(list)
|
||||
'\s+NOT IN\s*\([^\)]+\)', // NOT IN (list)
|
||||
'\s+LIKE\s+\S+'.$_les, // LIKE 'expr'[ ESCAPE '%s']
|
||||
'\s+NOT LIKE\s+\S+'.$_les // NOT LIKE 'expr'[ ESCAPE '%s']
|
||||
'\s*(?:<|>|!)?=\s*', // =, <=, >=, !=
|
||||
'\s*<>?\s*', // <, <>
|
||||
'\s*>\s*', // >
|
||||
'\s+IS NULL', // IS NULL
|
||||
'\s+IS NOT NULL', // IS NOT NULL
|
||||
'\s+EXISTS\s*\(.*\)', // EXISTS(sql)
|
||||
'\s+NOT EXISTS\s*\(.*\)', // NOT EXISTS(sql)
|
||||
'\s+BETWEEN\s+', // BETWEEN value AND value
|
||||
'\s+IN\s*\(.*\)', // IN(list)
|
||||
'\s+NOT IN\s*\(.*\)', // NOT IN (list)
|
||||
'\s+LIKE\s+\S.*('.$_les.')?', // LIKE 'expr'[ ESCAPE '%s']
|
||||
'\s+NOT LIKE\s+\S.*('.$_les.')?' // NOT LIKE 'expr'[ ESCAPE '%s']
|
||||
);
|
||||
|
||||
}
|
||||
@ -1712,7 +1793,7 @@ abstract class CI_DB_driver {
|
||||
* the table prefix onto it. Some logic is necessary in order to deal with
|
||||
* column names that include the path. Consider a query like this:
|
||||
*
|
||||
* SELECT * FROM hostname.database.table.column AS c FROM hostname.database.table
|
||||
* SELECT hostname.database.table.column AS c FROM hostname.database.table
|
||||
*
|
||||
* Or a query with aliasing:
|
||||
*
|
||||
@ -1760,7 +1841,7 @@ abstract class CI_DB_driver {
|
||||
}
|
||||
|
||||
// Convert tabs or multiple spaces into single spaces
|
||||
$item = preg_replace('/\s+/', ' ', $item);
|
||||
$item = preg_replace('/\s+/', ' ', trim($item));
|
||||
|
||||
// If the item has an alias declaration we remove it and set it aside.
|
||||
// Note: strripos() is used in order to support spaces in table names
|
||||
@ -1788,12 +1869,15 @@ abstract class CI_DB_driver {
|
||||
// with an alias. While we're at it, we will escape the components
|
||||
if (strpos($item, '.') !== FALSE)
|
||||
{
|
||||
$parts = explode('.', $item);
|
||||
$parts = explode('.', $item);
|
||||
|
||||
// Does the first segment of the exploded item match
|
||||
// one of the aliases previously identified? If so,
|
||||
// we have nothing more to do other than escape the item
|
||||
if (in_array($parts[0], $this->qb_aliased_tables))
|
||||
//
|
||||
// NOTE: The ! empty() condition prevents this method
|
||||
// from breaking when QB isn't enabled.
|
||||
if ( ! empty($this->qb_aliased_tables) && in_array($parts[0], $this->qb_aliased_tables))
|
||||
{
|
||||
if ($protect_identifiers === TRUE)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
abstract class CI_DB_forge {
|
||||
|
||||
@ -239,7 +239,13 @@ abstract class CI_DB_forge {
|
||||
*/
|
||||
public function add_key($key, $primary = FALSE)
|
||||
{
|
||||
if (is_array($key))
|
||||
// DO NOT change this! This condition is only applicable
|
||||
// for PRIMARY keys because you can only have one such,
|
||||
// and therefore all fields you add to it will be included
|
||||
// in the same, composite PRIMARY KEY.
|
||||
//
|
||||
// It's not the same for regular indexes.
|
||||
if ($primary === TRUE && is_array($key))
|
||||
{
|
||||
foreach ($key as $one)
|
||||
{
|
||||
@ -774,10 +780,6 @@ abstract class CI_DB_forge {
|
||||
case 'ENUM':
|
||||
case 'SET':
|
||||
$attributes['CONSTRAINT'] = $this->db->escape($attributes['CONSTRAINT']);
|
||||
$field['length'] = is_array($attributes['CONSTRAINT'])
|
||||
? "('".implode("','", $attributes['CONSTRAINT'])."')"
|
||||
: '('.$attributes['CONSTRAINT'].')';
|
||||
break;
|
||||
default:
|
||||
$field['length'] = is_array($attributes['CONSTRAINT'])
|
||||
? '('.implode(',', $attributes['CONSTRAINT']).')'
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
|
||||
abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
@ -531,40 +531,47 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
|
||||
is_bool($escape) OR $escape = $this->_protect_identifiers;
|
||||
|
||||
// Split multiple conditions
|
||||
if ($escape === TRUE && preg_match_all('/\sAND\s|\sOR\s/i', $cond, $m, PREG_OFFSET_CAPTURE))
|
||||
{
|
||||
$newcond = '';
|
||||
$m[0][] = array('', strlen($cond));
|
||||
|
||||
for ($i = 0, $c = count($m[0]), $s = 0;
|
||||
$i < $c;
|
||||
$s = $m[0][$i][1] + strlen($m[0][$i][0]), $i++)
|
||||
{
|
||||
$temp = substr($cond, $s, ($m[0][$i][1] - $s));
|
||||
|
||||
$newcond .= preg_match("/([\[\]\w\.'-]+)(\s*[^\"\[`'\w]+\s*)(.+)/i", $temp, $match)
|
||||
? $this->protect_identifiers($match[1]).$match[2].$this->protect_identifiers($match[3])
|
||||
: $temp;
|
||||
|
||||
$newcond .= $m[0][$i][0];
|
||||
}
|
||||
|
||||
$cond = ' ON '.$newcond;
|
||||
}
|
||||
// Split apart the condition and protect the identifiers
|
||||
elseif ($escape === TRUE && preg_match("/([\[\]\w\.'-]+)(\s*[^\"\[`'\w]+\s*)(.+)/i", $cond, $match))
|
||||
{
|
||||
$cond = ' ON '.$this->protect_identifiers($match[1]).$match[2].$this->protect_identifiers($match[3]);
|
||||
}
|
||||
elseif ( ! $this->_has_operator($cond))
|
||||
if ( ! $this->_has_operator($cond))
|
||||
{
|
||||
$cond = ' USING ('.($escape ? $this->escape_identifiers($cond) : $cond).')';
|
||||
}
|
||||
else
|
||||
elseif ($escape === FALSE)
|
||||
{
|
||||
$cond = ' ON '.$cond;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Split multiple conditions
|
||||
if (preg_match_all('/\sAND\s|\sOR\s/i', $cond, $joints, PREG_OFFSET_CAPTURE))
|
||||
{
|
||||
$conditions = array();
|
||||
$joints = $joints[0];
|
||||
array_unshift($joints, array('', 0));
|
||||
|
||||
for ($i = count($joints) - 1, $pos = strlen($cond); $i >= 0; $i--)
|
||||
{
|
||||
$joints[$i][1] += strlen($joints[$i][0]); // offset
|
||||
$conditions[$i] = substr($cond, $joints[$i][1], $pos - $joints[$i][1]);
|
||||
$pos = $joints[$i][1] - strlen($joints[$i][0]);
|
||||
$joints[$i] = $joints[$i][0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$conditions = array($cond);
|
||||
$joints = array('');
|
||||
}
|
||||
|
||||
$cond = ' ON ';
|
||||
for ($i = 0, $c = count($conditions); $i < $c; $i++)
|
||||
{
|
||||
$operator = $this->_get_operator($conditions[$i]);
|
||||
$cond .= $joints[$i];
|
||||
$cond .= preg_match("/(\(*)?([\[\]\w\.'-]+)".preg_quote($operator)."(.*)/i", $conditions[$i], $match)
|
||||
? $match[1].$this->protect_identifiers($match[2]).$operator.$this->protect_identifiers($match[3])
|
||||
: $conditions[$i];
|
||||
}
|
||||
}
|
||||
|
||||
// Do we want to escape the table name?
|
||||
if ($escape === TRUE)
|
||||
@ -1138,7 +1145,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param bool $escape
|
||||
* @return object
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function having($key, $value = NULL, $escape = NULL)
|
||||
{
|
||||
@ -1155,7 +1162,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param bool $escape
|
||||
* @return object
|
||||
* @return CI_DB_query_builder
|
||||
*/
|
||||
public function or_having($key, $value = NULL, $escape = NULL)
|
||||
{
|
||||
@ -1339,7 +1346,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* @param string the table
|
||||
* @param string the limit clause
|
||||
* @param string the offset clause
|
||||
* @return object
|
||||
* @return CI_DB_result
|
||||
*/
|
||||
public function get($table = '', $limit = NULL, $offset = NULL)
|
||||
{
|
||||
@ -1379,7 +1386,16 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
$this->from($table);
|
||||
}
|
||||
|
||||
$result = ($this->qb_distinct === TRUE)
|
||||
// ORDER BY usage is often problematic here (most notably
|
||||
// on Microsoft SQL Server) and ultimately unnecessary
|
||||
// for selecting COUNT(*) ...
|
||||
if ( ! empty($this->qb_orderby))
|
||||
{
|
||||
$orderby = $this->qb_orderby;
|
||||
$this->qb_orderby = NULL;
|
||||
}
|
||||
|
||||
$result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby))
|
||||
? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results")
|
||||
: $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows')));
|
||||
|
||||
@ -1387,6 +1403,11 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
{
|
||||
$this->_reset_select();
|
||||
}
|
||||
// If we've previously reset the qb_orderby values, get them back
|
||||
elseif ( ! isset($this->qb_orderby))
|
||||
{
|
||||
$this->qb_orderby = $orderby;
|
||||
}
|
||||
|
||||
if ($result->num_rows() === 0)
|
||||
{
|
||||
@ -1408,7 +1429,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* @param string $where
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @return object
|
||||
* @return CI_DB_result
|
||||
*/
|
||||
public function get_where($table = '', $where = NULL, $limit = NULL, $offset = NULL)
|
||||
{
|
||||
@ -1444,20 +1465,26 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* @param bool $escape Whether to escape values and identifiers
|
||||
* @return int Number of rows inserted or FALSE on failure
|
||||
*/
|
||||
public function insert_batch($table = '', $set = NULL, $escape = NULL)
|
||||
public function insert_batch($table, $set = NULL, $escape = NULL, $batch_size = 100)
|
||||
{
|
||||
if ($set !== NULL)
|
||||
if ($set === NULL)
|
||||
{
|
||||
if (empty($this->qb_set))
|
||||
{
|
||||
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($set))
|
||||
{
|
||||
return ($this->db_debug) ? $this->display_error('insert_batch() called with no data') : FALSE;
|
||||
}
|
||||
|
||||
$this->set_insert_batch($set, '', $escape);
|
||||
}
|
||||
|
||||
if (count($this->qb_set) === 0)
|
||||
{
|
||||
// No valid data array. Folds in cases where keys and values did not match up
|
||||
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
|
||||
}
|
||||
|
||||
if ($table === '')
|
||||
if (strlen($table) === 0)
|
||||
{
|
||||
if ( ! isset($this->qb_from[0]))
|
||||
{
|
||||
@ -1469,10 +1496,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
|
||||
// Batch this baby
|
||||
$affected_rows = 0;
|
||||
for ($i = 0, $total = count($this->qb_set); $i < $total; $i += 100)
|
||||
for ($i = 0, $total = count($this->qb_set); $i < $total; $i += $batch_size)
|
||||
{
|
||||
$this->query($this->_insert_batch($this->protect_identifiers($table, TRUE, $escape, FALSE), $this->qb_keys, array_slice($this->qb_set, $i, 100)));
|
||||
$affected_rows += $this->affected_rows();
|
||||
if ($this->query($this->_insert_batch($this->protect_identifiers($table, TRUE, $escape, FALSE), $this->qb_keys, array_slice($this->qb_set, $i, $batch_size))))
|
||||
{
|
||||
$affected_rows += $this->affected_rows();
|
||||
}
|
||||
}
|
||||
|
||||
$this->_reset_write();
|
||||
@ -1598,7 +1627,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* @param string the table to insert data into
|
||||
* @param array an associative array of insert values
|
||||
* @param bool $escape Whether to escape values and identifiers
|
||||
* @return object
|
||||
* @return bool TRUE on success, FALSE on failure
|
||||
*/
|
||||
public function insert($table = '', $set = NULL, $escape = NULL)
|
||||
{
|
||||
@ -1664,7 +1693,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
*
|
||||
* @param string the table to replace data into
|
||||
* @param array an associative array of insert values
|
||||
* @return object
|
||||
* @return bool TRUE on success, FALSE on failure
|
||||
*/
|
||||
public function replace($table = '', $set = NULL)
|
||||
{
|
||||
@ -1770,7 +1799,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* @param array $set An associative array of update values
|
||||
* @param mixed $where
|
||||
* @param int $limit
|
||||
* @return object
|
||||
* @return bool TRUE on success, FALSE on failure
|
||||
*/
|
||||
public function update($table = '', $set = NULL, $where = NULL, $limit = NULL)
|
||||
{
|
||||
@ -1845,7 +1874,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* @param string the where key
|
||||
* @return int number of rows affected or FALSE on failure
|
||||
*/
|
||||
public function update_batch($table = '', $set = NULL, $index = NULL)
|
||||
public function update_batch($table, $set = NULL, $index = NULL, $batch_size = 100)
|
||||
{
|
||||
// Combine any cached components with the current statements
|
||||
$this->_merge_cache();
|
||||
@ -1855,17 +1884,24 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
return ($this->db_debug) ? $this->display_error('db_must_use_index') : FALSE;
|
||||
}
|
||||
|
||||
if ($set !== NULL)
|
||||
if ($set === NULL)
|
||||
{
|
||||
if (empty($this->qb_set))
|
||||
{
|
||||
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($set))
|
||||
{
|
||||
return ($this->db_debug) ? $this->display_error('update_batch() called with no data') : FALSE;
|
||||
}
|
||||
|
||||
$this->set_update_batch($set, $index);
|
||||
}
|
||||
|
||||
if (count($this->qb_set) === 0)
|
||||
{
|
||||
return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE;
|
||||
}
|
||||
|
||||
if ($table === '')
|
||||
if (strlen($table) === 0)
|
||||
{
|
||||
if ( ! isset($this->qb_from[0]))
|
||||
{
|
||||
@ -1877,10 +1913,13 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
|
||||
// Batch this baby
|
||||
$affected_rows = 0;
|
||||
for ($i = 0, $total = count($this->qb_set); $i < $total; $i += 100)
|
||||
for ($i = 0, $total = count($this->qb_set); $i < $total; $i += $batch_size)
|
||||
{
|
||||
$this->query($this->_update_batch($this->protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set, $i, 100), $this->protect_identifiers($index)));
|
||||
$affected_rows += $this->affected_rows();
|
||||
if ($this->query($this->_update_batch($this->protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set, $i, $batch_size), $this->protect_identifiers($index))))
|
||||
{
|
||||
$affected_rows += $this->affected_rows();
|
||||
}
|
||||
|
||||
$this->qb_where = array();
|
||||
}
|
||||
|
||||
@ -1983,7 +2022,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* Compiles a delete string and runs "DELETE FROM table"
|
||||
*
|
||||
* @param string the table to empty
|
||||
* @return object
|
||||
* @return bool TRUE on success, FALSE on failure
|
||||
*/
|
||||
public function empty_table($table = '')
|
||||
{
|
||||
@ -2016,7 +2055,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
* This function maps to "DELETE FROM table"
|
||||
*
|
||||
* @param string the table to truncate
|
||||
* @return object
|
||||
* @return bool TRUE on success, FALSE on failure
|
||||
*/
|
||||
public function truncate($table = '')
|
||||
{
|
||||
@ -2316,7 +2355,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
*
|
||||
* Escapes identifiers in WHERE and HAVING statements at execution time.
|
||||
*
|
||||
* Required so that aliases are tracked properly, regardless of wether
|
||||
* Required so that aliases are tracked properly, regardless of whether
|
||||
* where(), or_where(), having(), or_having are called prior to from(),
|
||||
* join() and dbprefix is added only if needed.
|
||||
*
|
||||
@ -2342,7 +2381,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
|
||||
|
||||
// Split multiple conditions
|
||||
$conditions = preg_split(
|
||||
'/((^|\s+)AND\s+|(^|\s+)OR\s+)/i',
|
||||
'/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i',
|
||||
$this->{$qb_key}[$i]['condition'],
|
||||
-1,
|
||||
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
abstract class CI_DB_utility {
|
||||
|
||||
@ -254,11 +254,12 @@ abstract class CI_DB_utility {
|
||||
// Next blast through the result array and build out the rows
|
||||
while ($row = $query->unbuffered_row('array'))
|
||||
{
|
||||
$line = array();
|
||||
foreach ($row as $item)
|
||||
{
|
||||
$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;
|
||||
$line[] = $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure;
|
||||
}
|
||||
$out = substr($out, 0, -strlen($delim)).$newline;
|
||||
$out .= implode($delim, $line).$newline;
|
||||
}
|
||||
|
||||
return $out;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.1.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author Esen Sagynov
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_cubrid_driver extends CI_DB {
|
||||
|
||||
@ -187,25 +187,17 @@ class CI_DB_cubrid_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
if (($autocommit = cubrid_get_autocommit($this->conn_id)) === NULL)
|
||||
{
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
if (cubrid_get_autocommit($this->conn_id))
|
||||
elseif ($autocommit === TRUE)
|
||||
{
|
||||
cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_FALSE);
|
||||
return cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_FALSE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -218,19 +210,16 @@ class CI_DB_cubrid_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
if ( ! cubrid_commit($this->conn_id))
|
||||
{
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cubrid_commit($this->conn_id);
|
||||
|
||||
if ($this->auto_commit && ! cubrid_get_autocommit($this->conn_id))
|
||||
{
|
||||
cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
|
||||
return cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -243,16 +232,13 @@ class CI_DB_cubrid_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
if ( ! cubrid_rollback($this->conn_id))
|
||||
{
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cubrid_rollback($this->conn_id);
|
||||
|
||||
if ($this->auto_commit && ! cubrid_get_autocommit($this->conn_id))
|
||||
{
|
||||
cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.1.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author Esen Sagynov
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_cubrid_forge extends CI_DB_forge {
|
||||
|
||||
@ -178,6 +178,9 @@ class CI_DB_cubrid_forge extends CI_DB_forge {
|
||||
$attributes['TYPE'] = 'INTEGER';
|
||||
$attributes['UNSIGNED'] = FALSE;
|
||||
return;
|
||||
case 'LONGTEXT':
|
||||
$attributes['TYPE'] = 'STRING';
|
||||
return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.1.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author Esen Sagynov
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_cubrid_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.1.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author Esen Sagynov
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_cubrid_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_ibase_driver extends CI_DB {
|
||||
|
||||
@ -126,7 +126,7 @@ class CI_DB_ibase_driver extends CI_DB {
|
||||
*/
|
||||
protected function _execute($sql)
|
||||
{
|
||||
return ibase_query($this->conn_id, $sql);
|
||||
return ibase_query(isset($this->_ibase_trans) ? $this->_ibase_trans : $this->conn_id, $sql);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -134,24 +134,16 @@ class CI_DB_ibase_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
if (($trans_handle = ibase_trans($this->conn_id)) === FALSE)
|
||||
{
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
$this->_ibase_trans = ibase_trans($this->conn_id);
|
||||
|
||||
$this->_ibase_trans = $trans_handle;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -162,15 +154,15 @@ class CI_DB_ibase_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans->depth > 0)
|
||||
if (ibase_commit($this->_ibase_trans))
|
||||
{
|
||||
$this->_ibase_trans = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return ibase_commit($this->_ibase_trans);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -180,15 +172,15 @@ class CI_DB_ibase_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
if (ibase_rollback($this->_ibase_trans))
|
||||
{
|
||||
$this->_ibase_trans = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return ibase_rollback($this->_ibase_trans);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_ibase_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_ibase_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_ibase_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mssql_driver extends CI_DB {
|
||||
|
||||
@ -158,6 +158,7 @@ class CI_DB_mssql_driver extends CI_DB {
|
||||
if (mssql_select_db('['.$database.']', $this->conn_id))
|
||||
{
|
||||
$this->database = $database;
|
||||
$this->data_cache = array();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -182,22 +183,10 @@ class CI_DB_mssql_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
return $this->simple_query('BEGIN TRAN');
|
||||
}
|
||||
|
||||
@ -208,14 +197,8 @@ class CI_DB_mssql_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return $this->simple_query('COMMIT TRAN');
|
||||
}
|
||||
|
||||
@ -226,14 +209,8 @@ class CI_DB_mssql_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return $this->simple_query('ROLLBACK TRAN');
|
||||
}
|
||||
|
||||
@ -291,7 +268,7 @@ class CI_DB_mssql_driver extends CI_DB {
|
||||
*/
|
||||
protected function _version()
|
||||
{
|
||||
return 'SELECT @@VERSION AS ver';
|
||||
return "SELECT SERVERPROPERTY('ProductVersion') AS ver";
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -381,9 +358,19 @@ class CI_DB_mssql_driver extends CI_DB {
|
||||
*/
|
||||
public function error()
|
||||
{
|
||||
$query = $this->query('SELECT @@ERROR AS code');
|
||||
$query = $query->row();
|
||||
return array('code' => $query->code, 'message' => mssql_get_last_message());
|
||||
// We need this because the error info is discarded by the
|
||||
// server the first time you request it, and query() already
|
||||
// calls error() once for logging purposes when a query fails.
|
||||
static $error = array('code' => 0, 'message' => NULL);
|
||||
|
||||
$message = mssql_get_last_message();
|
||||
if ( ! empty($message))
|
||||
{
|
||||
$error['code'] = $this->query('SELECT @@ERROR AS code')->row()->code;
|
||||
$error['message'] = $message;
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mssql_forge extends CI_DB_forge {
|
||||
|
||||
@ -113,6 +113,11 @@ class CI_DB_mssql_forge extends CI_DB_forge {
|
||||
*/
|
||||
protected function _attr_type(&$attributes)
|
||||
{
|
||||
if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE)
|
||||
{
|
||||
unset($attributes['CONSTRAINT']);
|
||||
}
|
||||
|
||||
switch (strtoupper($attributes['TYPE']))
|
||||
{
|
||||
case 'MEDIUMINT':
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mssql_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mssql_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mysql_driver extends CI_DB {
|
||||
|
||||
@ -84,7 +84,7 @@ class CI_DB_mysql_driver extends CI_DB {
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $stricton = FALSE;
|
||||
public $stricton;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@ -147,9 +147,26 @@ class CI_DB_mysql_driver extends CI_DB {
|
||||
: FALSE;
|
||||
}
|
||||
|
||||
if ($this->stricton && is_resource($this->conn_id))
|
||||
if (isset($this->stricton) && is_resource($this->conn_id))
|
||||
{
|
||||
$this->simple_query('SET SESSION sql_mode="STRICT_ALL_TABLES"');
|
||||
if ($this->stricton)
|
||||
{
|
||||
$this->simple_query('SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->simple_query(
|
||||
'SET SESSION sql_mode =
|
||||
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
|
||||
@@sql_mode,
|
||||
"STRICT_ALL_TABLES,", ""),
|
||||
",STRICT_ALL_TABLES", ""),
|
||||
"STRICT_ALL_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES,", ""),
|
||||
",STRICT_TRANS_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES", "")'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->conn_id;
|
||||
@ -191,6 +208,7 @@ class CI_DB_mysql_driver extends CI_DB {
|
||||
if (mysql_select_db($database, $this->conn_id))
|
||||
{
|
||||
$this->database = $database;
|
||||
$this->data_cache = array();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -272,25 +290,12 @@ class CI_DB_mysql_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
$this->simple_query('SET AUTOCOMMIT=0');
|
||||
$this->simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK
|
||||
return TRUE;
|
||||
return $this->simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -300,17 +305,15 @@ class CI_DB_mysql_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
if ($this->simple_query('COMMIT'))
|
||||
{
|
||||
$this->simple_query('SET AUTOCOMMIT=1');
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$this->simple_query('COMMIT');
|
||||
$this->simple_query('SET AUTOCOMMIT=1');
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -320,17 +323,15 @@ class CI_DB_mysql_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
if ($this->simple_query('ROLLBACK'))
|
||||
{
|
||||
$this->simple_query('SET AUTOCOMMIT=1');
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$this->simple_query('ROLLBACK');
|
||||
$this->simple_query('SET AUTOCOMMIT=1');
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mysql_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mysql_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mysql_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mysqli_driver extends CI_DB {
|
||||
|
||||
@ -84,7 +84,7 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $stricton = FALSE;
|
||||
public $stricton;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@ -97,6 +97,17 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* MySQLi object
|
||||
*
|
||||
* Has to be preserved without being assigned to $conn_id.
|
||||
*
|
||||
* @var MySQLi
|
||||
*/
|
||||
protected $_mysqli;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Database connection
|
||||
*
|
||||
@ -122,13 +133,30 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
}
|
||||
|
||||
$client_flags = ($this->compress === TRUE) ? MYSQLI_CLIENT_COMPRESS : 0;
|
||||
$mysqli = mysqli_init();
|
||||
$this->_mysqli = mysqli_init();
|
||||
|
||||
$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 10);
|
||||
$this->_mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 10);
|
||||
|
||||
if ($this->stricton)
|
||||
if (isset($this->stricton))
|
||||
{
|
||||
$mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode="STRICT_ALL_TABLES"');
|
||||
if ($this->stricton)
|
||||
{
|
||||
$this->_mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_mysqli->options(MYSQLI_INIT_COMMAND,
|
||||
'SET SESSION sql_mode =
|
||||
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
|
||||
@@sql_mode,
|
||||
"STRICT_ALL_TABLES,", ""),
|
||||
",STRICT_ALL_TABLES", ""),
|
||||
"STRICT_ALL_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES,", ""),
|
||||
",STRICT_TRANS_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES", "")'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($this->encrypt))
|
||||
@ -142,13 +170,26 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
|
||||
if ( ! empty($ssl))
|
||||
{
|
||||
if ( ! empty($this->encrypt['ssl_verify']) && defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT'))
|
||||
if (isset($this->encrypt['ssl_verify']))
|
||||
{
|
||||
$mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE);
|
||||
if ($this->encrypt['ssl_verify'])
|
||||
{
|
||||
defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') && $this->_mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE);
|
||||
}
|
||||
// Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT
|
||||
// to FALSE didn't do anything, so PHP 5.6.16 introduced yet another
|
||||
// constant ...
|
||||
//
|
||||
// https://secure.php.net/ChangeLog-5.php#5.6.16
|
||||
// https://bugs.php.net/bug.php?id=68344
|
||||
elseif (defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'))
|
||||
{
|
||||
$this->_mysqli->options(MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
$client_flags |= MYSQLI_CLIENT_SSL;
|
||||
$mysqli->ssl_set(
|
||||
$this->_mysqli->ssl_set(
|
||||
isset($ssl['key']) ? $ssl['key'] : NULL,
|
||||
isset($ssl['cert']) ? $ssl['cert'] : NULL,
|
||||
isset($ssl['ca']) ? $ssl['ca'] : NULL,
|
||||
@ -158,22 +199,22 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
}
|
||||
}
|
||||
|
||||
if ($mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags))
|
||||
if ($this->_mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags))
|
||||
{
|
||||
// Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails
|
||||
if (
|
||||
($client_flags & MYSQLI_CLIENT_SSL)
|
||||
&& version_compare($mysqli->client_info, '5.7.3', '<=')
|
||||
&& empty($mysqli->query("SHOW STATUS LIKE 'ssl_cipher'")->fetch_object()->Value)
|
||||
&& version_compare($this->_mysqli->client_info, '5.7.3', '<=')
|
||||
&& empty($this->_mysqli->query("SHOW STATUS LIKE 'ssl_cipher'")->fetch_object()->Value)
|
||||
)
|
||||
{
|
||||
$mysqli->close();
|
||||
$this->_mysqli->close();
|
||||
$message = 'MySQLi was configured for an SSL connection, but got an unencrypted connection instead!';
|
||||
log_message('error', $message);
|
||||
return ($this->db->db_debug) ? $this->db->display_error($message, '', TRUE) : FALSE;
|
||||
}
|
||||
|
||||
return $mysqli;
|
||||
return $this->_mysqli;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@ -215,6 +256,7 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
if ($this->conn_id->select_db($database))
|
||||
{
|
||||
$this->database = $database;
|
||||
$this->data_cache = array();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -291,22 +333,10 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
$this->conn_id->autocommit(FALSE);
|
||||
return is_php('5.5')
|
||||
? $this->conn_id->begin_transaction()
|
||||
@ -320,14 +350,8 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ($this->conn_id->commit())
|
||||
{
|
||||
$this->conn_id->autocommit(TRUE);
|
||||
@ -344,14 +368,8 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ($this->conn_id->rollback())
|
||||
{
|
||||
$this->conn_id->autocommit(TRUE);
|
||||
@ -481,11 +499,11 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
*/
|
||||
public function error()
|
||||
{
|
||||
if ( ! empty($this->conn_id->connect_errno))
|
||||
if ( ! empty($this->_mysqli->connect_errno))
|
||||
{
|
||||
return array(
|
||||
'code' => $this->conn_id->connect_errno,
|
||||
'message' => is_php('5.2.9') ? $this->conn_id->connect_error : mysqli_connect_error()
|
||||
'code' => $this->_mysqli->connect_errno,
|
||||
'message' => is_php('5.2.9') ? $this->_mysqli->connect_error : mysqli_connect_error()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mysqli_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mysqli_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_mysqli_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.4.1
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -252,12 +252,16 @@ class CI_DB_oci8_driver extends CI_DB {
|
||||
return $this->data_cache['version'];
|
||||
}
|
||||
|
||||
if ( ! $this->conn_id OR ($version = oci_server_version($this->conn_id)) === FALSE)
|
||||
if ( ! $this->conn_id OR ($version_string = oci_server_version($this->conn_id)) === FALSE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
elseif (preg_match('#Release\s(\d+(?:\.\d+)+)#', $version_string, $match))
|
||||
{
|
||||
return $this->data_cache['version'] = $match[1];
|
||||
}
|
||||
|
||||
return $this->data_cache['version'] = $version;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -378,27 +382,10 @@ class CI_DB_oci8_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
if ( ! $this->trans_enabled)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ($this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
$this->commit_mode = is_php('5.3.2') ? OCI_NO_AUTO_COMMIT : OCI_DEFAULT;
|
||||
return TRUE;
|
||||
}
|
||||
@ -410,20 +397,10 @@ class CI_DB_oci8_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
if ( ! $this->trans_enabled)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ($this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$this->commit_mode = OCI_COMMIT_ON_SUCCESS;
|
||||
|
||||
return oci_commit($this->conn_id);
|
||||
}
|
||||
|
||||
@ -434,14 +411,8 @@ class CI_DB_oci8_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$this->commit_mode = OCI_COMMIT_ON_SUCCESS;
|
||||
return oci_rollback($this->conn_id);
|
||||
}
|
||||
@ -588,23 +559,29 @@ class CI_DB_oci8_driver extends CI_DB {
|
||||
*/
|
||||
public function error()
|
||||
{
|
||||
/* oci_error() returns an array that already contains the
|
||||
* 'code' and 'message' keys, so we can just return it.
|
||||
*/
|
||||
// oci_error() returns an array that already contains
|
||||
// 'code' and 'message' keys, but it can return false
|
||||
// if there was no error ....
|
||||
if (is_resource($this->curs_id))
|
||||
{
|
||||
return oci_error($this->curs_id);
|
||||
$error = oci_error($this->curs_id);
|
||||
}
|
||||
elseif (is_resource($this->stmt_id))
|
||||
{
|
||||
return oci_error($this->stmt_id);
|
||||
$error = oci_error($this->stmt_id);
|
||||
}
|
||||
elseif (is_resource($this->conn_id))
|
||||
{
|
||||
return oci_error($this->conn_id);
|
||||
$error = oci_error($this->conn_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = oci_error();
|
||||
}
|
||||
|
||||
return oci_error();
|
||||
return is_array($error)
|
||||
? $error
|
||||
: array('code' => '', 'message' => '');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -683,6 +660,14 @@ class CI_DB_oci8_driver extends CI_DB {
|
||||
*/
|
||||
protected function _limit($sql)
|
||||
{
|
||||
if (version_compare($this->version(), '12.1', '>='))
|
||||
{
|
||||
// OFFSET-FETCH can be used only with the ORDER BY clause
|
||||
empty($this->qb_orderby) && $sql .= ' ORDER BY 1';
|
||||
|
||||
return $sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY';
|
||||
}
|
||||
|
||||
$this->limit_used = TRUE;
|
||||
return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($this->qb_offset + $this->qb_limit + 1).')'
|
||||
.($this->qb_offset ? ' WHERE rnum >= '.($this->qb_offset + 1) : '');
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.4.1
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_oci8_forge extends CI_DB_forge {
|
||||
|
||||
@ -53,6 +53,13 @@ class CI_DB_oci8_forge extends CI_DB_forge {
|
||||
*/
|
||||
protected $_create_database = FALSE;
|
||||
|
||||
/**
|
||||
* CREATE TABLE IF statement
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_create_table_if = FALSE;
|
||||
|
||||
/**
|
||||
* DROP DATABASE statement
|
||||
*
|
||||
@ -146,4 +153,33 @@ class CI_DB_oci8_forge extends CI_DB_forge {
|
||||
// Not supported - sequences and triggers must be used instead
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Field attribute TYPE
|
||||
*
|
||||
* Performs a data type mapping between different databases.
|
||||
*
|
||||
* @param array &$attributes
|
||||
* @return void
|
||||
*/
|
||||
protected function _attr_type(&$attributes)
|
||||
{
|
||||
switch (strtoupper($attributes['TYPE']))
|
||||
{
|
||||
case 'TINYINT':
|
||||
$attributes['TYPE'] = 'NUMBER';
|
||||
return;
|
||||
case 'MEDIUMINT':
|
||||
$attributes['TYPE'] = 'NUMBER';
|
||||
return;
|
||||
case 'INT':
|
||||
$attributes['TYPE'] = 'NUMBER';
|
||||
return;
|
||||
case 'BIGINT':
|
||||
$attributes['TYPE'] = 'NUMBER';
|
||||
return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.4.1
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_oci8_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.4.1
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_oci8_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,9 +48,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_odbc_driver extends CI_DB {
|
||||
class CI_DB_odbc_driver extends CI_DB_driver {
|
||||
|
||||
/**
|
||||
* Database driver
|
||||
@ -93,6 +93,22 @@ class CI_DB_odbc_driver extends CI_DB {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* ODBC result ID resource returned from odbc_prepare()
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $odbc_result;
|
||||
|
||||
/**
|
||||
* Values to use with odbc_execute() for prepared statements
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $binds = array();
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
@ -127,6 +143,74 @@ class CI_DB_odbc_driver extends CI_DB {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Compile Bindings
|
||||
*
|
||||
* @param string $sql SQL statement
|
||||
* @param array $binds An array of values to bind
|
||||
* @return string
|
||||
*/
|
||||
public function compile_binds($sql, $binds)
|
||||
{
|
||||
if (empty($binds) OR empty($this->bind_marker) OR strpos($sql, $this->bind_marker) === FALSE)
|
||||
{
|
||||
return $sql;
|
||||
}
|
||||
elseif ( ! is_array($binds))
|
||||
{
|
||||
$binds = array($binds);
|
||||
$bind_count = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make sure we're using numeric keys
|
||||
$binds = array_values($binds);
|
||||
$bind_count = count($binds);
|
||||
}
|
||||
|
||||
// We'll need the marker length later
|
||||
$ml = strlen($this->bind_marker);
|
||||
|
||||
// Make sure not to replace a chunk inside a string that happens to match the bind marker
|
||||
if ($c = preg_match_all("/'[^']*'/i", $sql, $matches))
|
||||
{
|
||||
$c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i',
|
||||
str_replace($matches[0],
|
||||
str_replace($this->bind_marker, str_repeat(' ', $ml), $matches[0]),
|
||||
$sql, $c),
|
||||
$matches, PREG_OFFSET_CAPTURE);
|
||||
|
||||
// Bind values' count must match the count of markers in the query
|
||||
if ($bind_count !== $c)
|
||||
{
|
||||
return $sql;
|
||||
}
|
||||
}
|
||||
elseif (($c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bind_count)
|
||||
{
|
||||
return $sql;
|
||||
}
|
||||
|
||||
if ($this->bind_marker !== '?')
|
||||
{
|
||||
do
|
||||
{
|
||||
$c--;
|
||||
$sql = substr_replace($sql, '?', $matches[0][$c][1], $ml);
|
||||
}
|
||||
while ($c !== 0);
|
||||
}
|
||||
|
||||
if (FALSE !== ($this->odbc_result = odbc_prepare($this->conn_id, $sql)))
|
||||
{
|
||||
$this->binds = array_values($binds);
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Execute the query
|
||||
*
|
||||
@ -135,7 +219,25 @@ class CI_DB_odbc_driver extends CI_DB {
|
||||
*/
|
||||
protected function _execute($sql)
|
||||
{
|
||||
return odbc_exec($this->conn_id, $sql);
|
||||
if ( ! isset($this->odbc_result))
|
||||
{
|
||||
return odbc_exec($this->conn_id, $sql);
|
||||
}
|
||||
elseif ($this->odbc_result === FALSE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (TRUE === ($success = odbc_execute($this->odbc_result, $this->binds)))
|
||||
{
|
||||
// For queries that return result sets, return the result_id resource on success
|
||||
$this->is_write_type($sql) OR $success = $this->odbc_result;
|
||||
}
|
||||
|
||||
$this->odbc_result = NULL;
|
||||
$this->binds = array();
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -143,22 +245,10 @@ class CI_DB_odbc_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
return odbc_autocommit($this->conn_id, FALSE);
|
||||
}
|
||||
|
||||
@ -169,17 +259,15 @@ class CI_DB_odbc_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
if (odbc_commit($this->conn_id))
|
||||
{
|
||||
odbc_autocommit($this->conn_id, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$ret = odbc_commit($this->conn_id);
|
||||
odbc_autocommit($this->conn_id, TRUE);
|
||||
return $ret;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -189,17 +277,33 @@ class CI_DB_odbc_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
if (odbc_rollback($this->conn_id))
|
||||
{
|
||||
odbc_autocommit($this->conn_id, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$ret = odbc_rollback($this->conn_id);
|
||||
odbc_autocommit($this->conn_id, TRUE);
|
||||
return $ret;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Determines if a query is a "write" type.
|
||||
*
|
||||
* @param string An SQL query string
|
||||
* @return bool
|
||||
*/
|
||||
public function is_write_type($sql)
|
||||
{
|
||||
if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#i', $sql))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::is_write_type($sql);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -212,7 +316,7 @@ class CI_DB_odbc_driver extends CI_DB {
|
||||
*/
|
||||
protected function _escape_str($str)
|
||||
{
|
||||
return remove_invisible_characters($str);
|
||||
$this->db->display_error('db_unsupported_feature');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -309,58 +413,6 @@ class CI_DB_odbc_driver extends CI_DB {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Update statement
|
||||
*
|
||||
* Generates a platform-specific update string from the supplied data
|
||||
*
|
||||
* @param string $table
|
||||
* @param array $values
|
||||
* @return string
|
||||
*/
|
||||
protected function _update($table, $values)
|
||||
{
|
||||
$this->qb_limit = FALSE;
|
||||
$this->qb_orderby = array();
|
||||
return parent::_update($table, $values);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Truncate statement
|
||||
*
|
||||
* Generates a platform-specific truncate string from the supplied data
|
||||
*
|
||||
* If the database does not support the TRUNCATE statement,
|
||||
* then this method maps to 'DELETE FROM table'
|
||||
*
|
||||
* @param string $table
|
||||
* @return string
|
||||
*/
|
||||
protected function _truncate($table)
|
||||
{
|
||||
return 'DELETE FROM '.$table;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Delete statement
|
||||
*
|
||||
* Generates a platform-specific delete string from the supplied data
|
||||
*
|
||||
* @param string $table
|
||||
* @return string
|
||||
*/
|
||||
protected function _delete($table)
|
||||
{
|
||||
$this->qb_limit = FALSE;
|
||||
return parent::_delete($table);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Close DB Connection
|
||||
*
|
||||
@ -370,5 +422,4 @@ class CI_DB_odbc_driver extends CI_DB {
|
||||
{
|
||||
odbc_close($this->conn_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/database/
|
||||
* @link https://codeigniter.com/database/
|
||||
*/
|
||||
class CI_DB_odbc_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_odbc_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/database/
|
||||
* @link https://codeigniter.com/database/
|
||||
*/
|
||||
class CI_DB_odbc_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.1.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_driver extends CI_DB {
|
||||
|
||||
@ -126,7 +126,10 @@ class CI_DB_pdo_driver extends CI_DB {
|
||||
*/
|
||||
public function db_connect($persistent = FALSE)
|
||||
{
|
||||
$this->options[PDO::ATTR_PERSISTENT] = $persistent;
|
||||
if ($persistent === TRUE)
|
||||
{
|
||||
$this->options[PDO::ATTR_PERSISTENT] = TRUE;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@ -186,22 +189,10 @@ class CI_DB_pdo_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
return $this->conn_id->beginTransaction();
|
||||
}
|
||||
|
||||
@ -212,14 +203,8 @@ class CI_DB_pdo_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return $this->conn_id->commit();
|
||||
}
|
||||
|
||||
@ -230,14 +215,8 @@ class CI_DB_pdo_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return $this->conn_id->rollBack();
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.1.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/database/
|
||||
* @link https://codeigniter.com/database/
|
||||
*/
|
||||
class CI_DB_pdo_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.1.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.1.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/database/
|
||||
* @link https://codeigniter.com/database/
|
||||
*/
|
||||
class CI_DB_pdo_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_4d_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_4d_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_cubrid_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_cubrid_forge extends CI_DB_pdo_forge {
|
||||
|
||||
@ -178,6 +178,9 @@ class CI_DB_pdo_cubrid_forge extends CI_DB_pdo_forge {
|
||||
$attributes['TYPE'] = 'INTEGER';
|
||||
$attributes['UNSIGNED'] = FALSE;
|
||||
return;
|
||||
case 'LONGTEXT':
|
||||
$attributes['TYPE'] = 'STRING';
|
||||
return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver {
|
||||
|
||||
@ -126,7 +126,12 @@ class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver {
|
||||
*/
|
||||
public function db_connect($persistent = FALSE)
|
||||
{
|
||||
$this->conn_id = parent::db_connect($persistent);
|
||||
if ($persistent === TRUE)
|
||||
{
|
||||
log_message('debug', "dblib driver doesn't support persistent connections");
|
||||
}
|
||||
|
||||
$this->conn_id = parent::db_connect(FALSE);
|
||||
|
||||
if ( ! is_object($this->conn_id))
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_dblib_forge extends CI_DB_pdo_forge {
|
||||
|
||||
@ -111,6 +111,11 @@ class CI_DB_pdo_dblib_forge extends CI_DB_pdo_forge {
|
||||
*/
|
||||
protected function _attr_type(&$attributes)
|
||||
{
|
||||
if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE)
|
||||
{
|
||||
unset($attributes['CONSTRAINT']);
|
||||
}
|
||||
|
||||
switch (strtoupper($attributes['TYPE']))
|
||||
{
|
||||
case 'MEDIUMINT':
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_firebird_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_firebird_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_ibm_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_ibm_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_informix_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_informix_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
|
||||
|
||||
@ -73,7 +73,7 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $stricton = FALSE;
|
||||
public $stricton;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@ -133,15 +133,34 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
|
||||
.(empty($this->dbcollat) ? '' : ' COLLATE '.$this->dbcollat);
|
||||
}
|
||||
|
||||
if ($this->stricton)
|
||||
if (isset($this->stricton))
|
||||
{
|
||||
if (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND]))
|
||||
if ($this->stricton)
|
||||
{
|
||||
$this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode="STRICT_ALL_TABLES"';
|
||||
$sql = 'CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = "STRICT_ALL_TABLES"';
|
||||
$sql = 'REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
|
||||
@@sql_mode,
|
||||
"STRICT_ALL_TABLES,", ""),
|
||||
",STRICT_ALL_TABLES", ""),
|
||||
"STRICT_ALL_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES,", ""),
|
||||
",STRICT_TRANS_TABLES", ""),
|
||||
"STRICT_TRANS_TABLES", "")';
|
||||
}
|
||||
|
||||
if ( ! empty($sql))
|
||||
{
|
||||
if (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND]))
|
||||
{
|
||||
$this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode = '.$sql;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = '.$sql;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,6 +218,7 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
|
||||
if (FALSE !== $this->simple_query('USE '.$this->escape_identifiers($database)))
|
||||
{
|
||||
$this->database = $database;
|
||||
$this->data_cache = array();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_mysql_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_oci_driver extends CI_DB_pdo_driver {
|
||||
|
||||
@ -129,6 +129,29 @@ class CI_DB_pdo_oci_driver extends CI_DB_pdo_driver {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Database version number
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function version()
|
||||
{
|
||||
if (isset($this->data_cache['version']))
|
||||
{
|
||||
return $this->data_cache['version'];
|
||||
}
|
||||
|
||||
$version_string = parent::version();
|
||||
if (preg_match('#Release\s(?<version>\d+(?:\.\d+)+)#', $version_string, $match))
|
||||
{
|
||||
return $this->data_cache['version'] = $match[1];
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Show table query
|
||||
*
|
||||
@ -288,6 +311,14 @@ class CI_DB_pdo_oci_driver extends CI_DB_pdo_driver {
|
||||
*/
|
||||
protected function _limit($sql)
|
||||
{
|
||||
if (version_compare($this->version(), '12.1', '>='))
|
||||
{
|
||||
// OFFSET-FETCH can be used only with the ORDER BY clause
|
||||
empty($this->qb_orderby) && $sql .= ' ORDER BY 1';
|
||||
|
||||
return $sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY';
|
||||
}
|
||||
|
||||
return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($this->qb_offset + $this->qb_limit + 1).')'
|
||||
.($this->qb_offset ? ' WHERE rnum >= '.($this->qb_offset + 1): '');
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge {
|
||||
|
||||
@ -53,6 +53,13 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge {
|
||||
*/
|
||||
protected $_create_database = FALSE;
|
||||
|
||||
/**
|
||||
* CREATE TABLE IF statement
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_create_table_if = FALSE;
|
||||
|
||||
/**
|
||||
* DROP DATABASE statement
|
||||
*
|
||||
@ -60,13 +67,6 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge {
|
||||
*/
|
||||
protected $_drop_database = FALSE;
|
||||
|
||||
/**
|
||||
* CREATE TABLE IF statement
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS';
|
||||
|
||||
/**
|
||||
* UNSIGNED support
|
||||
*
|
||||
@ -146,4 +146,31 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge {
|
||||
// Not supported - sequences and triggers must be used instead
|
||||
}
|
||||
|
||||
/**
|
||||
* Field attribute TYPE
|
||||
*
|
||||
* Performs a data type mapping between different databases.
|
||||
*
|
||||
* @param array &$attributes
|
||||
* @return void
|
||||
*/
|
||||
protected function _attr_type(&$attributes)
|
||||
{
|
||||
switch (strtoupper($attributes['TYPE']))
|
||||
{
|
||||
case 'TINYINT':
|
||||
$attributes['TYPE'] = 'NUMBER';
|
||||
return;
|
||||
case 'MEDIUMINT':
|
||||
$attributes['TYPE'] = 'NUMBER';
|
||||
return;
|
||||
case 'INT':
|
||||
$attributes['TYPE'] = 'NUMBER';
|
||||
return;
|
||||
case 'BIGINT':
|
||||
$attributes['TYPE'] = 'NUMBER';
|
||||
return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver {
|
||||
|
||||
@ -160,6 +160,37 @@ class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Platform-dependant string escape
|
||||
*
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
protected function _escape_str($str)
|
||||
{
|
||||
$this->db->display_error('db_unsupported_feature');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Determines if a query is a "write" type.
|
||||
*
|
||||
* @param string An SQL query string
|
||||
* @return bool
|
||||
*/
|
||||
public function is_write_type($sql)
|
||||
{
|
||||
if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#i', $sql))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::is_write_type($sql);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Show table query
|
||||
*
|
||||
@ -195,72 +226,4 @@ class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver {
|
||||
{
|
||||
return 'SELECT column_name FROM information_schema.columns WHERE table_name = '.$this->escape($table);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Update statement
|
||||
*
|
||||
* Generates a platform-specific update string from the supplied data
|
||||
*
|
||||
* @param string $table
|
||||
* @param array $values
|
||||
* @return string
|
||||
*/
|
||||
protected function _update($table, $values)
|
||||
{
|
||||
$this->qb_limit = FALSE;
|
||||
$this->qb_orderby = array();
|
||||
return parent::_update($table, $values);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Truncate statement
|
||||
*
|
||||
* Generates a platform-specific truncate string from the supplied data
|
||||
*
|
||||
* If the database does not support the TRUNCATE statement,
|
||||
* then this method maps to 'DELETE FROM table'
|
||||
*
|
||||
* @param string $table
|
||||
* @return string
|
||||
*/
|
||||
protected function _truncate($table)
|
||||
{
|
||||
return 'DELETE FROM '.$table;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Delete statement
|
||||
*
|
||||
* Generates a platform-specific delete string from the supplied data
|
||||
*
|
||||
* @param string the table name
|
||||
* @return string
|
||||
*/
|
||||
protected function _delete($table)
|
||||
{
|
||||
$this->qb_limit = FALSE;
|
||||
return parent::_delete($table);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* LIMIT
|
||||
*
|
||||
* Generates a platform-specific LIMIT clause
|
||||
*
|
||||
* @param string $sql SQL Query
|
||||
* @return string
|
||||
*/
|
||||
protected function _limit($sql)
|
||||
{
|
||||
return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$this->qb_limit.' ', $sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/database/
|
||||
* @link https://codeigniter.com/database/
|
||||
*/
|
||||
class CI_DB_pdo_odbc_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
|
||||
|
||||
@ -154,7 +154,12 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver {
|
||||
*/
|
||||
public function is_write_type($sql)
|
||||
{
|
||||
return (bool) preg_match('/^\s*"?(SET|INSERT(?![^\)]+\)\s+RETURNING)|UPDATE(?!.*\sRETURNING)|DELETE|CREATE|DROP|TRUNCATE|LOAD|COPY|ALTER|RENAME|GRANT|REVOKE|LOCK|UNLOCK|REINDEX)\s/i', str_replace(array("\r\n", "\r", "\n"), ' ', $sql));
|
||||
if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#i', $sql))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::is_write_type($sql);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_sqlite_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_sqlite_forge extends CI_DB_pdo_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_sqlsrv_driver extends CI_DB_pdo_driver {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_pdo_sqlsrv_forge extends CI_DB_pdo_forge {
|
||||
|
||||
@ -111,6 +111,11 @@ class CI_DB_pdo_sqlsrv_forge extends CI_DB_pdo_forge {
|
||||
*/
|
||||
protected function _attr_type(&$attributes)
|
||||
{
|
||||
if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE)
|
||||
{
|
||||
unset($attributes['CONSTRAINT']);
|
||||
}
|
||||
|
||||
switch (strtoupper($attributes['TYPE']))
|
||||
{
|
||||
case 'MEDIUMINT':
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_postgre_driver extends CI_DB {
|
||||
|
||||
@ -247,22 +247,10 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
return (bool) pg_query($this->conn_id, 'BEGIN');
|
||||
}
|
||||
|
||||
@ -273,14 +261,8 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return (bool) pg_query($this->conn_id, 'COMMIT');
|
||||
}
|
||||
|
||||
@ -291,14 +273,8 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return (bool) pg_query($this->conn_id, 'ROLLBACK');
|
||||
}
|
||||
|
||||
@ -312,7 +288,12 @@ class CI_DB_postgre_driver extends CI_DB {
|
||||
*/
|
||||
public function is_write_type($sql)
|
||||
{
|
||||
return (bool) preg_match('/^\s*"?(SET|INSERT(?![^\)]+\)\s+RETURNING)|UPDATE(?!.*\sRETURNING)|DELETE|CREATE|DROP|TRUNCATE|LOAD|COPY|ALTER|RENAME|GRANT|REVOKE|LOCK|UNLOCK|REINDEX)\s/i', str_replace(array("\r\n", "\r", "\n"), ' ', $sql));
|
||||
if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#i', $sql))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::is_write_type($sql);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_postgre_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_postgre_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_postgre_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlite_driver extends CI_DB {
|
||||
|
||||
@ -122,24 +122,11 @@ class CI_DB_sqlite_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
$this->simple_query('BEGIN TRANSACTION');
|
||||
return TRUE;
|
||||
return $this->simple_query('BEGIN TRANSACTION');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -149,16 +136,9 @@ class CI_DB_sqlite_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$this->simple_query('COMMIT');
|
||||
return TRUE;
|
||||
return $this->simple_query('COMMIT');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@ -168,16 +148,9 @@ class CI_DB_sqlite_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$this->simple_query('ROLLBACK');
|
||||
return TRUE;
|
||||
return $this->simple_query('ROLLBACK');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlite_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlite_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.3.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlite_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author Andrey Andreev
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlite3_driver extends CI_DB {
|
||||
|
||||
@ -134,22 +134,10 @@ class CI_DB_sqlite3_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
return $this->conn_id->exec('BEGIN TRANSACTION');
|
||||
}
|
||||
|
||||
@ -160,14 +148,8 @@ class CI_DB_sqlite3_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return $this->conn_id->exec('END TRANSACTION');
|
||||
}
|
||||
|
||||
@ -178,14 +160,8 @@ class CI_DB_sqlite3_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return $this->conn_id->exec('ROLLBACK');
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author Andrey Andreev
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlite3_forge extends CI_DB_forge {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author Andrey Andreev
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlite3_result extends CI_DB_result {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author Andrey Andreev
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlite3_utility extends CI_DB_utility {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.0.3
|
||||
* @filesource
|
||||
*/
|
||||
@ -48,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Drivers
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlsrv_driver extends CI_DB {
|
||||
|
||||
@ -141,13 +141,14 @@ class CI_DB_sqlsrv_driver extends CI_DB {
|
||||
unset($connection['UID'], $connection['PWD']);
|
||||
}
|
||||
|
||||
$this->conn_id = sqlsrv_connect($this->hostname, $connection);
|
||||
|
||||
// Determine how identifiers are escaped
|
||||
$query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi');
|
||||
$query = $query->row_array();
|
||||
$this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi'];
|
||||
$this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']');
|
||||
if (FALSE !== ($this->conn_id = sqlsrv_connect($this->hostname, $connection)))
|
||||
{
|
||||
// Determine how identifiers are escaped
|
||||
$query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi');
|
||||
$query = $query->row_array();
|
||||
$this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi'];
|
||||
$this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']');
|
||||
}
|
||||
|
||||
return $this->conn_id;
|
||||
}
|
||||
@ -170,6 +171,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
|
||||
if ($this->_execute('USE '.$this->escape_identifiers($database)))
|
||||
{
|
||||
$this->database = $database;
|
||||
$this->data_cache = array();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -196,22 +198,10 @@ class CI_DB_sqlsrv_driver extends CI_DB {
|
||||
/**
|
||||
* Begin Transaction
|
||||
*
|
||||
* @param bool $test_mode
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_begin($test_mode = FALSE)
|
||||
protected function _trans_begin()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Reset the transaction failure flag.
|
||||
// If the $test_mode flag is set to TRUE transactions will be rolled back
|
||||
// even if the queries produce a successful result.
|
||||
$this->_trans_failure = ($test_mode === TRUE);
|
||||
|
||||
return sqlsrv_begin_transaction($this->conn_id);
|
||||
}
|
||||
|
||||
@ -222,14 +212,8 @@ class CI_DB_sqlsrv_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_commit()
|
||||
protected function _trans_commit()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return sqlsrv_commit($this->conn_id);
|
||||
}
|
||||
|
||||
@ -240,14 +224,8 @@ class CI_DB_sqlsrv_driver extends CI_DB {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trans_rollback()
|
||||
protected function _trans_rollback()
|
||||
{
|
||||
// When transactions are nested we only begin/commit/rollback the outermost ones
|
||||
if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return sqlsrv_rollback($this->conn_id);
|
||||
}
|
||||
|
||||
@ -274,9 +252,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
|
||||
*/
|
||||
public function insert_id()
|
||||
{
|
||||
$query = $this->query('SELECT @@IDENTITY AS insert_id');
|
||||
$query = $query->row();
|
||||
return $query->insert_id;
|
||||
return $this->query('SELECT SCOPE_IDENTITY() AS insert_id')->row()->insert_id;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -28,10 +28,10 @@
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.0.3
|
||||
* @filesource
|
||||
*/
|
||||
@ -42,7 +42,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*
|
||||
* @category Database
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/database/
|
||||
* @link https://codeigniter.com/user_guide/database/
|
||||
*/
|
||||
class CI_DB_sqlsrv_forge extends CI_DB_forge {
|
||||
|
||||
@ -111,6 +111,11 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge {
|
||||
*/
|
||||
protected function _attr_type(&$attributes)
|
||||
{
|
||||
if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE)
|
||||
{
|
||||
unset($attributes['CONSTRAINT']);
|
||||
}
|
||||
|
||||
switch (strtoupper($attributes['TYPE']))
|
||||
{
|
||||
case 'MEDIUMINT':
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user