Skip to content

Commit 3c40586

Browse files
author
Wazabii
committed
Add raw column method
1 parent 080835b commit 3c40586

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

AbstractDB.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ public function getTable(bool $withAlias = false): string
109109
*/
110110
public function getColumns(): array
111111
{
112+
if(is_string($this->columns)) {
113+
return explode(",", $this->columns);
114+
}
112115
if (!is_null($this->mig) && !$this->mig->columns($this->columns)) {
113116
throw new DBValidationException($this->mig->getMessage(), 1);
114117
}

DB.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,28 @@ protected function showView(): self
275275
return $this;
276276
}
277277

278-
public function columns(...$columns)
278+
/**
279+
* Select protected mysql columns
280+
* @param string $columns
281+
* @return self
282+
*/
283+
public function columns(...$columns): self
279284
{
280285
$this->columns = $this->prepArr($columns, false);
281286
return $this;
282287
}
283288

289+
/**
290+
* Select unprotected mysql columns
291+
* @param string $columns
292+
* @return self
293+
*/
294+
public function columnsRaw(string $columns): self
295+
{
296+
$this->columns = $columns;
297+
return $this;
298+
}
299+
284300
/**
285301
* Change where compare operator from default "=".
286302
* Will change back to default after where method is triggered

0 commit comments

Comments
 (0)