Converting DBD::mysql to DBD::ADO
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 [at] DocuMatrix.com
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?
=46rom 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 f=
or
accessing this attribute is via $dbh->{=E2=80=99mysql_insertid=E2=80=99}. =
(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 =3D 'bla', col2 =3D '' where .=
=2E.."
I am not sure I understand your question here... You want to know about MyS=
QL
support for triggers, or DBD::mysql?
> best wishes
> Markus Gruber
>
>
> Mit freundlichen Gr=C3=BC=C3=9Fen
> Markus Gruber
>
> Documatrix
> Output- und Informationstechnologie
> Consulting GmbH
> Wagendorf 13
> A-3443 Sieghartskirchen
> +43 699 110 27 147
> www.DocuMatrix.com
> Markus.Gruber [at] DocuMatrix.com
=2D-
"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]
Re: Converting DBD::mysql to DBD::ADO
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. [at] [at] IDENTITY:
<http://msdn2.microsoft.com/en-us/library/aa933167(sql.80,d=printer).aspx>
Steffen
AW: Re: Converting DBD::mysql to DBD::ADO
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 [at] gmail.com
Date: Mon, 12 Feb 2007 14:29:47 +0100
To: dbi-users [at] perl.org, Markus.Gruber markus.gruber [at] 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 [at] 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 [at] DocuMatrix.com