Ejemplo n.º 1
0
		public static void Main()
		{
			SQLRConnection con = new SQLRConnection("sqlrserver", 9000, "/tmp/example.socket", "user", "password", 0, 1);
			SQLRCursor cur = new SQLRCursor(con);

			cur.prepareQuery("begin  select image into :image from images;  select description into :desc from images;  end;");
        		cur.defineOutputBindBlob("image");
        		cur.defineOutputBindClob("desc");
        		cur.executeQuery();

        		String image = cur.getOutputBindBlob("image");
        		UInt32 imagelength = cur.getOutputBindLength("image");

        		String desc = cur.getOutputBindClob("desc");
        		UInt32 desclength = cur.getOutputBindLength("desc");

        		con.endSession();
Ejemplo n.º 2
0
        private void copyOutBindValues()
        {
            for (Int32 i = 0; i < Parameters.Count; i++)
            {
                SQLRelayParameter param = (SQLRelayParameter)Parameters[i];

                if (param.Direction == ParameterDirection.Output)
                {
                    param.Size = _sqlrcur.getOutputBindLength(param.ParameterName);

                    switch (param.SQLRelayType)
                    {
                    case SQLRelayType.Clob:
                        param.Value = _sqlrcur.getOutputBindClob(param.ParameterName);
                        continue;

                    case SQLRelayType.Blob:
                        param.Value = _sqlrcur.getOutputBindBlob(param.ParameterName);
                        continue;

                    case SQLRelayType.Cursor:
                        SQLRCursor cursor = _sqlrcur.getOutputBindCursor(param.ParameterName);
                        if (cursor.fetchFromBindCursor())
                        {
                            param.Value = new SQLRelayDataReader(_sqlrelaycon, cursor, false);
                        }
                        continue;
                    }

                    switch (param.DbType)
                    {
                    case DbType.AnsiString:
                    case DbType.AnsiStringFixedLength:
                    case DbType.String:
                    case DbType.StringFixedLength:
                    case DbType.Time:
                    case DbType.Guid:
                        param.Value = _sqlrcur.getOutputBindString(param.ParameterName);
                        break;

                    case DbType.Date:
                    case DbType.DateTime:
                    case DbType.DateTime2:
                    case DbType.DateTimeOffset:
                        Int16   year        = 0;
                        Int16   month       = 0;
                        Int16   day         = 0;
                        Int16   hour        = 0;
                        Int16   minute      = 0;
                        Int16   second      = 0;
                        Int32   microsecond = 0;
                        String  tz          = null;
                        Boolean isnegative  = false;
                        _sqlrcur.getOutputBindDate(param.ParameterName, out year, out month, out day, out hour, out minute, out second, out microsecond, out tz, out isnegative);
                        param.Value = new DateTime(year, month, day, hour, minute, second, microsecond / 1000);
                        break;

                    case DbType.Binary:
                        param.Value = _sqlrcur.getOutputBindBlob(param.ParameterName);
                        break;

                    case DbType.Boolean:
                        param.Value = _sqlrcur.getOutputBindInteger(param.ParameterName);
                        break;

                    case DbType.Currency:
                    case DbType.Decimal:
                    case DbType.Single:
                    case DbType.Double:
                    case DbType.VarNumeric:
                        param.Value = _sqlrcur.getOutputBindDouble(param.ParameterName);
                        break;

                    case DbType.Byte:
                    case DbType.Int16:
                    case DbType.Int32:
                    case DbType.Int64:
                    case DbType.SByte:
                    case DbType.UInt16:
                    case DbType.UInt32:
                    case DbType.UInt64:
                        param.Value = _sqlrcur.getOutputBindInteger(param.ParameterName);
                        break;

                    case DbType.Object:
                    case DbType.Xml:
                        param.Value = _sqlrcur.getOutputBindString(param.ParameterName);
                        break;
                    }
                }
            }
        }