Welcome Guest, Not a member yet? Register   Sign In
CodeIgnitor 2.x database class
#1

[eluser]ZeusChicago[/eluser]
Pulling my hair out here (and I think..think I found a bug)
Code:
$sqlVehicleInsert = "INSERT INTO
                                ".$this->db_prefix."vehicles.vehicles(
                                    vin_crc
                                    ,vin
                                    ,stock_crc
                                    ,stock
                                    ,flag_active
                                    ,flag_sold
                                    ,flag_new
                                    ,flag_certified
                                    ,flag_special
                                    ,flag_oneowner
                                    ,flag_home
                                    ,time_create
                                    ,time_update
                                    ,time_instock
                                    ,time_sold
                                    ,time_inactive
                                    ,source_id
                                    ,dealer_id
                                    ,location_id
                                    ,switchboard_id
                                    ,year
                                    ,make_refid
                                    ,model_refid
                                    ,modelnumber_refid
                                    ,miles
                                    ,doors
                                    ,passengers
                                    ,wheelbase
                                    ,evox_vif
                                    ,body_refid
                                    ,trim_refid
                                    ,style_refid
                                    ,style_brief_refid
                                    ,class_refid
                                    ,color_ext_refid
                                    ,color_ext_generic_refid
                                    ,color_ext_code_refid
                                    ,color_ext_hex
                                    ,color_int_refid
                                    ,color_int_generic_refid
                                    ,color_int_code_refid
                                    ,color_int_hex
                                    ,upholstery_refid
                                    ,engine_cylinders_refid
                                    ,mpg_city    
                                    ,mpg_highway)VALUES(CRC32(?),?,CRC32(?),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

$parmsVehicleInsert = array(
                            $this->vehicle_data->vin
                            ,$this->vehicle_data->vin
                            ,$this->vehicle_data->stock
                            ,$this->vehicle_data->stock
                            ,$this->vehicle_data->time_create
                            ,$this->vehicle_data->time_update
                            ,$this->vehicle_data->time_instock
                            ,$this->vehicle_data->time_sold
                            ,$this->vehicle_data->time_inactive
                            ,$this->vehicle_data->source_id
                            ,$this->vehicle_data->dealer_id
                            ,$this->vehicle_data->location_id
                            ,$this->vehicle_data->switchboard_id
                            ,$this->vehicle_data->year
                            ,$this->vehicle_data->make_refid
                            ,$this->vehicle_data->model_refid
                            ,$this->vehicle_data->modelnumber_refid
                            ,$this->vehicle_data->miles
                            ,$this->vehicle_data->doors
                            ,$this->vehicle_data->passengers
                            ,$this->vehicle_data->wheelbase
                            ,$this->vehicle_data->evox_vif
                            ,$this->vehicle_data->body_refid
                            ,$this->vehicle_data->trim_refid
                            ,$this->vehicle_data->style_refid
                            ,$this->vehicle_data->style_brief_refid
                            ,$this->vehicle_data->class_refid
                            ,$this->vehicle_data->color_ext_refid
                            ,$this->vehicle_data->color_ext_generic_refid
                            ,$this->vehicle_data->color_ext_code_refid
                            ,$this->vehicle_data->color_ext_hex
                            ,$this->vehicle_data->color_int_refid
                            ,$this->vehicle_data->color_int_generic_refid
                            ,$this->vehicle_data->color_int_code_refid
                            ,'xxxxxx' //,$this->vehicle_data->color_int_hex
                            ,$this->vehicle_data->upholstery_refid
                            ,$this->vehicle_data->engine_cylinders_refid
                            ,$this->vehicle_data->mpg_city
                            ,$this->vehicle_data->mpg_highway
                        );
$this->db->query($sqlVehicleInsert,$parmsVehicleInsert);

is giving me
#2

[eluser]ZeusChicago[/eluser]
is giving me
Code:
A Database Error Occurred
Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 48

INSERT INTO vehicles.vehicles( vin_crc ,vin ,stock_crc ,stock ,flag_active ,flag_sold ,flag_new ,flag_certified ,flag_special ,flag_oneowner ,flag_home ,time_create ,time_update ,time_instock ,time_sold ,time_inactive ,source_id ,dealer_id ,location_id ,switchboard_id ,year ,make_refid ,model_refid ,modelnumber_refid ,miles ,doors ,passengers ,wheelbase ,evox_vif ,body_refid ,trim_refid ,style_refid ,style_brief_refid ,class_refid ,color_ext_refid ,color_ext_generic_refid ,color_ext_code_refid ,color_ext_hex ,color_int_refid ,color_int_generic_refid ,color_int_code_refid ,color_int_hex ,upholstery_refid ,engine_cylinders_refid ,mpg_city     ,mpg_highway)VALUES(CRC32('2g1fb1edxb9161205'),'2g1fb1edxb9161205',CRC32('c11312'),'c11312','4/9/2011 2:11:13 am','5/5/2011 2:41:06 am','4/8/2011 12:00:00 am',NULL,NULL,NULL,NULL,NULL,NULL,2011,'1','1','1',0,'2',4,'112.3','6815','1','95','69',NULL,NULL,'49','4','45','c50415','9','2',NULL,'xxxxxx',NULL,'3',17,28,

Filename: models/vehiclemodel.php

Line Number: 1368
#3

[eluser]ZeusChicago[/eluser]
IF you look @ the sql its trying to execute in the error message, its not complete. I have matched up the fields to ? a dozen times, and I know I dont have extra. Has anyone else seen this?

CI 2.x and mysqli driver
#4

[eluser]ZeusChicago[/eluser]
I went and turned on the general mysql log and this is whats trying to get executed
Code:
INSERT INTO
                                                                vehicles.vehicles(
                                                                        vin_crc
                                                                        ,vin
                                                                        ,stock_crc
                                                                        ,stock
                                                                        ,flag_active
                                                                        ,flag_sold
                                                                        ,flag_new
                                                                        ,flag_certified
                                                                        ,flag_special
                                                                        ,flag_oneowner
                                                                        ,flag_home
                                                                        ,time_create
                                                                        ,time_update
                                                                        ,time_instock
                                                                        ,time_sold
                                                                        ,time_inactive
                                                                        ,source_id
                                                                        ,dealer_id
                                                                        ,location_id
                                                                        ,switchboard_id
                                                                        ,year
                                                                        ,make_refid
                                                                        ,model_refid
                                                                        ,modelnumber_refid
                                                                        ,miles
                                                                        ,doors
                                                                        ,passengers
                                                                        ,wheelbase
                                                                        ,evox_vif
                                                                        ,body_refid
                                                                        ,trim_refid
                                                                        ,style_refid
                                                                        ,style_brief_refid
                                                                        ,class_refid
                                                                        ,color_ext_refid
                                                                        ,color_ext_generic_refid
                                                                        ,color_ext_code_refid
                                                                        ,color_ext_hex
                                                                        ,color_int_refid
                                                                        ,color_int_generic_refid
                                                                        ,color_int_code_refid
                                                                        ,color_int_hex
                                                                        ,upholstery_refid
                                                                        ,engine_cylinders_refid
                                                                        ,mpg_city
                                                                        ,mpg_highway)VALUES(CRC32('2g1fb1edxb9161205'),'2g1fb1edxb9161205',CRC32('c11312'),'c11312','4/9/2011 2:11:13 am','5/5/2011 2:41:06 am','4/8/2011 12:00:00 am',NULL,NULL,NULL,NULL,NULL,NULL,2011,'1','1','1',0,'2',4,'112.3','6815','1','95','69',NULL,NULL,'49','4','45','c50415','9','2',NULL,'xxxxxx',NULL,'3',17,28,
#5

[eluser]ZeusChicago[/eluser]
Blah, scratch this. After working on it for way to long, I turned my monitor off and took a nap, woke up and found I was missing some of my entries in the parms array, no mater how many times my brain told me they matched up before :-x

Jim




Theme © iAndrew 2016 - Forum software by © MyBB