Skip to content

Commit

Permalink
Added support for binding parameters to Database_Query_Builder classe…
Browse files Browse the repository at this point in the history
…s, fixes #2388
  • Loading branch information
Woody Gilk committed Nov 28, 2009
1 parent 33407ab commit 65adda9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions classes/kohana/database/query/builder/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public function compile(Database $db)
$query .= ' WHERE '.Database_Query_Builder::compile_conditions($db, $this->_where);
}

if ($this->_parameters)
{
// Replace the bound parameters
$query = strtr($query, $this->_parameters);
}

return $query;
}

Expand Down
6 changes: 6 additions & 0 deletions classes/kohana/database/query/builder/insert.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ public function compile(Database $db)
$query .= (string) $this->_values;
}

if ($this->_parameters)
{
// Replace the bound parameters
$query = strtr($query, $this->_parameters);
}

return $query;
}

Expand Down
6 changes: 6 additions & 0 deletions classes/kohana/database/query/builder/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ public function compile(Database $db)
$query .= ' OFFSET '.$this->_offset;
}

if ($this->_parameters)
{
// Replace the bound parameters
$query = strtr($query, $this->_parameters);
}

return $query;
}

Expand Down
6 changes: 6 additions & 0 deletions classes/kohana/database/query/builder/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public function compile(Database $db)
$query .= ' WHERE '.Database_Query_Builder::compile_conditions($db, $this->_where);
}

if ($this->_parameters)
{
// Replace the bound parameters
$query = strtr($query, $this->_parameters);
}

return $query;
}

Expand Down

0 comments on commit 65adda9

Please sign in to comment.