lLock par. problem in EditBaseRecord() for MariaDB - SOLVED

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby nageswaragunupudi » Tue Apr 07, 2020 11:52 am

Mr. Hakan.
Please skip the previous postings. Let us find out where is the problem.

Let me understand what is happening with your server, by doing these small tests:

1) First connect to your server.
Then please execute this code:
Code: Select all  Expand view  RUN

? oCn:cServerInfo
? oCn:IsMariaDB
? oCn:in_transaction
 

and let us know the results. This information is very useful to us.
I await your response.
Regards

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

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby Horizon » Tue Apr 07, 2020 12:00 pm

Hi Mr. Rao,

Code: Select all  Expand view  RUN
? oCn:cServerInfo
10.4.12-MariaDB
Code: Select all  Expand view  RUN
? oCn:IsMariaDB
.F. :shock:
Code: Select all  Expand view  RUN
? oCn:in_transaction
1728
Cannot load from mysql.proc. The table is probably corrupted.

Code: Select all  Expand view  RUN
METHOD Connect(cDatabase) CLASS TMyDatabase_SQL
LOCAL oCn
    IF EMPTY(cDatabase)
        MsgAlert("Database can not be empty.")
    ELSE
        FWCONNECT oCn HOST ::cDSN USER ::cUser PASSWORD ::cPassword DB cDatabase
    ENDIF
    IF oCn == nil
        MsgAlert(cDatabase+" Can not connected..")
    ELSE
//      ? cDatabase+" connection OK."

   oCn:LockTimeOut   := 1
   oCn:lShowErrors   := .t.

? oCn:cServerInfo
? oCn:IsMariaDB
? oCn:in_transaction

    ENDIF
RETURN oCn
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby nageswaragunupudi » Tue Apr 07, 2020 12:16 pm

I am wondering why oCn:IsMariaDB false. This is creating the problem.

Let us think.
Regards

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

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby Horizon » Tue Apr 07, 2020 1:00 pm

Hi Mr. Rao,

Can you please try this mari15.prg.
Code: Select all  Expand view  RUN
/*
* Demonstrates oRs:EditBaseRecord( [cFieldList], [lAppend], [bEditDlg], [oBrw] )
* Where RowSet contains only some of the fields. this method can be used
* to edit full record of the table with all fields/selected fields
*
*/


#include "fivewin.ch"
#include "dbcombo.ch"

static aStates

//----------------------------------------------------------------------------//

function Main()

   local oCn, oRs
   local oDlg, oBrw

   FWNumFormat( "A", .t. )

   oCn   := FW_DemoDB()

   oCn:LockTimeOut   := 1
   oCn:lShowErrors   := .t.

? oCn:cServerInfo
? oCn:IsMariaDB
? oCn:in_transaction

   aStates  := oCn:Execute( "SELECT CODE,NAME FROM states" )
   oRs      := oCn:RowSet( "SELECT ID,FIRST,CITY,SALARY FROM customer" )

   DEFINE DIALOG oDlg SIZE 500,600 PIXEL TRUEPIXEL ;
      TITLE "EditBaseRecord()"

   @ 70,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oRs AUTOCOLS ;
      COLSIZES -4, -20, -20 ;
      CELL LINES NOBORDER FOOTERS FASTEDIT

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      :Salary:nFooterType  := AGGR_SUM
      :MakeTotals()
      :CreateFromCode()
   END

   @ 20, 20 BTNBMP PROMPT "ADD"  SIZE 100,30 PIXEL FLAT OF oDlg ;
      ACTION oRs:EditBaseRecord( nil, .t., { |oRec| MyEditDlg( oRec ) }, oBrw )

   @ 20,130 BTNBMP PROMPT "EDIT" SIZE 100,30 PIXEL FLAT OF oDlg ;
      ACTION EditRecord(oRs, oBrw) //oRs:EditBaseRecord( nil, .f., { |oRec| MyEditDlg( oRec ) }, oBrw, {|oRs|Locked_Problem(oRs)} )

   ACTIVATE DIALOG oDlg CENTERED

return nil

function EditRecord(oRs, oBrw)
    ? oRs, VALTYPE(oRs)
    xbrowser oRs slnum title "GO_DETAY"
    xbrowser oBrw slnum
    oRs:EditBaseRecord( nil, .f., { |oRec| MyEditDlg( oRec ) }, oBrw, {|oRs|Locked_Problem(oRs)} )
return

FUNCTION Locked_Problem(oRs)
    ? "Locked_Problem(oRs)", oRs
RETURN

static function MyEditDlg( oRec )

   local lNew     := ( oRec:RecNo == 0 )
   local oDlg, oFont

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
   DEFINE DIALOG oDlg SIZE 400,470 PIXEL TRUEPIXEL FONT oFont ;
      TITLE If( lNew, "ADD NEW ", "EDIT" ) + " RECORD"

   @ 030,020 SAY "ID :"          SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 060,020 SAY "First"         SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 090,020 SAY "Last"          SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 120,020 SAY "Street"        SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 150,020 SAY "City"          SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 180,020 SAY "State"         SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 210,020 SAY "Zip"           SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 240,020 SAY "HireDate"      SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 270,020 SAY "Married"       SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 300,020 SAY "Age"           SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 330,020 SAY "Salary"        SIZE 80,20 PIXEL OF oDlg RIGHT
   @ 360,020 SAY "Notes"         SIZE 80,20 PIXEL OF oDlg RIGHT

   @ 030,120 GET oRec:ID         SIZE 100,22 PIXEL OF oDlg READONLY RIGHT
   @ 060,120 GET oRec:First      SIZE 240,22 PIXEL OF oDlg VALID !Empty( oRec:First )
   @ 090,120 GET oRec:Last       SIZE 240,22 PIXEL OF oDlg VALID !Empty( oRec:Last )
   @ 120,120 GET oRec:Street     SIZE 240,22 PIXEL OF oDlg VALID !Empty( oRec:Street )
   @ 150,120 GET oRec:City       SIZE 240,22 PIXEL OF oDlg VALID !Empty( oRec:City )
   @ 180,120 DBCOMBO oRec:State  SIZE 240,300 PIXEL OF oDlg ;
      ALIAS aStates ITEMFIELD "1" LISTFIELD "2"
   @ 210,120 GET oRec:Zip        SIZE 240,22 PIXEL OF oDlg VALID !Empty( oRec:Zip )
   @ 240,120 GET oRec:HireDate   SIZE 240,22 PIXEL OF oDlg VALID !Empty( oRec:HireDate )
   @ 270,120 CHECKBOX oRec:Married PROMPT "" SIZE 22,22 PIXEL OF oDlg
   @ 300,120 GET oRec:Age        SIZE 240,22 PIXEL OF oDlg PICTURE "99" RIGHT VALID ( oRec:Age >= 20 )
   @ 330,120 GET oRec:Salary     SIZE 240,22 PIXEL OF oDlg PICTURE "999,999.99" RIGHT VALID ( oRec:Salary > 0 )
   @ 360,120 GET oRec:Notes      SIZE 240,22 PIXEL OF oDlg

   @ 420,020 BTNBMP PROMPT "Save"   SIZE 150,30 PIXEL FLAT OF oDlg ;
      ACTION ( If( oRec:Modified(), oRec:Save(), nil ), oDlg:End() ) WHEN oRec:Modified()
   @ 420,240 BTNBMP PROMPT "Cancel" SIZE 150,30 PIXEL FLAT OF oDlg ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
      ON PAINT oDlg:Box( 15, 10, 395, 390 )

return nil

 


It gives the same error.

Is it related or not I dont know. I have realized that buildh32.bat links libmysql32.lib. in this situation I have the same error.

When I changed to libmariadb32.lib. it compiles but exe can not run.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby nageswaragunupudi » Tue Apr 07, 2020 1:04 pm

Yes, I will do that.
But even before that please do this test:

After connecting the server
Code: Select all  Expand view  RUN
? oCn:cServerInfo
? "MARIADB" $ Upper( oCn:cServerInfo )
? Upper( oCn:cServerInfo )
? oCn:IsMariaDB
 
Regards

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

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby Horizon » Tue Apr 07, 2020 1:27 pm

Hi Mr. Rao,

Code: Select all  Expand view  RUN
? oCn:cServerInfo
10.4.12-MariaDB
Code: Select all  Expand view  RUN
? "MARIADB" $ Upper( oCn:cServerInfo )
.F.
Code: Select all  Expand view  RUN
? Upper( oCn:cServerInfo )
10.4.12-MARİADB (lower 'i' ==> Upper 'İ' codepage Windows 1254 Turkish charset)
Code: Select all  Expand view  RUN
? oCn:IsMariaDB
.F.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby nageswaragunupudi » Tue Apr 07, 2020 2:23 pm

Code:
? "MARIADB" $ Upper( oCn:cServerInfo )
.F.
Code:
? Upper( oCn:cServerInfo )
10.4.12-MARİADB (lower 'i' ==> Upper 'İ' codepage Windows 1254 Turkish charset)
Code:
? oCn:IsMariaDB
.F.


This is the cause of all problems.
Now let us think about it.
Regards

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

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby nageswaragunupudi » Wed Apr 08, 2020 4:02 am

There are a few differences in the functionality of MySql and MariaDB servers and also between different versions (particulary from ver. 8.0 ) of MySql.

In such cases, the library uses suitable functions depending on whether the server is MySql or MariaDB. To know if the server is MariaDB, we initialize the readonly DATA oCn:IsMariaDB with this test:
Code: Select all  Expand view  RUN

::IsMariaDB := "MARIADB" $ Upper( ::cServerInfo )
 

We did not foresee that this would fail on a Turkish installation and may be it may fail on some other language installtions.

We have now modified the test as
Code: Select all  Expand view  RUN
        ::IsMariaDB    := ( "M" $ ::cServerInfo .and. "DB" $ ::cServerInfo )
 

We expect this should work correctly on all installations.

If you let me know your email address, we will send you revised libraries and you may test and confirm.
Regards

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

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby Horizon » Wed Apr 08, 2020 8:40 am

Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby nageswaragunupudi » Wed Apr 08, 2020 10:04 am

Do you want libraries for Harbour with Visual Studio 32 bits? Or Borland?
Regards

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

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby Horizon » Wed Apr 08, 2020 10:14 am

nageswaragunupudi wrote:Do you want libraries for Harbour with Visual Studio 32 bits? Or Borland?


Harbour with Visual Studio 32 bits.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby Horizon » Wed Apr 08, 2020 2:06 pm

Horizon wrote:
nageswaragunupudi wrote:Do you want libraries for Harbour with Visual Studio 32 bits? Or Borland?


Harbour with Visual Studio 32 bits.


Hi Mr. Rao,

Your mail has not been arrived to me yet?
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby Horizon » Sat Apr 11, 2020 8:53 pm

up
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby nageswaragunupudi » Sun Apr 12, 2020 7:43 am

Through personal email, I requested you to check these with the revised libraray
Code: Select all  Expand view  RUN
xbrowser oCn:Execute( "SHOW ALL VARIABLES LIKE 'in_transaction'" )
AND
? oCn:in_transaction


I reminded you also, but there is no response from you to my email.
Regards

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

Re: New lLock parameter problem in EditBaseRecord() for MariaDB

Postby Horizon » Sun Apr 12, 2020 8:03 am

nageswaragunupudi wrote:Through personal email, I requested you to check these with the revised libraray
Code: Select all  Expand view  RUN
xbrowser oCn:Execute( "SHOW ALL VARIABLES LIKE 'in_transaction'" )
AND
? oCn:in_transaction


I reminded you also, but there is no response from you to my email.


I have sent again Mr. Rao.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 89 guests