MySql.Data.MySqlClient.MySqlParameter.GetPSType C# (CSharp) Method

GetPSType() private method

private GetPSType ( ) : int
return int
        internal int GetPSType()
        {
            switch (mySqlDbType)
            {
                case MySqlDbType.Bit:
                    return (int) MySqlDbType.Int64 | UNSIGNED_MASK;
                case MySqlDbType.UByte:
                    return (int) MySqlDbType.Byte | UNSIGNED_MASK;
                case MySqlDbType.UInt64:
                    return (int) MySqlDbType.Int64 | UNSIGNED_MASK;
                case MySqlDbType.UInt32:
                    return (int) MySqlDbType.Int32 | UNSIGNED_MASK;
                case MySqlDbType.UInt24:
                    return (int) MySqlDbType.Int32 | UNSIGNED_MASK;
                case MySqlDbType.UInt16:
                    return (int) MySqlDbType.Int16 | UNSIGNED_MASK;
                default:
                    return (int) mySqlDbType;
            }
        }

Usage Example

        public virtual void Prepare()
        {
            // strip out names from parameter markers
            string        text;
            List <string> parameter_names = PrepareCommandText(out text);

            // ask our connection to send the prepare command
            MySqlField[] paramList = null;
            statementId = Driver.PrepareStatement(text, ref paramList);

            // now we need to assign our field names since we stripped them out
            // for the prepare
            for (int i = 0; i < parameter_names.Count; i++)
            {
                //paramList[i].ColumnName = (string) parameter_names[i];
                string         parameterName = (string)parameter_names[i];
                MySqlParameter p             = Parameters.GetParameterFlexible(parameterName, false);
                if (p == null)
                {
                    throw new InvalidOperationException(
                              String.Format(Resources.ParameterNotFoundDuringPrepare, parameterName));
                }
                p.Encoding = paramList[i].Encoding;
                parametersToSend.Add(p);
            }

            // now prepare our null map
            int numNullBytes = 0;

            if (paramList != null && paramList.Length > 0)
            {
#if RT || NETSTANDARD1_5
                nullMap = new RtBitArray(paramList.Length);
#else
                nullMap = new BitArray(paramList.Length);
#endif
                numNullBytes = (nullMap.Count + 7) / 8;
            }

            packet = new MySqlPacket(Driver.Encoding);

            // write out some values that do not change run to run
            packet.WriteByte(0);
            packet.WriteInteger(statementId, 4);
            packet.WriteByte((byte)0);       // flags; always 0 for 4.1
            packet.WriteInteger(1, 4);       // interation count; 1 for 4.1
            nullMapPosition  = packet.Position;
            packet.Position += numNullBytes; // leave room for our null map
            packet.WriteByte(1);             // rebound flag
            // write out the parameter types
            foreach (MySqlParameter p in parametersToSend)
            {
                packet.WriteInteger(p.GetPSType(), 2);
            }
            dataPosition = packet.Position;
        }
All Usage Examples Of MySql.Data.MySqlClient.MySqlParameter::GetPSType