Ola!
O LetoDBf, trabalha em pé de igualdade com servidores DBF comerciais. Esses que custam os olhos da cara.
Esse é o problema do Harbour, quando o código OPEN colide com os interesses comerciais.
O Pritpal fez isso ai em baixo, mas não vejo niguém comentar.
2016-12-12 18:53 UTC-0800 Pritpal Bedi (bedipritpal at hotmail.com)(r444)
* hbqtwidgets/scripts.prg
+ Added: RecNo() field in SELECT statement. At times it is a must have info.
SELECT age,state,RecNo(),func(age*salary),Right(state,1),sum(salary),Min(salary),Max(salary),avg(salary),count(*) ;
FROM c:\harbour\tests\test.dbf GROUP BY age,state ORDER BY age-desc,state WHERE age > 66
2016-12-12 16:43 UTC-0800 Pritpal Bedi (bedipritpal at hotmail.com)(r443)
* hbqtwidgets/scripts.prg
% Changed : SQL parser from procedural to class code.
+ Array browser window adjusts to number of columns in the record upto
maximum columns which can be accomodated on the screen.
+ Implemented: SQL aggregate functions:
a) Count( * )
b) Min( cNumFieldName *|+|-|/ cSecondNumField *|+|-|/ cThirdNumField )
c) Max( cNumFieldName *|+|-|/ cSecondNumField *|+|-|/ cThirdNumField )
d) Avg( cNumFieldName *|+|-|/ cSecondNumField *|+|-|/ cThirdNumField )
e) Sum( cNumFieldName *|+|-|/ cSecondNumField *|+|-|/ cThirdNumField )
+ Implemented: SQL string functions:
a) SubStr( cCharFieldName, nFrom [, nCount ] )
b) Left( cCharFieldName, nCount )
c) Right( cCharFieldName, nCount )
d) Upper( cCharFieldName )
e) Lower( cCharFieldName )
+ Implemented: A general purpose field to club multiple numeric columns.
It is like SUM() function but is not an aggregate function. Syntax is:
a) Func( salary * age )
; WARNING: no parenthesis inside the function body.
; Title of the column representing above functions is constructed
automatically. Still, I am at a loss how to implement AS clause.
[ Preprocessor Limitation ].
; Example calls:
SELECT * FROM c:\harbour\tests\test.dbf ORDER BY age WHERE age>=90
SELECT first,last,age,state,zip,sum(age * age),count(*) ;
FROM c:\harbour\tests\test.dbf ORDER BY age-desc,state WHERE age>66
SELECT age,state,Func(age*salary),Right(state,1),Sum(salary),Min(salary),Max(salary),Avg(salary),Count(*) ;
FROM c:\harbour\tests\test.dbf GROUP BY age,state ORDER BY age-desc,state WHERE age > 66
2016-12-06 16:27 UTC-0800 Pritpal Bedi (bedipritpal at hotmail.com)(r442)
* hbqtwidgets/scripts.prg
+ Implemented LIKE operator in WHERE clause.
SELECT first,last,age,state,zip ;
FROM c:\harbour\tests\test.dbf ;
ORDER BY age-desc,state ;
WHERE last LIKE 'Vedal%'
OR
SELECT first,last,age,state,zip ;
FROM c:\harbour\tests\test.dbf ;
ORDER BY age-desc,state ;
WHERE last LIKE 'Vedal'
If "%" is not postfixed with search string then the behavior will
be exactly the same as "=" opertaor.
"=" operator matches the exact string.
"LIKE" without "%" will match the exact string.
"LIKE" with "%" will match the first characters of the string.
+ Implemented local resizable array browser to display the result set.
instead of calling Browse() which reduces the overhead to save
results in a table and then display. INTO clause is still respected,
though.
2016-12-02 16:39 UTC-0800 Pritpal Bedi (bedipritpal at hotmail.com)(r441)
* hbqtwidgets/scripts.prg
! Fixed: not to call 3rd rdd functions under a directive.
2016-12-02 16:18 UTC-0800 Pritpal Bedi (bedipritpal at hotmail.com)(r440)
* hbdbu/dbu.prg
* hbdbu/hbdbu.hbp
* hbqtwidgets/misc.prg
! Something missed.
2016-12-02 14:08 UTC-0800 Pritpal Bedi (bedipritpal at hotmail.com)(r439)
* hbdbu/dbu.prg
* hbdbu/hbdbu.hbp
+ Added few more contribs.
* hbqtwidgets/dbucreate.prg
! Fixed: <Create> and <Cancel> buttons on the "Create Table"
interface were not working.
* hbqtwidgets/getlist.prg
! Fixed a potential memoty leak. (Not confirmed).
* hbqtwidgets/hbqtdbu.prg
! Fixed: application freeze if editing was performed on ghost record.
Now a blank record is appeneded as soon as first editing action
is confirmed with ENTER.
* hbqtwidgets/scripts.ui
* hbqtwidgets/scripts.prg
- Removed: <-include> line edit.
+ Added: <-include> combo-box where multiple paths can be added and
managed as a drop-down list.
How to Add : Just type in the path in combo's edit field and
press ENTER.
How to Delete: Select the desired entry so that you can see it
in the combo's edit field, right-click, select
<Delete> from the context menu.
In single lineEdit control it was a mess to organize the paths.
+ The .hsv (Harbour Scripts View) filename is dispalyed on the
header of scripts tree. While saving and opening a new .hsv
the file open dialog now respects this path for .hsv files.
+ The path to the root of HbDBU is passed as an -i(nclude) directive
when a script is run.
+ If the script is a saved disk file, then, this path is also sent
as an -i(nclude) directive. Moreover, for console mode run,
the script is run while thread stays in this path.
+ Added: FUNCTION __hbqtExecSelect( cFields, cFrom, cWhere, cOrder, cInto )
which is activated with a statement like:
SELECT first,last,age,state FROM c:\harbour\tests\test.dbf ;
ORDER BY age-desc,state WHERE age>60
#command SELECT <fld,...> FROM <from> ;
[INTO <into>] ;
[ORDER BY <order,...>] ;
[WHERE <*whr*>] ;
=> ;
__hbqtExecSelect( #<fld>, <"from">, #<whr>, #<order>, <"into"> )
preprocessor directive is sent with the script buffer automatically.
; Yes, you read it right. HbQtScripts now implement a sub-set of
SQL SELECT statement which is translated to database commands and
result is displayed via Browse(). Let us understand the difference
in true SQL statement components vs HbQt.
SELECT * | comma sapartaed list of valid field names - no UDFs yet.
FROM fully qualified table name with path and extention. By default
DBFCDX driver is used, but to use another driver prefix the
table name with driver and "|", like:
dbfcdx|c:\harbour\tests\test.dbf
This must be the 2nd component of the statement.
INTO fully qualified table name with path and extention where
results will be deposited. DBFCDX is used for this purpose.
ORDER BY a comma separated list of field names contained in the result
set. Keyword "-desc" can be post-fixed with a fieldname to
present in descending order. In example statement as above
it is represented as - age-desc,state - where the whole result
is sorted descending on age first, then within each age group
state is sorted ascending.
WHERE This must be the last component of the statement.
The only operator supported for multiple conditions is
"AND" only, like: age > 90 and last = 'Thomas'.
The supported operators within a single condition are
>=, <=, !=, <>, =, <, >.
A condition has 3 components
//
1. FieldName - must be present in the table
2. Operator - one of the >=, <=, !=, <>, =, <, >
3. Value - string 'Thomas', numeric 90.0, date '2016-12-02'
a '=' condition is looked for if any index starting with its
FieldName is available or not. If available, then index order
is set to it and seek is performed with Value part which
greately enhances the speed.
; You can test it by simply placing the above SQL statement in a function
and just run it in console mode, assuming that test.dbf actually resides
where it is pointed to.
FUNCTION __test()
SELECT first,last,age,state FROM c:\harbour\tests\test.dbf ;
ORDER BY age-desc,state WHERE age>60
RETURN NIL
Muita gente não sabe o que tem pronto, e cria mais um recurso, mais um fork e a divisão vai aumentando.
Saudações,
Itamar M. Lins Jr.