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

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

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

Post by nageswaragunupudi »

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

? 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
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

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

Post by Horizon »

Hi Mr. Rao,

Code: Select all

? oCn:cServerInfo
10.4.12-MariaDB

Code: Select all

? oCn:IsMariaDB
.F. :shock:

Code: Select all

? oCn:in_transaction
1728
Cannot load from mysql.proc. The table is probably corrupted.

Code: Select all

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

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

Post by nageswaragunupudi »

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

Let us think.
Regards

G. N. Rao.
Hyderabad, India
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

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

Post by Horizon »

Hi Mr. Rao,

Can you please try this mari15.prg.

Code: Select all

/*
* 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 & VS 2019 & FWH 20.12
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post by nageswaragunupudi »

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

After connecting the server

Code: Select all

? oCn:cServerInfo
? "MARIADB" $ Upper( oCn:cServerInfo )
? Upper( oCn:cServerInfo )
? oCn:IsMariaDB
 
Regards

G. N. Rao.
Hyderabad, India
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

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

Post by Horizon »

Hi Mr. Rao,

Code: Select all

? oCn:cServerInfo
10.4.12-MariaDB

Code: Select all

? "MARIADB" $ Upper( oCn:cServerInfo )
.F.

Code: Select all

? Upper( oCn:cServerInfo )
10.4.12-MARİADB (lower 'i' ==> Upper 'İ' codepage Windows 1254 Turkish charset)

Code: Select all

? oCn:IsMariaDB
.F.
Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post by nageswaragunupudi »

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

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

Post by nageswaragunupudi »

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

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

         ::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
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

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

Post by Horizon »

Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post by nageswaragunupudi »

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

G. N. Rao.
Hyderabad, India
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

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

Post by Horizon »

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 & VS 2019 & FWH 20.12
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

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

Post by Horizon »

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 & VS 2019 & FWH 20.12
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

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

Post by Horizon »

up
Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

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

Post by nageswaragunupudi »

Through personal email, I requested you to check these with the revised libraray

Code: Select all

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
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

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

Post by Horizon »

nageswaragunupudi wrote:Through personal email, I requested you to check these with the revised libraray

Code: Select all

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 & VS 2019 & FWH 20.12
Post Reply