[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SQL Syntax Checker / Validator


Il 05/11/24 00:17, System64 Development ha scritto:
Hi,
I am having some issues with text going into text fields in a SQLITE table.
I'm using a very rudimentary code that I'm tweaking as I hit a wall [1]
hehe.

There is not a procedure in gambas that I can pass the text and it
corrects it or warns me that there is a “bug”.

[1]

'' Returns a text suitable for SQL queries, removes line breaks and
characters not compatible with SQL statements.

Public Function Chek4SQL(strInput As String) As String

   Dim strOutput As String
   strOutput = Replace(strInput, Chr(92) & Chr(110), ":")
   strOutput = Replace(strOutput, Chr(34), "")
   strOutput = Replace(strOutput, "\n", " ")
   strOutput = Replace(strOutput, "\r", "")
   strOutput = Replace(strOutput, "\x00", "")
   strOutput = Replace(strOutput, Chr(39), Chr(46)) ' ' > .
   strOutput = Replace(strOutput, Chr(44), Chr(46)) ' , > .
   Return strOutput
End

Thaks

Martín.



Hi Martin,

maybe this can be helpful?
https://gambaswiki.org/wiki/comp/gb.db/db/subst

Regards
Gianluigi


References:
SQL Syntax Checker / ValidatorSystem64 Development <64xcode@xxxxxxxxx>