/* ** Name: SqlChar ** ** Description: ** Class constructor for variable length byte strings. ** Data value is initially NULL. ** ** Input: ** charSet Character-set of byte strings. ** ** Output: ** None. ** ** Returns: ** None. ** ** History: ** 5-Sep-03 (gordy) ** Created. ** 1-Dec-03 (gordy) ** Adapted to new super class. */ public SqlChar(CharSet charSet) : base(charSet) { }
/* ** Name: SqlChar ** ** Description: ** Class constructor for fixed length byte strings. ** Size limit determines capacity and length. Data ** value is initially NULL. ** ** Input: ** charSet Character-set of byte strings ** size The fixed string length. ** ** Output: ** None. ** ** Returns: ** None. ** ** History: ** 5-Sep-03 (gordy) ** Created. ** 1-Dec-03 (gordy) ** Adapted to new super class. */ public SqlChar(CharSet charSet, int size) : base(charSet, size) { ensure(size); }
/* ** Name: SqlLongChar ** ** Description: ** Class constructor. Data value is initially NULL. ** Defines a SqlStream event listener for stream ** closure event notification. ** ** Input: ** charSet Character-set of byte stream. ** listener Stream listener. ** ** Output: ** None. ** ** Returns: ** None. ** ** History: ** 12-Sep-03 (gordy) ** Created. */ internal SqlLongChar( CharSet charSet, IStreamListener listener ) : base(listener) { this.charSet = charSet; }
/* ** Name: readString ** ** Description: ** Read a string from the input stream. The string is treated ** as an atomic value and the entire requested length must be ** available. The input bytes are converted to Unicode using ** the character encoding provided. Strings which are split ** must be read as byte arrays. ** ** Input: ** length Number of bytes in input string. ** char_set Character encoding for conversion. ** ** Output: ** None. ** ** Returns: ** String String value from input stream. ** ** History: ** 16-Jun-99 (gordy) ** Created. ** 22-Sep-99 (gordy) ** Added character set/encoding.*/ /// <summary> /// Read a string from the input stream. The string is treated /// as an atomic value and the entire requested length must be /// available. The input bytes are converted to Unicode using /// the character encoding provided. Strings which are split /// must be read as byte arrays. /// </summary> /// <param name="length">Number of bytes in input string.</param> /// <param name="char_set">Character encoding for conversion.</param> /// <returns>String value from input stream.</returns> public virtual String readString(int length, CharSet char_set) { String str; need(length, true); try { str = char_set.getString( buffer, data_ptr, length ); } catch( Exception ex ) { throw SqlEx.get( ERR_GC401E_CHAR_ENCODE, ex ); // Should not happen! } data_ptr += length; return (str); }
/* ** Name: SqlVarChar ** ** Description: ** Class constructor for limited length byte strings. ** Data value is initially NULL. ** ** Input: ** charSet Character-set of byte strings ** size The maximum string length. ** ** Output: ** None. ** ** Returns: ** None. ** ** History: ** 5-Sep-03 (gordy) ** Created. ** 1-Dec-03 (gordy) ** Adapted to new super class. */ public SqlVarChar( CharSet charSet, int size ) : this(charSet) { limit = size; }
/* ** Name: SqlLongChar ** ** Description: ** Class constructor. Data value is initially NULL. ** ** Input: ** charSet Character-set of byte stream. ** ** Output: ** None. ** ** Returns: ** None. ** ** History: ** 12-Sep-03 (gordy) ** Created. */ public SqlLongChar( CharSet charSet ) : base() { this.charSet = charSet; }
/* ** Name: SqlVarChar ** ** Description: ** Class constructor for variable length byte strings. ** Data value is initially NULL. ** ** Input: ** charSet Character-set of byte strings ** ** Output: ** None. ** ** Returns: ** None. ** ** History: ** 1-Dec-03 (gordy) ** Created. */ public SqlVarChar( CharSet charSet ) : base(true) { this.charSet = charSet; }
/* ** Name: setCharSet ** ** Description: ** Set the CharSet used to encode strings for the connection. ** ** Input: ** char_set CharSet to be used. ** ** Output: ** None. ** ** Returns: ** void ** ** History: ** 3-Jul-06 (gordy) ** Created. */ public void setCharSet(CharSet char_set) { this.char_set = char_set; return; }
/* ** Name: addCharSet ** ** Description: ** Maintains character sets in the csInfo array. ** ** Input; ** cs Index of character set in csInfo array. ** ** Output: ** None. ** ** Returns: ** CharSet Character set associated with csInfo entry. ** ** History: ** 26-Dec-02 (gordy) ** Extracted from getCharSet() for common functionality. */ private static CharSet addCharSet( int cs ) { /* ** Only one CharSet created for each character set. */ if (csInfo[cs][3] == null) // if CharSet not built yet { System.Text.Encoding encoding; /* ** Is the encoding supported. */ if ((encoding = getEncoding((String) csInfo[cs][1])) == null) throw new System.IO.IOException( "Character set of the database server " + "has no .NET character encoding"); csInfo[cs][3] = new CharSet( encoding, ((bool) csInfo[cs][2]), ((string) csInfo[cs][0]), ((string) csInfo[cs][1])); } return ((CharSet) csInfo[cs][3]); }
SqlChar(CharSet charSet, int size) : base(charSet, size) { ensure(size); } // SqlChar
SqlChar(CharSet charSet) : base(charSet) { } // SqlChar