Skip to content

getCompiledSelect() return query without binds #1526

Description

@nowackipawel

*alpha2.

Just close it if this is not an error :)
According to: https://codeigniter4.github.io/CodeIgniter4/database/query_builder.html I wrote:


				$db = \Config\Database::connect(DB_ZTO_GROUP);
				$builder = $db->table(self::$multiRelation[$relation_name]['table']);
				$builder
					->select($relation_name . '_' .self::$multiRelation[$relation_name][$as_rev?'to':'from'][0])
					->{$in_relation ? 'whereIn' : 'whereNotIn'}(
						$relation_name  . '_' . self::$multiRelation[$relation_name][$as_rev?'from':'to'][0],
						$values
					);

				d($builder->getCompiledSelect()); 

but d() prints:

SELECT `fcs2fct_fcs_identifier`
FROM `t_file_conversion_set2t_file_conversion_task`
WHERE `fcs2fct_fct_identifier` IN :fcs2fct_fct_identifier:

instead of:


SELECT `fcs2fct_fcs_identifier`
FROM `t_file_conversion_set2t_file_conversion_task`
WHERE `fcs2fct_fct_identifier` IN ('val1','val2')

I checked it and $values contains val1 and val2. Shouldn't getCompiledSelect returns sql with binded values? Docs : "Compiles the selection query just like $builder->get() but does not run the query. This method simply returns the SQL query as a string."

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    databaseIssues or pull requests that affect the database layer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions