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

SQL Syntax Checker / Validator


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.


Follow-Ups:
Re: SQL Syntax Checker / ValidatorGianluigi <gradobag@xxxxxxxxxxx>