11-306 GREGHIN WHATSNEWINADO2DOT5.PPT

advertisement
What’s new in ADO 2.5
Greg Hinkel
Program Manager
Data Access Group
greghin@microsoft.com
Agenda







Quick overview
Semi-structured Data
URL binding
Record Object
Changes to the Fields collection
Stream Object
Performance and XML
ADO Overview




A powerful consumer interface
Flexible
Works with many languages
High Performance with a simple
Object Model
ADO 2.1 - Object Model
Errors
Command
Connection
Recordset
Parameters
Fields
Semi-structured data

What is it?




Non-rectangular
Structured
navigatable
Examples:



A file system
Mail in a public folder or inbox
Web pages or document store
Semi-structured data(cont.)

Tree structured


Each node has a set of properties



Can have arbitrary depth
Each node may have a different set of
properties or attributes
Non-leaf nodes are collections
Leaf-nodes have interesting content
Working with semi-structured
data

Properties


Scoped Operations


Move, Copy, Delete apply to all contained
items
Querying


Get, Set, Add and Delete
Find items that satisfy search criteria
Must be efficient
ADO 2.5 - Design Goals




Keep it simple!
Allow the use of URLs
Do scoped operations
Manipulate text or binary streams
ADO 2.5 - Object Model
Errors
Command
Connection
Recordset
Record
Parameters
Fields
Stream
Semi-structured data and
ADO 2.5


Recordsets
 Rectangular
 Properties as fields
 Directories, files
Record
 Properties as fields, only more
 Superset of recordset fields
 Collection or file
 Can use a Stream object
URL binding

URLs identify objects



URL binding for





nodes
Individual files
Connection
Recordset
Record
Stream
The RootBinder cracks URLs
Dim conn As New Connection
Dim rec As New Record
Dim rec2 As New Record
conn.Open "URL=http://MC/davfs/"
rec.Open "TestFolder", conn
rec2.Open " TestFolder ", _
"URL=https://MC/davfs/“
Record Object







adCollectionRecord or
adSimpleRecord
Folders, files
A row of a recordset
Contents exposed as a stream
Has a collection of properties
Scopes operations
Use GetChildren to obtain a recordset
Opening a Record Object


URL binding
 rec.Open "bingo.txt", _
"URL=http://MC/davfs/“
 rec.Open , _
"URL=http://MC/davfs/bingo.txt“
 rec.Open “bingo.txt”, conn
From a recordset
 rec.Open rs
Record Properties






ActiveConnection
Mode
Access rights
ParentURL
RecordType
Simple record,
collection or structured document
State
Open, closed, fetching
Source
URL or rs
Record Methods







Cancel
Close
CopyRecord
DeleteRecord
MoveRecord
GetChildren
Open
Dim rec As New Record
Dim rs As New Recordset
rec.Open "TestFolder", _
"URL=http://MC/davfs/”
if rec.RecordType = adRecCollection then
Set rs = rec.GetChildren
‘do stuff with recordset
end if
Fields of a Record object

A field is a property




Title, size, last modified time, Subject, To,
CC, BCC
Fields are a collection on the record
object
Similar to the recordset’s field
collection
Can add, delete or change values
Dim rec As New Record
Dim fld As Field
rec.Open “TestFolder", _
"URL=http://MC/davfs"
‘loop thru the fields
For Each fld In rec.Fields
Debug.Print fld.Name, " = ", fld.Value
Next
The Recordset Object






Container of items
Tabular rather than tree view
Contains “common” properties
Use record to view “uncommon”
properties
Open directly or use GetChildren
Use Record and Recordset for
navigation
Variable number of Fields

Each row contained in a recordset
may have a different set of columns




Must share “common” properties
Superset of the recordset’s fields
collection
Add/delete fields from a record object
But only for fields that are unique to that
record
Dim rs As New Recordset
Dim rec As New Record
rs.Open “TestFolder", _
"URL=http://MC/davfs"
While Not rs.EOF
rec.Open rs
Debug.Print rec.Fields.Count
rec.Close
rs.MoveNext
Wend
The Fields collection

New or changed methods




Append Optionally provide the value
Update
CancelUpdate
Resync Retrieves values from the data
store
rec.Open "bingo.txt", "URL=http://MC/davfs/"
rec.Fields.Append "AssignedTo", adChar, _
30, adFldIsNullable, "Tim Brown"
rec.Fields.Append "Processed", adBoolean, , ,
False
rec.Fields.Update
rec.Open "bingo.txt", "URL=http://MC/davfs/"
rec.Fields("AssignedTo") = "Tim Brown"
rec.Fields("Processed") = False
rec.Fields.Update
Field object changes

New Properties
 Status
 Type
adDefaultStream,
adRecordURL
 OriginalValue
 UnderlyingValue
Stream Object



Binary or text stream
Implemented on top of IStream
interface
Leaf records have a default
stream, adDefaultStream


content of an email message
Contents of a file
Stream Properties

Charset
Specifies the character set

EOS

LineSeparator

Mode

Position

Size

State
open, closed or fetching

Type
binary or text
Access permissions
Stream Methods (1 of 2)

Cancel

Close

CopyTo

Flush

LoadFromFile

Open
another stream
Stream Methods (2 of 2)

Read
binary

ReadText
numchars or adReadLine

SaveToFile
adSaveCreateOverWrite

SetEOS

SkipLine

Write
binary

WriteText
adWriteLine
Dim strm As New Stream
strm.Open
strm.LoadFromFile _
"C:\inetpub\davfs\bingo.txt"
Debug.Print strm.Size
Debug.Print strm.Type 'adTypeText
strm.Charset = "ascii"
Debug.Print strm.ReadText
strm.SaveToFile "C:\CopyOfBingo.txt"
Performance





Faster than ADO 2.1
Improved scripting language
performance
Much better on multiple processor
machines
Windows 2000 will have an IMDB
provider
ADO Performance Tuning (11-311)
XML

ASP



File





rs.Save “C:\authors.xml”, adPersistXML
rs2.Open “C:\authors.xml”
Stream


rs.Save Response, adPersistXML
rs2.Open Request
rs.Save strm, adPersistXML
rs2.Open strm
Can save a recordset into DOM
Shape, can now save as XML
ADO 2.5 - Summary




Extends ADO to work with semistructured data provided by OLE DB
2.5 providers
Enables web-publishing and
document management
Performance gains and increased XML
capabilities
MDAC 2.5 shipping with Windows
2000


Available in Beta3
Some changes post Beta3
Feedback and Information
Newsgroups and web site:
 http://www.microsoft.com/data/
 microsoft.public.data.oledb
 microsoft.public.data.ado
 microsoft.public.data.ado.rds
Feedback
 MDAC: mdac@microsoft.com
 ADO: adodoc@microsoft.com
 OLE DB: oledbdoc@microsoft.com
 ODBC: odbcdoc@microsoft.com
Tech Ed Data Sessions

ADO for Non-Database Developers
(11-404)





ADO Performance Tuning (11-311)
COM Database Programming: High
Speed Data Access from Visual C++®
Via OLE DB (11-321)
New XML Integration Features with
ADO 2.5 (11-314)
Understanding OLE DB 2.5 (11-402)
What's New in ADO 2.5 (11-306 )
Download