CodeIgniter Forums
CI 3: query builder - php error - preg_match(): Compilation failed - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: CI 3: query builder - php error - preg_match(): Compilation failed (/showthread.php?tid=1169)



CI 3: query builder - php error - preg_match(): Compilation failed - navihtot - 02-16-2015

Hi i'm getting this php error. Is this an bug or am I doing something wrong?
Code:
A PHP Error was encountered

Severity: Warning

Message: preg_match(): Compilation failed: regular expression is too large at offset 35702

Filename: database/DB_query_builder.php

Line Number: 2316



RE: CI 3: query builder - php error - preg_match(): Compilation failed - InsiteFX - 02-16-2015

And what code is giving you the error?


RE: CI 3: query builder - php error - preg_match(): Compilation failed - navihtot - 02-17-2015

I'm doing many joins etc. with query builder:

Code:
//select
$this->db->select('pc_workload_execution.id, pc_workload_execution.pc_study_class_executors_id as executor, pc_studies.id as studies_id, pc_studies.study_finance_code, pc_studies.title_hr as study_title, pc_studies.study_level_execution_type, hr_employee.id as hr_employee_id, hr_employee.firstname, hr_employee.lastname, hr_employee.old_sys_id, hr_employee.hr_employment_status_id, val_pc_katedre.print_title, val_pc_katedre.katedra_finance_code, val_pc_katedre.id as katedra_id, pc_classes_workload_semester.class_type_id as class_type, val_class_type.code_hr as class_type_code, pc_classes_workload_semester.finance_coef as finance_coef');

//join
$this->db->join('pc_study_class_executors', 'pc_study_class_executors.id = pc_workload_execution.pc_study_class_executors_id');
$this->db->join('pc_classes_workload_semester', 'pc_classes_workload_semester.id = pc_study_class_executors.pc_study_class_workload_semester_id');
$this->db->join('pc_study_mandatory_classes', 'pc_study_mandatory_classes.id = pc_classes_workload_semester.pc_study_mandatory_classes_id');
$this->db->join('pc_studies', 'pc_studies.id = pc_study_mandatory_classes.pc_studies_id');
$this->db->join('pc_classes', 'pc_classes.id = pc_study_mandatory_classes.pc_classes_id');
$this->db->join('val_pc_katedre', 'val_pc_katedre.id = pc_classes.katedra_holder_id');
$this->db->join('val_class_type', 'val_class_type.id = pc_classes_workload_semester.class_type_id');
$this->db->join('hr_employee', 'hr_employee.id = pc_study_class_executors.hr_employee_id');

//where
$this->db->where('pc_studies.id IN ('.$studies.')');
$this->db->where('pc_classes.katedra_holder_id IN ('.$katedre.')');
$this->db->where('pc_workload_execution.id NOT IN ('.$ignore_m_executions.')');
// $this->db->where('hr_employment_status_id IN ('.$hr_employment_statuses.')');

//order by
$this->db->order_by('studies_id', 'asc');

$data_mandatory = $this->db->get('pc_workload_execution');

and this is line from DB_query_builder.php which is giving error:

Code:
preg_match('/^(\(?)(.*)('.preg_quote($op, '/').')\s*(.*(?<!\)))?(\)?)$/i', $conditions[$ci], $matches))



RE: CI 3: query builder - php error - preg_match(): Compilation failed - Narf - 02-17-2015

... the query builder is not made for such complex queries, it's only supposed to help you with basic ones.

Just use query(), there's no reason not to in this case.


RE: CI 3: query builder - php error - preg_match(): Compilation failed - navihtot - 02-19-2015

(02-17-2015, 04:14 AM)Narf Wrote: ... the query builder is not made for such complex queries, it's only supposed to help you with basic ones.

Just use query(), there's no reason not to in this case.

Sad
Ok. tnx for reply...