Changes Version 2.72: 2003-09-03 Moved DBD::ADO::TypeInfo from DBD/ADO.pm to DBD/ADO/TypeInfo.pm. Fixed number of tests at t\15func.t. Fixed warning 'Use of uninitialized value in string eq at t\02simple.t line 54'. Changes Version 2.71: 2003-08-31 New maintainer: Steffen Goeldner . Changes Version 2.7: Thu Aug 21 23:10:50 EDT 2003 Bug fix from Yimin Zheng regarding undef/null values passed as parameters to bind_param and/or execute Thanks Yimin. Enhancement to Meta Data support from Steffen Goeldner. Thanks Steffen. Modified all tests to skip if DBI_DSN is not defined. This should allow the automatic CPAN build at ActiveState to create a PPM for DBD::ADO Did minor clean up in the test and warning messages for uninitialized values. Changes Version 2.6: So what happened to the notes for 2.6? Changes Version 2.5: Mon Apr 8, 2002 23:00:39 Bug fix from Jacqui Caren , apply to bind image. Meta Data support from Steffen Goeldner. Includes: get_info Improved table_info column_info primary_key_info foreign_key_info Improved ADO to ODBC type conversions. package DBD::ADO::TypeInfo from Steffen Goeldner, however none of the current code is using this package, yet. Remove temp constants needed until DBI support SQL_* values. Added more tests. Changes Version 2.4: Tue Oct 23 23:25:42 EDT 2001 Patch for supporting primary_key_info from Steffen Goeldner Thanks Steffen! Bug in function call to openschema from Steffen Goeldner Thanks Steffen! Added support for CursorType. Fixed error messages to return more meaningful numbers. Fixed Nullable attribute. Added more documentation. Modified most of the tests to use Test::More. Changes Version 2.1: Sat May 26 07:51:19 EDT 2001 First CPAN release apart from DBI. Version number correction. Patch from Simon Oliver: Warning messages from undefined values. New maintainer: Thomas Lowery tlowery@stlowery.com When emailing, make sure to include ADO in the subject line. NAME DBD::ADO - A DBI driver for Microsoft ADO (Active Data Objects) SYNOPSIS use DBI; $dbh = DBI->connect("dbi:ADO:dsn", $user, $passwd); Options in the connect string: dbi:ADO:dsn;CommandTimeout=60 (your number) dbi:ADO:dsn;ConnectTimeout=60 (your number) or include both ConnectTimeout and CommandTimeout. The dsn may be a standard ODBC dsn or a dsn-less. See the ADO documentation for more information on the dsn-less connection. # See the DBI module documentation for full details DESCRIPTION The DBD::ADO module supports ADO access on a Win32 machine. DBD::ADO is written to support the standard DBI interface to data sources. Connection $dbh = DBI->connect("dbi:ADO:dsn", $user, $passwd, $attribs); Connection supports dsn and dsn-less calls. $dbh = DBI->connect( "dbi:ADO:File Name=oracle.udl", $user, $passwd, {RaiseError => [0|1], PrintError => [0|1], AutoCommit => [0|1]}); In addition the following attributes may be set in the connect string: Attributes CommandTimeout ConnectionString ConnectionTimeout CursorLocation DefaultDatabase IsolationLevel Mode Provider WARNING: The application is responsible for passing the correct information when setting any of these attributes. Functions support Using the standard DBI function call $dbh->func( arguments, 'function name') You may access the following functions: (case sensitive) OpenSchema All functions return a valid statement handle upon success. OpenSchema supports the following arguments: Any valid ADO Schema name such as adSchemaCatalogs adSchemaIndexes adSchemaProviderTypes example: my $sth = $dbh->func( 'adSchemaProviderTypes', 'OpenSchema' ); Enhanced DBI Methods prepare The prepare methods allows attributes: (from DBI) "prepare" $sth = $dbh->prepare($statement) or die $dbh->errstr; $sth = $dbh->prepare($statement, \%attr) or die $dbh->errstr; prepare supports setting the CursorType. $sth = $dbh->prepare( $statement, { CursorType => 'adOpenForwardOnly' } ) ... Cursortypes adOpenForwardOnly(default), adOpenKeyset, adOpenDynamic, adOpenStatic When using a statement handle within a statement handle: while( my $table = $sth1->fetchrow_hashref ) { ... my $col = $sth2->fetchrow_hashref; ... } It may be necessary to prepare the statement using CursorType => adOpenStatic. Changing the CursorType is a solution to the following problem. Can't execute statement 'select * from authors': Lasterror: -2147467259: OLE exception from "Microsoft OLE DB Provider for SQL Server": Cannot create new connection because in manual or distributed transaction mode. Win32::OLE(0.1403) error 0x80004005: "Unspecified error" in METHOD/PROPERTYGET "Open" Description: Cannot create new connection because in manual or distributed transactio HelpContext: 0 HelpFile: NativeError: 0 Number: -2147467259 Source: Microsoft OLE DB Provider for SQL Server SQLState: table_info Warning: This method is experimental and may change or disappear. $sth = $dbh->table_info(\%attr); $sth = $dbh->table_info({ TABLE_TYPE => 'VIEW', ADO_Columns => 1, Trim_Catalog => 0, Filter => q{TABLE_NAME LIKE 'C%'}, }); Returns an active statement handle that can be used to fetch information about tables and views that exist in the database. By default the handle contains the columns described in the DBI documentation: TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS ADO_Columns Additional ADO-only fields will be included if the ADO_Columns attribute is set to true: %attr = (ADO_Columns => 1); Trim_Catalog Some ADO providers include path info in the TABLE_CAT column. This information will be trimmed if the Trim_Catalog attribute is set to true: %attr = (Trim_Catalog => 1); Criteria The ADO driver allows column criteria to be specified. In this way the record set can be restricted, for example, to only include tables of type 'VIEW': %attr = (TABLE_TYPE => 'VIEW') You can add criteria for any of the following columns: TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE Filter The ADO driver also allows the recordset to be filtered on a Criteria string: a string made up of one or more individual clauses concatenated with AND or OR operators. %attr = (Filter => q{TABLE_TYPE LIKE 'SYSTEM%'}) The criteria string is made up of clauses in the form FieldName-Operator-Value. This is more flexible than using column criteria in that the filter allows a number of operators: <, >, <=, >=, <>, =, or LIKE The Fieldname must be one of the ADO 'TABLES Rowset' column names: TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, DESCRIPTION, TABLE_GUID, TABLE_PROPID, DATE_CREATED, DATE_MODIFIED Value is the value with which you will compare the field values (for example, 'Smith', #8/24/95#, 12.345, or $50.00). Use single quotes with strings and pound signs (#) with dates. For numbers, you can use decimal points, dollar signs, and scientific notation. If Operator is LIKE, Value can use wildcards. Only the asterisk (*) and percent sign (%) wild cards are allowed, and they must be the last character in the string. Value cannot be null. tables Warning: This method is experimental and may change or disappear. @names = $dbh->tables(\%attr); Returns a list of table and view names. Accepts any of the attributes described in the the table_info manpage method: @names = $dbh->tables({ TABLE_TYPE => 'VIEW' }); Warnings Support for type_info_all is supported, however, you're not using a true OLE DB provider (using the MS OLE DB -> ODBC), the first hash may not be the "best" solution for the data type. adSchemaProviderTypes does provide for a "best match" column, however the MS OLE DB -> ODBC provider does not support the best match. Currently the types are sorted by DATA_TYPE BEST_MATCH IS_LONG ... ADO It is strongly recommended that you use the latest version of ADO (2.1 at the time this was written). You can download it from: http://www.microsoft.com/Data/download.htm AUTHORS Phlip and Tim Bunce. With many thanks to Jan Dubois and Jochen Wiedmann for additions, debuggery and general help. Special thanks to Thomas Lowery, who maintained this module 2001-2003. Current maintainer is Steffen Goeldner. SEE ALSO ADO Reference book: ADO 2.0 Programmer's Reference, David Sussman and Alex Homer, Wrox, ISBN 1-861001-83-5. If there's anything better please let me know. http://www.able-consulting.com/tech.htm