Yes - I think there is a character escaping issue here but I cannot find it...
Does anyone out there have any ideas? On Sep 6, 12:03 pm, Sherif <sherifgmans...@gmail.com> wrote: > Interesting problem.. it sounds like maybe the Symfony task is > escaping something?... this is a strange one.. > > On Sep 3, 3:53 pm, wasabhi <abhinav.kesw...@gmail.com> wrote: > > > Hi there, > > > I'm developing in Symfony 1.2.4, using Propel and MySQL as my > > database. > > > I've written a task that: > > > 1. grabs a set of CSV files from a reporting source > > 2. uploads the CSV files using MySQL's 'load data infile ... ' syntax > > > It's step 2 above that is proving to be problematic. > > > The problem is that I keep getting an error saying, "SQLSTATE[42000]: > > Syntax error or access violation: 1148 The used command is not allowed > > with this MySQL version" > > > I write the query string to my debug log, cut n paste it into the CLI > > of MySQL and it executes perfectly. > > > The code: > > > $connection = Propel::getConnection(); > > > $taskLoad = "load data local infile '%s' into table task > > FIELDS > > terminated by ',' optionally enclosed by '\"' lines terminated by '\ > > \n' IGNORE 1 LINES (task_id, ord_type_code, actn_type_code, order_no, > > customer_name, product_desc, status, task_name, @rfs_rev_date, > > @ms_rev_date, @ms_signoff_date, signoff_person, ack_by, > > jeop_type_code, product_group, priority, actn_opt, sales_manager, > > work_group, @crd, crd_days, access, monitor, serv_comp_ind, designer, > > deps_signed_off, sales_reference, site_code, street, suburb, > > post_code, state, @last_dep_signoff, cnd_project) SET rfs_rev_date = > > str_to_date(@rfs_rev_date, '%%Y-%%m-%%d'), ms_rev_date = str_to_date > > (@ms_rev_date, '%%Y-%%m-%%d'), ms_signoff_date = str_to_date > > (@ms_signoff_date, '%%Y-%%m-%%d'), crd = str_to_date(@crd, '%%Y-%%m-% > > %d'), last_dep_signoff = str_to_date(@last_dep_signoff, '%%Y-%%m-% > > %d')"; > > > //note the dates have %% (to escape the %) when we do a > > sprintf() > > > $taskLoad = sprintf($taskLoad,$file); > > > > > sfContext::getInstance()->getLogger()->debug("{importCSVfiles} > > running this: ".$taskLoad); > > > try { > > $statement = $connection->prepare($taskLoad); > > $result = $statement->execute(); > > }catch (Exception $e){ > > > > sfContext::getInstance()->getLogger()->debug("{importCSVfiles} > > error ".$e->getMessage()); > > } > > > I've ensured that the user in question has been granted the global > > FILE permission in order to allow them to run 'load data infile ... '. > > > As mentioned above, the query I write to the debug log works just fine > > when executed via the CLI. > > > Any ideas where I could be going wrong? > > > Thanks for your help... > > @wasabhi --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---