Page 2 of 3

Re: SQL Questions

Posted: Mon Oct 01, 2018 5:36 pm
by dragancesu
In MySQL see https://www.w3schools.com/sql/sql_alter.asp

for DBF I use program DBX (dos version) or dbfCommander (windows, http://elphsoft.com/download.html)

Re: SQL Questions

Posted: Mon Oct 01, 2018 6:10 pm
by franco
I meant from inside program.
I thought I seen something like

Code: Select all

use file
if ! field('try')
append blank
replace name with 'try', type with 'character' width with 30, decimals with 0
endif
use

Re: SQL Questions

Posted: Thu Oct 04, 2018 6:13 am
by Rathinagiri
IMHO, if you want to use SQL trying to use proper 'SQL Queries' will help us a lot. From HMG you can run these queries to either insert data or extract data using 'INSERT' or 'SELECT' commands of SQL.

Re: SQL Questions

Posted: Thu Oct 04, 2018 8:15 am
by serge_girard
Rathi,

Is it possible to have something like this:

http://compgroups.net/comp.lang.xharbou ... ta/3100125

This would be the solution for Franco, I suppose.

Reagrds, Serge

Re: SQL Questions

Posted: Thu Oct 04, 2018 9:32 am
by gfilatov
serge_girard wrote: Thu Oct 04, 2018 8:15 am Is it possible to have something like this:

http://compgroups.net/comp.lang.xharbou ... ta/3100125

This would be the solution for Franco, I suppose.
Hi Serge,

There is a freeware library SELECTOR for a such need in the MiniGUI Ex distribution.

The console sample is below:

Code: Select all

/*
 * demo.prg
 */

#include "Selector.ch"

PROCEDURE Main()
    LOCAL nStart
    LOCAL n
    LOCAL aData

    IF File("temp.dbf")
       FErase("temp.dbf")
    ENDIF

	USE test EXCLUSIVE 

        @ SELECT first,last,age GROUP,state GROUP FROM test FOR age>60

	nStart := Seconds()
	aData := {}

	? ""

	temp->(DbGoTop())
	FOR n:=1 TO 20
		AAdd( adata, {Alltrim(temp->first),temp->age,temp->state} )
                ? Alltrim(temp->first),temp->age,temp->state
		temp->(DbSkip())
	NEXT

	? "=============================================================="	 
	? "Added " + Str(Len(aData)) + " Selector records into array in ", Seconds() - nStart   
	?? " seconds"
	? "=============================================================="	
	inkey(0)

	temp->(DbCloseArea())
	DbDrop('temp')

RETURN
and a screen output of this program is
Wayne 61 IN
Dickson 61 WI
Tom 62 AZ
Lance 62 FL
Terry 62 IA
Gregory 62 MD
Frederik 62 OR
Heinz 62 PA
Corey 62 SD
Vosgo 63 CA
Michael 63 HI
Luc 63 HI
Laura 63 IA
Francisco 63 MT
Matthew 63 NH
Albert 63 NM
Ralf 63 SC
Kandasamy 63 SC
Gilles 63 VT
Gerard 64 CA
==============================================================
Added 20 Selector records into array in 0.55 seconds
==============================================================
Hope that useful :idea:

Re: SQL Questions

Posted: Thu Oct 04, 2018 11:16 am
by serge_girard
Thanks Grigory, I think Franco will be glad!

Serge

Re: SQL Questions

Posted: Thu Oct 04, 2018 4:07 pm
by franco
Thanks Serge, Grigory, Rathi
I will give a try
Franco

Re: SQL Questions

Posted: Thu Oct 04, 2018 5:08 pm
by franco
I can not find the "selector.ch" file. Can you help.
Thanks Franco

Re: SQL Questions

Posted: Thu Oct 04, 2018 11:26 pm
by franco
Downloaded minigui and found selector.ch inside. Copied it to hmg3.2 include folder and hfcl include folder . Can not make it work ? does it work in hmg3.2 .
Franco

Re: SQL Questions

Posted: Sat Oct 06, 2018 3:21 pm
by gfilatov
franco wrote: Thu Oct 04, 2018 11:26 pm Downloaded minigui and found selector.ch inside. Copied it to hmg3.2 include folder and hfcl include folder . Can not make it work ? does it work in hmg3.2 .
Dear Franco,

It is a BCC-compiled library due to it will work in MiniGUi Ex only 8-)