Re: DBD::ADO: primary_key_info

2001-10-23 Thread Thomas A . Lowery

Thanks! I've a new release of DBD::ADO ready. I'll release it in
a few days.

Tom


-- 
Thomas A. Lowery
See DBI/FAQ http://tlowery.hypermart.net

_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




DBD::ADO: primary_key_info

2001-10-18 Thread Steffen Goeldner

Attached is a possible implementation for DBD::ADO.
I tested the following datasources:

 DBI_DSN=dbi:ADO:Provider=Microsoft.Jet.OLEDB.4.0;Data Source=test.mdb
 DBI_DSN=dbi:ADO:Provider=MSDAORA;Data Source=;User ID=;Password=


Steffen

*** ADO.pm.orig Mon Oct 15 08:21:42 2001
--- ADO.pm  Wed Oct 17 21:30:56 2001
***
*** 617,622 
--- 617,646 
$sth;
}
  
+   sub primary_key_info {
+   my( $dbh, @Criteria ) = @_;
+   my $QueryType = 'adSchemaPrimaryKeys';
+   my @Rows;
+   my $Cxn = $dbh-{ado_conn};
+   my $tmpCursorLocation = $Cxn-{CursorLocation};
+   $Cxn-{CursorLocation} = $ado_consts-{adUseClient};
+ 
+   my $RecSet = $Cxn-OpenSchema( $ado_consts-{$QueryType}, \@Criteria );
+   $RecSet-{Sort} = 'TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, ORDINAL';
+ 
+   while ( ! $RecSet-{EOF} ) {
+   my @Fields = map { $RecSet-Fields($_)-{Value} } ( 
+0,1,2,3,6,7 );
+   push( @Rows, \@Fields );
+   $RecSet-MoveNext;
+   }
+   $RecSet-Close; undef $RecSet;
+   $Cxn-{CursorLocation} = $tmpCursorLocation;
+ 
+   DBI-connect('dbi:Sponge:','','', { RaiseError = 1 })-prepare(
+   $QueryType, { rows = \@Rows, NAME =
+   [ qw( TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME KEY_SEQ 
+PK_NAME ) ]});
+   }
+ 
sub type_info_all {
my ($dbh) = @_;
my $names = {