[ALL] let's think about Query Language for 2.0

Ruslan Zasukhin sunshine at public.kherson.ua
Fri May 16 23:35:00 CDT 2003


on 5/16/03 10:16 PM, Keith DeLong at delong at redcort.com wrote:

Hi Keith,

> I'm intrigued by your ideas. Unlike others who've responded, my db
> experience outside Valentina goes back a decade (and further) so I've not
> used any of the modern db environments. So I'll just dream with you as I
> still work to get my brain around OOP DB concepts :-)
> 
> As I daydream I see this:
> 
>   Methods of class = SQL verbs (SELECT, WHERE, ORDERBY)
>   Map SQL functions to a table (or DB super) method or property
>    
> Perhaps the method names would be changed for clarity, but I'm inclined to
> leav them their common SQL name. In this way the concepts and transition to
> Object RelationalDB would be easier to understand and explain.
> 
> 
> class MyTable
> 
>   Mytable.Select (vFieldName(value), vFieldName(Value), etc)
>    //where value is the appropriate data type for the particular vField
> 
>   MyTable.Where (vFieldName,[vFieldName], ...)   //or vFieldNun
>     // where * = all fields and ** = fields and virtual fields
> 
>   MyTable.OrderBy (vFieldName, [vFieldName], ...)   //or vFieldNum
> 
>   //Cursor Equivalents
>   Result = MyTable.QueryAll      // returns all records like SQL Query
>   Result = MyTable.QueryFirst    // returns just first record
>   Result = MyTable.QueryNext     // functional equiv to cur.nextrecord
>   Result = MyTable.QueryLast     // returns last record
> 
> Other ideas...
>   Result = MyTable.QueryMax(fieldname)
>   Result = MyTable.QueryMin(fieldname)
>   
>   //Query Maintenance
>   MyTable.ResetSelect             // resets Select to "*"
>   MyTable.ResetWhere              // resets Where to ""
>   MyTable.ResetOrderBy            // resets OrderBy ""
>   MyTable.ResetQuery              // resets all the above to above values
> 
> So to use your example below:
> 
>   Person.Select (FirstName,LastName)
>   Person.Where (FirstName("Bill"), LastName("Gates"))
>   res = Person.QueryAll
> 
> The logic then expands to the Db super object. Valentina's functionality is
> implements SQL vocabulary via new methods and properties....
> 
> Res = MyDb.Query(PersonTable,AddressTable).All
>   // fields returned based on current Select of each table
> 
> Res = MyDb.Query(PersonTable,AddressTable).Min(Salarytable.Amount)
> 
> Am I anywhere in the same dream as you Ruslan?

Not exactly.

You here speak about mixture of 2 things

1) VIEW in SQL. When we can create virtual table that is based on some SQL
query in fact. You myTable do exactly this.

2) API with functions Select(), Where(), OrderBy(), exists in e.g. ADO of
Microsoft. Common for VisualBASIC developers and MFC developers.

This functions in fact in background build SQL string, and later send it to
DBMS server. Because Servers do not have other way as SQL strings.
So this API just play role of wrapper.


3) YES, we also can have this.
   But I have talk about totally new feature for V4RB,
    -- ability do search and sort on table without SQL at all!!!
     
IF somebody want make size of his app smaller,
    and faster and he have simple enough queries.
    Or may be he like work with navigational model,
    or his task better fit navigational model,
    then such developer can use in V4RB only BaseObjects and this new search
    features. NO CURSORS at all!   No SQL strings at all!
      
As result of search he get for example RB ARRAY with found RecIDs.
So now he can do BaseObject.RecID = arr[i] to iterate found records.

This way if great for local dbs. But may be problematic for remote db.
Navigational model go from one record to other to do task.
Loading of each record from server is slow.
This is why SQL have win in client-Server architecture. He do operations on
side of server and he do operations on BIG SET of records at once.

But here is its weakness. For some tasks building of JOINS cause huge
overhead. It is much faster find one record in TableA, then find few related
records in TableB. This works great on local dbs or may be with stored
procedures. 

Well, may be REALbasic developers do not need all this to avoid confusing.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list