SQL Questions

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
dragancesu
Posts: 568
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 14 times
Been thanked: 101 times

Re: SQL Questions

Post by dragancesu » Mon Oct 01, 2018 5:36 pm

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: 265
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Mon Oct 01, 2018 6:10 pm

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

User avatar
Rathinagiri
Posts: 5243
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 162 times
Been thanked: 161 times
Contact:

Post by Rathinagiri » Thu Oct 04, 2018 6:13 am

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: 2117
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 437 times
Been thanked: 95 times
Contact:

Post by serge_girard » Thu Oct 04, 2018 8:15 am

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

User avatar
gfilatov
Posts: 561
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 14 times
Been thanked: 126 times
Contact:

Post by gfilatov » Thu Oct 04, 2018 9:32 am

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: 2117
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 437 times
Been thanked: 95 times
Contact:

Post by serge_girard » Thu Oct 04, 2018 11:16 am

Thanks Grigory, I think Franco will be glad!

Serge

franco
Posts: 265
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Thu Oct 04, 2018 4:07 pm

Thanks Serge, Grigory, Rathi
I will give a try
Franco

franco
Posts: 265
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Thu Oct 04, 2018 5:08 pm

I can not find the "selector.ch" file. Can you help.
Thanks Franco

franco
Posts: 265
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » 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 .
Franco

User avatar
gfilatov
Posts: 561
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 14 times
Been thanked: 126 times
Contact:

Post by gfilatov » Sat Oct 06, 2018 3:21 pm

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