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

john drago <john.drago-n6GNfI+Y5Nu/3pe1ocb+swC/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
Hi Jay,

Have you tried using a normal DBI object to do the insert?

Something along the lines of:

my $dbh = DBI->connect( @DSN );

my $sth = $dbh->prepare("INSERT INTO table (...) VALUES (...)");

$sth->execute( @values );

$sth->finish();

If *that* works, but the CDBI call doesn't, then it's obvious where the problem lies. If it doesn't work either, then you'll know where to start looking.

Regards,

John Drago

www.devstack.com

On Fri, 15 Dec 2006 18:18 , 'James Hargreaves' <[email protected]> sent:

Hey everyone!

I think the problem might be down to the LENGTH of the story field or

the INSERT string in general? The story field is a MEMO, which I

thought could be of any length? Is this incorrect? Does that help

anyone come to a conclusion?? Other than that I am quite annoying :)

Thanks

Jay

On 15/12/06, James Hargreaves <[email protected] > wrote:

> 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 <[email protected] > 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

>

--

Bingo, bango, boshthedog.com

_______________________________________________

ClassDBI mailing list

ClassDBI-Ra3b/[email protected]

http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

_______________________________________________
ClassDBI mailing list
ClassDBI-Ra3b/[email protected]
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.