Preface

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Preface

Chapter 3, Selecting, talks about the inverse of Chapter 2, getting data


out of the database with SELECT, UNLOAD, and the ISQL OUTPUT state-
ment. This is the longest chapter in the book, which should come as no surprise;
the SQL SELECT statement may be the most powerful, most complex single
syntactic construction available in any programming language.
Chapter 3 starts with an explanation of the SELECT statement, the logical
execution of a SELECT, which shows how all the various clauses fit together
and contribute to the final result set without concern for how SQL Anywhere
actually executes a SELECT. Most of the rest of Chapter 3 follows the steps laid
out and explained in the beginning of the chapter. If youve ever had trouble
with the GROUP BY clause, or had a SELECT that returned 10,000 rows
instead of the three you wanted, or wondered why you cant call NUMBER(*)
in a WHERE clause, this is the chapter for you.
Chapter 4, Updating, covers the UPDATE statement and how it can be
used to update a single row in one table, or multiple rows, or even multiple rows
in multiple tables. This chapter also includes a section on the logical execution
of a set UPDATE and a discussion of cursor UPDATE statements using the
WHERE CURRENT OF clause.
Chapter 5, Deleting, is the evil twin of Chapter 4; it talks about deleting
single and multiple rows, and includes a section on the logical execution of a set
DELETE as well as information about cursor DELETE statements using
WHERE CURRENT OF. Chapter 5 also includes a section on TRUNCATE
TABLE and how it compares with DELETE: sometimes faster, sometimes not,
and why.
Chapter 6, Fetching, talks about the DECLARE, OPEN, FETCH, and
CLOSE statements as they apply to cursors using SELECT queries and proce-
dure calls. It also describes the cursor FOR loop, which vastly simplifies the
cursor loops in SQL by eliminating the need to DECLARE all those local vari-
ables or code those endless FETCH lists.
Chapter 7, Synchronizing, is the MobiLink chapter; it discusses how the
MobiLink server works together with the MobiLink client for ASA to synchro-
nize data back and forth between a consolidated database and dozens or
thousands of remote databases. MobiLink scripts are classified by level (con-
nection, session, table, and row) and by direction (upload versus download), and
error handling on the server and client sides is described.
Chapter 8, Packaging, talks about moving application logic into the data-
base using BEGIN blocks and SQL modules based on BEGIN blocks:
procedures, functions, triggers, and events. The SET assignment statement is
described, as well as the flow-of-control structures IF, CASE, and WHILE, the
EXECUTE IMMEDIATE statement, and the connection-level CREATE
VARIABLE statement. This chapter also introduces the basics of exception han-
dling, a topic that is expanded on in Chapter 9.
Chapter 9, Protecting, is the second-longest chapter, and it explores the
widest variety of topics including options, transactions, exceptions, errors,
subtransactions, locks, blocks, isolation levels, deadlocks, mutexes, user IDs,
privileges, user groups, logging, recovery, backup, restore, and (gasp!) database
validation. Many of these topics are only loosely connected to one another, but
they all fall under the general heading Crashing, Bashing, Thrashing, and the
Protection Therefrom.

xi

You might also like