Two DB questions

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Oct 23 08:26:06 EDT 2008


On 10/23/08 2:55 PM, "Jan Schenkel" <janschenkel at yahoo.com> wrote:

>> 2. Since I cannot test it in the moment, how can one check if an  existing
>> table does NOT contain any data/records (yet)? I presume one can get a db
>> cursor first and then check  "revdb_recordcount" = 0. Is that correct?
> 
> Depending on the database, you could look at its
> internal statistics system tables, but this is very
> DBMS-specific.


> You can't have a cursor without a SELECT query, so
> what you could do is something like
> ##
> put revdb_query(tConnection, "SELECT * FROM
> customers") into tCursor
> put revdb_recordcount(tCursor) into tRecordCount
> ##

> but depending on the DBMS, this may lock the entire table (as it's not going
> to make a copy of the entire table just so that you can traverse it at leisure
> while others make changes or delete records)

I will add to this.

For MOST dbs this can be quite LONG operation in seconds if table is quite
big.
 
> So if you're only interested in learning if there's any data in the table, and
> if your DBMS supports it, you should use a LIMIT or TOP clause in your SELECT
> query to make sure you only get the first record if there is one.

Again, some good news. :-)

Valentina DBMS offer to developers VERY REACH API.
This means that we have up to 1000 public methods that developers can use.

And one of them is:

      res = VTalble_RecordCount()

Easy?  YES.

Effective?  YES. Zero time.


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]





More information about the use-livecode mailing list