[CDBI] Re: ODBC / MS Access Carriage Return Problems

James Hargreaves james.hargreaves at gmail.com
Fri Dec 15 18:11:53 GMT 2006


Oh! Now I have just tried again, WITHOUT any carriage returns and it
STILL doesn't work!?! Must be something else? Here is the error
message:

DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access
Driver]Invalid precision value  (SQL-HY104)(DBD:
_rebind_ph/SQLBindParameter err=-1) [for Statement "INSERT INTO
newsitems (created, summary, story, title, news_category,
news_item_id)
VALUES (?, ?, ?, ?, ?, ?)
" with ParamValues: 6=undef, 1='2006-12-15', 4=undef, 3='ai oiauoiuai
ia oaieu oiue ie oiu ao ai oiauoiuai ia oaieu oiue ie oiu ao ai
oiauoiuai ia oaieu oiue ie oiu ao ai oiauoiuai ia oaieu oiue ie oiu ao
ai oiauoiuai ia oaieu oiue ie oiu ao ai oiauoiuai ia oaieu oiue ie oiu
ao ai oiauoiuai ia oaieu oiue ie oiu ao ai oiauoiuai ia oaieu oiue ie
oiu ao ai', 2='ai oiauoiuai ia oaieu oiue ie oiu ao ', 5=undef] at
C:/Perl/site/lib/DBIx/ContextualFetch.pm line 52.

And here is the object:

obj : $VAR1 = {
          'created' => '2006-12-15',
          'story' => 'ai oiauoiuai ia oaieu oiue ie oiu ao ai
oiauoiuai ia oaieu oiue ie oiu ao ai oiauoiuai ia oaieu oiue ie oiu ao
ai oiauoiuai ia oaieu oiue ie oiu ao ai oiauoiuai ia oaieu oiue ie oiu
ao ai oiauoiuai ia oaieu oiue ie oiu ao ai oiauoiuai ia oaieu oiue ie
oiu ao ai oiauoiuai ia oaieu oiue ie oiu ao ai',
          'summary' => 'ai oiauoiuai ia oaieu oiue ie oiu ao ',
          'title' => 'Test News Item 3',
          'news_category' => '12',
          'news_item_id' => '48850a63ed09ab063dc9cd199beff7ea'
        };

Any help would be much appreciated!

Thanks
Jay

On 15/12/06, James Hargreaves <james.hargreaves at gmail.com> wrote:
> Hi everyone!
>
> I'm having a bit of a problem with inserting data with carriage
> returns into an MS Access database (via ODBC). If I remove the
> carriage returns from my input it works fine, hence why I think there
> is a problem. The error I receive is as follows:
>
> DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access
> Driver]Invalid precision value  (SQL-HY104)(DBD:
> _rebind_ph/SQLBindParameter err=-1) [for Statement "INSERT INTO
> newsitems (created, summary, story, title, news_category,
> news_item_id)
> VALUES (?, ?, ?, ?, ?, ?)
> " with ParamValues: 6=undef, 1='2006-12-15', 4=undef, 3='e eiua oei
> aoiue aiue oiau aoieuaoi eoaiue io e eiua oei aoiue aiue oiau aoieuaoi
> eoaiue io e eiua oei aoiue aiue oiau aoieuaoi eoaiue io e eiua oei
> aoiue aiue oiau aoieuaoi eoaiue io e eiua oei aoiue aiue oiau aoieuaoi
> eoaiue io
>
> aoiua oiua oiua iou oai uoiau oaiu', 2='aoiu eoiua eoiue oia eiuao i
> eoiu a', 5=undef] at C:/Perl/site/lib/DBIx/ContextualFetch.pm line 52.
>
> The statement works fine when I use MySQL as the backend database. I
> don't think I should have to do the quoting myself for this - I would
> have thought Class::DBI (well actually I'm using Class::DBI::MSAccess)
> would do all that for me? The code where the problem occurs is fairly
> simple:
>
>   $s->debug .= $s->functions->dump($obj, 'obj');
>
>   unless (eval { $module->create($obj) })
>   { $MyPackage::errstr = $s->functions->handle_error($@);
>     return undef;
>   }
>
> Has anyone got any idea why this doesn't work? Is there an easy fix,
> without trying to quote the fields manually?
>
> Another question - I note in the error message there are numerous
> 'undef' fields in the ParamValues list. These values are not undef -
> as you can see from the object dump just prior to the create call:
>
> obj : $VAR1 = {
>           'created' => '2006-12-15',
>           'story' => 'e eiua oei aoiue aiue oiau aoieuaoi eoaiue io e
> eiua oei aoiue aiue oiau aoieuaoi eoaiue io e eiua oei aoiue aiue oiau
> aoieuaoi eoaiue io e eiua oei aoiue aiue oiau aoieuaoi eoaiue io e
> eiua oei aoiue aiue oiau aoieuaoi eoaiue io
>
> aoiua oiua oiua iou oai uoiau oaiu',
>           'summary' => 'aoiu eoiua eoiue oia eiuao i eoiu a',
>           'title' => 'Test News Item 2',
>           'news_category' => '13',
>           'news_item_id' => '89329dfb745e7d76a5b93cc3798a21b1'
>         };
>
> Does anyone know what might be going on here? Is this a problem?? Or
> is it caused by the carriage return problem above? As I say, it all
> works fine with MySQL and if I remove the carriage returns...
>
> Thanks
> Jay
>
> --
> Bingo, bango, boshthedog.com
>


-- 
Bingo, bango, boshthedog.com



More information about the ClassDBI mailing list