tips
[Top] [All Lists]

REALbasic Tip: Did my query find no records?

To: "REALbasic Tips" <realbasic-tips at lists dot realsoftware dot com>
Subject: REALbasic Tip: Did my query find no records?
From: Geoff Perlman <geoff at realsoftware dot com>
Date: Fri, 30 Mar 2001 11:31:13 -0600
When you perform a database query in REALbasic you use the SQLSelect
function of the database class. This function returns a databasecursor which contains a pointer to the current record (the first record in the cursor by default). The databasecursor class also has two boolean properties that help you determine if the current record pointer is before the first record or beyond the last record. They are called BOF (for Beginning Of File) and EOF (for End Of File). You can use these to easily determine if your query has
found any records.

If your query finds no records, both BOF and EOF will both be true since the
current record pointer points at nothing.

If your query finds one or more records, both BOF and EOF will be false
since the current record pointer is pointing at the first record and not at
the beginning or end of the file. For example, if your query found three
records, the cursor would look like this:

BOF
Record1 (the current record pointer is pointing at this record)
Record2
Record3
EOF
--

Geoff Perlman
President & CEO
REAL Software, Inc.
http://www.realsoftware.com
mailto:geoff at realsoftware dot com
Phone: 512-263-1233 x711
Fax:   512-263-1441


 - - - - - - - - - -
Got a useful tip to share? Send it to us at:
REALbasic-tips at lists dot realsoftware dot com dot
For list commands, send "Help" in the body of a message to
<requests at lists dot realsoftware dot com>


<Prev in Thread] Current Thread [Next in Thread>
  • REALbasic Tip: Did my query find no records?, Geoff Perlman <=