コード例 #1
0
ファイル: ingresdate.cs プロジェクト: GunterMueller/Ingres
 set(IngresDate data)
 {
     if (data == null || data.isNull())
     {
         setNull();
     }
     else
     {
         setNotNull();
         value    = data.value;
         interval = data.interval;
     }
     return;
 }         // set
コード例 #2
0
ファイル: msgin.cs プロジェクト: JordanChin/Ingres
 /*
 ** Name: readSqlData
 **
 ** Description:
 **	Reads an IngresDate data value from the current input message.
 **
 **	An IngresDate data value is composed of a data indicator byte
 **	which, if not NULL, may be followed by a string which is
 **	composed of a two byte integer indicating the byte length
 **	of the string followed by a character byte array of the
 **	indicated length.
 **
 ** Input:
 **	None.
 **
 ** Output:
 **	value	SQL data value.
 **
 ** Returns:
 **	void.
 **
 ** History:
 **	22-Sep-03 (gordy)
 **	    Created.
 */
 public void readSqlData( IngresDate value, bool isBlankDateNull )
 {
     if ( readSqlDataIndicator() )	// Read data indicator byte.
     {
         value.set( readString() );	// Read data value.
         if (isBlankDateNull  &&  value.getTruncSize() == 0)
             value.setNull();  // blank date is null
     }
     else
         value.setNull();		// NULL data value.
     return;
 }
コード例 #3
0
ファイル: rsltftch.cs プロジェクト: JordanChin/Ingres
        /*
        ** Name: allocateRowBuffer
        **
        ** Description:
        **	Allocate the column data array for a row and populate
        **	the array with a SqlData object for each column based
        **	on the column data type.
        **
        ** Input:
        **	rsmd		Row-set Meta-data.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	SqlData[]	Column data array.
        **
        ** History:
        **	14-May-99 (gordy)
        **	    Created.
        **	10-May-01 (gordy)
        **	    The character datatypes (CHAR, VARCHAR, LONGVARCHAR) may now
        **	    be sent as UCS2 character arrays in addition to the existing
        **	    Ingres Character Set strings.  The DBMS datatype is used to
        **	    distinguish the transport format.
        **	31-Oct-02 (gordy)
        **	    Adapted for generic GCF driver.
        **	 4-Aug-03 (gordy)
        **	    Extracted from readData() to separate row and column processing.
        **	22-Sep-03 (gordy)
        **	    Changed to use SQL Data objects to hold column values.
        **	 6-Jan-04 (thoda04)
        **	    Added BigInt support.
        **	16-Jun-06 (gordy)
        **	    ANSI Date/Time data type support.
        **	 7-Dec-09 (gordy, ported by thoda04)
        **	    Support BOOLEAN columns.
        */
        private SqlData[] allocateRowBuffer( AdvanRSMD rsmd )
        {
            SqlData[] row = new SqlData[ rsmd.count ];

            for( int col = 0; col < rsmd.count; col++ )
            {
                switch( rsmd.desc[ col ].sql_type )
                {
                    case ProviderType.DBNull :	row[ col ] = new SqlNull();	break;
                    case ProviderType.TinyInt :	row[ col ] = new SqlTinyInt();	break;
                    case ProviderType.SmallInt:	row[ col ] = new SqlSmallInt();	break;
                    case ProviderType.Integer :	row[ col ] = new SqlInt();	break;
                    case ProviderType.BigInt:  	row[ col ] = new SqlBigInt();	break;
                    case ProviderType.Single :	row[ col ] = new SqlReal();	break;
                    case ProviderType.Double :	row[ col ] = new SqlDouble();	break;
                    case ProviderType.Numeric:
                    case ProviderType.Decimal :	row[ col ] = new SqlDecimal();	break;
                    case ProviderType.Boolean :	row[ col ] = new SqlBool();   	break;

                    case ProviderType.Date :	row[col] = new SqlDate(); break;

                    case ProviderType.Time:
                        row[col] = new SqlTime(rsmd.desc[col].dbms_type);
                        break;

                    case ProviderType.Interval:
                    case ProviderType.IntervalDayToSecond:
                    case ProviderType.IntervalYearToMonth:
                        row[col] = new SqlInterval(rsmd.desc[col].dbms_type);
                        break;

                    case ProviderType.DateTime:
                        switch (rsmd.desc[col].dbms_type)
                        {
                            case DBMS_TYPE_IDATE:
                                row[col] = new IngresDate(conn.osql_dates,
                                                 conn.timeValuesInGMT());
                                break;

                            default:
                                row[col] = new SqlTimestamp(rsmd.desc[col].dbms_type);
                                break;
                        }
                        break;

                    case ProviderType.Binary :
                        row[ col ] = new SqlByte( rsmd.desc[ col ].length );
                        break;

                    case ProviderType.VarBinary :
                        row[ col ] = new SqlVarByte( rsmd.desc[ col ].length );
                        break;

                    case ProviderType.Char :
                        if ( rsmd.desc[ col ].dbms_type != DBMS_TYPE_NCHAR )
                            row[ col ] = new SqlChar( msg.getCharSet(),
                                rsmd.desc[ col ].length );
                        else
                            row[ col ] = new SqlNChar(rsmd.desc[col].length / 2 );
                        break;

                    case ProviderType.VarChar :
                        if ( rsmd.desc[ col ].dbms_type != DBMS_TYPE_NVARCHAR )
                            row[col] = new SqlVarChar(msg.getCharSet(),
                                rsmd.desc[col].length );
                        else
                            row[col] = new SqlNVarChar( rsmd.desc[col].length / 2 );
                        break;

                    case ProviderType.LongVarBinary :
                        row[ col ] = new SqlLongByte( (SqlStream.IStreamListener)this );
                        break;

                    case ProviderType.LongVarChar :
                        if ( rsmd.desc[ col ].dbms_type != DBMS_TYPE_LONG_NCHAR )
                            row[ col ] = new SqlLongChar( msg.getCharSet(),
                                (SqlStream.IStreamListener)this );
                        else
                            row[ col ] = new SqlLongNChar(
                                (SqlStream.IStreamListener)this );
                        break;

                    default :
                        if ( trace.enabled( 1 ) )
                            trace.write( tr_id + ": unexpected SQL type " +
                                rsmd.desc[ col ].sql_type );
                        throw SqlEx.get( ERR_GC4002_PROTOCOL_ERR );
                }
            }

            return( row );
        }
コード例 #4
0
ファイル: msgout.cs プロジェクト: JordanChin/Ingres
 /*
 ** Name: write
 **
 ** Description:
 **	Write a IngresDate data value to the current input message.
 **
 **	A IngresDate data value is composed of a data indicator byte
 **	which, if not NULL, may be followed by a string which is
 **	composed of a two byte integer indicating the byte length
 **	of the string followed by a character byte array of the
 **	indicated length.
 **
 ** Input:
 **	value	SQL data value.
 **
 ** Output:
 **	None.
 **
 ** Returns:
 **	void.
 **
 ** History:
 **	 1-Dec-03 (gordy)
 **	    Created.
 */
 public void write(IngresDate value)
 {
     if (writeSqlDataIndicator(value)) write(value.get());
     return;
 }
コード例 #5
0
ファイル: ingresdate.cs プロジェクト: JordanChin/Ingres
 /*
 ** Name: set
 **
 ** Description:
 **	Assign a new data value as a copy of an existing
 **	SQL data object.  If the input is NULL, a NULL
 **	data value results.
 **
 ** Input:
 **	data	The SQL data to be copied.
 **
 ** Output:
 **	None.
 **
 ** Returns:
 **	void.
 **
 ** History:
 **	 1-Dec-03 (gordy)
 **	    Created.
 */
 public void set(IngresDate data)
 {
     if (data == null || data.isNull())
         setNull();
     else
     {
         setNotNull();
         value = data.value;
         interval = data.interval;
     }
     return;
 }