Page 4 of 5
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Thu Mar 23, 2017 5:52 pm
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.
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Thu Mar 23, 2017 7:35 pm
by Maurizio
Thanks Rao,
I can't use oRs:savetodbf() because I need to do in a cycle like the example above.
Maurizio
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Thu Mar 23, 2017 7:55 pm
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
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 12:25 am
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
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 1:24 am
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.
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 1:25 am
by nageswaragunupudi
No
Only MSVC32.
But the Exe will be too large.
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 2:16 am
by dutch
Thank you, Mr.Rao.
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 8:52 am
by Maurizio
Thanks Rao ,
Just what I wanted
![Very Happy :D](./images/smilies/icon_biggrin.gif)
.
It's possible to have a list of the methods of RowSet class ?
Regards Maurizio
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 10:42 am
by nageswaragunupudi
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 3:40 pm
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
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 4:51 pm
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
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 5:00 pm
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
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Fri Mar 24, 2017 7:55 pm
by nageswaragunupudi
I see.
Let me think.
In the meantime better we also look for avoiding this error.
clean up you temporary folder. (try)
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Sat Mar 25, 2017 12:02 pm
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
Re: FWH 16.08 : Built-in MySql/MariaDB functionality (Updated )
Posted: Mon Mar 27, 2017 10:05 am
by Maurizio
Hello Rao ,
I have the same message with
oCn := maria_Connect( cServer, nil, cUser, cPassword, .F. )
I use FW January 2017
Maurizio