FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by cnavarro »

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 )
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by nageswaragunupudi »

Mr João Carlos

We have not created a method for it because it is not required for regular usage.
Please use:

Code: Select all

oCn:Execute( "DROP DATEBASE IF EXISTS " + cDb )
if oCn:nError == 0
  // success
endif
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by nageswaragunupudi »

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
vinhesoft
Posts: 20
Joined: Sat Sep 03, 2016 3:11 pm
Location: Campinas/SP-Brasil
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by vinhesoft »

Thanks,

Mr.Rao and Cnavarro

Att

Joao Carlos
VinheSoft
João Carlos
VinheSoft Informatica Ltda
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by nageswaragunupudi »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by nageswaragunupudi »

New in 16.12 (Upcoming)
================

1) Server variables can be accessed as DATAs of the connection object.
Examples:

Code: Select all

? oCn:max_allowed_packet
 
2) Built-in MySql functions can be used like methods of connection object, using Harbour variables as parameters
Examples:

Code: Select all

  ? oCn:DATEDIFF( Date(), dOldDate )
  ? oCn:UTC_TIMESTAMP()
 
3) Full table rowsets can be opened as DATAs of the connection object.
Examples:

Code: Select all

  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: Select all

  If oCn:IsMariaDB or oCn:nVersion >= 5.63
     // do something
  endif
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by nageswaragunupudi »

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
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by vilian »

Very Good!!!
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
vinhesoft
Posts: 20
Joined: Sat Sep 03, 2016 3:11 pm
Location: Campinas/SP-Brasil
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by vinhesoft »

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 Ltda
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by nageswaragunupudi »

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
vinhesoft
Posts: 20
Joined: Sat Sep 03, 2016 3:11 pm
Location: Campinas/SP-Brasil
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by vinhesoft »

Mr. Rao

Thanks

Joao Carlos
VinheSoft
João Carlos
VinheSoft Informatica Ltda
wmanesco
Posts: 29
Joined: Wed Sep 14, 2016 3:49 pm

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by wmanesco »

Hi,

Is the source code available in any location?

Thanks
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by nageswaragunupudi »

wmanesco wrote:Hi,

Is the source code available in any location?

Thanks
Not available please.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by nageswaragunupudi »

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
User avatar
Maurizio
Posts: 705
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )

Post by Maurizio »

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
Post Reply