Page 3 of 6

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

PostPosted: Fri Dec 09, 2016 9:03 pm
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 )

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

PostPosted: Sat Dec 10, 2016 12:44 am
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  Expand view

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

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

PostPosted: Sat Dec 10, 2016 12:55 am
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

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

PostPosted: Sat Dec 10, 2016 9:25 am
by vinhesoft
Thanks,

Mr.Rao and Cnavarro

Att

Joao Carlos
VinheSoft

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

PostPosted: Sun Dec 11, 2016 10:25 pm
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.

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

PostPosted: Sun Dec 11, 2016 10:38 pm
by nageswaragunupudi
New in 16.12 (Upcoming)
================

1) Server variables can be accessed as DATAs of the connection object.
Examples:
Code: Select all  Expand view
? 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  Expand view
 ? oCn:DATEDIFF( Date(), dOldDate )
  ? oCn:UTC_TIMESTAMP()
 


3) Full table rowsets can be opened as DATAs of the connection object.
Examples:
Code: Select all  Expand view
 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  Expand view

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

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

PostPosted: Sun Dec 11, 2016 11:29 pm
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.

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

PostPosted: Mon Dec 12, 2016 12:46 am
by vilian
Very Good!!!

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

PostPosted: Wed Jan 04, 2017 10:11 am
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

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

PostPosted: Wed Jan 04, 2017 11:43 am
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 "

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

PostPosted: Wed Jan 04, 2017 11:59 am
by vinhesoft
Mr. Rao

Thanks

Joao Carlos
VinheSoft

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

PostPosted: Mon Mar 13, 2017 2:46 pm
by wmanesco
Hi,

Is the source code available in any location?

Thanks

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

PostPosted: Mon Mar 13, 2017 2:51 pm
by nageswaragunupudi
wmanesco wrote:Hi,

Is the source code available in any location?

Thanks

Not available please.

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

PostPosted: Mon Mar 20, 2017 5:52 pm
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.

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

PostPosted: Thu Mar 23, 2017 5:37 pm
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