From - Sun Jun 10 10:02:37 2001
Return-path: <gnade-dev-admin@cert.uni-stuttgart.de>
Envelope-to: michael.erdmann@snafu.de
Delivery-date: Sat, 02 Jun 2001 15:46:15 +0200
Received: from mail.snafu.de [213.73.102.4]
	by localhost with POP3 (fetchmail-5.5.0)
	for erdmann@localhost (single-drop); Fri, 01 Jun 2001 15:56:18 +0200 (CEST)
Received: from mercury.rus.uni-stuttgart.de ([129.69.1.226])
	by smart.visp-europe.psi.com with esmtp (Exim 3.22 #1)
	id 156BjL-0002Rp-00
	for michael.erdmann@snafu.de; Sat, 02 Jun 2001 15:46:15 +0200
Received: from localhost ([127.0.0.1] helo=mercury.rus.uni-stuttgart.de)
	by mercury.rus.uni-stuttgart.de with esmtp (Exim 3.12 #4)
	id 156Bj9-00065S-00; Sat, 02 Jun 2001 15:46:03 +0200
Received: from charybdis.rus.uni-stuttgart.de ([129.69.1.58])
	by mercury.rus.uni-stuttgart.de with esmtp (Exim 3.12 #4)
	id 156BiO-000658-00
	for gnade-dev@cert.uni-stuttgart.de; Sat, 02 Jun 2001 15:45:16 +0200
Received: from mail2.passagen.se (mail2.passagen.se [195.163.107.11])
	by charybdis.rus.uni-stuttgart.de with ESMTP id PAA27397
	for <gnade-dev@cert.uni-stuttgart.de>; Sat, 2 Jun 2001 15:45:25 +0200 (MET DST)
	env-from (sunef@hem.passagen.se)
Received: from sufhempc (t5o73p18.telia.com [213.64.24.18]) by mail2.passagen.se (8.9.3/8.9.3/1.22)
	with SMTP id <PAA20961> for <gnade-dev@cert.uni-stuttgart.de>; Sat, 2 Jun 2001 15:45:20 +0200 (MET DST)
Message-ID: <008301c0eb6a$5d6c4010$0c00a8c0@net.home>
From: "Sune Falck" <sunef@hem.passagen.se>
To: "gnade" <gnade-dev@cert.uni-stuttgart.de>
References: <2BCC6E341F63C543B83AB5BF1953268B03A52B@mewtu.familiepfeifer.de> <002801c0e94b$ff59d430$0c00a8c0@net.home> <3B168681.3BE239B2@snafu.de> <000c01c0ea04$d8cbfd70$0c00a8c0@net.home> <000701c0ea0a$b4b49540$0c00a8c0@net.home> <3B1778DA.56D42882@snafu.de>
Subject: Re: [Gnade-dev] GNADE where to go ? a
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by charybdis.rus.uni-stuttgart.de id PAA27397
Sender: gnade-dev-admin@cert.uni-stuttgart.de
Errors-To: gnade-dev-admin@cert.uni-stuttgart.de
X-BeenThere: gnade-dev@cert.uni-stuttgart.de
X-Mailman-Version: 2.0.1
Precedence: bulk
List-Help: <mailto:gnade-dev-request@cert.uni-stuttgart.de?subject=help>
List-Post: <mailto:gnade-dev@cert.uni-stuttgart.de>
List-Subscribe: <http://cert.uni-stuttgart.de/mailman/listinfo/gnade-dev>,
	<mailto:gnade-dev-request@cert.uni-stuttgart.de?subject=subscribe>
List-Id: Dev. issues of the GNU Ada Database Environment (GNADE) Project. <gnade-dev.cert.uni-stuttgart.de>
List-Unsubscribe: <http://cert.uni-stuttgart.de/mailman/listinfo/gnade-dev>,
	<mailto:gnade-dev-request@cert.uni-stuttgart.de?subject=unsubscribe>
List-Archive: <http://cert.uni-stuttgart.de/pipermail/gnade-dev/>
Date: Sat, 2 Jun 2001 15:46:00 +0200
X-UIDL: f907a14c5a6f7e0ab470a7ced6976ff8
X-Mozilla-Status: 8013
X-Mozilla-Status2: 00000000

----- Original Message -----
>From: "Michael Erdmann" <michael.erdmann@snafu.de>


>I have put your proposal into some packages. What
>do you think!

>J=FCrgen, Floarin  any objections against GNU.ADO? I dont
>like the name ADO which should mean "Ada Data Objects" ??!

>My idea would be to setup this abstract interface and
>make a test implementation using postgres and afterwards
>the ODBC interface.
-------------------------------------------------

My opinion is that it is going to fast into the coding phase - What I mis=
s
is a
fundamental discussion about the role and interaction of the different
objects.
Using formal packages with correct headers and so on just makes the
whole picture more difficult to grasp and understand at this moment (for
me).

I would prefer to stay in some kind of concise pseudo code until the desi=
gn
has matured.

One example - There is a fundamental difference between a query (select)
returning a result set and a sql statement doing a change to the database
(update/insert/delete) and only returning the number of affected rows.
The select is more like an Open of an existing file and the other operati=
ons
are
more direct Command actions. Should we handle the cases differently ?

In MS ADO there is no need for an explicit Command object when doing
a select returning a result set if there are no parameters. One can also
skip the connection object and give a valid connection string instead of
a pointer to a connection object as .ActiveConnection. Should we
strive for the same flexibility or should we only have one way to achieve
the result.

I see no need to duplicate MS ADO in Ada but the goal should be to
that the Ada Data Objects has a clean and simple to use design.

Sune Falck


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The following is from the doc of MS ADO 2.6.

The ADO Object Model

ADO requires only nine objects and four collections to provide its entire
functionality. The following table introduces them.

Connection object

Represents a unique session with a data source. In the case of a
client/server database system, it may be equivalent to an actual network
connection to the server. Depending on the functionality supported by the
provider, some collections, methods, or properties of a Connection object
may not be available.

Command object

Used to define a specific command, such as a SQL query, intended to run
against a data source.

Recordset object

Represents the entire set of records from a base table or the results of =
an
executed command. All Recordset objects consist of records (rows) and fie=
lds
(columns).

Record object

Represents a single row of data, either from a Recordset or from the
provider. This record could represent a database record or some other typ=
e
of object such as a file or directory, depending upon your provider.

Stream object

Represents a stream of binary or text data. For example, an XML document =
can
be loaded into a stream for command input or returned from certain provid=
ers
as the results of a query. A Stream object can be used to manipulate fiel=
ds
or records containing these streams of data.

Parameter object

Represents a parameter or argument associated with a Command object, base=
d
on a parameterized query or stored procedure.

Field object

Represents a column of data with a common data type. Each Field object
corresponds to a column in the Recordset.

Property object

Represents a characteristic of an ADO object that is defined by the
provider. ADO objects have two types of properties: built-in and dynamic.
Built-in properties are those properties implemented in ADO and immediate=
ly
available to any new object. The Property object is a container for dynam=
ic
properties, defined by the underlying provider.

Error object

Contains details about data access errors that pertain to a single operat=
ion
involving the provider.

Fields collection

Contains all the Field objects of a Recordset or Record object.

Properties collection

Contains all the Property objects for a specific instance of an object.

Parameters

collection Contains all the Parameter objects of a Command object.

Errors collection

Contains all the Error objects created in response to a single
provider-related failure.

--------------------------------

Making a Connection

To connect to a data source, you must specify a connection string, the
parameters of which might differ for each provider and data source. For m=
ore
information, see Creating the Connection String.

ADO most commonly opens a connection by using the Connection object Open
method. The syntax for the Open method is shown here:

Dim connection as New ADODB.Connection
connection.Open ConnectionString, UserID, Password, OpenOptions

Alternatively, you can invoke a shortcut technique, Recordset.Open, to op=
en
an implicit connection and issue a command over that connection in one
operation. Do this by passing in a valid connection string as the
ActiveConnection argument to the Open method. Here is the syntax for each
method in Visual Basic:

Dim recordset as ADODB.Recordset
Set recordset =3D New ADODB.Recordset
recordset.Open Source, ActiveConnection, CursorType, LockType, Options

Note   When should you use a Connection object vs. the Recordset.Open
shortcut? Use the Connection object if you plan to open more than one
Recordset, or when executing multiple commands. A connection is still
created by ADO implicitly when you use the Recordset.Open shortcut.


Creating and Executing a Simple Command
-----------------------------------------
Though not a typical usage of the Command object, the following code show=
s
the basic method of using the Command object to execute a command against=
 a
data source. In this case, it is a row-returning command, so it returns t=
he
results of the command execution into a Recordset object.

'BeginBasicCmd
    Dim objConn As ADODB.Connection
    Dim objCmd As New ADODB.Command
    Dim objRs As ADODB.Recordset

    objCmd.CommandText =3D "SELECT OrderID, OrderDate, " & _
                         "RequiredDate, ShippedDate " & _
                         "FROM Orders " & _
                         "WHERE CustomerID =3D 'ALFKI' " & _
                         "ORDER BY OrderID"
    objCmd.CommandType =3D adCmdText

    ' Connect to the data source.
    Set objConn =3D GetNewConnection
    objCmd.ActiveConnection =3D objConn

    ' Execute once and display...
    Set objRs =3D objCmd.Execute

    Debug.Print "ALFKI"
    Do While Not objRs.EOF
        Debug.Print vbTab & objRs(0) & vbTab & objRs(1) & vbTab & _
                    objRs(2) & vbTab & objRs(3)
        objRs.MoveNext
    Loop

    'clean up
    objRs.Close
    objConn.Close
    Set objConn =3D Nothing
    Set objCmd =3D Nothing
'EndBasicCmd


The command to be executed is specified with the CommandText property.

Note   Several examples in this section call a utility function,
GetNewConnection, to establish a connection with the data provider. To av=
oid
redundancy, it is listed only once, here:

'BeginNewConnection
Private Function GetNewConnection() As ADODB.Connection
    Dim oCn As New ADODB.Connection
    Dim sCnStr As String

    sCnStr =3D "Provider=3DSQLOLEDB;Data Source=3DMySrvr;" & _
             "User Id=3DMyId;Password=3D123aBc;Database=3DNorthwind;"
    oCn.Open sCnStr

    Set GetNewConnection =3D oCn
End Function
'EndNewConnection







_______________________________________________
gnade-dev mailing list
gnade-dev@cert.uni-stuttgart.de
http://cert.uni-stuttgart.de/mailman/listinfo/gnade-dev

