2 package org
.de
.metux
.util
;
4 public class SQL_Encode
6 public static String
Text(String s
)
11 return "'"+escape(s
)+"'";
14 public static String
escape(String s
)
19 char[] chars
= s
.toCharArray();
22 for (int x
=0; x
<chars
.length
; x
++)
26 case '\'': res
+= "\\'"; break;
27 case '"': res
+= "\\\""; break;
28 default: res
+= chars
[x
]; break;
34 public static String
Name(String s
)
38 return "\""+escape(s
)+"\"";
41 public static String
Float(float f
)
46 public static String
Oid(long oid
)
48 return String
.valueOf(oid
);