FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Dec 09, 2016 09:03 PM
vinhesoft wrote:Mr.Rao

What is the method for deleting a database?

OCn: DeleteDB (cDB)
OCn: DropDB (cDB)
OCn: Delete (cDB)
OCn: Drop (cDB)

I just managed this way:

OCn: QueryResult ('drop databases' + cDB)

Is there any method for this?

Att

João Carlos
VinheSoft


Try with

oCn:DropTable( cTable )
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Sat Dec 10, 2016 12:44 AM
Mr João Carlos

We have not created a method for it because it is not required for regular usage.
Please use:
Code (fw): Select all Collapse
oCn:Execute( "DROP DATEBASE IF EXISTS " + cDb )
if oCn:nError == 0
  // success
endif
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Sat Dec 10, 2016 12:55 AM
dutch wrote:METHOD Cancel() --> Cancels the pending updates/append

How do I know that data pending for updates (rowset has changed)?

Thanks for any help.


if Empty( oRs:ModiCols )
// not modified
else
// modified
endif
Regards



G. N. Rao.

Hyderabad, India
Posts: 36
Joined: Sat Sep 03, 2016 03:11 PM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Sat Dec 10, 2016 09:25 AM

Thanks,

Mr.Rao and Cnavarro

Att

Joao Carlos
VinheSoft

João Carlos

VinheSoft Informatica

BCC 7.7 - FHW 24.07 - Harbour 3.2.0dev (r2404101339) for BCC 7.7
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Sun Dec 11, 2016 10:25 PM

New in 16.11:

METHOD Explain( cSql, [aParams], [lShow = .t.] ) --> lValidSQL

Can be used only with SELECT, INSERT and UPDATE Sql statements only. By default (lShow := .t.), the method displays the execution plan of the sql statement in a browse. Knowledgeable programmers can use this information for optimizing the queries.

http://stackoverflow.com/questions/1014 ... plain-plan

https://www.sitepoint.com/using-explain ... l-queries/

Return Value: Whether the SQL statement is valid or not.

Param-2: aParams. If provided, the value are applied to cSql
Param-3: lShow. Default .T., Specifying .F. can be used for quickly testing validity of sql without executing it.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Sun Dec 11, 2016 10:38 PM
New in 16.12 (Upcoming)
================

1) Server variables can be accessed as DATAs of the connection object.
Examples:
Code (fw): Select all Collapse
? oCn:max_allowed_packet


2) Built-in MySql functions can be used like methods of connection object, using Harbour variables as parameters
Examples:
Code (fw): Select all Collapse
  ? oCn:DATEDIFF( Date(), dOldDate )
  ? oCn:UTC_TIMESTAMP()


3) Full table rowsets can be opened as DATAs of the connection object.
Examples:
Code (fw): Select all Collapse
  oRs := oCn:customer
  XBROWSER oRs
  XBROWSER oCn:states FASTEDIT


4) New METHOD HideServer()
Normally we can find the names of the server and user by oCn:cServer and oCn:cUser.
Password can never be accessed.
Now, if oCn:HideServer() is executed, even the server-name and user-name can not be accessed from the application program.

5) New DATAs IsMySql and IsMariaDB
Whether the connected server is MySql server or MariaDB server.

6) New DATA nVersion: Server version in Numeric value
Eg Usage:
Code (fw): Select all Collapse
  If oCn:IsMariaDB or oCn:nVersion >= 5.63
     // do something
  endif
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Sun Dec 11, 2016 11:29 PM
Also New in 16.12 (Upcoming):

Automatic Recovery from Lost Connections:

During execution of a program, connection to the server can be lost either due to connection timeout or due to physical loss of connection like failure or internet or physical connection.

Even after disconnection, the program can continue to browse / view the tables already opened including sorting and filtering, but any attempts to write data, requery, etc will fail.

TimeOut:
It is customary to set time out to 28,800 seconds (8 hours) in many cases. In some cases it is possible that the timeout is set to a very short period.

When any sql is executed for access or writing data, if disconnection is encountered, automatically reconnection is attempted. In case of connections lost due to time out, the recovery is 100% successful. In case of physical loss of connections, the program can continue without accessing data from the server and when the physical connectivity is restored any attempt to read/write data will automatically reconnect to the server and proceed with the execution of the program.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Mon Dec 12, 2016 12:46 AM

Very Good!!!

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 36
Joined: Sat Sep 03, 2016 03:11 PM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Wed Jan 04, 2017 10:11 AM

Mr Rao

The method: len is not returning the correct field size

see below

{ {'CODGRU', 'N', 3,0}, {'NOMGRU', 'C', 30,0}, {'VALUE', 'N', 12,2} }

oRs: = oCn: Query ('select * from grupo')

oRs: Fields (1): len -> field size 'CODGRU' returns 3 -> Ok
oRs: Fields (2): len -> field size 'NOMGRU' returns 30 -> Ok
oRs: Fields (3): len -> field size 'VALUE' returns 14 -> here you should retune 12

I'm using version 16.12

João Carlos

VinheSoft Informatica

BCC 7.7 - FHW 24.07 - Harbour 3.2.0dev (r2404101339) for BCC 7.7
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Wed Jan 04, 2017 11:43 AM

I sent reply to your email on Jan 1st. It appears you did not receive it.

This is the gist of the reply

"This is what is reported by MySql's library "libmysql".
If we create a column as "decimal( n, d )", libmysql reports the length as n+2. Please note it is not n + d.
So, if a column is created as "decimal(10,2)", then libmysql reports the length as 12. ( adds 2 bytes for decimal and -ve sign).
For this reason, even TMySql and TDolphin also report the length as 12 not 10.
Till now, FWMYSQL also is reporting 12 for the same reason. I did not think much about it till I got your email

We shall consider modifying FWHMYSQL library to display the length compatible with our Harbour system. I may make this change in the next version.
Please note, MySql's "decimal(10,2)" is equivalent to Harbour " N, 11, 2 "

Regards



G. N. Rao.

Hyderabad, India
Posts: 36
Joined: Sat Sep 03, 2016 03:11 PM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Wed Jan 04, 2017 11:59 AM

Mr. Rao

Thanks

Joao Carlos
VinheSoft

João Carlos

VinheSoft Informatica

BCC 7.7 - FHW 24.07 - Harbour 3.2.0dev (r2404101339) for BCC 7.7
Posts: 29
Joined: Wed Sep 14, 2016 03:49 PM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Mon Mar 13, 2017 02:46 PM

Hi,

Is the source code available in any location?

Thanks

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Mon Mar 13, 2017 02:51 PM
wmanesco wrote:Hi,

Is the source code available in any location?

Thanks

Not available please.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Mon Mar 20, 2017 05:52 PM
For MSVC32 Users


If the MSVC32 application is linked with mysqlclient.lib instead of with libmysql32.lib, the exe works independently and does not require libmysql.dll. You can distribute the exe only without any dlls.
Regards



G. N. Rao.

Hyderabad, India
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Thu Mar 23, 2017 05:37 PM

Mr. Rao ,

I have to copy a recordset into a DBF (with the same structure) , which the best way ?
(I can't use :SaveToDBF)

oRs := oCn:RowSet(cString)
do while ! oRs:eof()
select(cAl)
dbappend()

-->>> copy oRs in DBF

   oRs:skip()

enddo

Regards Maurizio

http://www.nipeservice.com