Home of the original IBM PC emulator for browsers.
[PCjs Machine "ibm5170"]
Waiting for machine "ibm5170" to load....
T h e P C - S I G L i b r a r y o n C D - R O M
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This may well be the greatest collection of software ever compiled.
The PC-SIG Library on CD-ROM is our premier collection of the entire
PC-SIG library. Every shareware program we have is on one disc; over
900 megabytes of software you can have immediate access to.
Easy to use, all you have to do is insert the disc and type 'INSTALL' at
the DOS prompt. We've included all the tools you need for fast easy
access to the programs and their descriptions.
The WordCruncher text retrieval software allows you to quickly access
the description for any program you want. All the programs are indexed
by title, filename, PC-SIG disk number, and every word within the
program description. There couldn't be an easier way to find just the
right program. All the programs are logically divided into thirteen
major categories with subcategories, making it easier to find just the
right software.
All of the programs have been scanned for viruses. There are also three
online virus utilities that can be run from the CD-ROM which will scan,
screen and clean viruses. Not only does this save hard disk space, but
also gives every user added security from viruses.
Whether you're interested in Accounting or Windows, there's a shareware
program for you on the PC-SIG Library on CD-ROM.
Winner of the Optical Publishing Assn's Best Consumer Product Award.
Shareware for every imaginable need: Accounting Chemistry Educational
Engineering Games Hypertext Networks Programming Spreadsheets Utilities
Word Processing
Additional BBS file descriptions are available from PC-SIG so that the
CD-ROM can be set up quickly on a bulletin board.
System Requirements:
IBM PC/XT/AT PS/2 or compatible with 530K memory DOS 3.1 or higher and
a graphics monitor (Hercules/EGA/VGA/SVGA). A mouse is optional.
T h e E s s e n t i a l H o m e & B u s i n e s s C o l l e c t i o n
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"Never before has such a valuable collection of popular shareware been
compiled on one CD-ROM that everyone can afford." Dr. File Finder a.k.a.
Michael Callahan
Finally, 368 of the most useful, popular, important shareware programs
have been put together on one CD. No matter what your need, it's on The
Essential Home & Business Collection. Everything from Administration to
Windows software is here.
The Essential CD incorporates the WordCruncher text retrieval system.
Every program on the disc is indexed by title, filename, PC-SIG disk
number, and every word in the program description. A new utility, Narc,
is implemented so you can look at the program files and the author's
on-line documentation without having to first copy the program to your
hard disk. By using WordCruncher and Narc, you can quickly find the
program you want and review it to be sure, without ever having to run it
from your hard disk.
If you've got a CD-ROM player at home and want to get more use of it and
your computer, or if you're trying to avoid purchasing another Nintendo
cartridge, or if you just enjoy looking at new software, you need The
Essential Home & Business Collection.
System Requirements:
IBM PC/XT/AT PS/2 or compatible with 384K memory DOS 3.1 or higher and
Microsoft MS-DOS CD ROM extensions.
The PC-SIG Games CD-ROM
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Now you can play a game a day fo over a year. This CD-ROM is jammed
with over 380 shareware games of all types, designed to appeal to the
new generation of CD-ROM users out for fun. The CD incorporates a
hypermedia interface and allows 250 of the games to be played directly
from the CD-ROM.
The hottest games in shareware are on this disk, including the
action/arcade games "Jill of the Jungle" and "Wolfenstein 3D," which
rival or surpass commercial PC and Nintendo for use of animation,
SoundBlaster audio, and VGA graphics. There are also games designed to
teach children mathematics, spelling and even ecology. All these games
for less than a dime each!
Over 250 of the games can be played directly from the CD without copying
them to a floppy or a hard drive. Being able to run from the CD means
that users can explore games without using up valuable hard disk space
or spending time downloading and deleting files. The hypermedia
interface makes it easy to browse the titles, read a one line
description or full review, and copy or start a game by clicking the
mouse or using the keyboard.
To Order in the U.S.A.: Call 800-245-6717 and ask for Customer Service.
Outside the U.S.A. call (408) 730-9291 for the name of the dealer in
your country.
P C - S I G
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Welcome to the world of Shareware, state of the art software you can
actually try before you buy.
Shareware, a term coined in the early eighties, refers to the method of
distribution chosen by the software authors. With shareware, you can
receive a program and put it through its paces without having to pay for
it. If you find the program useful, and choose to keep the program, then
you pay a modest registration fee to the author.
For the last nine years, PC-SIG has been providing shareware and public
domain software to its customers and members. Since 1982 PC-SIG has
developed an unprecedented library of shareware programs, constantly
updated, consistently strong in every category. Our library of
shareware contains over 3500 titles divided into 120 logical categories.
Every program we add to the library is thoroughly reviewed and tested to
insure that each one meets the high standards of reliability and value we
insist upon and you expect. As a result, our library doesn't contain
every shareware program available, just those that really work.
PC-SIG has grown into the premier distributor of shareware and and
shareware information by producing shareware collections on CD-ROM,
publishing an encyclopedia of shareware, and by publishing Shareware
Magazine, a bi-monthly magazine distributed world-wide.
Quality and support - guaranteed. All of our programs are guaranteed
virus free. We've isolated our systems and check every program
submitted to insure that no viruses make their way to your computer or
ours.
Our support staff is available by phone as well as on our BBS to help
you with questions about installation and operation of PC-SIG's
products.
Through our network of international distributors, PC- SIG strives to
bring you the most current, exciting, technically advanced software
available as shareware.
If you can't find the software you need in PC-SIG's library, it may well
not exist.
To order the latest in Shareware, in the U.S.A: Call (800) 245-6717
Outside the U.S.A. call (408) 730-9291 for the name of the dealer in
your country.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Product Information Page 1 of 2
Quasar SQL For Windows
Release 2.0 - November 1991
PRODUCT INFORMATION
Copyright (c) 1991 by Stellar Industries
All Rights Reserved
Quasar SQL For Windows
Designed to take full advantage of the Microsoft Windows
environment, with its pull down menus, dialog boxes, icons and
instant access to on-line help, Quasar SQL For Windows is
incredibly easy to use. Besides a clear error handling and
reporting interface, the system also supports a complete
transaction management facility.
Quasar SQL For Windows is the ideal choice for creating Windows
relational database applications. It provides:
o A full-featured relational data base engine (the Quasar
Database Administrator)
o A multiple document editor (the Quasar Query Editor) for
on-line interactive queries
o An SQL call interface (the Quasar SQL API dynamic link
library), giving developers a choice of front-end
development environments such as 'C', 'C++', 'Visual
Basic', 'Pascal' etc.
o An implementation of the American National Standard
X.3.135-1986 SQL specification (level 2)* plus an
advanced indexing capability
All programs are written in 'C' for the Microsoft Windows
environment utilizing either 80286, 80386 or 80486 processors.
They may be run under Microsoft Windows 3.0 in either
"standard mode" or "enhanced mode".
Complete examples, including source code, are included for
both Microsoft 'C' application developers and for Microsoft
'Visual Basic' application developers.
* This release does not implement the UNION operator or the
CREATE VIEW statement. For an excellent guide to the SQL
language see C. J. Date "A Guide To DB2," Addison-Wesley
(1985).
Product Information Page 2 of 2
Whether you are a software developer, corporate data
processing organization or value added re-seller (VAR): Quasar
SQL For Windows may be used as your database platform for
Windows application development. For a fraction of the cost
of other systems, Quasar SQL For Windows puts a well designed
Windows relational data base management system at your
fingertips.
For additional information, contact us:
Stellar Industries: (714) 861-7885
3335 S. Falcon Ridge Road
Diamond Bar, CA 91765
S H A R E W A R E M A G A Z I N E
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Shareware Magazine has distinguished itself as the only internationally
distributed periodical devoted to the use and business of shareware.
Shareware Magazine provides detailed reviews of new products,
hard-hitting comparisons of shareware programs with regular retail
software, and timely information about changes in the industry and the
latest technology.
Intriguing columnists and regular features add to the excitement. The
beginners section sheds light on new user's concerns regarding
everything from choosing the right operating system to alleviating the
intimidation of using on-line systems.
Educational sections focus on how low cost shareware can aid in
classroom learning, curriculum development, and as a forum for
discussing the impact of computers and technology in schools.
Graphics Gallery renders expert advice and suggestions on how to better
work with graphics, desktop publishing, CAD systems, and the Windows
environment.
Programmers benefit from others experience in developing new programs or
polishing existing ones as well as choosing the right programming
language.
And columnists provide that subjective component, sometimes
controversial, that calls for a closer look at the way we compute and
how shareware effects what we do.
Published bimonthly, Shareware Magazine is available on a subscription
or at your local newsstand or computer bookstore. In conjunction with
PC-SIG, there are special benefits for subscribers as well as
opportunities for discount purchases from PC-SIG.
To Order, in the U.S.A.: Call 800-245-6717 and ask Customer Service.
Outside the U.S.A. call (408) 730-9291 for the name of the dealer in
your country.
[B]
FROM: ___________________________
___________________________
___________________________
[A] [B]
___________________________
PC-SIG Inc.
[A] [B]
1030-D East Duane Avenue
Sunnyvale California
94086
Fold - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Fold
HOW TO USE THIS RETURN ENVELOPE
1. Place any other pages underneath this page.
2. Using the Fold lines (above) as a guide, fold this flap under.
3. Fold the address flap so it covers this flap.
4. Tape or staple the envelope at the two spots marked [A].
5. Slip in any other enclosures (business cards, cheques, etc.).
6. Tape or staple the envelope at the spots marked [B].
THANKS FOR TAKING THE TIME TO PRINT THIS FORM -*- MAIL YOUR ORDER TO:
PC-SIG Inc. 1030-D East Duane Avenue Sunnyvale CA 94086
---------------------------------------------------------------------
Do not mail cash. Please allow four weeks for processing.
---------------------------------------------------------------------
Check the items desired:
PC-SIG Disks - Member $2.49 for 5.25" or $2.99 for 3.5"
Non-member $3.50 for 5.25" or $4.00 for 3.5"
_____ _____ _____ _____ _____ _____ _____ _____ _____
_____ _____ _____ _____ _____ _____ _____ _____ _____
_____ _____ _____ _____ _____ _____ _____ _____ total ______
One year subscription to Shareware Magazine $14.95 ______
Super Saver Membership $34.95 ______
(includes a 1 year subscription to Shareware Magazine,
the PC-SIG Encyclopedia on Disk with WordCruncher,
and 5 free disks)
The PC-SIG Catalog on Disk $7.00 ______
The PC-SIG Encyclopedia on Disk with WordCruncher $20.00 ______
GAMES CD Amazing Disk - Amazing Price! $25.00 ______
*** PC-SIG Library on CD-ROM 12th Edition *** $99.00 ______
Upgrade to the 12th Edition from ANY previous edition
of the PC-SIG Library on CD-ROM! $59.00 ______
Upgrade from ANY other shareware CD-ROM just $59.00 ______
Subtotal ______
Shipping and Handling $4.00
California residents add 8.25% sales tax ______
TOTAL ______
If you have any comments or suggestions, please let us know!
To order by phone with VISA or MASTERCARD call (800)245-6717
Ask for operator #2351
Company Information Page 1 of 1
Quasar SQL For Windows
Release 2.0 - November 1991
COMPANY INFORMATION
Copyright (c) 1991 by Stellar Industries
All Rights Reserved
Who is Stellar Industries?
Stellar Industries is a team of professional software
developers dedicated to providing top quality relational
database software at affordable prices. Stellar Industries is
committed to exceptional customer support.
Stellar Industries believes you can utilize our products as a
platform for your software targeted towards specific market
niches. Source code rights are also available. Contact us
for additional information.
Stellar Industries welcomes your comments and suggestions.
Please contact us at:
(714) 861-7885
3335 S. Falcon Ridge Road
Diamond Bar, CA 91765
License Information Page 1 of 2
Quasar SQL For Windows
Release 2.0 - November 1991
LICENSE INFORMATION
Copyright (c) 1991 by Stellar Industries
All Rights Reserved
Trial Use License
Quasar SQL For Windows (WINSQL20.ZIP) is provided at no charge for
evaluation purposes only. This shareware version of Quasar SQL
For Windows is a complete working version of the programs, it
differs from the registered version by the restriction on the
number of journal entries.
Term: Stellar Industries hereby grants you a limited license to
use this software for evaluation purposes only for a period not
to exceed 30 days. If you intend to continue using this software
after the 30-day evaluation period, you must make a registration
payment to Stellar Industries. Use of this software after the
evaluation period without registering is a violation of the terms
of this limited license.
You shall not use, copy, rent, lease, sell, modify, decompile,
disassemble, otherwise reverse engineer, or transfer this
software except as provided in this agreement. Any such
unauthorized use shall result in immediate and automatic
termination of this license.
All rights not expressly granted here are reserved to Stellar
Industries.
Limited Distribution License
Stellar Industries encourages you to freely copy and distribute
the unregistered version of WINSQL20 subject to the following
restrictions:
The WINSQL20 package is defined as containing all the material
listed in the PACKING.LST text file. If any files listed in the
PACKING.LST text file, or the PACKING.LST file itself, are
missing, then the package is not complete and distribution is
forbidden. Please contact us to obtain a complete package
suitable for distribution.
License Information Page 2 of 2
o The package, including all related program files and
documentation files, cannot be modified in any way and must be
distributed as a complete package, without exception.
o You may distribute the package, but you must not represent
in any way that you are selling the software itself.
o The printed documentation may not be reproduced in whole or
in part, using any means, without the prior written permission of
Stellar Industries. In other words, the disk-based documentation
may not be distributed in printed (hardcopy) form.
o Stellar Industries prohibits the distribution of outdated
versions of its products without written permission from Stellar
Industries. If the version you have is over twelve (12) months
old, please contact us to ensure that you have the most current
version. This version was released in November, 1991.
o You shall not use, copy, rent, lease, sell, modify,
decompile, disassemble, otherwise reverse engineer, or transfer
the licensed program except as provided in this agreement. Any
such unauthorized use shall result in immediate and automatic
termination of this license.
All rights not expressly granted here are reserved by Stellar
Industries.
Warranty Disclaimer
This program is provided "AS IS" without warranty of any kind.
In addition, Stellar industries specifically disclaims all
warranties, expressed or implied, including but not limited to
implied warranties of merchantability and/or fitness for a
particular purpose. In no event shall Stellar Industries be
liable for any claims for lost profits, lost savings or any other
damage, including but not limited to special, incidental,
consequential or other damage even if Stellar Industries has been
advised of the possibility of such damages. Some states do not
allow the exclusion or limitation of incidental or consequential
damages, so the above limitation or exclusion may not apply to
you.
In no case shall Stellar Industries' liability exceed the license
fees paid for the right to use the licensed software.
Governing law: This statement shall be construed, interpreted,
and governed by the laws of the state of California.
Stellar Industries
3335 S. Falcon Ridge Road
Diamond Bar, CA 91765
(714) 861-7885, (714) 861-4975 Fax
Order Form Page 1 of 1
Quasar SQL For Windows
Release 2.0 - November 1991
ORDER FORM
Copyright (c) 1991 by Stellar Industries
All Rights Reserved
We offer discounts on quantity orders and site licenses.
Source code rights are also available. Please call for
details. For domestic orders, we accept company or personal
checks. For international orders, please use a cashier's check
or money order in United States funds.
Voice: (714) 861-7885
Monday - Friday
8:00 AM - 5:00 PM
Mail to: Stellar Industries
3335 S. Falcon Ridge Road
Diamond Bar, CA 91765
Quasar SQL For Windows, please send:
____ Non-Commercial License @ $198.00 ea $ ______
____ Commercial License @ $298.00 ea $ ______
California Residents please add Sales Tax @ 8.25% $ ______
Shipping Within (US/Canada/Mexico): $ FREE
Shipping to Other International Locations: $ 15.00
Total $ ______
Please make your check payable to Stellar Industries
Diskette size: 5 1/4" _____ 3 1/2" _____
Name: ___________________________________________________
Company ___________________________________________________
Address ___________________________________________________
___________________________________________________
Signature ___________________________________________________
Date ___________________________________________________
Product Information Page 1 of 2
Quasar SQL For Windows
Release 2.0 - November 1991
PRODUCT INFORMATION
Copyright (c) 1991 by Stellar Industries
All Rights Reserved
Quasar SQL For Windows
Designed to take full advantage of the Microsoft Windows
environment, with its pull down menus, dialog boxes, icons and
instant access to on-line help, Quasar SQL For Windows is
incredibly easy to use. Besides a clear error handling and
reporting interface, the system also supports a complete
transaction management facility.
Quasar SQL For Windows is the ideal choice for creating Windows
relational database applications. It provides:
o A full-featured relational data base engine (the Quasar
Database Administrator)
o A multiple document editor (the Quasar Query Editor) for
on-line interactive queries
o An SQL call interface (the Quasar SQL API dynamic link
library), giving developers a choice of front-end
development environments such as 'C', 'C++', 'Visual
Basic', 'Pascal' etc.
o An implementation of the American National Standard
X.3.135-1986 SQL specification (level 2)* plus an
advanced indexing capability
All programs are written in 'C' for the Microsoft Windows
environment utilizing either 80286, 80386 or 80486 processors.
They may be run under Microsoft Windows 3.0 in either
"standard mode" or "enhanced mode".
Complete examples, including source code, are included for
both Microsoft 'C' application developers and for Microsoft
'Visual Basic' application developers.
* This release does not implement the UNION operator or the
CREATE VIEW statement. For an excellent guide to the SQL
language see C. J. Date "A Guide To DB2," Addison-Wesley
(1985).
Product Information Page 2 of 2
Whether you are a software developer, corporate data
processing organization or value added re-seller (VAR): Quasar
SQL For Windows may be used as your database platform for
Windows application development. For a fraction of the cost
of other systems, Quasar SQL For Windows puts a well designed
Windows relational data base management system at your
fingertips.
For additional information, contact us:
Stellar Industries: (714) 861-7885
3335 S. Falcon Ridge Road
Diamond Bar, CA 91765
General Information Page 1 of 8
Quasar SQL For Windows
Release 2.0 - November 1991
GENERAL INFORMATION
Copyright (c) 1991 by Stellar Industries
All Rights Reserved
Release 2.0 Enhancements
Quasar SQL For Windows Release 2.0 adds significant new
features:
***** Quasar SQL Applications Programming Interface (API)
What is the Quasar SQL API?
The Quasar SQL API is a powerful tool that enables you,
the software developer, to have full access to a modern,
highly optimized ANSI standard SQL database manager: the
Quasar Database Administrator. Your programs written in
any language which can access dynamic link libraries can
also access the Quasar SQL API. These languages include
'C', 'C++', 'Visual Basic', 'Pascal' and most assemblers.
In fact, any program which can access the Microsoft
Windows environment can access the Quasar SQL API.
Microsoft Windows itself is a dynamic link library.
The Quasar SQL API is your gateway to modern database
technology. With a little more than a dozen functions
and only 4 data structures you can perform almost any
database task.
How does the Quasar SQL API work?
"How is this done?" you might ask. Well, while the
Quasar Database Administrator is sophisticated, complex
and fully optimized for maximum performance: the Quasar
SQL API is simple and straight forward. The Quasar SQL
API effectively buffers you from all the complex tasks of
parsing, query analysis, query optimization, query tree
construction, etc.
How do I link to the Quasar SQL API?
When programming in 'C', you need to do only three things
to include all the power of SQL in your application:
General Information Page 2 of 8
1) When you link your object modules, include the
SQL.LIB import library along with libw.lib.
2) Include the SQL.H file (e.g. "#include <sql.h>") in
your source code.
3) Put the Quasar Database Administrator (DBA.EXE) and
Quasar SQL API (SQL.DLL) someplace where windows can
find them (usually in your windows directory).
When programming in 'Visual Basic', you need to do only
two things to include all the power of SQL in your
application:
1) Be sure to use the SQL.GBL file included with the
Quasar SQL API. Note that the 'C' style prefixes
used with variable names (i.e. the 'n' in
nResultCode, and the 'sz' in szErrorMessage) are not
used with 'Visual Basic'.
2) Put the Quasar Database Administrator (DBA.EXE) and
Quasar SQL API (SQL.DLL) someplace where windows can
find them (usually in your windows directory).
How do I use the Quasar SQL API?
Your program can login to the Quasar Database
Administrator (SqlLogin), open a cursor (SqlCursorOpen)
and execute a query (SqlExecute). The query itself is
passed to the Quasar SQL API as a simple text string. The
Quasar SQL API does all the work for you. To get your
answers back (from a SELECT statement, for example) you
simply fetch them one at a time from the Quasar SQL API.
You can fetch the first record (SqlFetchFirst), last
record (SqlFetchLast), next record (SqlFetchNext),
previous record (SqlFetchPrevious) or even a record at a
position you specify (SqlFetchPositioned).
You can have several cursors open at a time so that you
can access your data the way you want.
When you're all done, close your cursors (SqlCursorClose)
and log out (SqlLogout).
How can I check out my SQL statements?
You can check out your SQL statements using the Quasar
Query Editor (QE.EXE) included with the Quasar SQL API.
The Quasar Query Editor allows you to type in the query
your program is going to send to the Quasar SQL API and
have it execute right there in front of you. You'll get
all the results back on the screen where you can verify
it's what you expected. In fact, the Quasar Query Editor
uses the Quasar SQL API the same way your program does.
General Information Page 3 of 8
***** GENERAL PERFORMANCE IMPROVEMENT
Quasar SQL For Windows Release 2.0 has significant
performance improvements over both Release 1.0 (about 6
fold) and Release 1.1 (about 2 fold) as evidenced by the
timings below. These queries are available to you in the
EXAMPLE.ZIP file.
+--------------------------------------------------------+
| release: | 1.0 | 1.1 | 2.0 |
|--------------------+-----------+-----------+-----------|
| QUERY15.SQL | 6.0 sec. | 1.4 sec. | 0.5 sec. |
|--------------------+-----------+-----------+-----------|
| QUERY16.SQL | 5.1 sec. | 1.9 sec. | 1.0 sec. |
+--------------------------------------------------------+
(80386 33MHz, 17 msec IDE disk, HYPERDISK disk cache)
***** OTHER ENHANCEMENTS
Significantly fewer records are written to the
transaction journal.
Unpacking and Installation Instructions
Quasar SQL For Windows is provided as a single compressed file.
(WINSQL20.ZIP). The contents of WINSQL20.ZIP are defined in
the included PACKING.LST file.
Efficient operation of SQL For Windows requires that you use a
disk cache manager (such as MicroSoft's SMARTDRV.SYS). For
superior performance use a disk cache manager which also
caches disk writes, such as Norton Disk Cache (available with
Norton Utilities) or Hyperdisk Disk Accelerator (available as
shareware from HyperWare*). We at Stellar Industries
recommend Hyperdisk Disk Accelerator with which we observe a
three to six fold performance enhancement verses SMARTDRV.SYS.
Hyperdisk is available on many BBS's as HYDK421.ZIP.
Documentation for these disk cache managers should be
carefully reviewed. Utilizing SMARTDRV.SYS instead of
HyperDisk, the above timings become:
____________________
* HyperWare, RR#1 Box 91, Pall Mall, TN 38577; voice: (615)
864-6868; BBS: 8N1 (HST, V.32, V.22bis): (615) 864-6871
General Information Page 4 of 8
+--------------------------------------------------------+
| release: | 1.0 | 1.1 | 2.0 |
|--------------------+-----------+-----------+-----------|
| QUERY15.SQL | 20.0 sec. | 4.7 sec. | 1.8 sec. |
|--------------------+-----------+-----------+-----------|
| QUERY16.SQL | 22.0 sec. | 8.4 sec. | 5.9 sec. |
+--------------------------------------------------------+
Adding indices to tables greatly enhances performance. A
simple SELECT which extracts 5 records from a table of 3000
takes 10.6 seconds without an index. The same SELECT
statement takes only 0.6 seconds when there is an index on the
table.
While indices may be created at any time, we recommend that
you create indices immediately after you create their base
tables, otherwise CREATE INDEX has to read and rewrite all
data which is already in the table.
The importance of a good disk cache manager and thoughtful
database design including the use of indices (where
appropriate) cannot be over emphasized.
In order to properly install SQL For Windows on your computer
you will need to perform the following steps:
1) Use your favorite editor (NOTEPAD.EXE will suffice) to
insure that your 'CONFIG.SYS' file has the 'FILES=' MSDOS
parameter set to at least 30.
2) Move DBA.EXE, DBA.HLP, QE.EXE, QE.HLP, SQL.DLL and
SQL.HLP to the directory in which you keep windows
programs. This is usually the 'c:\windows' directory.
3) Make two new directories. One will be for the Quasar
Database Administrator's files (we recommend naming it
'database'), the other will be for your queries and data
(we recommend naming it 'data'). You can use the MS-DOS
'mkdir' command to do this.
4) Unpack EXAMPLE.ZIP (contained within WINSQL20.ZIP). This
file contains both sample queries and an import file to
load some sample data into the database. We recommend
putting these files in your 'data' directory.
5) Use your favorite editor (NOTEPAD.EXE will suffice) to
modify the windows initialization file WIN.INI. This
file can usually be found in the 'c:\windows' directory.
Add the following lines:
[QuasarDba]
AutoStart=1
DatabasePath=c:\database
DataFilePath=c:\data
General Information Page 5 of 8
FileNameDatabaseDump=c:\temp\quasar.dmp
[QuasarQe]
Acknowledge=1
DataFilePath=c:\data
OpenNew=1
UserName=SYSTEM
UserPassword=QUASAR
WarnOnClose=1
As DBA.EXE and QE.EXE automatically add some of these
lines if they do not already exist, be sure you are not
adding duplicate entries. If you edit WIN.INI before
running DBA.EXE or QE.EXE you don't have to worry.
These entries have the following meanings:
[QuasarDba] Identifies a block of entries as
belonging to the Quasar Database
Administrator.
AutoStart Set to '0' or '1'. When set to '1'
causes the Quasar Database
Administrator to automatically start
the database as soon as you start the
program.
DatabasePath Set to the path you want the database
files to reside in. Make sure to
create this directory before starting
the Quasar Database Administrator. We
recommend naming it 'database'.
DatafilePath Set to the path you want to use as
the default for import and export
operations. We recommend naming it
'data'.
FileNameDatabaseDump Set to the full file name of
the file you want the Quasar Database
Administrator to use for the 'dump'
operation.
[QuasarQe] Identifies a block of entries as
belonging to the Quasar Query Editor.
Acknowledge Set to '0' or '1'. When set to '1'
causes the Quasar Query Editor to
display an informational dialog box
every time a query completes.
DataFilePath Set to the path you want to use as
the default for file operations. We
recommend naming it 'data'.
General Information Page 6 of 8
OpenNew Set to '0' or '1'. When set to '1'
causes the Quasar Query Editor to
automatically create a new 'pad' when
the Query Editor first starts.
UserName Set to 'SYSTEM'. This identifies the
default user name.
UserPassword Set to 'QUASAR'. This identifies the
default user password.
WarnOnClose Set to '0' or '1'. When set to '1'
causes the Quasar Query Editor to
prompt the user for a file name
before closing a pad which contains
text not yet saved to disk.
SQL For Windows also relies upon the international date
and time settings. The Windows defaults are fine and you
can leave them alone. If you've changed them, don't
worry, time stamps are saved in binary and not converted
to international format until used for output. If you're
interested, we recommend the following settings:
[intl]
iDate=0
iTime=0
s1159=AM
s2359=PM
International date and time settings are most easily
changed via Microsoft's Windows Control Panel. Select
the "International" icon then click on either "date" or
"time".
6) Use Microsoft's Program Manager to create a new program
group:
a) select 'File', 'New'
b) select 'Program Group', 'OK'
c) Enter description: 'Quasar', group file: 'QUASAR'
d) select 'OK'
7) Use Microsoft's Program Manager to create two new program
items:
a) select 'File', 'New'
b) select Program Item, 'OK'
c) Enter description: 'Dba', command line: 'DBA.EXE'
General Information Page 7 of 8
d) select 'OK'
e) select 'File', 'New'
f) select Program Item, 'OK'
g) Enter description: 'Qe', command line: 'QE.EXE'
h) select 'OK'
8) Start the Quasar Database Administrator by clicking on the
'Dba' Icon in the Microsoft Program Manager. When the
Quasar Database Administrator complains that it can't find
a database, click on "OK". Now select 'Toolbox' in the
main menu. Select the 'Install' entry, this will install
the database in the directory identified by the
'DatabasePath' setting described above.
9) At this point the database is fully installed. To run
some sample queries, see the section "Example Queries"
below.
10) If you're not going to use the Quasar SQL Applications
Programming Interface (API), you may exit ('Exit' is in
the 'File' menu) the Quasar Database Administrator.
11) If you intend to use the Quasar SQL API for 'C' program
development: Move SQL.LIB into some directory where it
is accessible by your linker (usually c:\windev\lib).
Move SQL.H to a directory where it is accessible to the
compiler (usually c:\c\include). You will probably want
to read SQL.DOC. A sample application program is
included as EXAMPLEC.*. You ought to compile, link and
run it (the batch file EXAMPLEC.BAT is included to
accomplish this) to familiarize yourself with the Quasar
SQL API.
12) If you intend to use the Quasar SQL API for 'Visual Basic'
program development: A sample application program is
included. Move EXAMBLEB.* to a directory where you keep
your 'Visual Basic' programs (usually c:\vb). You ought
to compile and run EXAMPLEB to familiarize yourself with
the Quasar SQL API. You will probably want to read
SQL.DOC.
Example Queries
You will probably want to run our examples to familiarize
yourself with the operation of SQL For Windows.
General Information Page 8 of 8
1) Start the Quasar Database Administrator by clicking on the
'Dba' Icon in the Microsoft Program Manager. The
database ought to start automatically. If you didn't set
AutoStart=1 in the WIN.INI file, when the Quasar Database
Administrator's window appears select 'Control' from its
menu. Select the 'Start' entry, this will start the
database.
2) Start the Quasar Query Editor by clicking on the 'Qe' icon
in the Microsoft Program Manager. When the Quasar Query
Editor's window appears select 'File' from its menu. Now
select the 'Open' entry and open the file CREATE.SQL.
This is one of the files contained in EXAMPLE.ZIP. When
its text appears in a pad select the menu commands
'Database', 'Execute' (or hit control/x). This query
creates the tables of the example database.
3) Now go to the Quasar Database Administrator and select the
menu commands 'File', 'Import'. Select the file
EXAMPLE.DAT. This is one of the files contained in
EXAMPLE.ZIP. The 'Import' loads the data in EXAMPLE.DAT
into the tables you created with CREATE.SQL.
4) You can now execute any of the sample queries contained
in EXAMPLE.ZIP. Go to the Quasar Query Editor, open a
file (for example QUERY01.SQL) and execute it. Files
which contain select statements will cause the Quasar
Query Editor to open a new pad and place the results as
text into the new pad. You may then edit the data and/or
save it to a file using the 'File', 'Save As' commands.
5) To remove the sample data from the database just execute
the SQL 'drop table' statements in the DROP.SQL file.
6) You are now ready to write your own SQL statements and
create your own database.
Stellar Industries: (714) 861-7885
3335 S. Falcon Ridge Road
Diamond Bar, CA 91765
Quasar SQL API Page 1 of 51
Quasar SQL For Windows
Release 2.0 - November 1991
QUASAR SQL APPLICATIONS PROGRAMMING INTERFACE (API)
Copyright (c) 1991 by Stellar Industries
All Rights Reserved
Summary
This manual is divided into six sections:
Overview This section describes, in general terms, what
the Quasar SQL API is and how you might use it
to execute SQL statements within your program.
Examples are available both in 'C' (EXAMPLEC.*)
and 'Visual Basic' (EXAMPLEB.*).
Functions This section includes a formal description of
all functions which your program can import
from the Quasar SQL API dynamic link library
(SQL.LIB, SQL.DLL). Prototypes for all
functions can be found in the Quasar SQL API
include file for 'C' (SQL.H) and the global
file for 'Visual Basic' (SQL.GBL).
Constants This section includes a formal description of
all constants defined in the Quasar SQL API
include file for 'C' and the global file for
'Visual Basic'.
Data Structures This section includes a formal description of
all data structures which your program will use
when it communicates with the Quasar SQL API.
Typedefs for all these structures can be found
in the Quasar SQL API include file for 'C'.
Declarations can be found in the global file
for 'Visual Basic'.
Result Codes This section gives an explanation of all result
codes returned by the Quasar SQL API. Macro
definitions for all result codes can be found
in the Quasar SQL API include file for 'C'.
Global Const definitions can be found in the
global file for 'Visual Basic'.
Glossary This section defines specialized terms used in
this document.
Summary
Quasar SQL API Page 2 of 51
Overview
What is the Quasar SQL API?
The Quasar SQL API is a powerful tool that enables
you, the software developer, to have full access to
a modern, highly optimized ANSI standard SQL
database manager: the Quasar Database Administrator.
Your programs written in any language which can
access dynamic link libraries can also access the
Quasar SQL API. These languages include 'C', 'C++',
'Visual Basic', 'Pascal' and most assemblers. In
fact, any program which can access the Microsoft
Windows environment can access the Quasar SQL API.
Microsoft Windows itself is a dynamic link library.
The Quasar SQL API is your gateway to modern database
technology. With a little more than a dozen
functions and only 4 data structures you can perform
almost any database task.
How does the Quasar SQL API work?
"How is this done?" you might ask. Well, while the
Quasar Database Administrator is sophisticated,
complex and fully optimized for maximum performance:
the Quasar SQL API is simple and straight forward.
The Quasar SQL API effectively buffers you from all
the complex tasks of parsing, query analysis, query
optimization, query tree construction, etc.
How do I link to the Quasar SQL API?
When programming in 'C', you need to do only three
things to include all the power of SQL in your
application:
1) When you link your object modules, include the
SQL.LIB import library along with LIBW.LIB.
2) Include the SQL.H file (e.g. "#include
<SQL.H>") in your source code.
3) Put the Quasar Database Administrator (DBA.EXE)
and Quasar SQL API (SQL.DLL) someplace where
windows can find them (usually in your windows
directory).
When programming in 'Visual Basic', you need to do
only two things to include all the power of SQL in
your application:
Overview
Quasar SQL API Page 3 of 51
1) Be sure to use the SQL.GBL file included with
the Quasar SQL API. Note that the 'C' style
prefixes used with variable names (i.e. the
'n' in nResultCode, and the 'sz' in
szErrorMessage) are not used with 'Visual
Basic'.
2) Put the Quasar Database Administrator (DBA.EXE)
and Quasar SQL API (SQL.DLL) someplace where
windows can find them (usually in your windows
directory).
How do I use the Quasar SQL API?
Your program can login to the Quasar Database
Administrator (SqlLogin), open a cursor
(SqlCursorOpen) and execute a query (SqlExecute).
The query itself is passed to the Quasar SQL API as a
simple text string. The Quasar SQL API does all the
work for you. To get your answers back (from a
SELECT statement, for example) you simply fetch them
one at a time from the Quasar SQL API. You can fetch
the first record (SqlFetchFirst), last record
(SqlFetchLast), next record (SqlFetchNext), previous
record (SqlFetchPrevious) or even a record at a
position you specify (SqlFetchPositioned).
You can have several cursors open at a time so that
you can access your data the way you want.
When you're all done, close your cursors
(SqlCursorClose) and log out (SqlLogout).
How can I check out my SQL statements?
You can check out your SQL statements using the
Quasar Query Editor (QE.EXE) included with the Quasar
SQL API. The Quasar Query Editor allows you to type
in the query your program is going to send to the
Quasar SQL API and have it execute right there in
front of you. You'll get all the results back on
the screen where you can verify it's what you
expected. In fact, the Quasar Query Editor uses the
Quasar SQL API the same way your program does.
Overview
Quasar SQL API Page 4 of 51
Functions
All Quasar SQL API functions utilize a common structure to
maintain generic information : SQLCONTROL. All functions load
descriptive error information into this structure should an
error condition arise. The basic status condition is the
nResultCode field of this data structure. All Quasar SQL API
functions set this field to the appropriate result code in the
event of an error. Note: All Quasar SQL API functions clear
this field to 0 at entry.
SqlCursorClose Closes a cursor when it is no longer
needed
SqlCursorOpen Opens a cursor in preparation for
executing a query
SqlDescribeColumn Describes an individual column in the
result table
SqlDescribeTable Describes the overall characteristics of
the result table
SqlExecute Causes the database administrator to
execute a query and potentially create a
result table
SqlFetchFirst Retrieves the first record from the result
table
SqlFetchLast Retrieves the last record from the result
table
SqlFetchNext Retrieves the next record from the table
SqlFetchPrevious Retrieves the previous record from the
result table
SqlFetchPositioned Retrieves a particular record from the
result table. The record is identified by
its absolute physical position in the
table
SqlGetStatus Gets status information concerning the
last query executed
SqlLogin Logs an user onto the database
administrator
SqlLogout Logs an user off the database
administrator
Functions
Quasar SQL API Page 5 of 51
Functions: SqlCursorClose
Syntax BOOL FAR PASCAL SqlCursorClose(hUser, hCursor,
lpSqlControl)
This function closes the cursor specified by
the hCursor parameter and drops any result
table associated with it.
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor to
be closed. The hCursor
parameter must have been created
with the SqlCursorOpen function.
lpSqlControl LPSQLCONTROL Points to an SQL
control structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
Return Value The return value is 1 if no errors occurred
while closing the cursor, otherwise it is 0.
Comments Cursors should be closed before logging off
with SqlLogout.
Functions: SqlCursorClose
Quasar SQL API Page 6 of 51
Functions: SqlCursorOpen
Syntax HANDLE FAR PASCAL SqlCursorOpen(hUser,
lpSqlControl)
This function creates a cursor. You must
create a cursor after you have logged in
(SqlLogin) and before you execute a query
(SqlExecute). You can create as many cursors
as you need for your application.
Parameter Type/Description
hUser HANDLE Identifies the user who
will own the cursor. The hUser
parameter must have been created
with the SqlLogin function.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
Return Value The return value is a cursor handle if no
errors occurred while opening the cursor,
otherwise it is 0.
Comments The cursors created by one user are not
available to another. Once a cursor has been
created and used in an SqlExecute, it may be
reused in another SqlExecute by the same user.
When a cursor is reused in this manner, the
Quasar SQL API effectively closes the cursor and
re-opens it with the same handle prior to
executing the next query. Note that when a
cursor is reused, any old result table
associated with it is dropped. Cursors are
closed with SqlCursorClose. Cursors should be
closed before logging off with SqlLogout.
Functions: SqlCursorOpen
Quasar SQL API Page 7 of 51
Functions: SqlDescribeColumn
Syntax BOOL FAR PASCAL SqlDescribeColumn(hUser,
hCursor, lpSqlControl,
nColumnSequenceNumber, lpSqlColumn)
This function describes the characteristics of
the specified column (nColumnSequenceNumber) in
the result table associated with the hCursor
parameter. The description is loaded into the
SQLCOLUMN structure pointed to by the
lpSqlColumn parameter. To describe a column
you must have already logged in (SqlLogin),
created a cursor (SqlCursorOpen) and executed a
query (SqlExecute) which contained an SQL
SELECT statement.
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor
which owns the result table in
which the column exists. The
hCursor parameter must have been
created with the SqlCursorOpen
function. A result table must
be associated with the cursor.
A result table is created when a
query containing an SQL SELECT
statement is passed to
SqlExecute.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
nColumnSequenceNumber unsigned Identifies
the column to be described.
Column numbers range from 1 to
the number of columns in the
result table.
lpSqlColumn LPSQLCOLUMN Points to the target
SQL Column Description
Structure.
Functions: SqlDescribeColumn
Quasar SQL API Page 8 of 51
Return Value The return value is 1 if no errors occurred,
otherwise it is 0.
Comments If a result table is not associated with the
cursor an error will be generated.
Functions: SqlDescribeColumn
Quasar SQL API Page 9 of 51
Functions: SqlDescribeTable
Syntax BOOL FAR PASCAL SqlDescribeTable(hUser,
hCursor, lpSqlControl, lpSqlTable)
This function describes the characteristics of
the result table associated with the hCursor
parameter. The description is loaded into the
SQLTABLE structure pointed to by the lpSqlTable
parameter. To describe a table you must have
already logged in (SqlLogin), created a cursor
(SqlCursorOpen) and executed a query
(SqlExecute) which contained an SQL SELECT
statement.
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor
which owns the result table.
The hCursor parameter must have
been created with the
SqlCursorOpen function. A
result table must be associated
with the cursor. A result table
is created when a query
containing an SQL SELECT
statement is passed to
SqlExecute.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
lpSqlTable LPSQLTABLE Points to the target
SQL Table Description Structure.
Return Value The return value is 1 if no errors occurred,
otherwise it is 0.
Comments If a result table is not associated with the
cursor an error will be generated.
Functions: SqlDescribeTable
Quasar SQL API Page 10 of 51
Functions: SqlExecute
Syntax BOOL FAR PASCAL SqlExecute(hUser, hCursor,
lpSqlControl, lpstrQueryText)
This function executes the query text pointed
to by the lpstrQueryText parameter as a set of
one or more SQL statements. If an SQL SELECT
statement is included in the query text, a
result table is created and associated with the
hCursor parameter. To execute a query you must
have already logged in (SqlLogin) and created a
cursor (SqlCursorOpen).
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor
which will own the result table
if one is created by the query.
The hCursor parameter must have
been created with the
SqlCursorOpen function.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
Additionally, syntax errors
detected by the query manager
cause the nHiLiteOffset field to
be loaded with the character
position of the offending phrase
within the query text. In this
case, the nHiLiteLength field is
loaded with the number of
characters in the offending
phrase.
lpstrQueryText LPSTR Points to a null
terminated string containing the
SQL query. The SQL query may
contain one or more SQL
statements. Among the SQL
statements there can be only 0
or 1 SQL SELECT statement.
Functions: SqlExecute
Quasar SQL API Page 11 of 51
Return Value The return value is 1 if no errors occurred,
otherwise it is 0.
Comments Simply calling SqlExecute does not commit your
query. Queries are committed when you execute
an SQL COMMIT WORK statement. Be sure to
execute this vital statement whenever you want
your program to permanently modify the
database.
Each user must close all cursors which have an
associated result table before executing an SQL
COMMIT WORK statement. This is to insure that
your application has completed its access to
the result table before permanently committing
the transaction. A convenient way to do this
is to use the same cursor for the COMMIT WORK
as you did for the SELECT: the Quasar SQL API
automatically drops any result table that may
be associated with a cursor when the cursor is
reused.
Without the SQL COMMIT WORK statement, all your
transactions will be rolled back when either an
error occurs or when you log off (SqlLogout).
The only exception to this is if you have the
mSqlFlagAutoCommitOnLogout option flag set in
the wFlags field of the lpSqlControl parameter
when you log off. Only in this case are all
your transactions automatically committed at
logout, and then only if no errors have
occurred.
Functions: SqlExecute
Quasar SQL API Page 12 of 51
Functions: SqlFetchFirst
Syntax BOOL FAR PASCAL SqlFetchFirst(hUser, hCursor,
lpSqlControl, lpRecordBuffer)
This function reads the first record in the
result table associated with the hCursor
parameter. The data in this record is
formatted and loaded into the buffer pointed to
by the lpRecordBuffer parameter. To fetch this
record you must have already logged in
(SqlLogin), created a cursor (SqlCursorOpen)
and executed a query (SqlExecute) which
contained an SQL SELECT statement.
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor
which owns the result table in
which the record exists. The
hCursor parameter must have been
created with the SqlCursorOpen
function. A result table must
be associated with the cursor.
A result table is created when a
query containing an SQL SELECT
statement is passed to
SqlExecute.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
lpRecordBuffer LPSTR Points to a buffer
provided by the caller to
receive the formatted record.
This buffer must be at least as
large as the nRecordSize field
of SQLTABLE structure indicates.
Return Value The return value is 1 if no errors occurred and
the table had at least one record, otherwise it
is 0.
Functions: SqlFetchFirst
Quasar SQL API Page 13 of 51
Comments The usual procedure for using the SqlFetchFirst
function is as follows:
1) Set Data Format in the wFlags field of the
lpSqlControl parameter to the option you
intend to use. If you have selected the
mSqlFlagFormatPadded option, set the
nPadding field of the lpSqlControl
parameter to the number of spaces you want
between fields.
2) Call SqlExecute.
3) Call SqlDescribeTable to determine the
characteristics of the result table. Of
particular interest are the nRecordSize
and lNumberOfRecords fields of the
resultant SQLTABLE structure.
4) If SqlTable.lNumberOfRecords indicates
that one or more result table records are
available, allocate a buffer sufficiently
large (at least as large as
SqlTable.nRecordSize) to receive the
record's data. Set the lpRecordBuffer
parameter to point to this buffer and set
the nRecordBufferSize field of the
lpSqlControl parameter to the size of the
buffer.
5) Call SqlFetchFirst.
Once these steps are completed, you can make
unlimited calls to any of the Quasar SQL API
fetch functions without repeating steps (1)
through (4). The same lpRecordBuffer can be
reused for all fetches. Note, however, should
you change the Data Format setting in the
wFlags field of the lpSqlControl parameter, you
must call SqlDescribeTable to calculate the new
nRecordSize setting, reallocate the
lpRecordBuffer and adjust the nRecordBufferSize
field of the lpSqlControl parameter
accordingly.
Functions: SqlFetchFirst
Quasar SQL API Page 14 of 51
Functions: SqlFetchLast
Syntax BOOL FAR PASCAL SqlFetchLast(hUser, hCursor,
lpSqlControl, lpRecordBuffer)
This function reads the last record in the
result table associated with the hCursor
parameter. The data in this record is
formatted and loaded into the buffer provided
by the caller and pointed to by the
lpRecordBuffer parameter. To fetch this record
you must have already logged in (SqlLogin),
created a cursor (SqlCursorOpen) and executed a
query (SqlExecute) which contained an SQL
SELECT statement.
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor
which owns the result table in
which the record exists. The
hCursor parameter must have been
created with the SqlCursorOpen
function. A result table must
be associated with the cursor.
A result table is created when a
query containing an SQL SELECT
statement is passed to
SqlExecute.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
lpRecordBuffer LPSTR Points to a buffer
provided by the caller to
receive the formatted record.
This buffer must be at least as
large as the nRecordSize field
of SQLTABLE structure indicates.
Return Value The return value is 1 if no errors occurred and
the table had at least one record, otherwise it
is 0.
Functions: SqlFetchLast
Quasar SQL API Page 15 of 51
Comments The usual procedure for using the SqlFetchLast
function is as follows:
1) Set Data Format in the wFlags field of the
lpSqlControl parameter to the option you
intend to use. If you have selected the
mSqlFlagFormatPadded option, set the
nPadding field of the lpSqlControl
parameter to the number of spaces you want
between fields.
2) Call SqlExecute.
3) Call SqlDescribeTable to determine the
characteristics of the result table. Of
particular interest are the nRecordSize
and lNumberOfRecords fields of the
resultant SQLTABLE structure.
4) If SqlTable.lNumberOfRecords indicates
that one or more result table records are
available, allocate a buffer sufficiently
large (at least as large as
SqlTable.nRecordSize) to receive the
record's data. Set the lpRecordBuffer
parameter to point to this buffer and set
the nRecordBufferSize field of the
lpSqlControl parameter to the size of the
buffer.
5) Call SqlFetchLast.
Once these steps are completed, you can make
unlimited calls to any of the Quasar SQL API
fetch functions without repeating steps (1)
through (4). The same lpRecordBuffer can be
reused for all fetches. Note, however, should
you change the Data Format setting in the
wFlags field of the lpSqlControl parameter, you
must call SqlDescribeTable to calculate the new
nRecordSize setting, reallocate the
lpRecordBuffer and adjust the nRecordBufferSize
field of the lpSqlControl parameter
accordingly.
Functions: SqlFetchLast
Quasar SQL API Page 16 of 51
Functions: SqlFetchNext
Syntax BOOL FAR PASCAL SqlFetchNext(hUser, hCursor,
lpSqlControl, lpRecordBuffer)
This function reads the next record in the
result table associated with the hCursor
parameter. The data in this record is
formatted and loaded into the buffer provided
by the caller and pointed to by the
lpRecordBuffer parameter. To fetch this record
you must have already preformed at least one
SqlFetchFirst or SqlFetchLast or
SqlFetchPositioned function.
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor
which owns the result table in
which the record exists. The
hCursor parameter must have been
created with the SqlCursorOpen
function. A result table must
be associated with the cursor.
A result table is created when a
query containing an SQL SELECT
statement is passed to
SqlExecute.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
lpRecordBuffer LPSTR Points to a buffer
provided by the caller to
receive the formatted record.
This buffer must be at least as
large as the nRecordSize field
of SQLTABLE structure indicates.
Return Value The return value is 1 if no errors occurred and
the cursor was not already positioned at the
last record, otherwise it is 0.
Functions: SqlFetchNext
Quasar SQL API Page 17 of 51
Comments The same lpRecordBuffer can be reused for all
fetches. Note, however, should you change the
Data Format setting in the wFlags field of the
lpSqlControl parameter, you must call
SqlDescribeTable to calculate the new
nRecordSize setting, reallocate the
lpRecordBuffer and adjust the nRecordBufferSize
field of the lpSqlControl parameter
accordingly.
Functions: SqlFetchNext
Quasar SQL API Page 18 of 51
Functions: SqlFetchPositioned
Syntax BOOL FAR PASCAL SqlFetchPositioned(hUser,
hCursor, lpSqlControl, lRecordPosition,
lpRecordBuffer)
This function reads a record in the result
table associated with the hCursor parameter.
The lRecordPosition parameter indicates which
record is to be read. When lRecordPosition is
'1', the first physical record is read; when
lRecordPosition is '2', the second physical
record is read and so on and so forth. The
data in this record is formatted and loaded
into the buffer provided by the caller and
pointed to by the lpRecordBuffer parameter. To
fetch this record you must have already logged
in (SqlLogin), created a cursor (SqlCursorOpen)
and executed a query (SqlExecute) which
contained an SQL SELECT statement.
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor
which owns the result table in
which the record exists. The
hCursor parameter must have been
created with the SqlCursorOpen
function. A result table must
be associated with the cursor.
A result table is created when a
query containing an SQL SELECT
statement is passed to
SqlExecute.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
lRecordPosition unsigned long Indicates which
record is to be read.
lpRecordBuffer LPSTR Points to a buffer
provided by the caller to
Functions: SqlFetchPositioned
Quasar SQL API Page 19 of 51
receive the formatted record.
This buffer must be at least as
large as the nRecordSize field
of SQLTABLE structure indicates.
Return Value The return value is 1 if no errors occurred and
lRecordPosition is greater than zero and less
then or equal to the number of records in the
table, otherwise it is 0.
Comments Physical position is the raw position of the
record in the file. Physical order is not the
same as the order you specify with the SQL
ORDER BY clause.
The usual procedure for using the
SqlFetchPositioned function is as follows:
1) Set Data Format in the wFlags field of the
lpSqlControl parameter to the option you
intend to use. If you have selected the
mSqlFlagFormatPadded option, set the
nPadding field of the lpSqlControl
parameter to the number of spaces you want
between fields.
2) Call SqlExecute.
3) Call SqlDescribeTable to determine the
characteristics of the result table. Of
particular interest are the nRecordSize
and lNumberOfRecords fields of the
resultant SQLTABLE structure.
4) If SqlTable.lNumberOfRecords indicates
that one or more result table records are
available, allocate a buffer sufficiently
large (at least as large as
SqlTable.nRecordSize) to receive the
record's data. Set the lpRecordBuffer
parameter to point to this buffer and set
the nRecordBufferSize field of the
lpSqlControl parameter to the size of the
buffer.
5) Call SqlFetchPositioned.
Once these steps are completed, you can make
unlimited calls to any of the Quasar SQL API
fetch functions without repeating steps (1)
through (4). The same lpRecordBuffer can be
reused for all fetches. Note, however, should
you change the Data Format setting in the
wFlags field of the lpSqlControl parameter, you
Functions: SqlFetchPositioned
Quasar SQL API Page 20 of 51
must call SqlDescribeTable to calculate the new
nRecordSize setting, reallocate the
lpRecordBuffer and adjust the nRecordBufferSize
field of the lpSqlControl parameter
accordingly.
Functions: SqlFetchPositioned
Quasar SQL API Page 21 of 51
Functions: SqlFetchPrevious
Syntax BOOL FAR PASCAL SqlFetchPrevious(hUser,
hCursor, lpSqlControl, lpRecordBuffer)
This function reads the previous record in the
result table associated with the hCursor
parameter. The data in this record is
formatted and loaded into the buffer provided
by the caller and pointed to by the
lpRecordBuffer parameter. To fetch this record
you must have already preformed at least one
SqlFetchFirst or SqlFetchLast or
SqlFetchPositioned function.
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor
which owns the result table in
which the record exists. The
hCursor parameter must have been
created with the SqlCursorOpen
function. A result table must
be associated with the cursor.
A result table is created when a
query containing an SQL SELECT
statement is passed to
SqlExecute.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
lpRecordBuffer LPSTR Points to a buffer
provided by the caller to
receive the formatted record.
This buffer must be at least as
large as the nRecordSize field
of SQLTABLE structure indicates.
Return Value The return value is 1 if no errors occurred and
the cursor was not already positioned at the
first record, otherwise it is 0.
Functions: SqlFetchPrevious
Quasar SQL API Page 22 of 51
Comments The same lpRecordBuffer can be reused for all
fetches. Note, however, should you change the
Data Format setting in the wFlags field of the
lpSqlControl parameter, you must call
SqlDescribeTable to calculate the new
nRecordSize setting, reallocate the
lpRecordBuffer and adjust the nRecordBufferSize
field of the lpSqlControl parameter
accordingly.
Functions: SqlFetchPrevious
Quasar SQL API Page 23 of 51
Functions: SqlGetStatus
Syntax BOOL FAR PASCAL SqlGetStatus(hUser, hCursor,
lpSqlControl, lpSqlStatus)
This function returns status information about
the most recent call to SqlExecute which used
the cursor indicated by the hCursor parameter.
Status information includes the number of
database records deleted, inserted, selected or
updated and the amount of time elapsed during
query execution.
If the hUser and hCursor parameters are set to
0, SqlGetStatus simply tests for the presence
of an active running Quasar Database
Administrator. A value of 1 is returned if and
only if the database administrator is running.
Parameter Type/Description
hUser HANDLE Identifies the user who
owns the cursor. The hUser
parameter must have been created
with the SqlLogin function.
hCursor HANDLE Identifies the cursor for
which the status is to be
obtained. The hCursor parameter
must have been created with the
SqlCursorOpen function.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
lpSqlStatus LPSQLSTATUS Points to the target
SQL Status Structure.
Return Value The return value is 1 if no errors occurred,
otherwise it is 0.
Comments Each cursor's status information is reset every
time SqlExecute is called.
Functions: SqlGetStatus
Quasar SQL API Page 24 of 51
Functions: SqlLogin
Syntax HANDLE FAR PASCAL SqlLogin(lpSqlControl,
lpstrUserName, lpstrUserPassword)
In order to access the SQL Database
Administrator you must first identify yourself
as an user with sufficient privilege to access
the database. This is accomplished by calling
the SqlLogin function with your user name and
password. Once logged in, you can reference
all your tables without specifying an user
name. To reference another user's table you
must prefix the table name with the other
user's user name. For example for user
"JohnDoe" to select all columns of the system
tables he must use:
SELECT * FROM SYSTEM.TABLES;
For user "SYSTEM" to select the "PartNumber"
column of user "JohnDoe"'s table "Inventory"
use the form:
SELECT JohnDoe.Inventory.PartNumber FROM
JohnDoe.Inventory;
Or, more simply:
SELECT PartNumber FROM JohnDoe.Inventory;
Parameter Type/Description
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
lpstrUserName LPSTR Points to a null
terminated string containing the
user name.
lpstrUserPassword LPSTR Points to a null
terminated string containing the
user password.
Return Value The return value is an user handle if no errors
occurred while logging in, otherwise it is 0.
You must use this user handle in all calls to
the Quasar SQL API.
Functions: SqlLogin
Quasar SQL API Page 25 of 51
Comments Only those users recognized by the Quasar
Database Administrator will be allowed to log
in. When first installed, the Quasar Database
Administrator only recognizes the user "SYSTEM"
whose password is "QUASAR". You can create
additional users by logging in as "SYSTEM" with
password "QUASAR" and inserting records into the
SYSTEM.USERS table. This table has three
columns: USER_NAME, USER_PASSWORD and REMARK.
To add user "JohnDoe" with password
"IWantToRegisterNow" execute:
INSERT INTO USERS VALUES ('JohnDoe',
'IWantToRegisterNow', NULL);
John Doe can now login.
Functions: SqlLogin
Quasar SQL API Page 26 of 51
Functions: SqlLogout
Syntax BOOL FAR PASCAL SqlLogout(hUser, lpSqlControl)
This function logs the user off the system. If
the Automatic Commit option flag is set in the
wFlags field of the lpSqlControl parameter, any
transaction still in progress is automatically
committed; otherwise, all work performed by the
user since logging in or since the last COMMIT
WORK query (whichever occurred last) is rolled
back.
Parameter Type/Description
hUser HANDLE Identifies the user who
wishes to log off. The hUser
parameter must have been created
with the SqlLogin function.
lpSqlControl LPSQLCONTROL Points to an SQL
Control Structure. Any errors
that may occur cause the
szErrorDetail, szErrorMessage
and nResultCode fields of this
structure to be loaded with
descriptive information.
Return Value The return value is 1 if no errors occurred,
otherwise it is 0.
Comments While SqlLogout automatically closes all the
user's cursor before logging the user off, we
recommend explicitly closing cursor when they
are no longer needed.
Functions: SqlLogout
Quasar SQL API Page 27 of 51
Constants
This section includes a formal description of all constants
defined in the Quasar SQL API include file for 'C' and the
global file for 'Visual Basic'.
Be sure to use the values by name as the numeric values may
(and probably will) change in the next release of the Quasar
SQL API.
Data Class Identifies the general characteristics of
a column in the result table
Data Type Identifies the particular characteristics
of a column in the result table
Data Format Instructs the Quasar SQL API as to the
format of the returned data in the result
table
Automatic Commit Instructs the Quasar SQL API whether to
commit or roll back any pending
transaction at user log out
Name Length Defines the maximum length of user, table
and column names
Constants
Quasar SQL API Page 28 of 51
Constants: Data Class
The following constants identify the general characteristics
of a column in the result table. The nDataClass field of the
SQLCOLUMN data structure is set to one of these values as a
result of an SqlDescribeColumn function call.
mSqlDataClassAPPROXIMATE Indicates that the column is one of
the approximate numeric data types
mSqlDataClassBINARY Indicates that the column is of the
binary data type
mSqlDataClassCHAR Indicates that the column is one of
the character string data types
mSqlDataClassEXACT Indicates that the column is one of
the exact numeric data types
mSqlDataClassINVALID Indicates that the data type of the
column is invalid
Constants: Data Class
Quasar SQL API Page 29 of 51
Constants: Data Type
The following constants identify the particular
characteristics of a column in the result table. The
nDataType field of the SQLCOLUMN data structure is set to one
of these values as a result of an SqlDescribeColumn function
call.
mSqlDataTypeBINARY Indicates that the data type of the
column is BINARY: its length is given
by the nPrecision field of the
SQLCOLUMN data structure
mSqlDataTypeCHAR Indicates that the data type of the
column is CHAR: its length is given
by the nPrecision field of the
SQLCOLUMN data structure
mSqlDataTypeDECIMAL Indicates that the data type of the
column is DECIMAL: its precision and
scale are given by the nPrecision and
nScale fields of the SQLCOLUMN data
structure
mSqlDataTypeDOUBLE Indicates that the data type of the
column is DOUBLE PRECISION: its
precision is given by the nPrecision
field of the SQLCOLUMN data structure
mSqlDataTypeFLOAT Indicates that the data type of the
column is FLOAT: its precision is
given by the nPrecision field of the
SQLCOLUMN data structure
mSqlDataTypeINTEGER Indicates that the data type of the
column is INTEGER: its precision is
given by the nPrecision field of the
SQLCOLUMN data structure
mSqlDataTypeNUMERIC Indicates that the data type of the
column is NUMERIC: its precision and
scale are given by the nPrecision and
nScale fields of the SQLCOLUMN data
structure
mSqlDataTypeREAL Indicates that the data type of the
column is REAL: its precision is
given by the nPrecision field of the
SQLCOLUMN data structure
mSqlDataTypeSMALLINT Indicates that the data type of the
column is SMALLINT: its precision is
Constants: Data Type
Quasar SQL API Page 30 of 51
given by the nPrecision field of the
SQLCOLUMN data structure
mSqlDataTypeVARCHAR Indicates that the data type of the
column is VARCHAR: its maximum length
is given by the nPrecision field of
the SQLCOLUMN data structure
mSqlDataTypeINVALID Indicates that the data type of the
column is invalid
Constants: Data Type
Quasar SQL API Page 31 of 51
Constants: Data Format
When a record is fetched from the result table by means of one
of the SqlFetch functions, the Quasar SQL API loads the record
into a buffer provided by the user. The record is returned in
one of three optional formats. The user selects the format he
wants by setting the wFlags field of the SQLCONTROL structure
to one (and only one) of the following values:
mSqlFlagFormatPadded The record is returned as a single
null terminated character string.
The data for each column is contained
within this string separated by
spaces. The number of spaces is set
by the user in the nPadding field of
the SQLCONTROL structure. The length
of the string is constant across all
records and is available to the user
in the nRecordSize field of the
SQLTABLE data structure. The length
of each column's portion of the
string is available to the user in
the nFieldWidth field of the
SQLCOLUMN data structure.
mSqlFlagFormatString The record is returned as a set of
null terminated character strings,
one for each column. The first
column's string is loaded into the
first bytes of the record buffer. The
second column's string immediately
follows the first and so on. Each
string contains only the minimum
number of characters to represent the
data. That is, the strings are not
padded.
mSqlFlagFormatStructure The record is returned as a packed
'C' data structure. This format is
not recommended for 'Visual Basic'
users. Fields appear in the 'C' data
structure in the same order in which
they appear in the result table.
Character types are converted to null
terminated character strings padded
with spaces to bring them to the
length of nFieldWidth as found in the
SQLCOLUMN data structure.
Approximate and exact numeric types
are converted to their 'double'
representation. A record containing
three fields: CHAR (10), INTEGER,
DECIMAL(7,2) would appear as:
Constants: Data Format
Quasar SQL API Page 32 of 51
struct {
char szField1[11];
double dField2;
double dField3;
}
Constants: Data Format
Quasar SQL API Page 33 of 51
Constants: Automatic Commit & Name Length
When a query is executed via an SqlExecute call, it is not
committed and will be rolled back if the user should happen to
log off.
mSqlFlagAutoCommitOnLogout Setting this bit of the wFlags
field of the SQLCONTROL structure
tells the Quasar SQL API to issue a
commit command to the database
administrator prior to logging the
user off. This flag may be set in
combination (using the '|' operator)
with any one of Data Format flags.
While character string fields may be quite lengthy: names of
users, tables and columns are limited.
mSqlMaximumNameLength This is the maximum length (not
including the null terminator) of
names of users, tables and columns.
Constants: Automatic Commit & Name Length
Quasar SQL API Page 34 of 51
Data Structures
This section includes a formal description of all data
structures which your program will use when it communicates
with the Quasar SQL API. Typedefs for all these structures can
be found in the Quasar SQL API include file for 'C'.
Declarations can be found in the global file for 'Visual
Basic'.
SQLCOLUMN The data structure which describes a
column in the result table which was
generated by execution of a query
SQLCONTROL The data structure which contains
information needed by the Quasar SQL API to
perform its functions and which passes
process information back to the user
SQLSTATUS The data structure with gives the user
access to operational information
SQLTABLE The data structure which describes the
result table which was generated by
execution of a query
Data Structures
Quasar SQL API Page 35 of 51
Data Structures: SQLCOLUMN
Result Table Column Description Record
The SQLCOLUMN data structure describes the characteristics of
a specified column of the result table. The SQLCOLUMN data
structure is loaded as a result of an SqlDescribeColumn
function call.
typedef struct tagSQLCOLUMN {
BOOL bRightJustified;
char szColumnName[mSqlMaximumNameLength+1];
unsigned nColumnSequenceNumber;
unsigned nDataClass;
unsigned nDataType;
unsigned nFieldWidth;
unsigned nPrecision;
unsigned nScale;
} SQLCOLUMN;
typedef SQLCOLUMN *PSQLCOLUMN;
typedef SQLCOLUMN far *LPSQLCOLUMN;
The SQLCOLUMN data structure has the following fields:
bRightJustified Indicates whether the column, by
default, is left or right justified.
Right justification is indicated by a
a non-zero value.
szColumnName Gives the column heading as a null
terminated text string.
nColumnSequenceNumber Column numbers range from 1 to the
number of columns in the result
table.
nDataClass Identifies the general
characteristics of a column in the
result table. Its value will be set
to one of the Data Class constants.
nDataType Identifies the particular
characteristics of a column in the
result table. Its value will be set
to one of the Data Type constants.
nFieldWidth The number of character positions
guaranteed to hold the value of this
column when the record is fetched.
If Data Format in the wFlags field of
the lpSqlControl is
mSqlFlagFormatPadded: nFieldWidth is
Data Structures: SQLCOLUMN
Quasar SQL API Page 36 of 51
set to the size of the column. If
Data Format is mSqlFlagFormatString:
nFieldWidth is set to the size of the
column plus one for the terminating
null. If Data Format is
mSqlFlagFormatStructure and the
column is numeric: nFieldWidth is set
to sizeof(double), if the column is a
character string type: nFieldWidth is
set to the size of the column plus
one for the terminating null.
nPrecision If a numeric column, nPrecision is
set to the precision (as defined by
ANSI SQL) of the result. If a
character field, nPrecision is set to
the length (as defined by ANSI SQL)
of the result.
nScale If a numeric column, nScale is set to
the scale (as defined by ANSI SQL) of
the result. If a character field,
nScale is 0.
Data Structures: SQLCOLUMN
Quasar SQL API Page 37 of 51
Data Structures: SQLCONTROL
Quasar SQL API Interface Control Structure
The SQLCONTROL data structure contains the specifications
necessary to provide an interface between the applications
programmer and the Quasar SQL API.
typedef struct tagSQLCONTROL {
char szErrorDetail[65];
char szErrorMessage[257];
unsigned nHiLiteLength;
unsigned nHiLiteOffset;
unsigned nPadding;
unsigned nRecordBufferSize;
unsigned nResultCode;
unsigned long lRecordPosition;
unsigned long lReserved0
unsigned long lReserved1
unsigned long lReserved2
unsigned long lReserved3
unsigned long lReserved4
WORD wFlags;
} SQLCONTROL;
typedef SQLCONTROL *PSQLCONTROL;
typedef SQLCONTROL far *LPSQLCONTROL;
The SQLCONTROL data structure has the following fields:
szErrorDetail Each time an Quasar SQL API function
is called, any errors that may occur
cause this field to be loaded with a
descriptive string: "Error detected
at line n of module.c". This
information is useful if you need to
call customer service.
szErrorMessage Each time an Quasar SQL API function
is called, any errors that may occur
cause this field to be loaded with a
descriptive string: "ERROR xxx:
text." This provides a useful
diagnostic while you are debugging
your application. "xxx" is the ASCII
representation (base 10) of the
nResultCode.
nHiLiteLength Each time the SqlExecute is called,
any syntax errors within the query
cause this field to be set to the
length of the offending phrase within
the query text.
Data Structures: SQLCONTROL
Quasar SQL API Page 38 of 51
nHiLiteOffset Each time the SqlExecute is called,
any syntax errors within the query
cause this field to be set to the
offset of the offending phrase within
the query text.
nPadding The caller of the Quasar SQL API sets
this field to the number of padding
spaces to be inserted between columns
when the wFlags field of the
SQLCONTROL structure is set to
mSqlFlagFormatPadded.
nRecordBufferSize The caller of the Quasar SQL API sets
this field to the size (in bytes) of
the record buffer. This buffer must
be at least as large as the value in
the nRecordSize field of the SQLTABLE
data structure. The SQLTABLE data
structure is available by calling
SqlDescribeTable.
nResultCode Indicates the basic status condition
after any call to an Quasar SQL API
function. A value of 0 indicates no
error. Other values are listed under
Result Codes
lRecordPosition Indicates the position within the
result table of the most recent
record fetched. lRecordPosition can
range from 1 to the number of records
in the result table. If
lRecordPosition is 0 then no records
have been fetched.
lReserved0 Do not tamper with this field.
lReserved1 Do not tamper with this field.
lReserved2 Do not tamper with this field.
lReserved3 Do not tamper with this field.
lReserved4 Do not tamper with this field.
wFlags The caller of the Quasar SQL API sets
this field to the desired Data Format
to be utilized during record fetch
functions. The data format may be
optionally combined using the '|'
operator with the Automatic Commit
flag.
Data Structures: SQLCONTROL
Quasar SQL API Page 39 of 51
Data Structures: SQLSTATUS
Query Status Structure
The SQLSTATUS data structure describes the overall outcome of
the most recent SqlExecute operation for a given cursor.
typedef struct tagSQLSTATUS {
unsigned long lNumberOfRecordDeletes;
unsigned long lNumberOfRecordInserts;
unsigned long lNumberOfRecordSelects;
unsigned long lNumberOfRecordUpdates;
unsigned long lTimeElapsed;
} SQLSTATUS;
typedef SQLSTATUS *PSQLSTATUS;
typedef SQLSTATUS far *LPSQLSTATUS;
The SQLSTATUS data structure has the following fields:
lNumberOfRecordDeletes Indicates the total number of records
deleted by the most recent
SqlExecute.
lNumberOfRecordInserts Indicates the total number of records
inserted by the most recent
SqlExecute.
lNumberOfRecordSelects Indicates the total number of records
selected by the most recent
SqlExecute.
lNumberOfRecordUpdates Indicates the total number of records
updated by the most recent
SqlExecute.
lTimeElapsed Indicates the time elapsed (in
milliseconds) during the most recent
SqlExecute.
Data Structures: SQLSTATUS
Quasar SQL API Page 40 of 51
Data Structures: SQLTABLE
Result Table Description Record
The SQLTABLE data structure describes the characteristics of
the result table. The SQLTABLE data structure is loaded as a
result of an SqlDescribeTable function call.
typedef struct tagSQLTABLE {
unsigned nNumberOfColumns;
unsigned nRecordSize;
unsigned long lNumberOfRecords;
} SQLTABLE;
typedef SQLTABLE *PSQLTABLE;
typedef SQLTABLE far *LPSQLTABLE;
The SQLTABLE data structure has the following fields:
nNumberOfColumns Indicates the number of columns in
the result table.
nRecordSize Indicates the minimum size (in bytes)
of a buffer large enough to hold a
record fetched from the result table.
lNumberOfRecords Indicates the number of records in
the result table.
Data Structures: SQLTABLE
Quasar SQL API Page 41 of 51
Result Codes
This section gives an explanation of all result codes returned
by the Quasar SQL API. Macro definitions for all result codes
can be found in the Quasar SQL API include file for 'C'.
Global Const definitions can be found in the global file for
'Visual Basic'.
mSqlErrorAmbiguousColumn When a column name can be found in
more than one of several tables given
in the "FROM" clause of a query, the
database administrator cannot
determine which of them you mean. To
remove the ambiguity, use the
"Tablename.ColumnName" or the
"UserName.Tablename.ColumnName"
syntax.
mSqlErrorBadEnvironment The DatabasePath entry in the
"win.ini" file is not properly
specified: it must begin with a drive
identifier followed by a ':' and a
'\'. A typical entry is
"c:\database".
mSqlErrorBinaryNotAllowed When creating a table, the data type
BINARY was specified, the BINARY data
type is not allowed in this release.
mSqlErrorCannotActivateFile An attempt has been made to access
a file which is unrecognized by the
b-tree file manager. This is an
internal error which should never
occur. Please contact customer
service.
mSqlErrorCannotCloseFile When the b-tree file manager
attempted to close either a data file
or an index file, _lclose() returned
an error. This usually indicates a
problem with the DOS directory
structure, we recommend you run
'chkdsk'.
mSqlErrorCannotCloseLog When the database manager attempted to
close either the 'or_log.dat' or the
'or_log.idx' transaction journal
file, _lclose() returned an error.
This usually indicates a problem with
the DOS directory structure, we
recommend you run 'chkdsk'.
Result Codes
Quasar SQL API Page 42 of 51
mSqlErrorCannotCreateDataFile When the b-tree file manager
attempted to create a data file,
_lcreat() returned an error. This
usually indicates your setting for
'FILES' in the 'config.sys' file
should be increased.
mSqlErrorCannotCreateDumpFile When the dump manager attempted
to create a dump file, _lcreat()
returned an error. This usually
indicates your setting for 'FILES' in
the 'config.sys' file should be
increased.
mSqlErrorCannotCreateFile This result code will not occur.
mSqlErrorCannotCreateKeyFile When the b-tree file manager
attempted to create a key file,
_lcreat() returned an error. This
usually indicates your setting for
'FILES' in the 'config.sys' file
should be increased.
mSqlErrorCannotCreateLog When the database manager attempted
to create either the 'or_log.dat' or
the 'or_log.idx' transaction journal
file, _lcreat() returned an error.
This usually indicates your setting
for 'FILES' in the 'config.sys' file
should be increased.
mSqlErrorCannotDeleteFile When the b-tree file manager
attempted to remove either a data
file or a key file, remove() returned
an error. This usually indicates
someone has modified the file's
attribute settings. Please be sure
none of the database files are marked
as 'read only', 'hidden' or 'system'.
mSqlErrorCannotDropTable When the database manager attempted
to drop a table, its 'use count' was
greater than zero! This is an
internal error which should never
occur. Please contact customer
service.
mSqlErrorCannotOpenDataFile When the b-tree file manager
attempted to open a data file,
_lopen() returned an error. This
usually indicates someone has
modified the file's attribute
settings or deleted the file. Please
be sure none of the database files
Result Codes
Quasar SQL API Page 43 of 51
are marked as 'read only', 'hidden'
or 'system'. Also, delete files only
via SQL.
mSqlErrorCannotOpenFile This result code will not occur.
mSqlErrorCannotOpenKeyFile When the b-tree file manager
attempted to open a key file,
_lopen() returned an error. This
usually indicates someone has
modified the file's attribute
settings or deleted the file. Please
be sure none of the database files
are marked as 'read only', 'hidden'
or 'system'. Also, delete files only
via SQL.
mSqlErrorCannotOpenLog When the database manager attempted
to open either the 'or_log.dat' or
the 'or_log.idx' transaction journal
file, _lopen() returned an error.
This usually indicates your setting
for 'FILES' in the 'config.sys' file
should be increased.
mSqlErrorCannotRemoveTable When the database manager attempted
to delete a file during a 'Toolbox
Remove' database operation, remove()
returned an error. This usually
indicates someone has modified the
file's attribute settings. Please be
sure none of the database files are
marked as 'read only', 'hidden' or
'system'.
mSqlErrorCharNotAllowed When the bind manager attempted to
initialize an AVG() or SUM() set
function, it discovered that the
argument was a CHAR or VARCHAR
column!
mSqlErrorCheckpointDetected This result code will not occur.
mSqlErrorDataFileCorrupted The b-tree file manager encountered
illegal settings in the header
portions of a data file. It is
likely that your DOS files are
corrupted.
mSqlErrorDatabaseCorrupt The database manager encountered
illegal settings in the header
portions of the transaction journal
file. It is likely that your DOS
files are corrupted.
Result Codes
Quasar SQL API Page 44 of 51
mSqlErrorDbaNotAvailable The Quasar SQL API could not establish
communication with the Quasar Database
Administrator. Is the database
administrator running?
mSqlErrorDivideByZero During query execution a divide by
zero error occurred.
mSqlErrorDuplicateColumn During query execution a column is
called out more than once in a list
where it can appear only once. This
can only occur in the CREATE TABLE
statement and the INSERT statement.
mSqlErrorDuplicateRecord The b-tree file manager detected an
attempt to violate an UNIQUE
constraint.
mSqlErrorExistingDataFile When the b-tree file manager
attempted to create a data file, it
discovered the file already existed!
Delete files only via SQL.
mSqlErrorExistingKeyFile When the b-tree file manager
attempted to create a key file, it
discovered the file already existed!
Delete files only via SQL.
mSqlErrorFileReadFailed When the b-tree file manager
attempted to read a file, _lread()
returned an error.
mSqlErrorFileSeekFailed When the b-tree file manager
attempted to seek a position in a
file, _llseek() returned an error.
mSqlErrorFileWriteFailed When the b-tree file manager
attempted to write a file, _lwrite()
returned an error.
mSqlErrorGlobalLockFailed When the query manager attempted to
lock a global resource, GlobalLock()
or LockResource() returned an error
condition.
mSqlErrorGlobalUnlockFailed When the query manager attempted
to unlock a global resource,
GlobalUnlock() or UnlockResource()
returned an error condition.
mSqlErrorImportParseError This result code will not occur.
mSqlErrorIncompatibleTypes An attempt was made within the
query to perform an operation between
Result Codes
Quasar SQL API Page 45 of 51
two arguments whose types conflict.
An example is adding a text string to
a number.
mSqlErrorIndexExists An attempt was made within the query
to create an index whose name is
already used.
mSqlErrorIndexUndoFailed When the b-tree file manager
attempted to create an unique key
value a duplicate was found. The
attempt to undo the creation failed.
This is an internal error which
should never occur. Please contact
customer service.
mSqlErrorInitializationFailed When the b-tree file manager
attempted to initialize its tables, a
failure was detected. This is an
internal error which should never
occur. Please contact customer
service.
mSqlErrorInsufficientBuffer The record to be returned to the
Quasar SQL API user will not fit in
the buffer allocated by the user.
That is, the value of the nRecordSize
field of the SQLTABLE structure is
larger than that supplied by the user
as indicated by the nRecordBufferSize
field of the SQLCONTROL structure.
Please be sure to allocate buffers
large enough to accommodate
nRecordSize bytes.
mSqlErrorInternalError This is an internal error which
should never occur. Please contact
customer service.
mSqlErrorInvalidColumnSpec The arguments of an SQL LIKE
predicate must be of a character
string type.
mSqlErrorInvalidColumnType This is an internal error which
should never occur. Please contact
customer service.
mSqlErrorInvalidCursor A call was made to the Quasar SQL API
where the pCursor field of the
SQLCONTROL structure is set to a
value which does not match any
existing cursor.
Result Codes
Quasar SQL API Page 46 of 51
mSqlErrorInvalidData During the execution of a CREATE
TABLE query, the scale of a numeric
column exceeds its precision.
mSqlErrorInvalidEscapeChar The data type of the escape
character in a LIKE predicate is not
a character string type.
mSqlErrorInvalidPattern The pattern of an SQL LIKE predicate
must not be NULL.
mSqlErrorInvalidUser The SqlLogin function was called with
an lpstrUserName or lpstrUserPassword
argument whose length exceeded
mSqlMaximumNameLength.
mSqlErrorKeyFileCorrupted The b-tree file manager encountered
illegal settings in the header
portions of a key file. It is likely
that your DOS files are corrupted.
mSqlErrorListSizesUnequal The number of columns in the column
list of an SQL INSERT query does not
match the number of values in the
value list or the number of fields
selected in the subquery.
mSqlErrorMultipleSelects Only one SELECT statement may occur
within a query.
mSqlErrorNoColumnExists The bind manager encountered a column
specification which it could not
match to a table defined within the
current scope.
mSqlErrorNoIndexExists A DROP INDEX was attempted when no
index exists.
mSqlErrorNoOldRecord When the b-tree file manager
attempted to carry out an
SqlFetchNext or SqlFetchPrevious
function, it discovered there was no
current record. You must first
execute an SqlFetchFirst,
SqlFetchLast or SqlFetchPositioned.
mSqlErrorNoTableExists During execution of a query a table
name was encountered which cannot be
found in the database under the
currently logged-on user name or
under the explicitly declared user
name.
Result Codes
Quasar SQL API Page 47 of 51
mSqlErrorNoUserExists During execution of a query an user
name was encountered which cannot be
found in the database.
mSqlErrorNodeSizeTooSmall This is an internal error which
should never occur. Please contact
customer service.
mSqlErrorNotAggregate While the select list of a SELECT
statement started with aggregate
types (i.e. SUM()), a select list
element was later encountered which
was a simple type (i.e. a column
specification). Aggregate types and
simple types cannot be mixed unless
the simple type is a grouping column.
mSqlErrorNotGroupingColumn A regular column specification was
encountered where a grouping column
was required.
mSqlErrorNotInGroupedTable While the select list of a SELECT
statement started with simple types
(i.e. a column specification), a
select list element was later
encountered which was an aggregate
type (i.e. SUM()). Simple types and
aggregate types cannot be mixed
unless the simple type is a grouping
column.
mSqlErrorNotSingleRecord A subquery returned more than one
record. When a subquery is used as
an argument to a comparison predicate
it must return a single record.
mSqlErrorNullInNotNullCol An attempt was made to insert a NULL
value in a column which was declared
as NOT NULL.
mSqlErrorNullNotAllowed An attempt was made to use a NULL
value where NULL values are not
permitted.
mSqlErrorParserSyntaxError There is a syntax error in the SQL
statement.
mSqlErrorParserStackOverflow This is an internal error which
should never occur. Please contact
customer service.
mSqlErrorPrecisionConflict A mathematical operation was
requested which would result in loss
of precision.
Result Codes
Quasar SQL API Page 48 of 51
mSqlErrorResultTableExists An attempt was made to commit a
transaction (COMMIT WORK) while a
result table was still open. Users
must close all cursors which have an
associated result table before
committing work.
mSqlErrorScaleOverflow The scale of the result of a
mathematical operation overflowed.
mSqlErrorSecurityViolation SqlLogin was called with an invalid
lpstrUserName or lpstrUserPassword.
mSqlErrorSetFunctionsNested Set functions may not be nested.
mSqlErrorStarNotAllowed The SELECT * syntax is illegal when
used with the GROUP BY clause.
mSqlErrorSubqueryNotOneColumn When a subquery is used as an
argument to a predicate it must
return a single field in the select
list.
mSqlErrorTableConflict The target table of an INSERT, DELETE
or UPDATE query may not also appear
in a 'from' clause of a subquery.
mSqlErrorTableExists An attempt was made in a CREATE TABLE
query to create a table which already
exists.
mSqlErrorTooManyColumnNames The list of column names in an
INSERT statement exceeds the number
of columns in the table.
mSqlErrorTooManyTablesOpen An attempt was made to open more
tables than the maximum number of
tables which may be open at one time.
mSqlErrorTrialSizeExceeded The number of events recorded in
the log has exceeded the trial size
allotment. Further operation will
irrecoverably corrupt your data.
mSqlErrorUserNotLoggedIn A call was made to the Quasar SQL API
where hUser does not match an
existing user.
mSqlErrorVariableHeaderMark The b-tree file manager
encountered illegal settings in the
header portions of a data file. It
is likely that your DOS files are
corrupted.
Result Codes
Quasar SQL API Page 49 of 51
mSqlErrorVariableHeaderSize The b-tree file manager attempted
to place a record in a position which
was not large enough. This is an
internal error which should never
occur. Please contact customer
service.
mSqlErrorVariableHeaderWrong The b-tree file manager
encountered illegal settings in the
header portions of a data file. It
is likely that your DOS files are
corrupted.
mSqlErrorVariableHeaderZero The b-tree file manager
encountered illegal settings in the
header portions of a data file. It
is likely that your DOS files are
corrupted.
mSqlErrorWrongVersion The b-tree file manager has
determined that your data and key
files are stamped with a version
which is incompatible with the
current release.
Result Codes
Quasar SQL API Page 50 of 51
Glossary
This section defines specialized terms used in this document.
B-tree file manager The Quasar Database Administrator is
made of several large function units.
One of these is the b-tree file
manager. It is responsible for
carrying out low level data access
and operates directly on the raw DOS
files located in the database
directory.
Bind manager The Quasar Database Administrator is
made of several large function units.
One of these is the bind manager. It
is responsible for associating the
logical constructs in the query with
actual users, tables and columns in
the database.
Cursor The Quasar SQL API keeps track of the
result of a query by means of a
cursor. The cursor may include
status information, the table where
the result of a SELECT may be found,
the column descriptions for such a
table, the current record position
for fetch operations, etc.
Database manager The Quasar Database Administrator is
made of several large function units.
One of these is the database manager.
It is responsible for carrying out
high level data access and operates
on logical tables and columns. The
database manager uses the b-tree file
manager to access records in the raw
DOS files located in the database
directory. The database manager is
also responsible for policing
transactions and the transaction
journal (or 'log').
Dump manager The Quasar Database Administrator is
made of several large function units.
One of these is the dump manager. It
is responsible for creating the dump
file.
Physical position The raw position of the record in the
file. Physical order is not the same
Glossary
Quasar SQL API Page 51 of 51
as the order you specify with the SQL
ORDER BY clause.
Query By query we mean any SQL statement.
Query manager The Quasar Database Administrator is
made of several large function units.
One of these is the query manager.
It is responsible for parsing the
query into its component parts.
Record buffer One of the arguments to the Quasar SQL
API fetch functions is a pointer to a
record buffer. This is the buffer
which receives the formatted contents
of a record.
Result table All SELECT queries generate a table
containing the chosen records. This
is called the result table. Its
contents are made available to you
one at a time through one of the
Quasar SQL API fetch functions.
Transaction journal A transaction journal is a pair of
files ('or_log.dat' and 'or_log.idx')
written by the database manager. The
transaction journal contains a record
for every event which caused a change
to the database.
Glossary
Quasar SQL Syntax Page 1 of 34
Quasar SQL For Windows
Release 2.0 - November 1991
Quasar SQL SYNTAX
Copyright (c) 1991 by Stellar Industries
All Rights Reserved
Summary
This manual is divided into nine sections:
Overview This section describes, in general terms, what
SQL is and the notation used in this document.
Statements This section includes a description of the
syntax of all SQL Statements which your program
can use.
Data Types This section includes a description of all data
types recognized by SQL.
Operators This section includes a description of all
arithmetic operators used with SQL.
Built-in Functions This section includes a description of all
built-in functions used with SQL.
Expressions This section includes a description of the
syntax of expressions used with SQL.
Search Condition This section includes a description of the
syntax used to select specific data elements.
System Catalog This section includes a description of the
tables used by the Quasar Database Administrator
to keep track of the database.
Glossary This section defines specialized terms used in
this document.
Summary
Quasar SQL Syntax Page 2 of 34
Overview
General Information
Structured Query Language (SQL) is the database
management language declared by the American
National Standards Institute (ANSI) as a standard.
SQL is the lingua franca of the computer database
world. SQL is used on mainframes, minicomputers and
PCs.
Notational Conventions
While uppercase is used throughout this document to
indicate SQL keywords (COMMIT, SELECT, etc), in
actuality the Quasar Database Administrator will
accept keywords in either upper or lowercase. The
keyword 'COMMIT' may be spelled 'commit', 'Commit',
'COMMIT', etc.
The names of users, tables, indices and columns, and
the content of character fields are, however, case
sensitive. If you used some combination of upper
and lower case to create them, you have to use the
same combination to access them. All system names
were created using upper case only.
Optional elements are indicated by enclosing them
within square brackets as in [option]. When a
choice may be made among a list of possible optional
elements, individual selections are separated by
vertical bars as in [option1 | option2 | option3].
When a pattern may be repeated, an ellipsis follows
the pattern as in "ColumnName1 [, ColumnName2] ...".
This example implies a list of one or more column
names separated by commas.
Overview
Quasar SQL Syntax Page 3 of 34
Statements
SQL is based on various uses of the following statements:
COMMIT WORK Instructs the database administrator to make
all changes to the database by the current
transaction permanent.
CREATE INDEX Creates an index on a database table.
CREATE TABLE Creates a database table.
DELETE Deletes records from a database table.
DROP INDEX Deletes an index from a database table.
DROP TABLE Deletes a database table.
INSERT Creates records in a database table.
ROLLBACK WORK Instructs the database administrator to forget
all changes made to the database by the current
transaction.
SELECT Retrieves data from database tables.
UPDATE Modifies the content of records within database
tables.
Statements
Quasar SQL Syntax Page 4 of 34
Statement: COMMIT WORK
Syntax COMMIT WORK;
Changes made to the database are not made
permanent until this statement is executed.
Should the current user execute a ROLLBACK WORK
or unexpectedly log off, all changes made by
the user since logging in or executing a COMMIT
WORK (whichever occurred most recently) will
vanish.
During database recovery only committed
transactions are restored.
Comments As queries are executed within a transaction
and records are created, read, updated or
deleted; the database applies various kinds of
locks on the applicable records. These locks
are released when the transaction is committed
or rolled back. In order to minimize the
conflict between transactions, be sure to
minimize the amount of time these locks are in
place by issuing a COMMIT WORK or ROLLBACK WORK
whenever possible.
Committing a transaction automatically starts a
new transaction. COMMIT WORK is very fast
since the changes have already been made, they
are merely flagged as permanent.
Statements: COMMIT WORK
Quasar SQL Syntax Page 5 of 34
Statement: CREATE INDEX
Syntax CREATE [UNIQUE] INDEX
[CreatorName.]IndexName
ON [UserName.]TableName (
ColumnName1 [ASC | DESC][,
ColumnName2 [ASC | DESC]]
...
);
This statement creates the index IndexName on
the table TableName. While indices are never
referenced explicitly in SQL (other than
creating and dropping them), they are used
extensively by the Quasar Database Administrator
to maximize system performance.
Phrase Description
CREATE [UNIQUE] INDEX
Specify UNIQUE if you wish key
values to be distinguishable,
one from another, across the
entire table upon which the
index is constructed. If an
attempt is made to create a
record in the table which
violates this unique constraint,
an error condition will arise.
[CreatorName.]IndexName
IndexName becomes the name of
the newly created index.
Specify CreatorName if you wish
the index to belong to a user
different from the current user.
ON [UserName.]TableName
TableName identifies the table
upon which the index is to be
constructed. Specify UserName
if the table belongs to a user
different from the current user.
ColumnName1 [ASC | DESC]
ColumnName identifies a column
in the table to be included in
the index key. Specify ASC for
ascending and DESC for
Statements: CREATE INDEX
Quasar SQL Syntax Page 6 of 34
descending. ASC is default. We
recommend against the use of
DESC, it is included in order to
conform to the ANSI standard.
[, ColumnName2 [ASC | DESC]] ...
Additional columns may be
included within the index key by
creating a list of columns
separated by commas. The index
key will be constructed in the
order in which columns appear in
this list.
Comments While indices may be created at anytime, we
recommend that you create indices immediately
after you create their base table; otherwise,
CREATE INDEX has to read and rewrite all data
which is already in the table.
The presence of suitable indices may greatly
enhance system performance. Indices do,
however, cause a moderate increase in the
amount of time it takes to write a record to
the table upon which the index is constructed.
The database user should add indices
judiciously.
ColumnName, CreatorName, IndexName, TableName
and UserName are limited to 32 characters.
Statements: CREATE INDEX
Quasar SQL Syntax Page 7 of 34
Statement: CREATE TABLE
Syntax CREATE TABLE [UserName.]TableName (
ColumnName1 DataType1 [NOT NULL [UNIQUE]][,
ColumnName2 DataType2 [NOT NULL [UNIQUE]]]
...
[UNIQUE (ColumnNameA[, ColumnNameB] ... )][,
UNIQUE (ColumnNameA[, ColumnNameB] ... )]
...
);
This statement creates the table TableName with
the columns as specified.
Phrase Description
CREATE TABLE [UserName.]TableName
TableName becomes the name of
the newly created table.
Specify UserName if you wish the
table to belong to a user
different from the current user.
ColumnName1 DataType1 [NOT NULL [UNIQUE]]
ColumnName identifies a column
to be included in the table.
DataType indicates the data type
of the column.
When a column is specified as
NOT NULL, any attempt to insert
or update a record which would
result in a NULL value in this
column will cause an error
condition to arise.
When a column is specified as
UNIQUE, an UNIQUE index is
automatically created for that
column. This index will insure
that all values for that column
are distinguishable, one from
another, across the entire
table. Any attempt to insert or
update a record which violates
this unique constraint will
cause an error condition to
arise.
[, ColumnName2 DataType2 [NOT NULL UNIQUE]]]
...
Statements: CREATE TABLE
Quasar SQL Syntax Page 8 of 34
Additional columns may be
included within the table by
creating a list of column
definitions separated by commas.
[UNIQUE (ColumnNameA[, ColumnNameB] ... )]
The combination of ColumnNameA,
ColumnNameB, ... are to be
unique across all records in the
table.
An UNIQUE index which includes
the named columns is
automatically created. This
index will insure that key
values for these columns are
distinguishable, one from
another, across the entire
table. Any attempt to insert or
update a record which violates
this unique constraint will
cause an error condition to
arise.
[, UNIQUE (ColumnNameN[, ColumnNameO] ... )]
Additional unique constraints
may be added by creating a list
of unique constraint definitions
separated by commas. Each
unique constraint is maintained
by a separate UNIQUE index.
Comments ColumnName, TableName and UserName are limited
to 32 characters.
Statements: CREATE TABLE
Quasar SQL Syntax Page 9 of 34
Statement: DELETE
Syntax DELETE FROM [UserName.]TableName
[WHERE SearchCondition];
This statement deletes records from the table
TableName. SearchCondition specifies which
records are to be deleted.
Phrase Description
DELETE FROM [UserName.]TableName
TableName is the name of the
table containing the records to
be deleted. Specify UserName if
the table belongs to a user
different from the current user.
WHERE SearchCondition
SearchCondition specifies which
records are to be deleted.
Comments TableName and UserName are limited to 32
characters.
Statements: DELETE
Quasar SQL Syntax Page 10 of 34
Statement: DROP INDEX
Syntax DROP INDEX [CreatorName.]IndexName
ON [UserName.]TableName;
This statement deletes the index IndexName on
the table TableName.
Phrase Description
DROP INDEX [CreatorName.]IndexName
IndexName is the name of the
index to be deleted. Specify
CreatorName if the index belongs
to a user different from the
current user.
ON [UserName.]TableName
TableName identifies the table
upon which the index exists.
Specify UserName if the table
belongs to a user different from
the current user.
Comments While indices may be dropped at anytime,
dropping an index on a table causes the entire
table to be rebuilt.
When a table is deleted, all indices associated
with that table are automatically dropped.
CreatorName, IndexName, TableName and UserName
are limited to 32 characters
Statements: DROP INDEX
Quasar SQL Syntax Page 11 of 34
Statement: DROP TABLE
Syntax DROP TABLE [UserName.]TableName;
This statement deletes the table TableName.
Phrase Description
DROP TABLE [UserName.]TableName
TableName is the name of the
table to be deleted. Specify
UserName if the table belongs to
a user different from the
current user.
Comments All indices associated with the table are
automatically dropped.
TableName and UserName are limited to 32
characters
Statements: DROP TABLE
Quasar SQL Syntax Page 12 of 34
Statement: INSERT
Syntax INSERT INTO [UserName.]TableName
[(ColumnName1[, ColumnName2] ... )]
VALUES (Value1[, Value2] ... );
-- or --
Syntax INSERT INTO [UserName.]TableName
[(ColumnName1[, ColumnName2] ... )]
SelectStatement;
This statement inserts records into the table
TableName.
Phrase Description
INSERT INTO [UserName.]TableName
TableName is the name of the
table into which records are to
be inserted. Specify UserName
if the table belongs to a user
different from the current user.
(ColumnName1[, ColumnName2] ... )
Identifies columns into which
data is to be deposited. If any
columns exist in the table which
are not listed, they are set to
the NULL value. A column name
may not be repeated. Column
names do not have to be in the
same order as they are in the
table itself.
VALUES (Value1[, Value2] ... )
Specifies the values to be
deposited in the record. If a
list of columns was supplied,
there must be a match between
the number of column names in
the list and the number of
values supplied. If a list of
columns was not supplied, there
must be a match between the
total number of columns in the
table and the number of values
supplied.
Statements: INSERT
Quasar SQL Syntax Page 13 of 34
The data type of the value must
be compatible with the data type
of the column into which it is
to be deposited. When the
column allows the NULL value,
the value may be 'NULL'.
SelectStatement
The SelectStatement generates a
set of records to be inserted.
If a list of columns was
supplied, there must be a match
between the number of column
names in the list and the number
of columns generated by the
SelectStatement. If a list of
columns was not supplied, there
must be a match between the
total number of columns in the
table and the number of columns
generated by the
SelectStatement.
The data types of the columns
generated by the SelectStatement
must be compatible with the data
types of the columns into which
they are to be deposited.
Comments ColumnName, TableName and UserName are limited
to 32 characters.
Statements: INSERT
Quasar SQL Syntax Page 14 of 34
Statement: ROLLBACK WORK
Syntax ROLLBACK WORK;
Changes made to the database are not made
permanent until a COMMIT WORK statement is
executed. ROLLBACK WORK instructs the database
to purge all changes to the database by the
current user since logging in or executing a
COMMIT WORK (whichever occurred most recently).
Comments As queries are executed within a transaction
and records are created, read, updated or
deleted; the database applies various kinds of
locks on the applicable records. These locks
are released when the transaction is committed
or rolled back. In order to minimize the
conflict between transactions, be sure to
minimize the amount of time these locks are in
place by issuing a COMMIT WORK or ROLLBACK WORK
whenever possible.
Rolling a transaction back automatically starts
a new transaction. ROLLBACK WORK may take some
time while the database administrator purges
updates.
Statements: ROLLBACK WORK
Quasar SQL Syntax Page 15 of 34
Statement: SELECT
Syntax SELECT [ALL | DISTINCT]
Expression1[, Expression2] ...
FROM [UserName1.]TableName1 [CorrelationName1][,
[UserName2.]TableName2 [CorrelationName2]]
...
[WHERE SearchCondition]
[GROUP BY ColumnSpecification1[,
ColumnSpecification2]
...
[HAVING SearchCondition]]
[ORDER BY ColumnSpecificationA [ASC | DESC][,
ColumnSpecificationB [ASC | DESC]]
...];
This statement generates a result table. There
is one column in the result table for each
Expression in the expression list of the SELECT
statement. The values deposited in the columns
of the result table are generated by evaluating
the corresponding Expression.
Phrase Description
SELECT [ALL | DISTINCT]
ALL is default. DISTINCT
insures that all records in the
result table are
distinguishable, one from
another. When DISTINCT is
specified, duplicate records are
eliminated from the result
table.
Expression1[, Expression2]
This list specifies the values
to be inserted into the columns
of the result table. The data
types of the columns of the
result table are determined by
the data types of the values
resulting from the expressions
in this list.
You may substitute a single '*'
in place of the list of
expressions. '*' implies a list
of all columns of all tables
identified in the FROM clause.
Statements: SELECT
Quasar SQL Syntax Page 16 of 34
You may not use '*' if you use
the GROUP BY clause.
FROM [UserName1.]TableName1 [CorrelationName1]
TableName is the name of the
table from which records are to
be read. Specify UserName if
the table belongs to a user
different from the current user.
CorrelationName is effectively
an alias for the TableName which
it follows.
[, [UserName2.]TableName2 [CorrelationName2]]
...
Additional tables may be
included by creating a list of
tables separated by commas.
This effectively creates a
Cartesian product of all the
tables in the list.
WHERE SearchCondition
SearchCondition specifies which
records are to be read.
GROUP BY ColumnSpecification1
Rearranges the table(s)
identified by the FROM clause
into groups such that within any
one group all rows have the same
value for the GROUP BY
column(s). The SELECT clause is
then applied to these groups.
Each group generates a single
record in the result table.
Please refer to a text book for
a description of the "grouped
table". "Grouped tables" are
fully supported by the Quasar
Database Administrator.
[, ColumnSpecification2] ...
Additional columns may be
included within the GROUP BY
clause by creating a list of
columns separated by commas.
Statements: SELECT
Quasar SQL Syntax Page 17 of 34
Please refer to a text book for
a description of the "grouped
table". "Grouped tables" are
fully supported by the Quasar
Database Administrator.
HAVING SearchCondition
Specifies a restriction on the
grouped table resulting from the
GROUP BY clause by eliminating
groups not meeting the
SearchCondition.
Please refer to a text book for
a description of the "grouped
table". "Grouped tables" are
fully supported by the Quasar
Database Administrator.
ORDER BY ColumnSpecificationA [ASC | DESC]
Records in the result table will
be sorted on the basis of the
data in the columns specified by
the ORDER BY clause. Specify
ASC for ascending and DESC for
descending. ASC is default.
ColumnSpecification must
identify one of the Expressions
within the list of expressions
of the SELECT STATEMENT. An
integer may be used in place of
the ColumnSpecification; when an
integer is used it identifies
which column in the result table
is to be used to determine the
order.
[, ColumnSpecificationB [ASC | DESC]] ...
Additional ordering
ColumnSpecifications (or
integers) may be included within
the ORDER BY clause by creating
a list of columns (or integers)
separated by commas.
Comments CorrelationName, TableName and UserName are
limited to 32 characters.
Statements: SELECT
Quasar SQL Syntax Page 18 of 34
Statement: UPDATE
Syntax UPDATE [UserName.]TableName
SET ColumnName1 = Expression1[,
ColumnName2 = Expression2]
...
[WHERE SearchCondition];
This statement modifies records in the table
TableName. SearchCondition specifies which
records are to be modified.
Phrase Description
UPDATE [UserName.]TableName
TableName is the name of the
table in which records are to be
modified. Specify UserName if
the table belongs to a user
different from the current user.
SET ColumnName1 = Expression1
Expression is evaluated and the
result placed in the column
identified by ColumnName.
Columns not specifically
identified are left unaffected.
[, ColumnName2 = Expression2] ...
Additional columns may be
modified by creating a list of
ColumnNames and Expressions
separated by commas. A column
name may not be repeated.
[WHERE SearchCondition]
SearchCondition specifies which
records are to be modified.
Comments ColumnName, TableName and UserName are limited
to 32 characters.
Statements: UPDATE
Quasar SQL Syntax Page 19 of 34
Data Types
Data types are organized into three basic categories:
Approximate Numeric This type is typically referred to as
floating point.
Exact Numeric This type is typically referred to as fixed
point.
Character String This type is used to store text.
Data Types
Quasar SQL Syntax Page 20 of 34
Data Types: Approximate Numeric
This type is typically referred to as floating point.
Data type Description
FLOAT Floating point number with magnitude ranging
from approximately 1.7976931348623158e+308 to
2.2250738585072014e-308.
FLOAT(p) Floating point number with p significant
digits, with magnitude ranging from
approximately 1.7976931348623158e+308 to
2.2250738585072014e-308.
REAL Floating point number with magnitude ranging
from approximately 1.7976931348623158e+308 to
2.2250738585072014e-308.
DOUBLE PRECISION Floating point number with magnitude ranging
from approximately 1.7976931348623158e+308 to
2.2250738585072014e-308.
Data Types: Approximate Numeric
Quasar SQL Syntax Page 21 of 34
Data Types: Exact Numeric
This type is typically referred to as fixed point.
Data type Description
DEC Signed decimal number with up to 19 digits of
which 0 appear to the right of the decimal
point.
DEC(p) Signed decimal number with up to p digits of
which 0 appear to the right of the decimal
point; 1 <= p <= 19.
DEC(p, s) Signed decimal number with up to p digits of
which s appear to the right of the decimal
point; 1 <= p <= 19 and 0 <= s <= p.
DECIMAL Signed decimal number with up to 19 digits of
which 0 appear to the right of the decimal
point.
DECIMAL(p) Signed decimal number with up to p digits of
which 0 appear to the right of the decimal
point; 1 <= p <= 19.
DECIMAL(p, s) Signed decimal number with up to p digits of
which s appear to the right of the decimal
point; 1 <= p <= 19 and 0 <= s <= p.
INT Whole number ranging from -2147483647 to
2147483647.
INTEGER Whole number ranging from -2147483647 to
2147483647.
NUMERIC Signed decimal number with up to 19 digits of
which 0 appear to the right of the decimal
point.
NUMERIC(p) Signed decimal number with up to p digits of
which 0 appear to the right of the decimal
point; 1 <= p <= 19.
NUMERIC(p, s) Signed decimal number with up to p digits of
which s appear to the right of the decimal
point; 1 <= p <= 19 and 0 <= s <= p.
SMALLINT Whole number ranging from -2147483647 to
2147483647.
Data Types: Exact Numeric
Quasar SQL Syntax Page 22 of 34
Data Types: Character String
This type is used to store text.
Data type Description
CHAR Character data, length assumed to be 1.
CHAR(n) Character data, length specified by n where 1
<= n <= 2047.
CHARACTER Character data, length assumed to be 1.
CHARACTER(n) Character data, length specified by n where 1
<= n <= 2047.
VARCHAR Character data, variable length where maximum
length is 2047.
VARCHAR(n) Character data, variable length where maximum
length is specified by n where 1 <= n <= 2047.
Data Types: Character String
Quasar SQL Syntax Page 23 of 34
Operators
The arithmetic operators have their usual meanings:
+ The value on the right is added to the value on
the left.
- The value on the right is subtracted from the
value on the left.
* The value on the right is multiplied by the
value on the left.
/ The value on the left is divided by the value
on the right.
Operators
Quasar SQL Syntax Page 24 of 34
Built-in functions
Built-in functions act on several rows in a table together.
Built-in functions may not be nested. SQL supports the
following built-in functions:
AVG(Expression) For each record selected, Expression
is analyzed and a value obtained.
AVG returns the average of these
values. Only values which are not
NULL are included.
COUNT(DISTINCT Expression) For each record selected,
Expression is analyzed and a value
obtained. COUNT(DISTINCT) returns
the number of these values which are
distinguishable, one from another.
Only values which are not NULL are
included.
COUNT(*) COUNT(*) returns the number of
records selected.
MAX(Expression) For each record selected, Expression
is analyzed and a value obtained.
MAX returns the maximum of these
values. Only values which are not
NULL are included.
MIN(Expression) For each record selected, Expression
is analyzed and a value obtained.
MIN returns the minimum of these
values. Only values which are not
NULL are included.
SUM(Expression) For each record selected, Expression
is analyzed and a value obtained.
SUM returns the sum of these values.
Only values which are not NULL are
included.
Built-in functions
Quasar SQL Syntax Page 25 of 34
Expressions
Expressions can be:
A column name
A constant or literal value
A built-in function
An arithmetic combination of expressions
Constants can be:
Integer (for example: 100, -5, +127)
Decimal (for example: 100.0, -.001, 1., +1.5)
Floating point (for example: 1E10, -2E-7, +3.14159E0)
Character string (for example: 'SMITH' '-@k9-22', '-1',
'Quasar')
Order of execution:
Arithmetic expressions are evaluated before comparisons
and logical operations.
Arithmetic expressions are evaluated left to right except
that multiplication and division are performed before
addition and subtraction. Parentheses can be used to
control the order of evaluation.
Expressions
Quasar SQL Syntax Page 26 of 34
Search Conditions
A search condition can be a simple condition or a logical
combination of conditions. If the value of any expression is
NULL then the condition evaluates to UNKNOWN:
Simple conditions:
Expression1 = Expression2
Evaluates to TRUE if and only if Expression1
has a value equal to that of Expression2,
otherwise the condition evaluates to FALSE.
Expression1 < Expression2
Evaluates to TRUE if and only if Expression1
has a value less than that of Expression2,
otherwise the condition evaluates to FALSE.
Expression1 <= Expression2
Evaluates to TRUE if and only if Expression1
has a value less than or equal to that of
Expression2, otherwise the condition evaluates
to FALSE.
Expression1 > Expression2
Evaluates to TRUE if and only if Expression1
has a value greater than that of Expression2,
otherwise the condition evaluates to FALSE.
Expression1 >= Expression2
Evaluates to TRUE if and only if Expression1
has a value greater than or equal to that of
Expression2, otherwise the condition evaluates
to FALSE.
Expression1 <> Expression2
Evaluates to TRUE if and only if Expression1
has a value which is not equal to that of
Expression2, otherwise the condition evaluates
to FALSE.
Expression1 [NOT] BETWEEN Expression2 AND Expression3
Same as [NOT] ((Expression2 <= Expression1) AND
(Expression1 <= Expression3).
Expression1 [NOT] IN (Value1[, Value2] ...)
Search Conditions
Quasar SQL Syntax Page 27 of 34
Same as [NOT] ((Expression1 = Value1)[ OR
(Expression1 = Value2)] ... .
Expression1 [NOT] IN (Subquery)
TRUE if Expression1 is [not] equal to any value
returned by Subquery.
ColumnName [NOT] LIKE Pattern
Only available for character types: [not] TRUE
if the string in the specified column matches
Pattern. In Pattern, '_' matches any single
character, '%' matches any character sequence.
ColumnName IS [NOT] NULL
True if the value of ColumnName is [not] NULL.
[NOT] EXISTS (Subquery)
[Not] TRUE if Subquery returns at least one
record.
Expression1 [NOT] IN (Subquery)
[Not] TRUE if Subquery returns at least one
value which is equal to Expression1.
Expression1 = [ANY | ALL | SOME] (Subquery)
Expression1 < [ANY | ALL | SOME] (Subquery)
Expression1 <= [ANY | ALL | SOME] (Subquery)
Expression1 > [ANY | ALL | SOME] (Subquery)
Expression1 >= [ANY | ALL | SOME] (Subquery)
Expression1 <> [ANY | ALL | SOME] (Subquery)
Please refer to a text book for a description
of the "quantified" predicate. While
supported, we recommend against its use.
Logical combination of conditions:
NOT Condition
Evaluates to TRUE if and only if Condition is
FALSE. Evaluates to FALSE if and only if
Condition is TRUE.
Condition1 AND Condition2
Evaluates to TRUE if and only if both
Condition1 and Condition2 are TRUE.
Condition1 OR Condition2
Search Conditions
Quasar SQL Syntax Page 28 of 34
Evaluates to TRUE if either Condition1 or
Condition2 is TRUE or both are TRUE. Evaluates
to TRUE even if one condition is UNKNOWN.
Search Conditions
Quasar SQL Syntax Page 29 of 34
System Catalog
The system catalog is composed of four tables: SYSTEM.COLUMNS,
SYSTEM.INDICES, SYSTEM.TABLES and SYSTEM.USERS. All these
tables belong to the user "SYSTEM". These tables are
maintained by the Quasar Database Administrator.
Unless otherwise indicated, you must not modify the
SYSTEM.COLUMNS, SYSTEM.INDICES, SYSTEM.TABLES and SYSTEM.USERS
tables.
COLUMNS This table contains information about all
columns of all tables in the database.
INDICES This table contains information about all
indices in the database. When more than one
column is included in an index, there is a
separate record for each column included.
TABLES This table contains information about all
tables in the database.
USERS This table contains information about all users
known to the database.
System Catalog
Quasar SQL Syntax Page 30 of 34
System Catalog: SYSTEM.COLUMNS
This table contains information about all columns of all
tables in the database. You may only modify the REMARK field
of records in this table.
Column Type/Description
SEQUENCE_NUMBER SMALLINT Indicates the position of the column
within the table.
LENGTH SMALLINT Indicates the length of character
strings or the precision of numeric values.
SCALE SMALLINT Indicates the scale of numeric values.
DATA_TYPE VARCHAR(32) Indicates data type.
NOT_NULL CHARACTER(5) Indicates whether NULL values are
allowed. TRUE indicates NULL is not allowed.
USER_NAME VARCHAR(32) Indicates the user name of the
owner of the table.
TABLE_NAME VARCHAR(32) Indicates the name of the table.
COLUMN_NAME VARCHAR(32) Indicates the name of the column.
REMARK VARCHAR(128) A comment.
System Catalog: SYSTEM.COLUMNS
Quasar SQL Syntax Page 31 of 34
System Catalog: SYSTEM.INDICES
This table contains information about all indices in the
database. When more than one column is included in an index,
there is a separate record for each column included. You may
only modify the REMARK field of records in this table.
The INDEX_NAME of indices created to enforce unique
constraints have a '~' as their first character.
Column Description
USER_NAME VARCHAR(32) Indicates the user name of the
owner of the table upon which the index is
constructed.
TABLE_NAME VARCHAR(32) Indicates the name of the table
upon which the index is constructed.
INDEX_NAME VARCHAR(32) Indicates the name of the index.
SEGMENT_NUMBER SMALLINT Indicates the position of the column
within the index key.
NUMBER_OF_SEGMENTS SMALLINT Indicates the number of columns
included in the index key.
DESCENDING CHARACTER(5) Indicates whether the index is
marked as ascending or descending. ASC
indicates ascending while DESC indicates
descending.
UNIQUE CHARACTER(5) Indicates whether duplicate values
are allowed. TRUE indicates all values must be
distinguishable, one from another. FALSE
indicates duplicate values are allowed.
CREATOR_NAME VARCHAR(32) Indicates the user name of the
creator of the index.
COLUMN_NAME VARCHAR(32) Indicates the name of the column
which makes up this segment of the index key.
REMARK VARCHAR(128) A comment.
System Catalog: SYSTEM.INDICES
Quasar SQL Syntax Page 32 of 34
System Catalog: SYSTEM.TABLES
This table contains information about all tables in the
database. You may only modify the REMARK field of records in
this table.
The TABLE_NAME of temporary tables used during the execution
of a query have a '~' as their first character.
Column Description
TABLE_ID SMALLINT Used internally to identify the MSDOS
files used in the table.
NUMBER_OF_COLUMNS SMALLINT Indicates the number of columns in
the table.
ISAM_CONTROL_BLOCK BINARY Used internally to save the ISAM
control block for the table.
USER_NAME Indicates the name of the user who owns the
table.
TABLE_NAME VARCHAR(32) Indicates the name of the table.
REMARK VARCHAR(128) A comment.
System Catalog: SYSTEM.TABLES
Quasar SQL Syntax Page 33 of 34
System Catalog: SYSTEM.USERS
This table contains information about all users known to the
database.
You may manage user access by modifying the SYSTEM.USERS
table. Use Caution: deleting all user records will
permanently lock you out of the database. Do not delete the
user "SYSTEM".
Column Description
USER_NAME VARCHAR(32) Indicates a user name.
USER_PASSWORD VARCHAR(32) Indicates a user password.
REMARK VARCHAR(128) A comment.
System Catalog: SYSTEM.USERS
Quasar SQL Syntax Page 34 of 34
Glossary
current user The current user is the user who
logged into the database to execute
the query.
key A key is the set of columns within a
table used to construct an index on
that table.
key value The database administrator creates a
key value by concatenating the values
of all columns defined in an index.
The columns are concatenated in the
order in which they were specified
when the index was created.
result table All SELECT queries generate a table
containing the chosen records. This
is called the result table. Its
contents are made available to you
one at a time through one of the
Quasar SQL API fetch Statements.
transaction journal A transaction journal is a pair of
files ('or_log.dat' and 'or_log.idx')
written by the database manager. The
transaction journal contains a record
of every event which caused a change
to the database.
Glossary
Volume in drive A has no label
Directory of A:\
WINSQL20 ZIP 272409 12-06-91 7:24a
GO-STRT DAT 540 1-06-93 4:57p
SIGORDER TXT 3090 3-10-93 3:22p
GO-FORM DAT 3090 3-10-93 3:22p
GO EXE 26022 1-10-92 12:14p
PKUNZIP EXE 23528 3-15-90 1:10a
PCSIG TXT 2335 2-10-93 8:50a
SHAREMAG TXT 1837 1-21-92 6:11a
CDROM TXT 4874 3-18-93 1:28p
QUASAR TXT 3067 12-06-91 7:24a
10 file(s) 340792 bytes
16384 bytes free