home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv4.zip
/
VACPP
/
IBMCPP
/
HELP
/
DAXHDI.INF
(
.txt
)
< prev
next >
Wrap
OS/2 Help File
|
1995-05-18
|
38KB
|
1,130 lines
ΓòÉΓòÉΓòÉ <hidden> About this Information ΓòÉΓòÉΓòÉ
The How Do I... information provides solutions to common tasks that you would
perform with the various components of VisualAge C++. Before you begin to use
this information, it would be helpful to understand how to navigate through it:
Use the Contents and Index facilities to locate topics.
Use the Search facility to search the text of this document.
Use hypertext links to acquire related information on the current topic.
Hypertext links appear in a different color (which you can customize
using the OS/2 Scheme Palette). For example, below there are two lists of
hypertext links. By double-clicking on the text of the link or by
pressing Enter on a highlighted link, you will open a panel of related
information. To shift the focus to other links using the keyboard, use
the Tab key.
For more information on using this help facility, see:
How to Use the Contents
How to Obtain Additional Information
How to Access and Use IPF Facilities
For more information, see:
Other Information You Might Find Helpful
Communicating Your Comments to IBM
Notices
Trademarks
ΓòÉΓòÉΓòÉ <hidden> How to Use the Contents ΓòÉΓòÉΓòÉ
The Contents window is the first to appear. Some topics have a plus ( ) icon
beside them. This icon indicates that additional topics are available.
To expand the Contents if you are using a mouse, click on the plus ( ) icon. If
you are using the keyboard, use the Up or Down Arrow key to highlight the
topic, and press the plus (+) key. To see additional topics for a heading with
a plus ( ) icon, click on the icon or highlight that topic and press the plus
(+) key.
To view a topic, double-click on the topic (or press the Up or Down Arrow key
to highlight the topic, and then press the Enter key).
ΓòÉΓòÉΓòÉ <hidden> How to Obtain Additional Information ΓòÉΓòÉΓòÉ
After you select a topic, the information for that topic appears in a window.
Highlighted words or phrases indicate that additional information is available.
Certain words and phrases are highlighted in a different color from the
surrounding text. These are called hypertext terms.
If you are using a mouse, double-click on the highlighted word. If you are
using a keyboard, press the Tab key to move to the highlighted word, and then
press the Enter key. Additional information then appears in a window.
ΓòÉΓòÉΓòÉ <hidden> How to Access and Use IPF Facilities ΓòÉΓòÉΓòÉ
Several choices are available for managing the information presented in this
document. There are three PullDown menus: the Services menu, the Options menu,
and the Help menu.
The actions that are selectable from the Services menu operate on the active
window currently displayed on the screen. These actions include the following:
Placing Bookmarks
You can set a placeholder so you can retrieve information of interest to
you.
Searching for Information
You can find occurrences of a word or phrase in the current topic, selected
topics, or all topics.
Printing Information
You can print one or more topics. You can also print a set of topics by
first marking the topics in the Contents list.
Copying Information to a File
You can copy a topic that you are viewing to the System Clipboard or to a
file that you can edit. This method is particularly useful for copying
syntax definitions and program samples into the application that you are
developing.
Using the actions that are selectable from the Options menu, you can change
the way your Contents list is displayed. To expand the Contents and show all
levels for all topics, choose Expand all from the Options PullDown menu. You
can also press the Ctrl, Shift and * keys together.
The actions that are selectable from the Help menu allow you to select
different types of help information.
For information about any of the menu choices, highlight the choice in the
menu and press F1.
ΓòÉΓòÉΓòÉ <hidden> Placing Bookmarks ΓòÉΓòÉΓòÉ
When you place a bookmark on a topic, it is added to a list of bookmarks you
have previously set. You can view the list, and you can remove one or all
bookmarks from the list. If you have not set any bookmarks, the list is empty.
To set a bookmark, do the following:
1. Select a topic from the Contents.
2. When that topic appears, select the Bookmark option from the Services
menu.
3. If you want to change the name used for the bookmark, type the new name
in the field.
4. Click on the Place radio button (or press the Up or Down Arrow key to
select it).
5. Click on OK (or select it and press Enter). The bookmark is then added to
the bookmark list.
ΓòÉΓòÉΓòÉ <hidden> Searching for Information ΓòÉΓòÉΓòÉ
You can specify a word or phrase to be searched. You can also limit the search
to a set of topics by first marking the topics in the Contents list.
To search for a word or phrase in all topics, do the following:
1. Select the Search option from the Services menu.
2. Type the word or words to be searched for.
3. Click on All sections (or press the Up or Down Arrow keys to select it).
4. Click on Search (or select it and press Enter) to begin the search.
5. The list of topics where the word or phrase appears is displayed.
ΓòÉΓòÉΓòÉ <hidden> Printing Information ΓòÉΓòÉΓòÉ
You can print one or more topics, the index, or the table of contents. Make
sure that your printer is connected to the serial port, configured correctly,
and ready for input. To print:
1. Select Print from the Services menu.
2. Select what you want to print. Note that the This section and Marked
sections choices are only available if you are viewing a topic or if you
have marked topics, respectively. To mark topics in the table of
contents, press the Ctrl key and click on the topics, or use the arrow
keys.
3. Select Print to print what you've chosen on your printer.
ΓòÉΓòÉΓòÉ <hidden> Copying Information to a File ΓòÉΓòÉΓòÉ
You can copy a topic that you are viewing in two ways:
Copy copies the topic that you are viewing into the System Clipboard. If
you are using a Presentation Manager (PM) editor (for example, the
Enhanced Editor) that copies or cuts (or both) to the System Clipboard,
and pastes to the System Clipboard, you can easily add the copied
information to your program source module.
Copy to file copies the topic that you are viewing into a temporary file
named TEXT.TMP. You can later edit that file by using any editor.
TEXT.TMP is placed in the directory where your viewable document resides.
To copy a topic, do the following:
1. Expand the Contents list and select a topic.
2. When the topic appears, select Copy to file from the Services menu.
3. The system puts the text pertaining to that topic into the temporary file
TEXT.TMP.
ΓòÉΓòÉΓòÉ <hidden> Other Information You Might Find Helpful ΓòÉΓòÉΓòÉ
The VisualAge C++ provides a number of online guides and references that we
hope you'll find helpful as you develop applications. This information
includes:
User's Guide information provides conceptual and usage information,
Reference information is organized for quick access, and
How Do I... information gives you specific instructions for performing
common tasks.
You can get to this online information from the Information folder inside the
main product folder. You can also get to it from the Help menu in any of the
components of the product.
ΓòÉΓòÉΓòÉ <hidden> Communicating Your Comments to IBM ΓòÉΓòÉΓòÉ
If there is something you like, or dislike, about this document, please let us
know. You can use one of the methods listed below to send your comments to IBM.
Please be sure to include the complete title of the publication that you are
commenting on. For example, you would refer to the How Do I... information for
the Browser as:
VisualAge C++ Browser: How Do I... for OS/2.
The comments you send should only pertain to the information in this document
and its presentation. To request additional publications or to ask questions or
make comments about the functions of IBM products or systems, you should talk
to your IBM representative or your authorized IBM remarketer.
When you send comments to IBM, you grant IBM a nonexclusive right to use or
distribute your comments in any way it believes appropriate without incurring
any obligation to you.
You can send your comments to IBM in the following ways:
By mail to the following address:
IBM Canada Ltd. Laboratory
Information Development
2G/345/1150/TOR
1150 EGLINTON AVENUE EAST
NORTH YORK, ONTARIO
CANADA M3C 1H7
By FAX to the following number:
- United States and Canada: (416) 448-6161
- Other countries (+1) 416-448-6161
By electronic mail to one of the following IDs. Be sure to include your
entire network address if you wish to get a reply.
- Internet: torrcf@vnet.ibm.com
- IBMLink: toribm(torrcf)
- IBM/PROFS: torolab4(torrcf)
- IBMMAIL: ibmmail(caibmwt9)
ΓòÉΓòÉΓòÉ <hidden> Notices ΓòÉΓòÉΓòÉ
Copyright International Business Machines Corporation, 1995. All rights
reserved.
Note to U.S. Government Users - Documentation related to restricted rights -
Use, duplication, or disclosure is subject to restrictions set forth in GSA ADP
Schedule Contract with IBM Corp.
This edition applies to Version 3.0 of IBM VisualAge C++ for OS/2 (30H1664,
30H1665, 30H1666) and to all subsequent releases and modifications until
otherwise indicated in new editions. Make sure you are using the correct
edition for the level of the product.
This publication could include technical inaccuracies or typographical errors.
Changes are periodically made to the information herein; any such changes will
be reported in subsequent revisions.
Requests for publications and for technical information about IBM products
should be made to your IBM Authorized Dealer or your IBM Marketing
Representative.
When you send information to IBM, you grant IBM a nonexclusive right to use or
distribute the information in any ways it believes appropriate without
incurring any obligation to you.
Any reference to an IBM licensed program in this publication is not intended to
state or imply that only IBM's licensed program may be used. Any functionally
equivalent product, program, or service that does not infringe any of IBM's
intellectual property rights may be used instead of the IBM product, program,
or service. Evaluation and verification of operation in conjunction with other
products, except those expressly designated by IBM, is the user's
responsibility.
IBM may have patents or pending patent applications covering subject matter in
this document. The furnishing of this document does not give you any license
to these patents. You can send license inquiries, in writing, to the IBM
Director of Licensing. IBM Corporation, 500 Columbus Avenue, Thornwood, NY,
10594, USA.
This publication contains examples of data and reports used in daily business
operations. To illustrate them as completely as possible, the examples include
the names of individuals, companies, brands, and products. All of these names
are fictitious and any similarity to the names and addresses used by an actual
business enterprise is entirely coincidental.
ΓòÉΓòÉΓòÉ <hidden> Trademarks and Service Marks ΓòÉΓòÉΓòÉ
The following terms used in this publication are trademarks or service marks of
IBM Corporation in the United States or other countries:
C/2 C Set/2
C Set ++ Common User Access
CUA IBM
Operating System/2 OS/2
Personal System/2 Presentation Manager
PS/2 VisualAge
WorkFrame/2
Other company, product, and service names, which may be denoted by a double
asterisk(**), may be trademarks or service marks of others.
ΓòÉΓòÉΓòÉ 1. See details about my database table or view ΓòÉΓòÉΓòÉ
If the table or view object is not yet in the client area:
1. Select Create Classes... from the File menu
2. Select the DB2/2 database you want
3. Select Connect
4. Select the table or view you want
5. Select Create class to create a class from the table or view
Then simply double-click on the table or view object you want to work with to
open its settings notebook. (Or click Mouse Button 2 on the table or view
object to see its pop-up menu, and then select Open settings.)
Note: You cannot change any information in the table or view settings
notebook.
ΓòÉΓòÉΓòÉ 2. Create or change tables or views ΓòÉΓòÉΓòÉ
You cannot change the actual table or view definition in Data Access Builder.
But you can customize the mapping between a table or view and its class. You
must do this in DB2/2.
Note: Before you can use tables or views in Data Access Builder, you must also
have access to them in DB2/2.
Related Task:
Customize the mapping
ΓòÉΓòÉΓòÉ 3. Use the table or view object ΓòÉΓòÉΓòÉ
Each table object represents a single database table. Each view object
represents a view on a database table or tables.
To see the pop-up menu for actions you can perform on a table or view, click
Mouse Button 2 on the object.
To open the settings notebook for a table or view object, double-click on it.
(This is the same as selecting Open settings from the object's pop-up menu.)
Related Task:
Change the layout of objects in the client area
Create more than one class for a table or view object
ΓòÉΓòÉΓòÉ 4. Use the class object ΓòÉΓòÉΓòÉ
Each class object represents a class that Data Access Builder created from a
table or view you selected from an existing database.
To see the pop-up menu for actions you can perform on a class, click Mouse
Button 2 on the object.
To open the settings notebook for a class object, double-click on it. (This is
the same as selecting Open settings from the object's pop-up menu.)
A class's settings notebook describes the properties of that class, such as its
attributes and methods. The class was created using certain default settings,
but you can change these in the settings notebook.
When the settings are the way you want them, you can generate source code for
the class. And then you can view the source code files you generated. (The View
source... option appears on the class pop-up menu after you generate source
code for the class.)
Note: After generating source code for a class, you can use the settings
notebook to change the class, and to generate source code again if necessary.
Related Task:
Change the layout of objects in the client area
Know which of my classes have been generated
See my source code after I've generated it
Customize the mapping
ΓòÉΓòÉΓòÉ 5. Change the layout of objects in the client area ΓòÉΓòÉΓòÉ
You can change the following aspects of the layout of the table and class icons
the client area:
orientation of the icons (either horizontal or vertical)
size of the icons (either small, medium or large)
To change the orientation of the icons in the client area:
Select Icon size from the View menu
Select the type of layout you want
The orientation of the icons changes.
To change the size of the icons in the client area:
Select Icon size from the View menu
Select the icon size you want
The size of the icons changes.
Related Tasks:
Use the table or view object
Use the class object
ΓòÉΓòÉΓòÉ 6. Start Data Access Builder ΓòÉΓòÉΓòÉ
To start Data Access Builder, do any one of the following:
Select Database from the Project menu of your WorkFrame project.
Select the Data Access Builder icon from the Tools folder in the C++
folder. Double click on the Data Access Builder icon.
Type ICSDATA from the command line in your current directory.
Type ICSDATA <FILENAME.DAX> on a command line in your target directory,
if you know which file you want to resume work on.
Click mouse button 2 on <FILENAME.DAX> file in a WorkFrame Project, then
select Database from the pop-up menu.
ΓòÉΓòÉΓòÉ 7. Save my work ΓòÉΓòÉΓòÉ
To save all the information in your current session, select Save from the File
menu. All the information about all mappings in the client area is saved.
To save all the information in your current session for the first time, or to
save the session to a file other than the one named in the title bar, select
Save as... from the File menu. Use .DAX as the file extension.
Related Task:
Resume work on a saved session
ΓòÉΓòÉΓòÉ 8. Resume work on a saved session ΓòÉΓòÉΓòÉ
To resume work on a session that you saved, select Open... from the File menu.
All the information about all the mappings in that session is restored to the
client area.
Note: When a session is opened, Data Access Builder does not reconnect to the
database tables. This lets you resume work on a session at your convenience,
without having to have continual access to all your database tables.
Related Tasks:
Save my work
Recover when the database definitions change
ΓòÉΓòÉΓòÉ 9. Customize the mapping ΓòÉΓòÉΓòÉ
To customize the way a class is mapped to its table or view:
1. Click Mouse Button 2 on the class object to see its pop-up menu, and then
select Open settings. (Or simply double-click on the class object to open
its settings notebook.)
2. Page through the notebook to see the default settings.
3. Make the desired changes on the first two pages; the Methods pages are
read-only.
If you want to reset all the values on the page to what they were when you
last opened that notebook page, select Reset.
Related Information:
Changing the Mapping between a Table and a Class
ΓòÉΓòÉΓòÉ 10. Recover when the database definitions change ΓòÉΓòÉΓòÉ
Changes made to a DB2/2 database table are not automatically updated in Data
Access Builder. The only connection between the actual table and the Data
Access Builder object occurs once-when the object first appears in the client
area.
So it is possible to open a saved session that contains old table definitions
and resume work on it. But if the changes to the database table or view are
substantial, your generated Data Access Builder code may no longer be usable.
Note: Some 'safe' updates to a table that normally will not affect your
generated code's viability are: adding a column, deleting an unmapped column,
or adding a foreign key.
To get a fresh connection to the database table, do one of the following:
In the same session:
1. Delete the table object (which also deletes all classes mapped to
it).
2. Select Create classes... from File menu.
3. Connect to the database again.
4. Select the table or view again.
5. Then select Create class again.
Start a new session:
1. Select New... from the File menu to start a new session. (You might
want to save your old file for purposes of comparison.)
2. Connect to the database again.
3. Select that table or view again.
4. Then select Create class again.
5. Change the Class notebook accordingly.
Related Tasks:
Customize the mapping
ΓòÉΓòÉΓòÉ 11. Create a class from more than one database table ΓòÉΓòÉΓòÉ
To create a class from more than one database table or from parts of more than
one table:
1. In DB2/2, create a view from the tables or from the parts of tables you
want to include.
2. Then, in Data Access Builder, select Create Classes... from the File
menu.
3. Connect to the database, and select the view that you just created.
Note: Doing this results in a class that cannot modify the tables. If the
view is read-only: the Add, Update, and Delete methods will throw an
exception.
ΓòÉΓòÉΓòÉ 12. Create more than one class for a table or view object ΓòÉΓòÉΓòÉ
If you already have a class mapped to a table or view object, and you want to
create another class for the same object:
1. Click Mouse Button 2 on the table or view object to see its pop-up menu.
2. Select Create class from the pop-up menu.
3. To customize the default mapping for the new class, double-click on the
object to open its settings notebook.
Note: This is an alternative to creating more than one view of a database
table in DB2/2.
Related Task:
Customize the mapping
ΓòÉΓòÉΓòÉ 13. Customize my class once it's generated ΓòÉΓòÉΓòÉ
The source code that Data Access Builder generates is not intended to be edited
directly. You would lose all your changes if you generated code from the same
class again later.
To customize a class before building it into a program, you should define a
derived class (a subclass) from the ones Data Access Builder created. You can
use WorkFrame, Visual Builder, or your text editor to do this. Then you can
safely make your changes to that derived class.
ΓòÉΓòÉΓòÉ 14. Use the generated code ΓòÉΓòÉΓòÉ
With Data Access Builder you can do the following:
Generate a Visual Builder part and use it in Visual Builder.
Generate a Visual Builder part and use it in a C++ program.
Generate IDL source and use it in a SOM program.
Select the following link to see a sample program in each of these three
options.
Related Task:
Add data using the generated code
Update data using the generated code
Delete data using the generated code
Retrieve data using the generated code
Use the generated methods
Work with multiple rows
Related Information:
Constructing Applications Using Data Access Builder and the Visual
Builder
Constructing an Application Using Data Access Builder and C++
Constructing an Application Using Data Access Builder and SOM
ΓòÉΓòÉΓòÉ 15. Write an application to connect to a database ΓòÉΓòÉΓòÉ
Connecting to a database is just one task your finished program must perform.
The whole process of accessing data in a DB2/2 database involves: connect,
access (add, update, delete, or retrieve), transact, and disconnect.
There are three variations of connection to a database:
1. Visual Builder
2. C++
3. SOM
Related Information:
Using Visual Builder Programs
Using C++ Programs
Using SOM Programs
ΓòÉΓòÉΓòÉ 16. Build my application once it's written ΓòÉΓòÉΓòÉ
You can build your application either through WorkFrame or from scratch on an
OS/2 command line.
Open the WorkFrame project that holds you files. Use View Tool setup to set
the option for your build action. (This is not necessary if you initially
copied your project from DAXSAMP Database DLL.) Choose Build from the Project
pull-down menu.
Related Information:
Constructing Applications Using Data Access Builder and the Visual
Builder
Constructing an Application Using Data Access Builder and C++
Constructing an Application Using Data Access Builder and SOM
ΓòÉΓòÉΓòÉ 17. Create source code from a class ΓòÉΓòÉΓòÉ
To create source code from a class object in the client area:
1. Click Mouse Button 2 on the class object to see its pop-up menu.
2. Select Generate from the class pop-up menu.
This generates the default type of code (Visual Builder part or IDL
source). By default, the files are named after the table or view, as is
the class, to help you remember the association between them. The names
can be changed using the settings notebook.
For a Visual Builder part, the generated files will have the following
extensions:
filenameY.CPP
filenameV.HPP
filenameV.MAK
filenameV.SQC
filenameV.VBE
filenameV.DEF
For IDL source, the generated files will have the following extensions:
filenameX.CPP
filenameI.IDL
filenameI.MAK
filenameI.SQC
To change the type of code that Data Access Builder generates by default:
Temporarily, use the Generate conditional cascade, and select the other
option.
Permanently, select Generate options... from the Options menu., and
select the other option. Then select Save as default in the Generate
Options window.
Related Task:
See my source code after I've generated it
Know which of my classes have been generated
ΓòÉΓòÉΓòÉ 18. Generate both kinds of source code from the same class ΓòÉΓòÉΓòÉ
You can generate two different kinds of source code (parts and IDL) from a
single class object, without having to create another one:
1. Click Mouse Button 2 on the class object to see its pop-up menu.
2. Select Generate from the class pop-up menu.
This generates the default type of code (Visual Builder part or IDL
source). The files are named after the table or view, as is the class, to
help you remember the association between them.
For a Visual Builder part, the generated files will have the following
extensions:
filenameY.CPP
filenameV.HPP
filenameV.MAK
filenameV.SQC
filenameV.VBE
filenameV.DEF
For IDL source, the generated files will have the following extensions:
filenameX.CPP
filenameI.IDL
filenameI.MAK
filenameI.SQC
3. Repeat step 1, but select the other kind of source code.
The class settings notebook contains a page of methods that apply to each kind
of source code. Double-click on the class object to open its settings
notebook. Or click Mouse Button 2 on the object to see its pop-up menu, and
then select Open settings.
Related Tasks:
See my source code after I've generated it
Know which of my classes have been generated
ΓòÉΓòÉΓòÉ 19. See my source code after I've generated it ΓòÉΓòÉΓòÉ
To see the source files that Data Access Builder generates:
1. Click Mouse Button 2 on the class object to see its pop-up menu.
2. Select View Source.... (This item is only available on the pop-up menu
after source code has been generated.)
3. Select from the View Source window the file or files you want to browse.
(You cannot edit these files.)
Related Tasks:
Use the generated code
ΓòÉΓòÉΓòÉ 20. Know which of my classes have been generated ΓòÉΓòÉΓòÉ
You can tell by the class object's appearance whether code has been generated
for it, and which type of code:
This object (plain blue ball):
This is the original, ungenerated state. Code has not been generated yet.
(Another clue is that the pop-up menu for the class object does not
contain the View source... item until code has been generated.)
This object (blue ball with an orange puzzle piece on right side):
Has a Visual Builder part generated for it.
This object (blue ball with a green box on left side):
Has IDL source generated for it.
This object (blue ball with both an orange puzzle piece on right side and
a green box on left side):
Has both kinds of source files generated for it.
If you modify the settings notebook after a class has been generated, the icon
for the class will return to the ungenerated state (plain blue ball) because
source has not been generated for the most recent settings changes.
Related Task:
Use the class object
ΓòÉΓòÉΓòÉ 21. Include my own SQL components in my program ΓòÉΓòÉΓòÉ
You can incorporate your own SQL components in your make or build. To do this:
1. Use your text editor to produce your own SQC files.
2. Make sure the SQLPREP action options are set to what you require
3. Set the database name to your target database. Use the Prompt check box
to allow you to modify the database during your build.
4. Specify your files in the makemake (this is automatic in a build).
Related Tasks:
Bind my application to a different database
Change my SQLPREP/SQLBIND options
ΓòÉΓòÉΓòÉ 22. Bind my application to a different database ΓòÉΓòÉΓòÉ
To bind your application to a different database:
1. Ensure the tables and columns referenced are the same between the two
databases.
2. Use the /B option of the SQLPREP step when you build your application.
3. Move the application .EXE file and the generated .BND files to the
workstation with the new database.
4. Use the SQLBIND option to bind each .BND file (including those generated
by Data Access Builder) to the new database.
Related Tasks:
Include my own SQL components in my program
Change my SQLPREP/SQLBIND options
ΓòÉΓòÉΓòÉ 23. Change my SQLPREP/SQLBIND options ΓòÉΓòÉΓòÉ
To change your SQLPREP/SQLBIND options:
1. Use WorkFrame to set up the Data Access Builder tools.
2. Select View Tool setup.
3. To compile, select SQL Prep under the compile action.
4. To bind, select SQL Bind under the bind action.
Related Tasks:
Include my own SQL components in my program
Bind my application to a different database
ΓòÉΓòÉΓòÉ 24. Add data using the generated code ΓòÉΓòÉΓòÉ
Use the Add method to add a new row to a table. To use the Add method:
1. First set the value of each attribute for which you want to store data.
Use the set attribute method for each attribute. For example, if an
object has five attributes, you will need to use the set attribute method
five times, once per attribute.
For C++ programs, use set<Attribute>. For IDL programs, use
_set_<Attribute>. You must replace <Attribute> with the actual attribute
name.
2. Then issue the Add method. This takes the values from the attributes and
creates and adds new rows in your table.
Note: If you want an attribute to be null, use the set<Attribute>ToNull
method before adding. (You can use the is<Attribute>Nullable method first
to determine whether an attribute can accept null values.)
To do this in Visual Builder with a Visual Builder part:
1. Use attribute-to-attribute connection to set the attribute values. Use
the add() action to add the row to the database. Use the commit() action
on the database connection to complete the transaction.
Related Tasks:
Use the generated methods
Update data using the generated code
Delete data using the generated code
Retrieve data using the generated code
ΓòÉΓòÉΓòÉ 25. Update data using the generated code ΓòÉΓòÉΓòÉ
Use the Update method to update the data in an existing row. To use Update:
1. First identify the row which you want to update. To do this, set the
value of the data identifier(s) with the value that corresponds to the
value in the row to be updated.
2. To update the values, set the values of the attributes other than the
data identifiers with the new values using the set attribute method.
For C++ programs, use set<Attribute>. For IDL programs, use
_set_<Attribute>. You must replace <Attribute> with the actual attribute
name.
3. Then update the row using the Update method.
Note: If you try to update using an object that is read-only, the update will
fail. (Use the isReadOnly method first to determine if an object is
read-only.)
To do this in Visual Builder with a Visual Builder part:
1. Use attribute-to-attribute connection to set the attribute values. Use
the update() action to add the row to the database. Use the commit()
action on the database connection to complete the transaction.
Related Tasks:
Use the generated methods
Add data using the generated code
Delete data using the generated code
Retrieve data using the generated code
ΓòÉΓòÉΓòÉ 26. Delete data using the generated code ΓòÉΓòÉΓòÉ
Use the Delete method to delete the data in an existing row. To use Delete:
1. First identify the row you want to delete. To identify the row, give
values to all the attributes that are defined as data identifiers.
2. Then use the Delete method to delete the row.
Note: As a precaution, you can use the Retrieve method first to retrieve
the values to verify it is the row you want to delete.
To do this in Visual Builder with a Visual Builder part:
1. Use attribute-to-attribute connection to set the attribute values. Use
the delete() action to add the row to the database. Use the commit()
action on the database connection to complete the transaction.
Related Tasks:
Use the generated methods
Add data using the generated code
Update data using the generated code
Retrieve data using the generated code
ΓòÉΓòÉΓòÉ 27. Retrieve data using the generated code ΓòÉΓòÉΓòÉ
Use the Retrieve method to retrieve a row that matches the value or values
given to the attributes. If more than one row matches the values, an exception
will be thrown.
To retrieve the value of an attribute, use <Attribute> method in C++ or
_get_<Attribute> method in SOM. To check if the value is null or not, use
is<Attribute>Null in C++ or _get_<Attribute>IsNull in SOM.
To do this in Visual Builder with a Visual Builder part:
1. Use attribute-to-attribute connection to set the attribute values. Use
the retrieve() action to add the row to the database. Use the commit()
action on the database connection to complete the transaction. If you use
the Manager class, the result is available on the sequence reference
returned by the items attribute.
There are two other methods in the Manager class that allow you to read
multiple rows:
Refresh retrieves all the rows into a sequence
Select retrieves with a condition specified as an IString.
Related Tasks:
Use the generated methods
Add data using the generated code
Update data using the generated code
Delete data using the generated code
ΓòÉΓòÉΓòÉ 28. Use the generated methods ΓòÉΓòÉΓòÉ
You can use the following methods with Visual Builder and C++ parts:
Add
Update
Delete
Retrieve
<Attribute>()
set<Attribute>(attribute type)
set<Attribute>(const Istring)
is<Attribute>Nullable
Use this method to test whether an attribute can be set to null. It
returns True if the attribute is nullable.
is<Attribute>Null
Use this method to test whether an attribute is currently set to null. It
returns True if the attribute is null.
set<Attribute>ToNull
Use this method to set an attribute to null. An exception will be thrown
if you try to use this method against an attribute which is not nullable.
isReadOnly
Use this method to test whether an object is read-only. It returns True
if the object is read-only.
isDefaultReadOnly
Use this method to test whether an object is read-only by default. It
returns True if the object is read-only by default.
setReadOnly
Use this method to set an object to read-only or read/write. If you want
an object to be set to read-only, pass True as the input parameter. If
you want the object to be read/write, pass False as the input parameter.
(Using False as the parameter is allowed only when the object is not
read-only by default.)
<Attribute>AsString
You can use the following methods with IDL source:
Add
Update
Delete
Retrieve
_set_<Attribute>
_get_<Attribute>
_get_DefaultReadOnly
Use this method to test whether an object is read-only by default. It
returns True if the object is read-only by default.
_get_CurrentReadOnly
Use this method to test whether an object is read-only. It returns True
if the object is read-only.
_set_CurrentReadOnly
Use this method to test whether an object is read-only. It returns True
if the object is read-only.
_get_<Attribute>isNullable
Use this method to test whether an attribute can be set to null. It
returns True if the attribute is nullable.
_get_<Attribute>isNull
Use this method to test whether an attribute is currently set to null. It
returns True if the attribute is null.
_set_<Attribute>isNull
Use this method to set an attribute to null. An exception will be thrown
if you try to use this method against an attribute which is not nullable.
IDL doesn't have <Attribute>AsString or items.
Related Tasks:
Add data using the generated code
Update data using the generated code
Delete data using the generated code
Retrieve data using the generated code
ΓòÉΓòÉΓòÉ 29. Work with multiple rows ΓòÉΓòÉΓòÉ
The data manipulation methods are divided in two classes. The first class, with
the same name as the table, contains methods that will access a single row of
data. The second class-called the Manager class for parts, and the Factory
class for IDL-is used to manipulate multiple instances (or rows) of the first
class.
Items
Select
Use the select method to retrieve a set of rows that meet a condition.
The condition is passed as a parameter.
Parts specific: Visually, this can be done by connecting to an entry
field for typing in queries.
Refresh
Use the refresh method to retrieve all the rows in a table.
Parts specific: Visually, this can be done by connecting the refresh
method to a list box to display the results.
Related Tasks:
Use the generated methods
Add data using the generated code
Update data using the generated code
Delete data using the generated code
Retrieve data using the generated code
ΓòÉΓòÉΓòÉ 30. Connect to the Database ΓòÉΓòÉΓòÉ
To connect to the database:
1. Use the IDatastore part provided on VBDAX or the class library. (include
IDSMCON or WPD)
2. Use the connect action after specifying the database name, userid and
password (if not already logged on).
Related Tasks:
Complete a Transaction
Disconnect from the Database
ΓòÉΓòÉΓòÉ 31. Logon to the Database ΓòÉΓòÉΓòÉ
To logon to my system:
1. Use UPM.
2. Logon /L userid /p:password or specify userid and password on the connect
to IDatastore.
Related Tasks:
Connect to the Database
Complete a Transaction
Disconnect from the Database
Logoff from the Database
ΓòÉΓòÉΓòÉ 32. Complete a Transaction ΓòÉΓòÉΓòÉ
To complete a transaction:
1. Use commit() or rollback() action on IDatastore.
Related Tasks:
Disconnect from the Database
ΓòÉΓòÉΓòÉ 33. Disconnect from the Database ΓòÉΓòÉΓòÉ
To disconnect from the database:
1. Use the disconnect() action on IDatastore.
Related Tasks:
Connect to the Database
Complete a Transaction
Logoff from the Database
ΓòÉΓòÉΓòÉ 34. Logoff from the Database ΓòÉΓòÉΓòÉ
To logoff from the database:
1. If connect logged you on, disconnect logs you off. Otherwise, use logoff
/L.
ΓòÉΓòÉΓòÉ 35. Use the Database Access Class Library in Visual Builder ΓòÉΓòÉΓòÉ
To use the Database Access Class Library in Visual Builder:
1. Load IBMCPP\DDE4VB\VBDAX.VBB
2. Add IDatastore to the non visual part of you application, or, add
IDSConnectCanvas to the IFrameWindow.
Related Information:
Constructing Applications Using Data Access Builder and the Visual
Builder