We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi guys, have a problem prepared queries on update binds. I use postgresql
// core/Database/Query -> setQuery() result echo debug($this->originalQueryString);
UPDATE user_profile SET deleted_id = :deleted_id, delete_date = :delete_date, status = :status WHERE user_id = :user_id: 1 1
Last / core/Database/Postgre/PreparedQuery -> _prepare() result $sql var_dump result 1
get results not problem;
$binds = []; $binds[':deleted_id'] = null; $binds[':user_id'] = 2; $binds[':status'] = 1; $binds[':delete_date'] = null;
$query = $this->db->prepare(function($db) { return $db->table('user_profile', false) ->set('deleted_id', ':deleted_id', false) ->set('delete_date', ':delete_date', false) ->set('status', ':status', false) ->where('user_id', ':user_id', false) ->update(); });
$query->execute($binds);
The text was updated successfully, but these errors were encountered:
@byazrail Try this first. :bind: https://bcit-ci.github.io/CodeIgniter4/database/queries.html?highlight=bind#named-bindings
UPDATE user_profile SET deleted_id = :deleted_id:, delete_date = :delete_date:, status = :status: WHERE user_id = :user_id:
Sorry, something went wrong.
What @JakeAi said. Binds in recent times have used a colon both before and after the variable.
No branches or pull requests
Hi guys,
have a problem prepared queries on update binds.
I use postgresql
// core/Database/Query -> setQuery() result
echo debug($this->originalQueryString);
UPDATE user_profile SET deleted_id = :deleted_id, delete_date = :delete_date, status = :status
WHERE user_id = :user_id:
1
1
Last / core/Database/Postgre/PreparedQuery -> _prepare() result
$sql var_dump result
1
get results not problem;
$binds = [];
$binds[':deleted_id'] = null;
$binds[':user_id'] = 2;
$binds[':status'] = 1;
$binds[':delete_date'] = null;
$query = $this->db->prepare(function($db)
{
return $db->table('user_profile', false)
->set('deleted_id', ':deleted_id', false)
->set('delete_date', ':delete_date', false)
->set('status', ':status', false)
->where('user_id', ':user_id', false)
->update();
});
$query->execute($binds);
The text was updated successfully, but these errors were encountered: