SQL Questions

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: SQL Questions

Post 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)
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: SQL Questions

Post 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
All The Best,
Franco
Canada
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: SQL Questions

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: SQL Questions

Post 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
There's nothing you can do that can't be done...
User avatar
gfilatov
Posts: 1060
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: SQL Questions

Post 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:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: SQL Questions

Post by serge_girard »

Thanks Grigory, I think Franco will be glad!

Serge
There's nothing you can do that can't be done...
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: SQL Questions

Post by franco »

Thanks Serge, Grigory, Rathi
I will give a try
Franco
All The Best,
Franco
Canada
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: SQL Questions

Post by franco »

I can not find the "selector.ch" file. Can you help.
Thanks Franco
All The Best,
Franco
Canada
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: SQL Questions

Post 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
All The Best,
Franco
Canada
User avatar
gfilatov
Posts: 1060
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: SQL Questions

Post 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-)
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Post Reply