⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch18.htm

📁 好书《C++ Builder高级编程技术》
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>

<HEAD>
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
	<META NAME="Author" Content="Steph Mineart">
	<TITLE>Ch 18 -- Working with CASE Tools: Cadet, ER1, and 
SDesigner</TITLE>
</HEAD>

<BODY BACKGROUND="bg1.gif" tppabs="http://pbs.mcp.com/ebooks/0672310228/buttonart/bg1.gif" BGCOLOR="#FFFFFF">

<P ALIGN="CENTER"><IMG SRC="sams.gif" tppabs="http://pbs.mcp.com/ebooks/0672310228/buttonart/sams.gif" WIDTH="75" HEIGHT="24" ALIGN="BOTTOM"
BORDER="0"><BR>
<BR>
<A HREF="index-3.htm" tppabs="http://pbs.mcp.com/ebooks/0672310228/index.htm"><IMG SRC="toc.gif" tppabs="http://pbs.mcp.com/ebooks/0672310228/buttonart/toc.gif" WIDTH="40" 
HEIGHT="40" ALIGN="BOTTOM"
ALT="TOC" BORDER="0" NAME="toc4"></A><A HREF="ch17.htm" tppabs="http://pbs.mcp.com/ebooks/0672310228/ch17.htm"><IMG SRC="back-1.gif" tppabs="http://pbs.mcp.com/ebooks/0672310228/buttonart/back.gif"
WIDTH="40" HEIGHT="40" ALIGN="BOTTOM" ALT="BACK" BORDER="0" NAME="toc1"></A><A HREF="ch19.htm" tppabs="http://pbs.mcp.com/ebooks/0672310228/ch19.htm"><IMG
SRC="forward.gif" tppabs="http://pbs.mcp.com/ebooks/0672310228/buttonart/forward.gif" WIDTH="40" 
HEIGHT="40" ALIGN="BOTTOM" ALT="FORWARD" BORDER="0"
NAME="toc2"></A></P>
<H2 ALIGN="CENTER"><FONT COLOR="#000077">Charlie Calvert's C++ Builder Unleashed</FONT></H2>
<P>
<H2 ALIGN="CENTER"><A NAME="Heading1"></A><FONT COLOR="#000077">- 18 
-</FONT></H2>
<H2 ALIGN="CENTER"><A NAME="Heading2"></A><FONT COLOR="#000077">Working with CASE
Tools: Cadet, ER1, and SDesigner</FONT></H2>
<P>
<H3><A NAME="Heading3"></A><FONT COLOR="#000077">Overview</FONT></H3>
<P>In this chapter, I will give a 
very superficial overview of three CASE tools.
The purpose of this chapter is merely to introduce you to these tools so that you
know that they exist and to tell you something about what they can do for you.</P>
<P>In particular, this chapter focuses 
on the following products:

<UL>
	<LI>The Data Module Designer from Paradox 7.0: This tool can help you design Paradox
	databases. It gives you a visual overview of your database and gives you a handy
	visual method for establishing referential 
integrity.
	<P>
	<LI>SDesigner: This full-featured, powerful, and very complex tool is meant for professional
	database designers.
	<P>
	<LI>ER1: Embarcadero makes one of the hottest data modeling tools on the market.
	Like SDesigner, this 
full-featured database tool is meant for professionals. ER1
	is known for its advanced technology and easy-to-use tools.
	<P>
	<LI>Cadet: This shareware tool is developed in Delphi. It provides an inexpensive
	yet very powerful means of working with 
Paradox, dBASE, and InterBase tables.
</UL>

<P>Before going any further, I want to stress that this subject is starting to wander
fairly far afield from the main topics of this book. In particular, my goal is to
describe BCB, not third-party tools 
such as SDesigner or Cadet.</P>
<P>The main purpose of this chapter is to alert you to the existence of these tools
and of others like them. My intention is not to recommend these tools above competing
products, nor am I interested in describing these 
tools in any depth.</P>
<P>I have gone into considerable depth about database programming in this book. I
feel that I would be remiss at this point if I did not at least point you toward
these kinds of tools. If you earn your living creating 
databases, then you already
know how important data modeling tools can be. In that case, your only interest in
this chapter will be simply to see highly abstracted database tools working with
BCB. On the other hand, if you're interested in entering 
the database field, then
this is a subject you should master, and hopefully this chapter will inspire you
to explore this field in more depth.</P>
<P>Once again, I want to stress that this subject is too wide of the main interests
of this book to 
merit an in-depth examination. Instead, I want to give a quick overview
of the subject to alert you to its importance and to the availability of some valuable
tools. Unlike all the other chapters in this book, this one is designed to be completed
in 
only a few minutes.
<H3><A NAME="Heading4"></A><FONT COLOR="#000077">What Are CASE and Data Modeling
Tools?</FONT></H3>
<P>The primary problem solved by CASE and data modeling tools is managing complexity.
Most of the databases in this book are fairly 
simple. Even the more complex databases
I've presented, such as the ones for <TT>kdAdds</TT> or <TT>Music</TT>, are fairly
easy to grasp.</P>
<P>Problems arise, however, when you have huge databases consisting of 30 or more
tables that are related in 
a maze of complex links. If you're wrestling with that
kind of complexity, or if you're considering taking on a project of that size, then
you will find some kind of data modeling tool to be a necessity.</P>
<P>Good tools of this kind will 
reverse-engineer a database and show you a diagram
depicting the relationship between tables. An example of this kind of diagram, as
drawn by SDesigner, is shown in Figure 18.1. While you're studying this screen shot,
understand that sometimes 
pictures shown in books look best when shot in 640x480
screen mode but that tools such as SDesigner were made to be run in much higher resolutions.
If you increase the resolution to 1024x768, for example, then you can get a clear
view of a larger 
number of tables.<BR>
<BR>
<A NAME="Heading5"></A><A HREF="18ebu01.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu01.jpg">FIGURE 18.1.</A><FONT COLOR="#000077">
</FONT><I>A portion of a physical data model displayed in SDesigner.</I></P>
<P>Powerful data modeling tools will also let you add 
tables, fields, indexes, and
referential integrity to your database. The goal is to allow you to use the mouse
to drag lines between the tables to designate how they interrelate. At the appropriate
times, dialogs should pop up automatically asking you 
to specify the details of your
links. After you're done, you can save the data model, at which time SQL or some
other code that will automatically update the database is generated.</P>
<P>A number of sophisticated CASE tools will also automatically 
generate code for
you. For example, Delphi has CASE tools available from third parties that will automatically
generate forms and code for projects after you're through designing the tables and
their relationships. At the time of this writing, I do 
not know of any CASE tools
that perform this task for BCB, but I assume that they will appear over the next
few months.
<H3><A NAME="Heading6"></A><FONT COLOR="#000077">The Paradox Data Model Designer</FONT></H3>
<P>If you have Paradox 7.0, you have a 
data modeling tool that you can use with BCB.
To get started, launch Paradox and select the <TT>CUNLEASHED</TT> alias. This alias
points to most of the Paradox tables that ship with this book. A description of the
way to create this alias is provided 
or referenced in the readme file on the CD that
ships with this book.</P>
<P>After you set up the alias, choose Tools | Data Model Designer from the Paradox
menu. A window like the one shown in Figure 18.2 appears.<BR>
<BR>
<A NAME="Heading7"></A><A 
HREF="18ebu02.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu02.jpg">FIGURE 18.2.</A><FONT COLOR="#000077">
</FONT><I>The Data Model Designer as it appears when first selected from the Tools
menu of Paradox 7.0.</I></P>
<P>The goal of this exercise will be to get an overview of the tables in 
the kdAdds
program from Chapter 14, &quot;Sessions and Relational Real-World Databases.&quot;
To get started, add all the tables from the database to the Data Model Designer,
as shown in Figure 18.3.<BR>
<BR>
<A NAME="Heading8"></A><A 
HREF="18ebu03.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu03.jpg">FIGURE 18.3.</A><FONT COLOR="#000077">
</FONT><I>The Data Model Designer after you have added all the tables used in the
kdAdds program.</I></P>
<P>Now that the tables are in place, the next step is to show the relationships 
between
these tables. Click once on the <TT>kdNames</TT> table, drag the mouse cursor on
top of the <TT>kdAdds</TT> table, and let go. Afterward, you will see the image shown
in Figure 18.4.<BR>
<BR>
<A NAME="Heading9"></A><A 
HREF="18ebu04.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu04.jpg">FIGURE 18.4.</A><FONT COLOR="#000077">
</FONT><I>The relationship between the <TT>kdAdds</TT> and <TT>kdNames</TT> tables
as shown in the Paradox Data Model Designer.</I></P>
<P>At this stage, you might try connecting the 
<TT>kdNames</TT> table to the other
tables in the database, as shown in Figure 18.5.<BR>
<BR>
<A NAME="Heading10"></A><A HREF="18ebu05.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu05.jpg">FIGURE 18.5. </A><I>The <TT>kdNames</TT>
table is the controlling table in the relationship between it 
and <TT>kdAdds</TT>,
<TT>kdPhone</TT>, <TT>kdEmail</TT>, and <TT>kdMemo</TT>.</I></P>
<P>When you're defining these relationships, be sure you drag from the <TT>kdNames</TT>
table to the tables that are subordinate to it. If you define the 
relationship in
the opposite direction, you end up with a different depiction of the relationship
between the tables, as shown in Figure 18.6. This view of the table is not incorrect,
but it gives you a different perspective.</P>
<P>If you try to 
define a relationship between two tables that have no links, a dialog
pops up explaining what has happened, as shown in Figure 18.7.</P>
<P>If you drag the mouse cursor between two indexed tables, a dialog that lets you
define the relationship between 
the tables will pop up. You can use this tool to
actually design the elements of your database, as shown in Figure 18.8.</P>
<P>That's all I'm going to say about the Paradox Data Model Designer. As I said in
the beginning of this chapter, dwelling on 
Paradox in a book about BCB would make
no sense. However, I wanted to give you a brief introduction to this subject so that
you can understand something about the tools available on the market.<BR>
<BR>
<A NAME="Heading11"></A><A 
HREF="18ebu06.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu06.jpg">FIGURE 18.6.</A><FONT COLOR="#000077">
</FONT><I>The relationship between the <TT>kdMemo</TT> and <TT>kdNames</TT> table
from the point of view of the <TT>kdMemo</TT> table.<BR>
<BR>
<A NAME="Heading12"></A></I><A 
HREF="18ebu07.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu07.jpg">FIGURE 18.7.</A><FONT COLOR="#000077">
</FONT><I>The dialog you get when you try to relate two tables that have no links
on which a relationship can be defined.</I><BR>
<BR>
<A NAME="Heading13"></A><A 
HREF="18ebu08.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu08.jpg">FIGURE 18.8.</A><FONT COLOR="#000077">
</FONT><I>Establishing a relationship between two tables in the Paradox Data Model
Designer.</I>
<H3 ALIGN="CENTER"></H3>
<H3><A NAME="Heading14"></A><FONT 
COLOR="#000077">SDesigner</FONT></H3>
<P>SDesigner is a much more powerful and much more complex tool than Paradox. To
get started with it, you should have ODBC drivers installed on your system. In Chapter
8, &quot;Database Basics and Database 
Tools,&quot; I described how to set up an ODBC
connection to an InterBase table.</P>
<P>Assuming you have SDesigner, InterBase, and ODBC installed on your system, you
can get started by launching SDesigner. Close all the windows and open the File 
menu,
as shown in Figure 18.9.<BR>
<BR>
<A NAME="Heading15"></A><A HREF="18ebu09.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu09.jpg">FIGURE 18.9.</A><FONT COLOR="#000077">
</FONT><I>The File menu in SDesigner gives you the option of reverse-engineering
a database.</I></P>
<P>If you select 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -