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

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 »

Actually you do not even have to open RowSet.
You can directly save the result of SQL statement to DBF.
Important: You should link DBFCDX to the application.

Sample:

Code: Select all

   cSql  := "SELECT FIRST,CITY,AGE,SALARY FROM customer"
   oCn:SaveToDBF( cSql, "c:\fwh\samples\custpart.dbf" )

   USE c:\fwh\samples\custpart NEW SHARED VIA "DBFCDX"
   XBROWSER "custpart"
 
The entire execution is extremely fast.
Note: This creates a new DBF file.
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 »

Thanks Rao,
I can't use oRs:savetodbf() because I need to do in a cycle like the example above.
Maurizio
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 »

Maurizio,

IF you really needs to do this in a cycle, I think you could to do by this way:

Code: Select all

aValues := oCn:Execute(cString)
FOR n = 1 TO Len(aValues)
      oCn:Insert(cTable,,aValues[n])    
NEXT
 
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
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 »

Code: Select all

   do while !oRs:Eof()
      (cAlias)->( DBAPPEND() )
      (cAlias)->( AEVAL( oRs:Scatter( .t. ), { |u,i| FieldPut( i, u ) } ) )
      oRs:Skip( 1 )
   enddo
 
OR

Code: Select all

   nFieldCount := oRs:FCount()
   do while !oRs:Eof()
      (cAlias)->(DBAPPEND())
      for n := 1 to nFieldCount
         (cAlias)->( FieldPut( n, oRs:FieldGet( n ) ) )
      next
      oRs:Skip( 1 )
   enddo
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post by dutch »

Dear Mr.Rao,

WIll it be compatible with BCC7?
nageswaragunupudi wrote: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.
Thanks.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
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 »

No
Only MSVC32.
But the Exe will be too large.
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post by dutch »

Thank you, Mr.Rao.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
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 »

Thanks Rao ,

Just what I wanted :D .

It's possible to have a list of the methods of RowSet class ?

Regards Maurizio
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 »

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 »

Thanks Rao ,

I have a loop that every 60 minutes connecting to a server

FWCONNECT oCn HOST cServer USER cUser PASSWORD cPassword

I read the new data and i close .

oCn:Close()

Sometimes I get this error :
2013 Lost connection to MySQL server at 'waiting for initial comunication packet' ,system error 2 .

it's possible not view the message and write in a log ?

Regards Maurizio

Regards Maurizio
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 understand you already know the use of oCn:lShowErrors and oCn:lLogErr.

Normally no errors or other messages are either displayed or logged unless you explicitly set the above flags.

But we thought some messages about losing connection are very important to the user to know what is happening or why data is not being saved, etc. For this reason we are displaying some connection related error messages compulsorily. We expect such messages would help the user to check his cables/internet connections etc and continue the program.

Let us consider an option to suppress these messages also in specific cases like yours. Your requirement is just in time before the next release.

Setting oCn:lLogErr to .t. anyway logs all error messages including this message
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 »

Thanks Rao ,

but in this case the error is when I connect , lLogErr it should be in

FWCONNECT oCn HOST cServer USER cUser PASSWORD cPassword

Maurizio
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 see.
Let me think.

In the meantime better we also look for avoiding this error.
clean up you temporary folder. (try)
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 »

Instead of

FWCONNECT oCn HOST cServer USER cUser PASSWORD cPassword


Please try
oCn := maria_Connect( cServer, nil, cUser, cPassword, .F. )

This would suppress display of error messages while connecting
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 »

Hello Rao ,

I have the same message with

oCn := maria_Connect( cServer, nil, cUser, cPassword, .F. )

I use FW January 2017 :cry:

Maurizio
Post Reply