Overview
Comment:In '#list' section, use a column number to identify the column, not a hash that would not be usable then
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: e9801f721bf7a5d007ba6ffc1314de75c31105f8b432805294131406251fc48d
User & Date: bohwaz on 2023-02-02 02:03:33
Other Links: branch diff | manifest | tags
Context
2023-02-02
02:23
Always silently include id and key in selected columns in '#list' section check-in: b6d49f3956 user: bohwaz tags: dev
02:03
In '#list' section, use a column number to identify the column, not a hash that would not be usable then check-in: e9801f721b user: bohwaz tags: dev
01:19
Implement new '#list' section in Brindille skeletons Also implement new 'explain' parameter for '#sql' and children sections check-in: 5e1c85998a user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/UserTemplate/Sections.php from [2197634be7] to [014736d024].

282
283
284
285
286
287
288
289
290

291
292



293

294
295

296
297
298

299
300
301
302
303
304
305
306
307
308
309
		else {
			$where = self::_moduleReplaceJSONExtract($params['where']);
		}

		$columns = [];

		if (!empty($params['select'])) {
			foreach (explode(',', $params['select']) as $c) {
				$c = trim($c);

				$name = trim(strtok($c, ' AS '));
				$alias = strtok(false);





				$hash = md5($c);
				$columns[$hash] = [

					'label' => $alias ? trim($alias, ' \'"') : $name,
					'select' => $this->_moduleReplaceJSONExtract($name),
				];

			}

			if (!empty($params['order'])) {
				$params['order'] = md5($this->_moduleReplaceJSONExtract($params['order']));
			}
		}
		else {
			$columns = self::_getModuleColumnsFromSchema($params['schema'], $params['columns'] ?? null, $tpl, $line);
		}

		$columns['document'] = [];







|

>
|
|
>
>
>
|
>
|
|
>
|
|
|
>



|







282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
		else {
			$where = self::_moduleReplaceJSONExtract($params['where']);
		}

		$columns = [];

		if (!empty($params['select'])) {
			foreach (explode(';', $params['select']) as $i => $c) {
				$c = trim($c);

				$pos = strpos($c, ' AS ');

				if ($pos) {
					$select = trim(substr($c, 0, $pos));
					$label = str_replace("''", "'", trim(substr($c, $pos + 5), ' \'"'));
				}
				else {
					$select = $c;
					$label = null;
				}

				$select = self::_moduleReplaceJSONExtract($select);

				$columns['col' . $i] = compact('label', 'select');
			}

			if (!empty($params['order'])) {
				$params['order'] = self::_moduleReplaceJSONExtract($params['order']);
			}
		}
		else {
			$columns = self::_getModuleColumnsFromSchema($params['schema'], $params['columns'] ?? null, $tpl, $line);
		}

		$columns['document'] = [];