Package org.owasp.esapi.codecs
Class MySQLCodec
- java.lang.Object
-
- org.owasp.esapi.codecs.Codec
-
- org.owasp.esapi.codecs.MySQLCodec
-
public class MySQLCodec extends Codec
Implementation of the Codec interface for MySQL strings. See http://mirror.yandex.ru/mirrors/ftp.mysql.com/doc/refman/5.0/en/string-syntax.html for more information.- Since:
- June 1, 2007
- Author:
- Jeff Williams (jeff.williams .at. aspectsecurity.com) Aspect Security
- See Also:
Encoder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MySQLCodec.Mode
Specifies the SQL Mode the target MySQL Server is running with.
-
Field Summary
Fields Modifier and Type Field Description static int
ANSI_MODE
Target MySQL Server is running in {@link "http://dev.mysql.com/doc/refman/5.0/en/ansi-mode.html"} ANSI Modestatic int
MYSQL_MODE
Target MySQL Server is running in Standard MySQL (Default) mode.
-
Constructor Summary
Constructors Constructor Description MySQLCodec(int mode)
Deprecated.MySQLCodec(MySQLCodec.Mode mode)
Instantiate the MySQL Codec with the given SQLMySQLCodec.Mode
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Character
decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackString.java.lang.String
encodeCharacter(char[] immune, java.lang.Character c)
Default implementation that should be overridden in specific codecs.-
Methods inherited from class org.owasp.esapi.codecs.Codec
containsCharacter, decode, encode, getHexForNonAlphanumeric, toHex, toOctal
-
-
-
-
Field Detail
-
MYSQL_MODE
public static final int MYSQL_MODE
Target MySQL Server is running in Standard MySQL (Default) mode.- See Also:
- Constant Field Values
-
ANSI_MODE
public static final int ANSI_MODE
Target MySQL Server is running in {@link "http://dev.mysql.com/doc/refman/5.0/en/ansi-mode.html"} ANSI Mode- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MySQLCodec
public MySQLCodec(int mode)
Deprecated.Instantiate the MySQL codec- Parameters:
mode
- Mode has to be one of {MYSQL_MODE|ANSI_MODE} to allow correct encoding- See Also:
MySQLCodec(org.owasp.esapi.codecs.MySQLCodec.Mode)
-
MySQLCodec
public MySQLCodec(MySQLCodec.Mode mode)
Instantiate the MySQL Codec with the given SQLMySQLCodec.Mode
.- Parameters:
mode
- The mode the target server is running in
-
-
Method Detail
-
encodeCharacter
public java.lang.String encodeCharacter(char[] immune, java.lang.Character c)
Default implementation that should be overridden in specific codecs. Returns quote-encoded character- Overrides:
encodeCharacter
in classCodec
- Parameters:
immune
-c
- the Character to encode- Returns:
- the encoded Character
-
decodeCharacter
public java.lang.Character decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackString. If the current character is not encoded, this method MUST reset the PushbackString. Returns the decoded version of the character starting at index, or null if no decoding is possible. Formats all are legal (case sensitive) In ANSI_MODE '' decodes to ' In MYSQL_MODE \x decodes to x (or a small list of specials)- Overrides:
decodeCharacter
in classCodec
- Parameters:
input
- the Character to decode- Returns:
- the decoded Character
-
-