https://lists.gambas-basic.org/archive/ ... 00064.html
That was quick. I am impressed.

Welcome to the cutting edge of gambas where any problems you find get fixed quicklyPoly wrote: ↑Tue Mar 25, 2025 11:21 am Have a look here, it has already been fixed.
https://lists.gambas-basic.org/archive/ ... 00064.html
That was quick. I am impressed.![]()
Thank you for your kind words.BruceSteers wrote: ↑Tue Mar 25, 2025 12:04 pm
Thanks to Benoit for fixing and thanks to you for reporting, Gambas is now a little bit better
![]()
I installed the development and can verify that it works properly with sqlite database
There is no need to wait for gb.db2 Subst to be in a new release.
Public Function RemoveBasedOnDate(hConn As Connection, sTableName As String, iDaysBack As Integer, bUseDateTime As Boolean) As Boolean
Dim rResult As Result
Dim sQuery As String
Dim sDateBackShort, sDateBackLong As String
sDateBackShort = Format(Date(Now - iDaysBack), "yyyy-mm-dd")
sDateBackLong = Subst("&1 00:00:00", sDateBackShort)
If bUseDateTime Then
sQuery = Subst("DELETE FROM `&1` WHERE Date < '&2'", sTableName, sDateBackLong)
Else
sQuery = Subst("DELETE FROM `&1` WHERE Date < '&2'", sTableName, sDateBackShort)
Endif
Debug sQuery
'--make it a transaction that can be rolled back--
hConn.Begin
rResult = hConn.Exec(sQuery)
hConn.Commit
Return True
Catch
Debug Subst("&1 (&2): &3", Error.Where, Error.Code, Error.Text)
hConn.Rollback
Error.Clear
Return False
End
Debug sQuery
so you can see the actual query that will be executed.If RemoveBasedOnDate(MyConn, "LogTable", 2, True) Then
Message.Info(" Removed records older than 2 days from LogTable")
Else
Message.Error("Something went wrong!!")
Endif
Many thanks for the tip and your code examples.gbWilly wrote: ↑Thu Mar 27, 2025 12:28 am
There is no need to wait for gb.db2 Subst to be in a new release.
You can use gb Subst as well. I been working like that for over 10 years and it never failed me.
I have a lot of fun with gambas. I just need more time.
Many moons ago I wrote a small thing aimed at people completely new to Gambas3 and programming in general. It never really got finished (personal circumstances) but it is still valid and more important usable introduction to GUI programming in Gambas3 and best of all downloadable as a pdf. Mail address in there is no longer valid and maybe some here on the forum contributed to grammar corrections and more. Check it out and discover...
I learned a lot a long time ago on a Gambas forum before this one (White Islands software) and learned just by trying to solve the problems people reported on the forum. Try to replicate them in a vm and see what was causing it. Kind of what I see Bruce doing on this forum, getting smarter by the day, while helping othersPoly wrote: ↑Thu Mar 27, 2025 6:38 pm But I think Gambas is great and I'm happy if I can perhaps help some beginners to try Gambas more by discovering errors or ambiguities and eliminating them.
My first introduction to Gambas was quickly ended by the fact that an array was read only. Because I thought I was too stupid, but that was a bug in the version at the time.
Well, enjoy it some more...
This is from you?gbWilly wrote: ↑Thu Mar 27, 2025 9:27 pm Many moons ago I wrote a small thing aimed at people completely new to Gambas3 and programming in general.