[DISCUSSION] "SET PROPERTY" as SQL command
Ruslan Zasukhin
sunshine at public.kherson.ua
Sun Nov 2 20:15:18 CST 2003
Hi All,
We think now on the next SQL command:
Set Property of Something to SomeValue.
1) we have global properties. Mainly this is for Vserver.
SET cacheSize = 10
GET cacheSize
2) It looks that Database can have own properites.
SET DbCustomers.DateFormat = 'MDY'
SET DbCustomers.DateSep = '/'
SET DbCustomers.TimeSep = ':'
GET DbCustomers.DateFormat
3) also we can propagate this to Table and field Levels:
SET tblPerson.Property = value
SET fldName.Property = value
SET tblPerson.fldName.Property = value
----------------------------
PROBLEM: as you see just SET is not enough.
because we do not have effective way to differ db name from
table name
So it looks as we need syntax as
SET Property = Value // for GLOBAL properties
SET DATABASE PROPERTY dbName.property = value
SET TABLE PROPERTY tblName.property = value
SET FIELD PROPERTY tblName.property = value
GET DATABASE PROPERTY dbName.property
GET TABLE PROPERTY tblName.property
GET FIELD PROPERTY tblName.property
* If we do SET PORPERTY but object do not have such property yet, then it
must be created.
* To drop property we need to have commands as
DROP DATABASE PROPERTY dbName.property
DROP TABLE PROPERTY tblName.property
DROP FIELD PROPERTY tblName.property
* What about plural form, when I want SET/GET few properties in one STEP?
Well, for SET it looks easy:
SET DATABASE PROPERTY DbCustomers.DateFormat = 'MDY',
DbCustomers.DateSep = '/'
DbCustomers.TimeSep = ':'
* For GET on single property....
GET returns some value, so we cannot use it with DB.Sqlexecute().
Therefore it should be used with SqlSelect() ?
also not very nice...
* BTW, may be create special kind of call for case when ONLY ONE value is
expected in result? There are some kinds of such SELECTs and it is annoying
work with cursors just to extract one value. So may be:
SqlGetValue( SqlString ) as VARIANT
Example:
VARIANT v = SqlGetValue( "SELECT max(a) FROM T" );
and
VARIANT v = SqlGetValue( "GET TABLE PROPERTY tblPerson.property" );
For languages that do not have VARIANT, we can use
SqlGetIntValue(), SqlGetStrVlue();
----------------------
At last of end:
* Do we need these Database/Table/Field properties feature?
* well for Database this properties already exists in Valentina...
* Hmm, may be field properties also?
Look on this command:
SET FIELD PROPERTY fldName.MaxLength = 60
some kind of simple ALTER TABLE? :-)
So what you think guys ?
Anybody have dream about this? If yes then please tell us WHY.
This is not RDBMS feature.
This feature IMHO DB closer to Object-Relational.
The main advantage of it -- USER/DEVELOPER can create properties on the fly
self. And they will be stored inside of .vdb file, i.e. In the DATABASE
STRUCTURE.
--
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