Error loading class..

Post your Gambas programming questions here.
Post Reply
salihburhan
Posts: 15
Joined: Thursday 24th October 2019 2:14pm

Error loading class..

Post by salihburhan »

For some reason, I get a "unable to load class file" error.
It is a very straightforward class that holds some db data much like all the others I use.

During debug this is the message I get:
Cannot load class '$oGSk': Loading has already failed.

Though program does not crash. Later, at some point it gives the error I mentioned at the top.

(Upd.

It does crash eventually when I try to create the same class somewhere else.. )

A bug? Any help will be appreciated. (Gambas 3.12.2 on debian 10.10)
Here is the class below:


' Gambas class file

Public id As Integer
Public sk_id As Integer
Public price As Float
Public tarih As Date
Public is_inPromotion As Boolean
Public is_active As Boolean
Public objSk As New Sk


Public Sub _new()
id = 0
sk_id = 0
price = 0
tarih = Now
is_inPromotion = False
is_active = False
End

Public Sub set_by_id($qid As Integer)
Dim $rs As Result
If $qid > 0 Then id = $qid
$rs = start_nt.dbConn.get_by_id("getir_sk", id)
If $rs.MoveFirst() Then
id = 0
Return
Endif
sk_id = $rs!sk_id
price = Round($rs!price, -2)
tarih = $rs!tarih
is_inPromotion = $rs!is_inPromotion
is_active = $rs!is_active
objSk = start_nt.nt_cache.get_sk_by_id_copy(sk_id)
End

Public Sub set_insert()
Dim $wQ As String
$wQ = "INSERT into getir_sk (sk_id, price, tarih, is_inPromotion, is_active) " &
"VALUES (&1, &2, &3, &4, &5) returning id;"
$wQ = db.Subst(sk_id, price, tarih, is_inPromotion, is_active)
id = start_nt.dbConn.insertValue($wQ)
End

Public Sub set_update_price($fPrice As Float)
Dim $wQ As String
If $fPrice > 0 Then price = $fPrice
$wQ = "UPDATE getir_sk SET price=&1 " &
"WHERE id=&1;"
$wq = db.Subst(price, id)
start_nt.dbConn.execQuery($wq)
End

Public Sub set_update_is_active($bActive As Boolean)
Dim $wQ As String
is_active = $bActive
$wQ = "UPDATE getir_sk SET is_active=&1 " &
"WHERE id=&1;"
$wq = db.Subst(is_active, id)
start_nt.dbConn.execQuery($wq)
End

Public Sub set_update_promotion($bPromo As Boolean)
Dim $wQ As String
is_inPromotion = $bPromo
$wQ = "UPDATE getir_sk SET is_inPromotion=&1 " &
"WHERE id=&1;"
$wq = db.Subst($bPromo, id)
start_nt.dbConn.execQuery($wq)
End

Public Sub set_delete($qid As Integer)
If $qid > 0 Then id = $qid
start_nt.dbConn.delete_by_id("getir_sk", id)
End
Post Reply