Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
catfan committed Jun 24, 2017
2 parents bcabbef + 6798b96 commit 8ee8ae1
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/Medoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*!
* Medoo database framework
* https://medoo.in
* Version 1.4.4
* Version 1.4.5
*
* Copyright 2017, Angel Lai
* Released under the MIT license
Expand Down Expand Up @@ -298,16 +298,23 @@ public function exec($query, $map = [])

$statement = $this->pdo->prepare($query);

foreach ($map as $key => $value)
if ($statement)
{
$statement->bindValue($key, $value[ 0 ], $value[ 1 ]);
}
foreach ($map as $key => $value)
{
$statement->bindValue($key, $value[ 0 ], $value[ 1 ]);
}

$statement->execute();
$statement->execute();

$this->statement = $statement;
$this->statement = $statement;

return $statement;
return $statement;
}
else
{
return false;
}
}

protected function generate($query, $map)
Expand Down Expand Up @@ -343,7 +350,7 @@ protected function tableQuote($table)

protected function mapKey()
{
return ':MeDoOmEdOo_' . $this->guid++;
return ':MeDoO_' . $this->guid++ . '_mEdOo';
}

protected function columnQuote($string)
Expand Down Expand Up @@ -548,17 +555,15 @@ protected function dataImplode($data, &$map, $conjunctor)

foreach ($value as $index => $item)
{
$map_key .= 'L' . $index;

$item = strval($item);

if (!preg_match('/(\[.+\]|_|%.+|.+%)/', $item))
{
$item = '%' . $item . '%';
}

$like_clauses[] = $column . ($operator === '!~' ? ' NOT' : '') . ' LIKE ' . $map_key;
$map[ $map_key ] = [$item, PDO::PARAM_STR];
$like_clauses[] = $column . ($operator === '!~' ? ' NOT' : '') . ' LIKE ' . $map_key . 'L' . $index;
$map[ $map_key . 'L' . $index ] = [$item, PDO::PARAM_STR];
}

$wheres[] = '(' . implode($connector, $like_clauses) . ')';
Expand Down

0 comments on commit 8ee8ae1

Please sign in to comment.