📄 ch18.htm
字号:
Reverse Engineering from the menu, you can choose the name of the
database you want to use from the list of available drivers, as shown in Figure 18.10.
If you don't see InterBase in this list, then you probably don't have the ODBC drivers
for
InterBase installed. In this case, you still have a course of action open to
you since SDesigner can reverse-engineer the schematic SQL code produced when you
choose Extract | SQL Metadata for Database from the WISQL menu. In particular, you
should
choose the menu item in WISQL and then save the output to a text file. Then
point SDesigner at the text file, and it will reverse-engineer it. The <TT>Music.ddl</TT>
files in the <TT>Data</TT> directory on the CD that accompanies this book are
examples
of the type of file that SDesigner can reverse-engineer.</P>
<P>After clicking OK, you are presented with a dialog that lets you select the InterBase
database to which you want to connect. I described how to set up these database links
in
Chapter 8. In this case, I signed into the link to the Music database, filling
in my username of <TT>SYSDBA</TT> and the default password of <TT>masterkey</TT>.
The password might be different on your system.</P>
<P>You can then select which tables
you want to examine, as well as which parts of
the tables, such as indexes, primary keys, and foreign keys. The selections I made
are shown in Figure 18.11.<BR>
<BR>
<A NAME="Heading16"></A><A HREF="18ebu10.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu10.jpg">FIGURE 18.10.</A><FONT
COLOR="#000077">
</FONT><I>Selecting a database name.<BR>
<BR>
<A NAME="Heading17"></A></I><A HREF="18ebu11.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu11.jpg">FIGURE 18.11.</A><FONT COLOR="#000077">
</FONT><I>Selecting the tables that I want to import from the Music database. Notice
that
you can choose to view the primary keys, foreign keys, and other pieces of metadata.</I></P>
<P>In Figure 18.12, you can see what the diagram of the database looks like after
SDesigner has finished the reverse-engineering process. Notice that the
links between
the tables are visible.<BR>
<BR>
<A NAME="Heading18"></A><A HREF="18ebu12.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu12.jpg">FIGURE 18.12.</A><FONT COLOR="#000077">
</FONT><I>The Music database after it has been imported into SDesigner.</I></P>
<P>From the view shown in
Figure 18.12, you can perform almost any action you want
on the databases. You can physically move around the relative positions of the tables,
and you can examine or redefine the metadata in any manner you choose. For example,
if you look at Figure
18.13, you can see part of a list of all the indexes in the
music database. The columns on the far right designate whether a particular index
is primary, foreign, or unique, as designated by the columns headed by P, F, and
U.<BR>
<BR>
<A
NAME="Heading19"></A><A HREF="18ebu13.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu13.jpg">FIGURE 18.13.</A><FONT COLOR="#000077">
</FONT><I>Examining the indexes from the Music database.</I></P>
<P>If you click the Define button at the bottom left of the dialog, you can edit
an index. If
you click the New button, you can create a New index, and--well, I'll
leave it up to you to figure out what the Delete button does!</P>
<P>That's all I'm going to say about SDesigner. I'm sure you can tell from this brief
introduction that this tool
is very powerful. I have not touched on even one-tenth
of the capabilities of this tool. For example, if you drop down the Dictionary menu,
as in Figure 18.14, you can see some of the many features of this product.<BR>
<BR>
<A NAME="Heading20"></A><A
HREF="18ebu14.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu14.jpg">FIGURE 18.14.</A><FONT COLOR="#000077">
</FONT><I>The Dictionary menu gives some hint to the capabilities to be found in
SDesigner.</I></P>
<P>Of all the traits of a tool like SDesigner, perhaps the most important is the
capability to give a visual overview of your database. You can often spot flaws in
your database design after just a glance at one of these views.
<H3><A NAME="Heading21"></A><FONT COLOR="#000077">ER1</FONT></H3>
<P>ER1, a tool from Embarcadero
Technologies Inc. (<A HREF="javascript:if(confirm('http://www.embarcadero.com/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.embarcadero.com/'" tppabs="http://www.embarcadero.com/"><TT>www.embarcadero.com</TT></A>,
415-834-3131), is comparable to SDesigner in terms of its scope and capabilities.
It does not, however, have as large a presence in the market.</P>
<P>You can
reverse-engineer a database in ER1 exactly as you did in SDesigner. Once
again, the key to the process is having the ODBC drivers in place. The result of
importing the Music database is shown in Figure 18.15. Notice the fancy zoom window
in the bottom
right of the screen; it shows the currently selected database in a
mode that is easier to read. Both SDesigner and ER1 let you zoom in as much as you
want on the view of a table, but this handy zoom window is particularly easy to use.<BR>
<BR>
<A
NAME="Heading22"></A><A HREF="18ebu15.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu15.jpg">FIGURE 18.15.</A><FONT COLOR="#000077">
</FONT><I>ER1 can reverse-engineer a database using the same type of technology as
SDesigner.</I></P>
<P>If you click any one table, you can pop up an Entity
Editor window that lets you
examine the attributes, columns, indexes, relationships, and other aspects of the
table. Sample views of the Entity Editor are shown in Figure 18.16 and Figure 18.17.<BR>
<BR>
<A NAME="Heading23"></A><A
HREF="18ebu16.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu16.jpg">FIGURE 18.16.</A><FONT COLOR="#000077">
</FONT><I>The Columns page in the Entity Editor from ER1.<BR>
<BR>
<A NAME="Heading24"></A></I><A HREF="18ebu17.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu17.jpg">FIGURE 18.17.</A><FONT COLOR="#000077">
</FONT><I>The
Relationships page in the Entity Editor from ER1.</I></P>
<P>Some of the pages in the Entity Editor are designed to let you enter notes so
that you can add comments about a particular table. Your comments, of course, will
be attached specifically to a
particular table, and they can be viewed by others
who want to be apprised of your work or design.</P>
<P>SDesigner also gives you at least this much functionality, if not more. However,
I do find that ER1 has a particularly clear view of the tables
in a database, as
well as a very cleverly designed interface. Remember that this description is not
meant to be a comparative review of the two products, and you should definitely examine
other sources of information before spending money on any of
these tools.</P>
<P>These products all enable you to print out the diagrams they make of a database.
You can then hang this printout on a communal bulletin board where it can be referenced
or reviewed by others working on your team. In general, both
SDesigner and ER1 have
numerous features designed to aid a team of programmers in database design.
<H3><A NAME="Heading25"></A><FONT COLOR="#000077">Cadet</FONT></H3>
<P>I don't think the talented creator of Cadet would mind if I preface my overview
of his product by stating that it is not as powerful as either SDesigner or ER1.
It is a much cheaper product to buy, and you can get trial shareware versions for
free from the Net. I should add, however, that Cadet has more to offer than the Data
Model Designer from Paradox.
<DL>
<DT></DT>
</DL>
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>I should perhaps add here that price
is a big issue on these products. The big professional database tools like ER1 and
SDesigner can be very pricey. Finding a relatively affordable product like Cadet
can be a boon to programmers. In fact, you should check the CD that accompanies this
book to see whether it includes a trial version of Cadet.
<HR>
</BLOCKQUOTE>
<P>Cadet can reverse-engineer an InterBase table via ODBC. Note, however, that you
do not have as much detailed information available after you import. For example,
no lines designate the links between the tables.</P>
<P>Cadet does, however, allow you
to draw the relationships yourself using a few
easy-to-master visual tools. If you take a few minutes to do this work, you can get
a neat, easy-to-read diagram showing the relationship between the tables.</P>
<P>Finally, you can use Cadet to edit the
metadata of your database. For example,
you can create tables, edit the fields of the tables, or set up indexes.</P>
<P>That's all I'm going to say about Cadet in this book. Before closing this section,
however, I want to point out what a great
bargain Cadet can be for small programming
houses or independent programmers. It does not pack the power of a tool such as ER1
or SDesigner, but it is still a very powerful tool that can dramatically improve
your ability to manipulate and maintain a
database. For example, take a look at a
view from WISQL, as shown in Figure 18.18. When you get down to it, wouldn't you
rather use Cadet than a tool like WISQL?<BR>
<BR>
<A NAME="Heading27"></A><A HREF="18ebu21.jpg" tppabs="http://pbs.mcp.com/ebooks/0672310228/art/18/18ebu21.jpg">FIGURE 18.18.</A><FONT
COLOR="#000077">
</FONT><I>WISQL provides a very primitive view of a database compared to what you
see in a product like Cadet.</I>
<H3 ALIGN="CENTER"></H3>
<H3><A NAME="Heading28"></A><FONT COLOR="#000077">Summary</FONT></H3>
<P>In this brief
chapter, I have given you an overview of some of the CASE tools
you can use with BCB. I have made no attempt to cover all the products in the field.
I have also made no attempt to explore these products in depth, in large part because
this book is
about BCB, not about any third-party CASE tool, regardless of its merits.</P>
<P>I want to stress that the information shown in this chapter is not a form of review,
nor have I tried to compare or rate these tools. On the contrary, my goal has been
merely to make sure you are aware of the presence of these tools and of the fact
that you can use them with BCB.</P>
<P>CASE and data modeling tools can provide an enormous boost to difficult database
projects. If you work with databases all day long,
then you probably ought to be
using one of these tools. Certainly, they are worth careful consideration for anyone
who works full-time in the field. As a rule, after you have spent a day or two with
any one of them, you will find it difficult to
consider programming without it.</P>
<P>Another great benefit of data modeling tools is that they can teach you a good
deal about database design, and they can help steer you in the right direction when
creating your data model. Just wandering through
the menus of a product like SDesigner
is an education in itself, and no one who has mastered the tool could ever be said
to be less than a solid intermediate-level database programmer. Becoming an expert
at using these tools is likely to improve the
skills of most programmers and to add
considerably to your knowledge of database design.</P>
<P ALIGN="CENTER"><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="41" HEIGHT="41"
ALIGN="BOTTOM" ALT="TOC" BORDER="0" NAME="toc8"></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="41" HEIGHT="41" ALIGN="BOTTOM" ALT="BACK" BORDER="0" NAME="toc6"></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="41" HEIGHT="41" ALIGN="BOTTOM" ALT="FORWARD" BORDER="0"
NAME="toc7"></A></P>
<P>
<P ALIGN="CENTER"><FONT COLOR="#000000">©</FONT><A HREF="copy.htm" tppabs="http://pbs.mcp.com/ebooks/0672310228/copy.htm">Copyright</A><FONT
COLOR="#000000">, Macmillan Computer Publishing. All rights reserved.</FONT>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -