Subversion-Projekte lars-tiefland.ci

Revision

Revision 68 | Revision 2107 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 68 Revision 2049
Zeile 4... Zeile 4...
4
 *
4
 *
5
 * An open source application development framework for PHP
5
 * An open source application development framework for PHP
6
 *
6
 *
7
 * This content is released under the MIT License (MIT)
7
 * This content is released under the MIT License (MIT)
8
 *
8
 *
9
 * Copyright (c) 2014 - 2016, British Columbia Institute of Technology
9
 * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
10
 *
10
 *
11
 * Permission is hereby granted, free of charge, to any person obtaining a copy
11
 * Permission is hereby granted, free of charge, to any person obtaining a copy
12
 * of this software and associated documentation files (the "Software"), to deal
12
 * of this software and associated documentation files (the "Software"), to deal
13
 * in the Software without restriction, including without limitation the rights
13
 * in the Software without restriction, including without limitation the rights
14
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Zeile 27... Zeile 27...
27
 * THE SOFTWARE.
27
 * THE SOFTWARE.
28
 *
28
 *
29
 * @package	CodeIgniter
29
 * @package	CodeIgniter
30
 * @author	EllisLab Dev Team
30
 * @author	EllisLab Dev Team
31
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
31
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
32
 * @copyright	Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
32
 * @copyright	Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
33
 * @license	http://opensource.org/licenses/MIT	MIT License
33
 * @license	http://opensource.org/licenses/MIT	MIT License
34
 * @link	https://codeigniter.com
34
 * @link	https://codeigniter.com
35
 * @since	Version 2.1.0
35
 * @since	Version 2.1.0
36
 * @filesource
36
 * @filesource
37
 */
37
 */
Zeile 309... Zeile 309...
309
	}
309
	}
Zeile 310... Zeile 310...
310
 
310
 
Zeile 311... Zeile 311...
311
	// --------------------------------------------------------------------
311
	// --------------------------------------------------------------------
312
 
-
 
313
	/**
-
 
314
	 * Update_Batch statement
-
 
315
	 *
-
 
316
	 * Generates a platform-specific batch update string from the supplied data
-
 
317
	 *
-
 
318
	 * @param	string	$table	Table name
-
 
319
	 * @param	array	$values	Update data
-
 
320
	 * @param	string	$index	WHERE key
-
 
321
	 * @return	string
-
 
322
	 */
-
 
323
	protected function _update_batch($table, $values, $index)
-
 
324
	{
-
 
325
		$ids = array();
-
 
326
		foreach ($values as $key => $val)
-
 
327
		{
-
 
328
			$ids[] = $val[$index];
-
 
329
 
-
 
330
			foreach (array_keys($val) as $field)
-
 
331
			{
-
 
332
				if ($field !== $index)
-
 
333
				{
-
 
334
					$final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
-
 
335
				}
-
 
336
			}
-
 
337
		}
-
 
338
 
-
 
339
		$cases = '';
-
 
340
		foreach ($final as $k => $v)
-
 
341
		{
-
 
342
			$cases .= $k.' = CASE '."\n";
-
 
343
 
-
 
344
			foreach ($v as $row)
-
 
345
			{
-
 
346
				$cases .= $row."\n";
-
 
347
			}
-
 
348
 
-
 
349
			$cases .= 'ELSE '.$k.' END, ';
-
 
350
		}
-
 
351
 
-
 
352
		$this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
 
353
 
-
 
354
		return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
-
 
355
	}
-
 
356
 
-
 
357
	// --------------------------------------------------------------------
-
 
358
 
312
 
359
	/**
313
	/**
360
	 * Truncate statement
314
	 * Truncate statement
361
	 *
315
	 *
362
	 * Generates a platform-specific truncate string from the supplied data
316
	 * Generates a platform-specific truncate string from the supplied data