Page 2 of 3

Re: HMG 3.0 (Test XII)

Posted: Mon Nov 16, 2009 6:48 am
by mol
I wanna post report and dbf, where I have problem with polish characters.

Re: HMG 3.0 (Test XII)

Posted: Mon Nov 16, 2009 9:54 am
by mol
Roberto Lopez wrote:
mol wrote:I have a question:
How to connect to MySQL database without mysql.lib when ADO is removed from harbour?
Via ODBC, but, you should install MySql ODBC client (I guess that there is no licensing problems with it).

For a sample of ODBC usage, please look at \hmg\samples\rdd.sql\mdb.
I don't know how to link all my informations for working app.
When I connect to MySQL database via ODBC, I get connection, but, after, when I send request to database, I get error:
Error SDDODBC/1902 Invalid field type: SELECT * FROM country (DOS Error 65528)
Called from DBUSEAREA(0)
CALLED FROM MAIN(43)

Code: Select all

	odp := RDDINFO( RDDI_CONNECT,;
		{ "ODBC", "DBQ=" +"Server=localhost;Driver={MySQL ODBC 5.1 Driver};dsn=;User=root;password=123;database=korespondencja;Option=3;"} )
	if odp = 0
                //not connected
		return
	endif
	
	// it's required to use record locking to set autocommit to 0!!!!
	RDDINFO(RDDI_EXECUTE,"SET AUTOCOMMIT = 0")

	DBUSEAREA( .T.,, "SELECT * FROM country", "country" )
I can place all sample if sb. want to access to test it.
Marek

Re: HMG 3.0 (Test XII)

Posted: Mon Nov 16, 2009 4:53 pm
by Roberto Lopez
mol wrote:I wanna post report and dbf, where I have problem with polish characters.
Thanks Marek. I'll try to catch the problem.

Re: HMG 3.0 (Test XII)

Posted: Mon Nov 16, 2009 4:57 pm
by Roberto Lopez
mol wrote:
Roberto Lopez wrote:
mol wrote:I have a question:
How to connect to MySQL database without mysql.lib when ADO is removed from harbour?
Via ODBC, but, you should install MySql ODBC client (I guess that there is no licensing problems with it).

For a sample of ODBC usage, please look at \hmg\samples\rdd.sql\mdb.
I don't know how to link all my informations for working app.
When I connect to MySQL database via ODBC, I get connection, but, after, when I send request to database, I get error:
Error SDDODBC/1902 Invalid field type: SELECT * FROM country (DOS Error 65528)
Called from DBUSEAREA(0)
CALLED FROM MAIN(43)

Code: Select all

	odp := RDDINFO( RDDI_CONNECT,;
		{ "ODBC", "DBQ=" +"Server=localhost;Driver={MySQL ODBC 5.1 Driver};dsn=;User=root;password=123;database=korespondencja;Option=3;"} )
	if odp = 0
                //not connected
		return
	endif
	
	// it's required to use record locking to set autocommit to 0!!!!
	RDDINFO(RDDI_EXECUTE,"SET AUTOCOMMIT = 0")

	DBUSEAREA( .T.,, "SELECT * FROM country", "country" )
I can place all sample if sb. want to access to test it.
Marek
I've not attempted to use MySql via ODBC yet (I've just pointed that it could be possible) so, I have not info right now to help you on that.

Re: HMG 3.0 (Test XII)

Posted: Mon Nov 16, 2009 5:33 pm
by mol
Connecting to database, inserting rows works OK. But I can't retrieve data by select...


Don't you know Roberto, where to find more info about RDDSQL?
I can't find anything with google.
I've tried to write to Przemek Czerpak, but, I think, I have bad address.

Best regards, Marek

Re: HMG 3.0 (Test XII)

Posted: Mon Nov 16, 2009 6:45 pm
by Roberto Lopez
mol wrote:Connecting to database, inserting rows works OK. But I can't retrieve data by select...


Don't you know Roberto, where to find more info about RDDSQL?
I can't find anything with google.
I've tried to write to Przemek Czerpak, but, I think, I have bad address.

Best regards, Marek
RDDSQL author is Mindaugas Kavaliauskas <dbtopas at dbtopas.lt>

Here is the library source code and samples from Harbour sources.

Re: HMG 3.0 (Test XII)

Posted: Mon Nov 16, 2009 7:02 pm
by mol
I've written to him, but he couldn't help me.
I think, I will leave this topic.
I think, it must be a little bug in RDDSQL.

Regards, Marek

Re: HMG 3.0 (Test XII)

Posted: Mon Nov 16, 2009 8:29 pm
by mol
I've made some tests and found, that RDDSQL with MySQL and ODBC have problem with CHAR, VARCHAR or TEXT fields.
I'm writing with Mindaugas Kavaliauskas <dbtopas at dbtopas.lt> about this problem.
I'll inform you about results.

I'm very interesting to make working example with Mysql, RDDSQL and ODBC with record locking.
Best regards, Marek

Re: HMG 3.0 (Test XII)

Posted: Tue Nov 17, 2009 9:42 am
by gfilatov
mol wrote:I've made some tests and found, that RDDSQL with MySQL and ODBC have problem with CHAR, VARCHAR or TEXT fields.
I'm writing with Mindaugas Kavaliauskas <dbtopas at dbtopas.lt> about this problem.
I'll inform you about results.

I'm very interesting to make working example with Mysql, RDDSQL and ODBC with record locking.
Hello Marek,

I was able to connect and select data from mysql table by RDDSQL and mysql ODBC connector 3.51.
Take a look for the working sample below:

Code: Select all

/*
 * MINIGUI - Harbour Win32 GUI library Demo
 *
 * Copyright 2002-2009 Roberto Lopez <harbourminigui@gmail.com>
 * http://harbourminigui.googlepages.com/
 *
 * Copyright 2009 Grigory Filatov <gfilatov@freemail.ru>
 *
 * Based on RDDSQL ODBC sample included in Harbour distribution
*/

#include "minigui.ch"
#include "dbinfo.ch"
#include "error.ch"

#define RDDI_CONNECT          1001
#define RDDI_DISCONNECT       1002
#define RDDI_EXECUTE          1003

ANNOUNCE RDDSYS
REQUEST SQLMIX, SDDODBC

*--------------------------------------------------------*
Function Main()
*--------------------------------------------------------*
LOCAL nConnection

	RDDSETDEFAULT( "SQLMIX" )

	SET( _SET_DATEFORMAT, "yyyy-mm-dd" )

	nConnection := RDDINFO( RDDI_CONNECT, { "ODBC", "Server=localhost;Driver={MySQL ODBC 3.51 Driver};dsn=;User=root;database=test;" } )
	IF nConnection == 0
		MsgStop("Unable connect to the server!", "Error")
		Return nil
	ENDIF

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 HEIGHT 480 ;
		TITLE 'MiniGUI ODBC Database Driver Demo' ;
		MAIN NOMAXIMIZE ;
		ON INIT OpenTable() ;
		ON RELEASE CloseTable()

		DEFINE MAIN MENU

			DEFINE POPUP 'File'
				ITEM "Exit"		ACTION ThisWindow.Release()
			END POPUP

		END MENU

		@ 10,10 BROWSE Browse_1	;
			WIDTH 610	;
			HEIGHT 390	;	
			HEADERS { 'Code' , 'Name' , 'Residents' } ;
			WIDTHS { 50 , 160 , 100 } ;
			WORKAREA country ;
			FIELDS { 'country->Code' , 'country->Name' , 'country->Residents' } ;
			JUSTIFY { BROWSE_JTFY_LEFT, BROWSE_JTFY_LEFT, BROWSE_JTFY_RIGHT }

	END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return nil

*--------------------------------------------------------*
Procedure OpenTable
*--------------------------------------------------------*

   If CreateTable()

	DBUSEAREA( .T.,, "SELECT * FROM country", "country" )

	INDEX ON FIELD->RESIDENTS TAG residents TO country

	GO TOP

   Else

	Form_1.Release()

   EndIf

Return

*--------------------------------------------------------*
Procedure CloseTable
*--------------------------------------------------------*

   DBCLOSEALL()

Return

*--------------------------------------------------------*
Function CreateTable
*--------------------------------------------------------*
Local ret := .T.

   RDDINFO(RDDI_EXECUTE, "DROP TABLE country")

   If RDDINFO(RDDI_EXECUTE, "CREATE TABLE country (CODE char(3), NAME char(50), RESIDENTS int(11))")

      If ! RDDINFO(RDDI_EXECUTE, "INSERT INTO country values ('LTU', 'Lithuania', 3369600), ('USA', 'United States of America', 305397000), ('POR', 'Portugal', 10617600), ('POL', 'Poland', 38115967), ('AUS', 'Australia', 21446187), ('FRA', 'France', 64473140), ('RUS', 'Russia', 141900000)")

	MsgStop("Can't fill table Country!", "Error")
	ret := .F.

      EndIf

   Else

	MsgStop("Can't create table Country!", "Error")
	ret := .F.

   EndIf

Return ret

Re: HMG 3.0 (Test XII)

Posted: Thu Nov 19, 2009 12:41 pm
by arroya2
En Español.
Hola Roberto.
Mi pregunta es si esta versión de HMG 3.0 es fiable para trabajar con ella, o debo seguir usando HMG 2.9.5. Usted sabe que estoy comenzando a programar en HMG y no soy muy habilidoso que digamos.

Saludos cordiales.
Rafael Pérez

In English.
Hello Roberto.
My question is whether this version of HMG 3.0 is reliable to work with it, or should I keep using 2.9.5 HMG. You know I'm starting to program in HMG and I'm not very clever to say.

Best regards.
Rafael Perez