{ ************************************************************************* }
{                                                                           }
{  Licensed Materials - Property of IBM and/or HCL                                     }
{                                                                           }
{  IBM Informix Dynamic Server                                              }
{  (c) Copyright IBM Corporation 1996, 2004 All rights reserved.            }
{  (c) Copyright HCL Technologies Ltd. 2017.  All Rights Reserved.             }
{                                                                           }
{ ************************************************************************* }
{                                                                           }
{   Title:      boot901.sql                                                 }
{                                                                           }
{   Description:                                                            }
{       sql script for migrating from 9.00 database to a 9.00D1 database.   }
{       construction.                                                       }
{                                                                           }
{ ************************************************************************* }
{                                                                           }
{  ** IMPORTANT - PLEASE READ                                               } 
{                                                                           }
{     All types and routines referenced in this file must be prefixed       }
{     with the user name "informix". E.g., use "informix.boolean"           }
{     and not "boolean"                                                     }
{									    }
{     Also, please follow the formatting conventions!!!                     }
{                                                                           }
{ ************************************************************************* }

-- Add all the language builtin functions for serial datatypes.

 create function informix.equal(serial, serial) returns informix.boolean
 	specific ifx_serial_equal
 	with (commutator = equal, negator = notequal, class = 'CPU',
               not variant)
 	external name '9' language builtin;
 
 create function informix.equal(serial8, serial8) returns informix.boolean
 	specific ifx_serial8_equal
 	with (commutator = equal, negator = notequal, class = 'CPU',
               not variant)
 	external name '9' language builtin;
 

 create function informix.notequal(serial, serial) returns informix.boolean
 	specific ifx_serial_not_equal
 	with (commutator = notequal, negator = equal, class = 'CPU',
               not variant)
 	external name '26' language builtin;
 
 create function informix.notequal(serial8, serial8) returns informix.boolean
 	specific ifx_serial8_not_equal
 	with (commutator = notequal, negator = equal, class = 'CPU',
               not variant)
 	external name '26' language builtin;
 

 create function informix.greaterthan(serial, serial) returns informix.boolean
 	specific ifx_serial_greater_than
 	with (negator = lessthanorequal, class = 'CPU', not variant)
 	external name '13' language builtin;
 
 create function informix.greaterthan(serial8, serial8) returns informix.boolean
 	specific ifx_serial8_greater_than
 	with (negator = lessthanorequal, class = 'CPU', not variant)
 	external name '13' language builtin;
 

 create function informix.lessthan(serial, serial) returns informix.boolean
 	specific ifx_serial_less_than
 	with (negator = greaterthanorequal, class = 'CPU', not variant)
 	external name '18' language builtin;
 
 create function informix.lessthan(serial8, serial8) returns informix.boolean
 	specific ifx_serial8_less_than
 	with (negator = greaterthanorequal, class = 'CPU', not variant)
 	external name '18' language builtin;
 

 create function informix.greaterthanorequal(serial, serial) returns informix.boolean
 	specific ifx_serial_greater_than_or_equal
 	with (negator = lessthan, class = 'CPU', not variant)
 	external name '12' language builtin;
 
 create function informix.greaterthanorequal(serial8, serial8) 
 	returns informix.boolean
 	specific ifx_serial8_greater_than_or_equal
 	with (negator = lessthan, class = 'CPU', not variant)
 	external name '12' language builtin;
 

 create function informix.lessthanorequal(serial, serial) returns informix.boolean
 	specific ifx_serial_less_than_or_equal
 	with (negator = greaterthan, class = 'CPU', not variant)
 	external name '15' language builtin;
 
 create function informix.lessthanorequal(serial8, serial8) returns informix.boolean
 	specific ifx_serial8_less_than_or_equal
 	with (negator = greaterthan, class = 'CPU', not variant)
 	external name '15' language builtin;
 

 create function informix.negate(serial) returns serial
 	specific ifx_serial_negate
 	with (class = 'CPU', not variant)
 	external name '23' language builtin;
 
 create function informix.negate(serial8) returns serial8
 	specific ifx_serial8_negate
 	with (class = 'CPU', not variant)
 	external name '23' language builtin;
 

 create function informix.minus(serial, serial) returns decimal
 	specific ifx_serial_minus
 	with (class = 'CPU', not variant)
 	external name '23' language builtin;
 
 create function informix.minus(serial8, serial8) returns decimal
 	specific ifx_serial8_minus
 	with (class = 'CPU', not variant)
 	external name '23' language builtin;
 

 create function informix.positive(serial) returns serial
 	specific ifx_serial_positive
 	with (class = 'CPU', not variant)
 	external name '35' language builtin;
 
 create function informix.positive(serial8) returns serial8
 	specific ifx_serial8_positive
 	with (class = 'CPU', not variant)
 	external name '35' language builtin;
 

 create function informix.plus(serial, serial) returns decimal
 	specific ifx_serial_plus
 	with (class = 'CPU', commutator = plus, not variant)
 	external name '35' language builtin;
 
 create function informix.plus(serial8, serial8) returns decimal
 	specific ifx_serial8_plus
 	with (class = 'CPU', commutator = plus, not variant)
 	external name '35' language builtin;
 

 create function informix.times(serial, serial) returns decimal
 	specific ifx_serial_times
 	with (class = 'CPU', commutator = times, not variant)
 	external name '25' language builtin;
 
 create function informix.times(serial8, serial8) returns decimal
 	specific ifx_serial8_times
 	with (class = 'CPU', commutator = times, not variant)
 	external name '25' language builtin;
 

 create function informix.divide(serial, serial) returns decimal
 	specific ifx_serial_divide
 	with (class = 'CPU',  not variant)
 	external name '8' language builtin;
 
 create function informix.divide(serial8, serial8) returns decimal
 	specific ifx_serial8_divide
 	with (class = 'CPU',  not variant)
 	external name '8' language builtin;
 

 create function informix.abs(serial)
         returns serial
 	specific ifx_serial_abs
 	with (class = 'CPU', not variant)
 	external name '100' language builtin;
 
 create function informix.abs(serial8)
         returns serial8
 	specific ifx_serial8_abs
 	with (class = 'CPU', not variant)
 	external name '100' language builtin;
 

 create function informix.exp(serial)
         returns float
 	specific ifx_serial_exp
 	with (class = 'CPU', not variant)
 	external name '103' language builtin;
 
 create function informix.exp(serial8)
         returns float
 	specific ifx_serial8_exp
 	with (class = 'CPU', not variant)
 	external name '103' language builtin;
 
 

 create function informix.hex(serial)
         returns char(20)
 	specific ifx_serial_hex
 	with (class = 'CPU', not variant)
 	external name '92' language builtin;
 
 create function informix.hex(serial8)
         returns char(20)
 	specific ifx_serial8_hex
 	with (class = 'CPU', not variant)
 	external name '92' language builtin;
 

 create function informix.log10(serial)
         returns float
 	specific ifx_serial_log10
 	with (class = 'CPU', not variant)
 	external name '102' language builtin;
 
 create function informix.log10(serial8)
         returns float
 	specific ifx_serial8_log10
 	with (class = 'CPU', not variant)
 	external name '102' language builtin;
 

 create function informix.logn(serial)
         returns float
 	specific ifx_serial_logn
 	with (class = 'CPU', not variant)
 	external name '101' language builtin;
 
 create function informix.logn(serial8)
         returns float
 	specific ifx_serial8_logn
 	with (class = 'CPU', not variant)
 	external name '101' language builtin;
 

 create function informix.mod(serial, integer)
         returns int
 	specific ifx_serial_mod
 	with (class = 'CPU', not variant)
 	external name '104' language builtin;
 
 create function informix.mod(serial8, integer)
         returns int8
 	specific ifx_serial8_mod
 	with (class = 'CPU', not variant)
 	external name '104' language builtin;
 

 create function informix.pow(serial, float)
         returns float
 	specific ifx_serial_pow
 	with (class = 'CPU', not variant)
 	external name '105' language builtin;
 
 create function informix.pow(serial8, float)
         returns float
 	specific ifx_serial8_pow
 	with (class = 'CPU', not variant)
 	external name '105' language builtin;
 

 create function informix.root(serial, float default 2.0)
 	returns float
 	specific ifx_serial_root
 	with (class = 'CPU', not variant)
 	external name '106' language builtin;
 
 create function informix.root(serial8, float default 2.0)
 	returns float
 	specific ifx_serial8_root
 	with (class = 'CPU', not variant)
 	external name '106' language builtin;
 

 create function informix.round(serial, integer default 0)
 	returns decimal
 	specific ifx_serial_round
 	with (class = 'CPU', not variant)
 	external name '90' language builtin;
 
 create function informix.round(serial8, integer default 0)
 	returns decimal
 	specific ifx_serial8_round
 	with (class = 'CPU', not variant)
 	external name '90' language builtin;
 

 create function informix.sqrt(serial)
         returns float
 	specific ifx_serial_sqrt
 	with (class = 'CPU', not variant)
 	external name '107' language builtin;
 
 create function informix.sqrt(serial8)
         returns float
 	specific ifx_serial8_sqrt
 	with (class = 'CPU', not variant)
 	external name '107' language builtin;
 

 create function informix.trunc(serial, integer default 0)
 	returns decimal
 	specific ifx_serial_trunc
 	with (class = 'CPU', not variant)
 	external name '91' language builtin;
 
 create function informix.trunc(serial8, integer default 0)
 	returns decimal
 	specific ifx_serial8_trunc
 	with (class = 'CPU', not variant)
 	external name '91' language builtin;
 

 create function informix.cos(serial)
         returns float
 	specific ifx_serial_cos
 	with (class = 'CPU', not variant)
 	external name '97' language builtin;
 
 create function informix.cos(serial8)
         returns float
 	specific ifx_serial8_cos
 	with (class = 'CPU', not variant)
 	external name '97' language builtin;
 

 create function informix.sin(serial)
         returns float
 	specific ifx_serial_sin
 	with (class = 'CPU', not variant)
 	external name '96' language builtin;
 
 create function informix.sin(serial8)
         returns float
 	specific ifx_serial8_sin
 	with (class = 'CPU', not variant)
 	external name '96' language builtin;
 

 create function informix.tan(serial)
         returns float
 	specific ifx_serial_tan
 	with (class = 'CPU', not variant)
 	external name '93' language builtin;
 
 create function informix.tan(serial8)
         returns float
 	specific ifx_serial8_tan
 	with (class = 'CPU', not variant)
 	external name '93' language builtin;
 

 create function informix.acos(serial)
         returns float
 	specific ifx_serial_acos
 	with (class = 'CPU', not variant)
 	external name '99' language builtin;
 
 create function informix.acos(serial8)
         returns float
 	specific ifx_serial8_acos
 	with (class = 'CPU', not variant)
 	external name '99' language builtin;
 

 create function informix.asin(serial)
         returns float
 	specific ifx_serial_asin
 	with (class = 'CPU', not variant)
 	external name '98' language builtin;
 
 create function informix.asin(serial8)
         returns float
 	specific ifx_serial8_asin
 	with (class = 'CPU', not variant)
 	external name '98' language builtin;
 

 create function informix.atan(serial)
         returns float
 	specific ifx_serial_atan
 	with (class = 'CPU', not variant)
 	external name '94' language builtin;
 
 create function informix.atan(serial8)
         returns float
 	specific ifx_serial8_atan
 	with (class = 'CPU', not variant)
 	external name '94' language builtin;
 
 
 create function informix.atan2(serial, float)
         returns float
 	specific ifx_serial_atan2
 	with (class = 'CPU', not variant)
 	external name '95' language builtin;
 
 create function informix.atan2(serial8, float)
         returns float
 	specific ifx_serial8_atan2
 	with (class = 'CPU', not variant)
 	external name '95' language builtin;


create function informix.ifx_lo_release(informix.blob)
	returns integer
	external name '(sq_lo_release)'
	language c; {this is variant}

create function informix.like(lvarchar, lvarchar) returns informix.boolean
        specific ifx_lvarchar_like_with_no_escape
        with (class = 'CPU', not variant)
        external name '17' language builtin;

create function informix.like(lvarchar, lvarchar, lvarchar)
        returns informix.boolean
        specific ifx_lvarchar_like_with_escape
        with (class = 'CPU', not variant)
        external name '17' language builtin;

create function informix.matches(lvarchar, lvarchar)
        returns informix.boolean
        specific ifx_lvarchar_matches_binary
        with (class = 'CPU', not variant)
        external name '19' language builtin;

create function informix.matches(lvarchar, lvarchar, lvarchar)
        returns informix.boolean
        specific ifx_lvarchar_matches_trinary
        with (class = 'CPU', not variant)
        external name '19' language builtin;

create function informix.concat(informix.lvarchar, informix.lvarchar) 
	returns informix.lvarchar
	with (class = 'CPU', not variant)
	external name '(lvarchar_concat)' language C;

create function informix.length(lvarchar)
        returns int
	specific ifx_lvarchar_length
	with (class = 'CPU', not variant)
	external name '16' language builtin;

create function informix.octet_length(lvarchar)
        returns int
	specific ifx_lvarchar_octet_length
	with (class = 'CPU', not variant)
	external name '74' language builtin;

create function informix.char_length(lvarchar)
        returns int
	specific ifx_lvarchar_char_length
	with (class = 'CPU', not variant)
	external name '75' language builtin;
