Converting DBD::mysql to DBD::ADO

Converting DBD::mysql to DBD::ADO

am 12.02.2007 15:14:37 von markus.gruber

Hello!

At the moment i am convertig a system from mysql to a microsoft sql server 2005 database. Generally i had no problems with mysql and it is running stable and pretty quick. But while converting i ran into some problems:

- How can i get the insert id which is returned from the database after an insert-statement?
- Is there a trigger, that the system accepts empty fields? for example "update table set col1 = 'bla', col2 = '' where ...."

best wishes
Markus Gruber


Mit freundlichen Grüßen
Markus Gruber

Documatrix
Output- und Informationstechnologie
Consulting GmbH
Wagendorf 13
A-3443 Sieghartskirchen
+43 699 110 27 147
www.DocuMatrix.com
Markus.Gruber@DocuMatrix.com

Re: Converting DBD::mysql to DBD::ADO

am 12.02.2007 15:29:47 von ulisses.montenegro

On Monday 12 February 2007 11:14, Markus.Gruber wrote:
> Hello!
>
> At the moment i am convertig a system from mysql to a microsoft sql server
> 2005 database. Generally i had no problems with mysql and it is running
> stable and pretty quick. But while converting i ran into some problems:
>
> - How can i get the insert id which is returned from the database after an
> insert-statement?

=46rom perldoc DBD::mysql:

* mysql_insertid
MySQL has the ability to choose unique key values automatically. If this=20
happened, the new ID will be stored in this attribute. An alternative way f=
or=20
accessing this attribute is via $dbh->{â€=99mysql_insertidâ€=99}. =
(Note we are using=20
the $dbh in this case!)

> - Is there a trigger, that the system accepts empty=20
> fields? for example "update table set col1 =3D 'bla', col2 =3D '' where .=
.."

I am not sure I understand your question here... You want to know about MyS=
QL=20
support for triggers, or DBD::mysql?

> best wishes
> Markus Gruber
>
>
> Mit freundlichen Grüßen
> Markus Gruber
>
> Documatrix
> Output- und Informationstechnologie
> Consulting GmbH
> Wagendorf 13
> A-3443 Sieghartskirchen
> +43 699 110 27 147
> www.DocuMatrix.com
> Markus.Gruber@DocuMatrix.com

=2D-=20
"But would I be a good Messaih with my low self-esteem?
If I don't believe in myself would that be blasphemy?"
[Hell Yeah, The Bloodhound Gang]

AW: Re: Converting DBD::mysql to DBD::ADO

am 12.02.2007 15:50:08 von markus.gruber

Hello!

i think i've explaned my problem not clear.

the system is currently running with mysql nearly perfect.

and now i have to convert it to mssql2005.
and there i have got those problems.
is there an according value to $dbh->{mysql_insertid}?

and the second problem is, that if there is one empty column at insert or update statements the system does not execute them.
is there a possibility to deactivate this "feature".

lg
Markus Gruber


-----Original Nachricht-----
From: Ulisses Reina Montenegro de Albuquerque ulisses.montenegro@gmail.com
Date: Mon, 12 Feb 2007 14:29:47 +0100
To: dbi-users@perl.org, Markus.Gruber markus.gruber@documatrix.com
Subject: Re: Converting DBD::mysql to DBD::ADO

> On Monday 12 February 2007 11:14, Markus.Gruber wrote:
> > Hello!
> >
> > At the moment i am convertig a system from mysql to a microsoft sql server
> > 2005 database. Generally i had no problems with mysql and it is running
> > stable and pretty quick. But while converting i ran into some problems:
> >
> > - How can i get the insert id which is returned from the database after an
> > insert-statement?
>
> From perldoc DBD::mysql:
>
> * mysql_insertid
> MySQL has the ability to choose unique key values automatically. If this
> happened, the new ID will be stored in this attribute. An alternative way for
> accessing this attribute is via $dbh->{’mysql_insertid’}. (Note we are using
> the $dbh in this case!)
>
> > - Is there a trigger, that the system accepts empty
> > fields? for example "update table set col1 = 'bla', col2 = '' where ...."
>
> I am not sure I understand your question here... You want to know about MySQL
> support for triggers, or DBD::mysql?
>
> > best wishes
> > Markus Gruber
> >
> >
> > Mit freundlichen Grüßen
> > Markus Gruber
> >
> > Documatrix
> > Output- und Informationstechnologie
> > Consulting GmbH
> > Wagendorf 13
> > A-3443 Sieghartskirchen
> > +43 699 110 27 147
> > www.DocuMatrix.com
> > Markus.Gruber@DocuMatrix.com
>
> --
> "But would I be a good Messaih with my low self-esteem?
> If I don't believe in myself would that be blasphemy?"
> [Hell Yeah, The Bloodhound Gang]
>

Mit freundlichen Grüßen
Markus Gruber

Documatrix
Output- und Informationstechnologie
Consulting GmbH
Wagendorf 13
A-3443 Sieghartskirchen
+43 699 110 27 147
www.DocuMatrix.com
Markus.Gruber@DocuMatrix.com

Re: Converting DBD::mysql to DBD::ADO

am 12.02.2007 16:03:38 von sgoeldner

Markus.Gruber wrote:

> - How can i get the insert id which is returned from the database after an insert-statement?

DBD::ADO doesn't support last_insert_id(), because there is no generic way to
implement it.
For a MS SQL Server specific way, see e.g. @@IDENTITY:




Steffen