+ All Categories
Home > Documents > Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W....

Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W....

Date post: 10-Mar-2020
Category:
Upload: others
View: 10 times
Download: 0 times
Share this document with a friend
185
Unify DataServer: Embedding SQL/A Into C (ᝤϡϟി SQL/A ώᡑ) R
Transcript
Page 1: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

Unify DataServer: Embedding SQL/A Into C

(����� SQL/A ���)

Page 2: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

��

� ���� ��� ,A &730A �8:98:+<387� $+-:+6/7<8� �+5308:73+� &$� �55 :312<; :/;/:>/.� !:37</. 37 <2/

&73</. $<+</; 80 �6/:3-+�

%23:. �.3<387�!:/>38=;5A 9=,53;2/. =7./: <2/ <3<5/ ��� ������

���� � ��� ���� ���� ���

������������� ��� ��� ������

��� �����

�8 9+:< 80 <23; .8-=6/7< 6+A ,/ :/9:8.=-/.� <:+7;63<</.� <:+7;-:3,/.� ;<8:/. 37 + :/<:3/>+5 ;A;</6� 8:

<:+7;5+</. 37<8 +7A 5+71=+1/ 8: -869=</: 5+71=+1/� 37 +7A 08:6 8: ,A +7A 6/+7;� /5/-<:873-� 6/-2+73-+5�

6+17/<3-� 89<3-+5� -2/63-+5� 6+7=+5 8: 8<2/:?3;/ ?3<28=< <2/ 9:38: ?:3<</7 -87;/7< 80 &730A �8:98:+<387�

&730A �8:98:+<387 6+4/; 78 :/9:/;/7<+<387; 8: ?+::+7<3/; ?3<2 :/;9/-< <8 <2/ -87</7<; 80 <23; .8-=6/7<

+7. ;9/-303-+55A .3;-5+36; +7A 36953/. ?+::+7<3/; 80 6/:-2+7<+,353<A 8: 03<7/;; 08: +7A 9+:<3-=5+: 9=:98;/��=:<2/:� &730A �8:98:+<387 :/;/:>/; <2/ :312< <8 :/>3;/ <23; .8-=6/7< +7. <8 6+4/ -2+71/; 0:86 <36/ <8

<36/ 37 3<; -87</7< ?3<28=< ,/371 8,531+</. <8 78<30A +7A 9/:;87 80 ;=-2 :/>3;387; 8: -2+71/;�

%2/ $80<?+:/ ./;-:3,/. 37 <23; .8-=6/7< 3; 0=:73;2/. =7./: + $80<?+:/ �3-/7;/ �1://6/7<� %2/ $80<?+:/

6+A ,/ =;/. 8: -893/. 875A 37 +--8:.+7-/ ?3<2 <2/ </:6; 80 <2/ 53-/7;/ +1://6/7<� �< 3; +1+37;< <2/ 5+? <8

-89A <2/ $80<?+:/ 87 <+9/� .3;4� 8: +7A 8<2/: 6/.3=6 08: +7A 9=:98;/ 8<2/: <2+7 <2+< ./;-:3,/. 37 <2/

53-/7;/ +1://6/7<�

%2/ &730A �8:98:+<387 !=,53-+<387; �/9+:<6/7< >+5=/; +7. +99:/-3+</; +7A -866/7<; A8= 6+A 2+>/

-87-/:7371 8=: 9:8.=-<; 8: <23; .8-=6/7<� !5/+;/ +..:/;; -866/7<; <8�

�--/55��+<+$/:>/: !:8.=-< �+7+1/:&730A �8:98:+<387��� �/77+7/ �:3>/$+-:+6/7<8� �� � ���������� ��&���*���� ���������) ���� �������

������� &���*� +7. <2/ &730A �818 +:/ :/13;</:/. <:+./6+:4; 80 &730A �8:98:+<387� &730A�+<+$/:>/:� #!% +7. #��� +:/ <:+./6+:4; 80 &730A �8:98:+<387� &��) +7. !�� � � +:/

:/13;</:/. <:+./6+:4; 80 &��) $A;</6 �+,8:+<8:3/;� �7-� $"� 3; + <:+./6+:4 80 �7</:7+<387+5 �=;37/;;

�+-237/; �8:9� %2/ ) (37.8? $A;</6 3; + 9:8.=-< 80 <2/ �+;;+-2=;/<<; �7;<3<=</ 80 %/-278581A� �8<30�

$�� +7. $���8<30 +:/ <:+./6+:4; 80 9/7 $80<?+:/ �8=7.+<387� �7-� $*��$� 3; + :/13;</:/.

<:+./6+:4� +7. $"� $/:>/:� ��C�3,:+:A� +7. 9/7 $/:>/: +:/ <:+./6+:4; 80 $A,+;/� �7-� ��� #��) 3; +

:/13;</:/. <:+./6+:4 80 �708:63@ $80<?+:/� �7-� ���#�$ 3; + <:+./6+:4 80 �71:/; �8:9� #���� 3; +:/13;</:/. <:+./6+:4 80 :+-5/ �8:98:+<387� $=7 3; + :/13;</:/. <:+./6+:4� +7. $=7'3/?� $=7C�� $=7C��

)��/($� $=7 $� !�C��$� +7. 9/7 (37.8?; +:/ <:+./6+:4; 80 $=7 �3-:8;A;</6;� �55 $!�#�

<:+./6+:4; +:/ <:+./6+:4; 8: :/13;</:/. <:+./6+:4; 80 $!�#� �7</:7+<387+5� �7-� $!�#�;<+<387 3;

53-/7;/. /@-5=;3>/5A <8 $=7 �3-:8;A;</6;� �7-� �8>/55 3; + :/13;</:/. <:+./6+:4 80 �8>/55� �7-� �+-37<8;2 3;

+ <:+./6+:4 80 �+-37<8;2 �+,8:+<8:A� �7-� 53-/7;/. <8 �995/ �869=</:� �7-� �3-:8;80<� �$� +7. �$C� $

+:/ :/13;</:/. <:+./6+:4; +7. (37.8?; 3; + <:+./6+:4 80 �3-:8;80<� �55 8<2/: 9:8.=-<; 8: ;/:>3-/;6/7<387/. 2/:/37 6+A ,/ :/13;</:/. <:+./6+:4;� <:+./6+:4;� 8: ;/:>3-/ 6+:4; 80 <2/3: :/;9/-<3>/

6+7=0+-<=:/:;� -869+73/;� 8: 8:1+73B+<387;�

!+:< �=6,/:� �����

Page 3: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���

��

����������� �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

;V4\ $*� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �a�>]����$) *� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

��� ���� ��� �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

Z�<�6 ������0^ �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

Z�<�6 �����V � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �DUV � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �Z�<�/RV � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

&�!WG �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

���)�0^ � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����)�>]��A � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����)�>]XY � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����)�B` � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �T��#'�����) ��� � � � � � � � � � � � � � � � � � � � � � � � � � � ���#'���I8������) ��� � � � � � � � � � � � � � � � � �1�Q����) ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �,[���) ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �:F/R���) ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

5C?_- ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�������� ������ ��� � � � � � � � � � � � � � � � � � � � � � � �

.SP��"(�+ �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

���� �����*�" �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

&�!WG�>] ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �&�!WG�I8 ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �92H��� ����% ��� � � � � � � � � � � � � � � � � � � � � � � � � �K73G� ����% ��� � � � � � � � � � � � � � � � � � � � � � � � � � � �

&�!WG�=E ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �&�!WG��V@bN ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �&�!WG�������� �� ��� � � � � � � � � � � � � � � � � � � � � � �&�!WG��������N����N ��� � � � � � � � � � � � � � � � � � �

)(*(�)"�� )�$%�)";LM ��� � � � � � � � � � � � � � � � � � � � � � � �;LM^J �(�� ��O ��� � � � � � � � � � � � � � � � � � � � � � � � � ��#! )(*(&('�� )�$%&(';LM �� � � � � � � � � � � � � � � � � � � � �

Page 4: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

iv

.�&_P��)4W �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

$�,4��BAO ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

$�,4��BU[ ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

$�,4���BCM ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

$�,4�����B�TV ��� � � � � � � � � � � � � � � � � � � � � � � � � � � �

$�,4���]PB�TV ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��$#- �����4�S? ��� � � � � � � � � � � � � � � � � � � � � � � � � � � �.�&_P�H���4S? ��� � � � � � � � � � � � � � � � � � � � � �

�$#- �����4���-6 ��� � � � � � � � � � � � � � � � � � � � � � � ��$#- �����4���W+�#" ��� � � � � � � � � � � � � � � � � ��$#- �����4�Eb��$�,4�AO ��� � � � � � � ��$#- �����4��5�� �� � � � � � � � � � � � � � � � � � � � � � � ���e �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�� �������������� ��� � � � � � � � � � � � � � � � � � � � �

!�(/#��-3���16�9c ��� � � � � � � � � � � � � � � � � � � � � �

!�(/#� ���� ^�=I ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � �XRJB^ ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �^�L\�JB �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��$#- ��^�L\ �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��$#- ��L\^�JB �� � � � � � � � � � � � � � � � � � � � � � � � � � � ��$#- ��L\^�Y<�:�Z8M �� � � � � � � � � � � � � �

���4�Eb�� ������^�L\�JB ��� � � � � � � � � � � � ��$#- �����4�S? ��� � � � � � � � � � � � � � � � � � � � � � � � � ��$#- ��^�L\ ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��$#- �����4���-6 ��� � � � � � � � � � � � � � � � � � � � � ��$#- �����4�W�+�#"�CM�AO ��� � � � � ��$#- �����4��5���L\^�:�Z8M ��

!�(/#�*20� ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �!�(/#�*20� �E�a ��� � � � � � � � � � � � � � � � � � � � � � �!�(/#�*20� �%� �- �� � � � � � � � � � � � � � � � �!�(/#�*20� �Q@ �� � � � � � � � � � � � � � � � � � � � � � � � ����4�!�(/#�*20� �� � � � � � � � � � � � � � � � � � � � �

;KFd7 ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �;KFd7+��4' �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �;KFd7�Eb �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �L\ ������^ ��N`>D � � � � � � � � � � � � � � � � �!�(/#�*20� �HL\^�N`�GY �� � � �

Page 5: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

CPKk;*9(7 ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �CPKk;+��7(1�9" ��� � � � � � � � � � � � � � � � � � � � � � � � �

e H�E ����,���'#�)2$�fT �� � � � � � � � �Qab �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �CPKk; ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �?�^���!7 ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�'��(-8���3�X�H� ��� � � � � � � � � � � � � � � � � � � � � �

#�)2$��,���'\g_:�MYNB ��� � � � � � � � � � � �VF��!7 ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �?�^���!7 ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �Qab ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��906$�fT�IS���Qab ��� � � � � � � � � � � � � � � ��35�"bLm��/�'dU�IS���Qab ��QabMYNB ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

CPKk; ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

@W�l ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�������9�9�Qab ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

��� ���� ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

=h �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

������ ����`> �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

'59���49Ai � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �Dg'59���49��(5�9 � � � � � � � � � � � � � � � � � � �&�".����-9 � � � � � � � � � � � � � � � � � � � � � � � � � � � �'59���49<J � � � � � � � � � � � � � � � � � � � � � � � � � � � �'59���49Oj �� � � � � � � � � � � � � � � � � � � � � � � � � � � �&�".���8� �� � � � � � � � � � � � � � � � � � � � � � � � � � � �

Gc'59���49��(5�9 ���� � � � � � � � � � � � � � � � �&�".����-9 ���� � � � � � � � � � � � � � � � � � � � � � � � � � � �'59���49<J ���� � � � � � � � � � � � � � � � � � � � � � � � � � � �'59���49Oj ���� � � � � � � � � � � � � � � � � � � � � � � � � � � �&�".���8� ���� � � � � � � � � � � � � � � � � � � � � � � � � � � �

������ ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

������%�"���(Ri ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � ��5�[] ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��%�"�dU ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��%�"�dUZ ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��%�"�dUVF ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��%�"�dUZ%�' ��� � � � � � � � � � � � � � � � � � � � � � � � � �

Page 6: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

vi

�#�!�gW<q#��%?H ���� � � � � � � � � � � � � � � ���������f�Jk���3�1'!47� ���� � � � � � � � � � �_ja�3� ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�7$���!gWTm ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��7$���!gWYA ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � ��7$���!gW^ ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

; E�Tm ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�����B\] ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

������ ���� ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�,4���27NC� ���#", ���� � � � � � � � � � � � � � � � � � � ��#", ��i�E�> ����� ��*��5ZTm ���� � � ��#", ��hP��� �*��5�7)�5 ���� � � � � � � � � ��#", ���,4���2747� ���� � � � � � � � � � � � � � � � � ��#", ���,4���27NC ���� � � � � � � � � � � � � � � � � � � �

���/����:l ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �<q���/ ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �<q���/b@ ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

����������� ���� ���� � � � � � � � � � � � � � � � � � � � � �

�����$("�9KOn ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � �

+6��.�7%X`GU ���� � � � � � � � � � � � � � � � � � � � � � � � � � � �+6��.�7%X` �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �b`f�+6��.�7%X` �� � � � � � � � � � � � � � � � �CcD�+6��.�7%X` ���� � � � � � � � � � � � � � � � � ���#0; E��+6��.�7%X` ���� � � � � � � ��� 5�IV��f�+6��.�7%X` ���� � � ��� 5IV�+6��.�7%X` ���� � � � � � � � � � � �

+6��.�7%4�%eM ��� � � � � � � � � � � � � � � � � � � � � � � � �+6��.�7%GU ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

i�E�>f�[F ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �i�E�>f ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �i�E�>f$("��/7& ���� � � � � � � � � � � � � � � � � � � � � � �

�� 5�[F ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��� 5IV ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��� 5�/7&Qp ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �-�%gW ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

Sdf�[F ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

=RLo8�[F ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

Page 7: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���

! ������$ ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�����������"� ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

����������$��� ��& ���� � � � � � � � � � � � � � � � � � � ������%��#������& ���� � � � � � � � � � � � � � � � �

��� ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�� ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

Page 8: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

ix��GAI.M����

���������

��GAI.M��C _`EO5KH�&d%^��m SQL/A �,g���.EL6�8JQ,ev�* C EO5KG,zr����$���&d%^.EL6�8JQ,ev�*x��RT�;94�kb��,|��� + �

)$�-�

g�89<Hs���CEO5KH�ev�7QB0M�kb

z�^ Unify DataServer SQL/A ��ev�kb

��GAI.M��Unify DataServer GAI.M�8L�:��������GAI.M����&d%^ SQL/A �,g���S��� SQL/A ;94,kb�*��,w��$���&d%^SQL/A ��$����&d%^ SQL/A ��1E8JQ��"��[l���$�-��"�� SQL/A ������Wy�w���Unify DataServer: SQL/A Reference ,fp�������

LN�8J@M=�;F�9�X��'!Structured Query Language (SQL) �V�,'�|(� + �Fabian Pascal SQL and Relational Basics ���n�,f

p���������n���Unify Corporation�$���#�-��n�=/9>LCI�;,~������$��ISBN ��1–5581–063–X ���

��GAI.M��RT�a�Z��U�i,g��$��

o�h ��}�o�h���\�*P�?��u�$��[lj,i�$����� �<�DM��2KH���u���

{�h ��}�{�h��SQL/A��$��3�P�?,i�$��

. . . ��}�t��q�[c������Y]���q��+��

,i�$��

���

Page 9: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

x ��92:&<����

���V>7<6�����BL "��!14.()������ R�NX�I "��!��#$T!�������

��OW�����0�,8�)�OW$DM �!NX$T!�������

��CF�����0�,8�)�Q?$K�������!NX$T!�������CF�����0�,8�)�Q?$K�������!NX$T!�������

��7<6�����0�,8�)�@S�&(+)�!YZ$T!�������

��92:&<���%��\�H[�!0�,8�)/�5<��company�orders���

�"��/�5<��ACCELL/SQL �E�08=.3�*�-:�1;&<�

� ����"��/�5<$GP���-:�1;&<$JE�!�����

92:&<�\$H[����/�5<$H[�!�������/�5<

��TUTORIAL )'�9�U�A�"�����

�� ���

���

Page 10: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

xi���������

company ����

1 Athena Development Corp. 5800 S.W. Washington St.2 Brooks Management Cons. 1200 Fifth Avenue3 G. O. Computers, Inc. 125 Grays Plaza Suite 1854 H. B. W. Investors Group 125 Wall Street Suite 410 5 Hewitt Stone Associates 121 Embarcadero Square Suite 7006 J. A. Donne & Associates 501 Broadway Suite 10507 Stanton, Stone & Miller 525 Madison Avenue Trade Ctr 8 White & Wong, P.S. 105 Nob Hill Suite 15009 Young Designs, Inc. 12 Union Square Suite 50010 Yujikawa Limited 115 Wedgewood Court Suite 250

Portland OR 97210 (503) 555–2400 7New York NY 01000 (212) 555–1200 6Los Gatos CA 95402 (408) 555–7100 2New York NY 00102 (212) 555–3400 1San Francisco CA 94087 (415) 555–7002 6St. Paul MN 60451 (612) 555–6464 4Chicago IL 30821 (312) 555–8020 8 San Francisco CA 94085 (415) 555–2300 7San Francisco CA 94086 (415) 555–2550 17 San Francisco CA 90403 (415) 555–8800 3

��� �� ������ �� ������ �� ������

�� ������ �� ������� ����� �� ������ ���

Page 11: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

xii � �������

orders ����

orders ��������"�#���&('� ������!������)ord_company ��company ���� co_key )�$���%�!������

10002 3 3% 10, net 60 days P 08/15/86 Best way 0 0 312485 6 2% 10, net 30 days P 02/08/85 Best way 0 0 1510001 1 2% 10, net 30 days F 01/23/86 Best Way 0 1 610003 1 3% 10, net 60 days P 08/15/86 Best way 0 0 610004 8 2% 10, net 30 days P 07/11/86 Best Way 0 0 1110005 8 2% 10, net 30 days P 07/11/86 Best Way 0 0 910006 8 2% 10, net 30 days P 07/11/86 Best Way 0 0 910007 9 2% 10, net 30 days P 07/11/86 Best Way 0 0 910008 9 2% 10, net 30 days P 07/11/86 Best Way 0 0 1010009 9 2% 10, net 30 days P 07/11/86 Best Way 0 0 1010010 7 2% 10, net 30 days P 06/15/86 UPS 0 0 510011 5 2% 10, net 30 days P 08/10/86 Local truck 0 0 410012 2 2% 10, net 30 days F 05/01/86 UPS 0 0 410002 3 3% 10, net 60 days P 08/15/86 Best way 0 0 312485 6 2% 10, net 30 days P 02/08/85 Best way 0 0 1510001 1 2% 10, net 30 days F 01/23/86 Best Way 0 1 610003 1 3% 10, net 60 days P 08/15/86 Best way 0 0 610004 8 2% 10, net 30 days P 07/11/86 Best Way 0 0 1110005 8 2% 10, net 30 days P 07/11/86 Best Way 0 0 910006 8 2% 10, net 30 days P 07/11/86 Best Way 0 0 910007 9 2% 10, net 30 days P 07/11/86 Best Way 0 0 910008 9 2% 10, net 30 days P 07/11/86 Best Way 0 0 1010009 9 2% 10, net 30 days P 07/11/86 Best Way 0 0 1010010 7 2% 10, net 30 days P 06/15/86 UPS 0 0 510011 5 2% 10, net 30 days P 08/10/86 Local truck 0 0 410012 2 2% 10, net 30 days F 05/01/86 UPS 0 0 4

������ ������� �������

��

�����

�����

����

�����

�����

Page 12: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

1

����� SQL/A ���

Page 13: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

2 .�&�$������*�

��� ���

��)���.�&�$SQL/A��1����'0���.�&�$ SQL/A "�����#�!��+/��������)��.�&��,�

SQL/A -���� �SQL/A �(10%����+/����

Page 14: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

3r�S�L������^D

����� SQL/A ���

r�S�L SQL/A ��C 6=':8�Vu�� SQL/A �p�Pae�'<�6� �SQL/A p��C 6=':8�h��C MN�p�G�r�S!�Vu�� �

r�S�L SQL/A �[�li @B�Y�� �

.#470&�"6;(�*9>

%:�]w

ANSI SQL Level 2\J

6;6=,0)���_fIm

Unify DataServer FK���6=.&3

.#470&?"6;(�*9> .#470&�"6;(�*9>�����r�S�L SQL/A p Vu���ZQX�r�S�L SQL/A p Wj ������ �.#470&r�S�L SQL/Ap Vu���TvuCm�"6;(�*9> Ua ������ �

%:�]w ZQ �k��SQL/Ap�+1�-+ /$0& ������ �%:��nb ���r�S�L SQL/A �Pde�H` Vu���]w ������ �

6;6=,0)���_fIm SQL/A�6;6=,0) EPP��SQL/Ap Ec��SQL/A Hy�����%:� qR�� �%:����1�5<�xt�sO�2�--#6�oA

g����Pp%:����� �

Page 15: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

4 _�J�G������RA

Unify DataServer CF_�J�G SQL/A ��Y�Unify DataServer4;-&1�"&+*���CF?�L`� ���Unify DataServer 4;-&1���=?�N������

ZcG SQL/A

ZcG SQL/A !L`���_�J�G"4:(�)8<�_�J�GSQL/A]![@��W��/*1�03.'������

Relational Host Language Interface (RHLI)

Relational Host Language Interface(RHLI) �ET!L`����b>��U\!BX����_�J�G"4:(�)8<�0�,5�*!KV�� �������

ZcG03.%

ZcG03.%!L`���_�J�G SQL/A "4:(�)8<4;'97!03.'�� �������03.%��OI�����_�J�G SQL/A ]!DM����

�����

� ��

-#26.&�"4:(�

)8<

�-#26.&�"4:(�)8<�Q�^�

$9�Pa �$9��SHPa�

SQL/A03.% �"4:(�)8<�03.'�

RHLI ET �Unify DataServer: RHLI Reference�

ZcGSQL/A �Unify DataServer: Writing Interactive SQL/AQueries�

Page 16: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

5c�L�G������UA

���� SQL/A �

c�L�G SQL/A _��C IJ3:)97�Pf�"SQL/A _��������%��[hGSQL/A_��c�L�GSQL/A_���Pf�"�����������_�c�L�G2�*8<���\@�E >�"Pfab��!

���

c�L�GSQL/A_�Z���EXEC SQL '�;�0���#��!��%�

c�L�G SQL/A _$Pf��/�,4�+$MV�"������%�/�,4�+$MV�"���[hGSQL/A��RHLI$Pf����

��X���=?�������Ye����

S^_

c�L�GSQL/A_���Pf�"SQL/A_

S^_��BW #�dZ�Dg�" SQL/A _���S^_�-&16.(�SQL/A_�2�*8<��F!`�RK����

S^_$RK�"��_�BW2�*8<�RK����RK�"]��_$B

W������RKQC$NH����

����_$S^�"ab�����Ye��46 5�*$OT��� ��

��

Page 17: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

6 C�5�4������:2

C�5�4$+.%�'-/=�7>� ����� <F4SQL/A B"�01�A�8 �������B��C�5�4$+.%�'-/��6D� ����*�(-/7>�!����!03�B��C�5�4$+.%�'-

/�6D� ;�������9?� ��EXECUTE IMMEDIATE B�6D �!�����#�@E������

&,/)C�5�4*�

(-/9?�� � EXECUTE

IMMEDIATE �6D��

ALTER DEFAULT SCHEMA �

ALTER SCHEMA �

ALTER TABLE �

CLOSE DATABASE �

COMMIT WORK � �

CONNECT �

CREATE BTREE INDEX �

CREATE HASH INDEX �

CREATE LINK INDEX �

CREATE SCHEMA �

CREATE SYNONYM �

CREATE TABLE �

CREATE VIEW �

CREATE VOLUME �

DELETE � �

DISCONNECT �

DROP BTREE INDEX �

DROP HASH INDEX �

DROP LINK INDEX �

DROP SCHEMA �

DROP SYNONYM �

DROP TABLE �

DROP VIEW �

��������

��������

Page 18: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

74�*�(������/%

�"$ -2���� EXECUTE

IMMEDIATE �,6���4�*�(!�

�#$

DROP VOLUME �

GRANT ACCESS ON �

GRANT DBA TO �

GRANT ON SCHEMA �

GRANT ON TABLE �

GRANT SCHEMA �

INSERT � �

OPEN DATABASE �

RENAME TABLE �

REVOKE ACCESS ON �

REVOKE DBA FROM �

REVOKE ON SCHEMA �

REVOKE ON TABLE �

REVOKE SCHEMA FROM �

ROLLBACK WORK � �

SELECT� � �

SET CURRENT SCHEMA �

SET TRANSACTION LEVEL � �

SLOCK � �

UNLOCK � �

UPDATE � �

XLOCK � �

� SELECT 3�-2�������EXECUTE IMMEDIATE �,6�����������

�����SQL/A 3�'��&1�)3�05���Unify DataServer: SQL/A Reference��+

. �����

Page 19: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

8 S�C�?������G7

����

2(-PH��C "/4%�&36�PH���2(-PH��SQL/AO�2(-@B��;�<WI M= ���2(-PH EU �����@B:>;

�,�*L N ���

"$)(��+�.5�8��L�K �2(-PH EU ���2(-PH

�,�**#/��,�*0�(�V�,�**#/�A9I�������

�!�

������� ���� ��������

��� ��

������

���������

���

���

����2(-PHEUQR�JT��17 1�'��2(-PH�EU� DF �����

Page 20: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

9z"U!M������\J

������

.�3@��SQL/A |�T(��NI��&S�269���

g�M SQL/A v��df��� �269)[�� ������z"U!M SQL/A ��C PQ)X}����m�269��?B;��)eV� �� ')S������269).�3@�bk� ��.�3@��m����

S)+/20� ��

SQL/A vu_S)w���KS�g��+/20�&s~�&���.�3@)X}� ��

7�<@�$���S�!)w�]T��.�3@��s~���% �*�

.�3@�ts~�`p)jG�� ��SELECTv�#����S��7�<@�$h)OW�& �� ��

z"U!M SQL/A v)X}���.�3@�Va�-�=B�+/20�/A�1)S� ��

.�3@)-�=B�&��.�3@i�8�4)�S���+/20��%�

eV�& �� ��.�3@s~���&��/A�1� ��

.�3@)X}�&Fql�xy�o����DG�Y������E���

Z��.�3@X}� ��

r5,:>6/.�3@

5,:>6/�cP�'�.�3@

L%n�.�3@

C{.�3@

R^Hp.�3@

���������

������ �

�������

Page 21: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

10 k�N�H������XF

!���� ���

f/#4:0&$�.?��f/#4:0&"8>(�*<A�Rn ���f

/#4:0&$�.? Rn�����SELECT i Rn ��)A6#?S�`�����$�.? O\��YM���

���� ���������

/#4:0&�]J���$�.?��/#4:0&�"8>(�*<A�Rn

���/#4:0&�]J���$�.? Rn�����SELECT i Rn ��)A6#?S�`������$�.? O\��YM���$�.?

�TLS�O\�����

�������

G�c�$�.?��/#4:0&�"8>(�*<A�Rn ���G�c�

$�.? Rn�����$�.?�dm)A6#?S�`������YM

���G�c�$�.?��"8>(�*<A�^�8@'=;_C���"&

-,����

�"���

Bl$�.?��]J �$�.?�Dg���L�-03�i"&-,��

���dgb�O\�����Bl$�.?���SQL/A 250% Rn � �"&-,���!�

��� ���

KZEe$�.?��1�7?a�L KZ ��PV ����YM�Rn

���KZEe$�.?��f/#4:0&$�.?�/#4:0&�]J��

�$�.?���G�c�$�.?� ��Rn��������

�����

�# ��

f/#4:0&$�.?

KZEe$�.?

34 9�+��1�7?���h[LIQ�

Bl$�.? �"8>(�*<A�250'�W

/#4:0&�]J���

$�.?�G�c�$�.?

�/#4:0&�"8>(�*<A�

Uj�W

Page 22: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

11^"H!E������RA

����

DPKc@��4-7;5. SQL/A Z�B�'S\*C! ���

4-7;5.Z��DPKc@*J`�'��*Ya�� ��d�S\ 0?

8->N�����OGN���J`����%���DPKc@��OGN

�IU�(������6�3�S\ b`��'$��& ��

����4-7;5. SQL/A Z DPKc@*J`�'��F& �+�6�3�B�'Ya�S\ �0?8->N�W%(�����DPKc@*J

`� �������OGN� SELECT Z*LX�'��IU�('d�T#6�33-9 )�& �+�DPKc@ ��S\*[M�� ��

����DPKc@��59 :�2��4-7;5.�,9=/�1<?�Q�]��V_� ��

Page 23: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

13

���� ����������

Page 24: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

14 E�4�0�&)�� '+�8�C

��� ���

�:���E�4�0 SQL/A �&)�� '+�8����-A?���$(�+��,.�7�/D?�E�4�0SQL/A�&)�� '+�"!�� ��=F���

#�%*�32;

#�%*��3�>@

#�%*���359

#�%*��� �316

#�%*��B<316

Page 25: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

15l�N�H&9>.�/<A�Xk

�� ������

l�N�H SQL/A &9>.�/<A$FU�!���BD� ��Cdc�+'8='A�T���� ��

SQL/Ah�`��,�@�8 EXEC SQL $FU����

JP�K\���6�3:�0�s��;07i]$Ro���� ��

g]L$jG �!n�M#�Wq���*�2?$Ro���� ��

�����Z���fVc�)=�4(5-h�r$S����l�N�H&9>.�/<A��)=�4(5-�_m���)=��[IWq�$QY���� ��

��l�N�H SQL/A &9>.�/<A$O^�!`��Unify DataServer 6�3:�0�&-10�!��ep���atH SQL/A � CREATEDATABASE h$Ro�"�����%Eb�6�3:�0$O^����l�N�H SQL/A h�6�3:�0�O^���%�

Page 26: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

16 <�0�-�#(���&,�4�;

EXEC SQL �����

C #*�'%7�<�0�-SQL/A:��6�8���+�! EXEC SQL �9���EXEC SQL �9�� �C ./�:��5�SQL/A:��,"�)�� �2��

<�0�-SQL/A:�� $�*,�3����

C #*�'%7�<�0�- UPDATE :�=�2��

main (){

EXEC SQL UPDATE company SET co_key=1;

printf (”End of UPDATE statement\n”);...}

���� SQL/A�

C./:

EXEC SQL�:�1���

���� SQL/A��

��������

=

Page 27: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

17{$X#Q/=A4�5@E�a�y

������

?69wc��C /=A4�5@E�wc���?69wc��SQL/A v�?69RTv��M�N�d-mO�"��?69wc-Z�������RTLP

M�8�7j-o�"��

��f���FG�W}-g|�"��

np�8�770=-\�?69wc�hRyz

{$X#Qv��?69wc�Ybyz

v[�j-%�?69wc�Z�yz

TEXT 8�7&�BINARY 8�7-%�?69wc�Z�yz

;Bj-%�?69wc�Z�yz

?69wc!�j�J)p���r�hR��(V�"��hRf�C RThRv-Z���?69wc-hR�"��hRf��2�D�: BEGINDECLARE SECTION�hRv��' 2�D�: END DECLARE SECTION (Ue�+"��

?69wc��8�770=��%�hR�"��8�770=��N��*

8�7>�6���8�770=�SKd� +��)"�.�N��*8�

7>�6����?69wc8�7-a�X.�)�"���8�7-_

^��)�*����

CHARACTER 70=�8�7>�6��(8�7-_ ^*?69wc��8�7>�6��')%1 <09ui��hR�� +��)"�.�lH<09r���*�~��CHARACTER 70=�8�7>�6��j��UnifyDataServer 8�7>�6(x�+*���;B�`,*�$���

hRf��Nc�qt�%It�%s]�*����"��Nc�It�k�

�hRf��3C�<B�wc-hR�"��qt�k��hRf��C�1B

�wc-hR�"��

�������

Page 28: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

C �����������

18 �%c$\/CM8�9KQ�m �

��u`t �����p,u`�#��rp��p key �rp;1C�=�;D�:��wS���#��5IL6;�p name �CHARACTER;1C��z�30�=�;D�:���wS���#��@N�k��*�%�����A1>,Z-��z�31�u`�#��

EXEC SQL BEGIN DECLARE SECTION; long key; char name[31];EXEC SQL END DECLARE SECTION;

� ��P�4N�p�7P�AN�p��� C `bu`������o� �3EO�<0Q79:<H� C MB.OQ:G?J/N,en�������

������������

RT�� �Unify DataServer �'"Y��* SQL/A F:>�p�aXq��*=�;;1C,h�#��F:>�p,u`�*� �~�����h��

=�;;1C,f��������

|V��l C ̀ bu`��&h�#����u`��,y���+!�CMQ>�*�%�F:>�p,]iU�*���� #��

��!�=�;D�:�(NUMERIC 2 �=�;x,_d�*� �short int ;1C�F:>�p,f��#��

��aXq���=�;;1C,f��*���v{)�^W�}(+#�-���

!��gx�s)j�(+�)�px��X2L�,[���)�#��

Page 29: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

194�(�%��!��� "�)�3

����������

�������6��� ���2*+& /$�C&'+&

AMOUNT uamt x long int x

BINARY ubinbuf x max n

struct {long curlen;char data[n];} x

ubinptr struct {long curlen; char * dataptr;} x

BYTE char x[n] char x[n]

CHARACTER char x[n] char x[n]

DATE udate x short int x

FLOAT double x double x

HUGE AMOUNT uhamt x double x

HUGE DATE uhdate x long int x

NUMERIC( 1–4) short x short int x

NUMERIC (5–9) long x long int x

REAL float x float x

TEXT utxtbuf x max n

�������� � ���������� ��������� �

utxtptr x struct{long curlen; char * dataptr;} x

TIME utime x short int x

.# x ����2*5�0���� n �2*�,���0����

15 NUMERIC(1–4) �SMALLINT���-������NUMERIC(5–9) �INTEGER�� DECIMAL���-������FLOAT � DOUBLE PRECISION���-������

Page 30: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

20 R�;�5!),#�$+-�B�Q

���������

G74E�,&�-H�A@�*%(NE��O��'�&�&")�83

F������� �G74E�2�K��9��,&�-H�'�&&"

)�/1�L�?����

�����AMOUNT &")�0E��G74E MIN �=J��D:�MIN �'�&&") AMOUNT �H�O����,&�-H�P>������83F���'�&&")�*%(NE�<T������� �

���������

0E�&") AVG4EMAX ���MIN 4E SUM4E COUNT4E

AMOUNT AMOUNT AMOUNT HUGEAMOUNT

NUM (5–9)

BINARY n/a n/a n/a n/a

BYTE n/a n/a n/a n/a

CHAR n/a CHAR n/a NUM (5–9)

DATE DATE DATE DATE NUM (5–9)

FLOAT FLOAT FLOAT FLOAT NUM (5–9)

HUGEAMOUNT

HUGEAMOUNT

HUGEAMOUNT

HUGEAMOUNT

NUM (5–9)

HUGE DATE HUGE DATE HUGE DATE HUGE DATE NUM (5–9)

NUM (1–4) FLOAT NUM (1–4) NUM (5–9) NUM (5–9)

NUM (1–4) FLOAT NUM (1–4) NUM (5–9) NUM (5–9)

REAL REAL REAL REAL NUM (5–9)

TEXT n/a n/a n/a n/a

TIME TIME TIME TIME NUM (5–9)

CU6� CHAR��CHARACTER�CU6���NUM��NUMERIC�CU6���

MS� NUMERIC(1.4)��SMALLINT����DECIMAL(1–4)����I�������

NUMERIC(5–9)��INTEGER����DECIMAL(5–9)����I�������

FLOAT��DOUBLE PRECISION ����I�������

Page 31: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

21t!\ S*>G0�2FK�d�s

����

� �

x�8�44,> �Unify DataServer: Writing InteractiveSQL/A Queries�

C WY8�44,> -@I�7+K/237D� C WYG=)IK3B<E*H

hTPf �Unify DataServer: Writing InteractiveSQL/A Queries�

t!\ S SQL/A p�^e�%���A39qf�g�1JK (:)(o����t!\ S SQL/A p�N���A39qf�1JK�� �"^e�����

t!\ S SQL/A p�8�4?�3�u�['��%���G4�Kj(a�A39qf(_v����

u�['�UM�j�A39qf(J�:��X����A39qf(ncC WY�p�_v�%��������

DELETE�UPDATE�INSERT�SELECT�#�5,;C6.p�k�A39qf(`l����SELECT p� INTO R�X���V]�%8�4?�3�x�iL�%A39qf(Qb����

SELECT p��x co_key�x co_name$����Zj(r����SELECT�G4�Kj��A39qf key � name �Om�&���

...EXEC SQL SELECT co_key, co_name INTO :key, :name FROM SQL_books.company WHERE co_key=3;

printf (”The selected name is: %s\n”, name);...

�������

w

Page 32: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

22 y�X�Q(7>-�.<A�`x

2�18�/�u[~k&�j �D�$u[~:/3vc�Ho����

g#^� �Pp�y�X�M�#���

+;=,1ie�:/3vc�K��$~!#�j�bW��2�1�:/

3vc�YN� %�Pst��Ppy�X�%���K��$~!#�a

�bW��Ehg#^�"%���

strlen Kc&Z{���+;=,1ie�vc�"zR�Pp&_#O$������}&BF�]����

void strterm(strp) char strp[]; /* ––> string to have blanks stripped */{ int i; for ( i = strlen(strp); ––i >= 0; ) if ( (strp[i] != ’ ’) && (strp[i] != ’\0’) )

break; strp[ ( i + 1 ) ] = ’\0’; return;}

AMOUNT 2�1&:/3vc�Ho�$��TJe��$2�11)7uamt �:/3vc&Z{���� ��uamt 2�11)7��C SU� longint 2�11)7�nG���long int 2�11)7��C_#�#��'������uamt :/3vc�Ho %$ AMOUNT 2�1����C_#&0@�vV��4?!#�95�&L����� ��

:/3vck&7>A3��#r]�$bW���k&100 �I��26*?3�C_#2 �Ho����:/3vck&2�18�/�l{�$�"�100 �I$q|��#��'�Unify DataServer ��dm 2 &AMOUNT k�l{����

AMOUNT 1)7�~&7>A3�$���BF�!��:/3vc&100 �I#�f��C_#&w\����

EXEC SQL BEGIN DECLARE SECTION uamt price;EXEC SQL END DECLARE SECTION;... EXEC SQL SELECT nv_unit_price INTO :price FROM SQL_books.nvntry WHERE nv_number=5006;

printf (”The price is: %f\n”, price/100.);

������ ��

������AMOUNT ���

}

Page 33: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

23t U�N):A-�/?C�a�r

BINARY 5�3�TEXT 5�3'Jo�%<06qb��Unify DataServer �5�33*:'Zu��eQ &����&��Hqlw'_$D�� �dO &�����

I5�33*:�����EG�"��5�3'Jo��%<06qb����

3*:�$���

849(� BINARY ��� TEXT k��!�'Jo�%<06qb��&#�<06qb�5�33*:� utxtbuf � ubinbuf ���

BINARY ��� TEXT k��=*C3'Jo�%<06qb��&#�<06qb�5�33*:��utxtptr�ubinptr ���

�&#�5�33*:����Tgh�<06qb'eQ����

utxtbuf ��� ubinbuf � �

utxtbuf qb�"� ubinbuf qb'eQ�%��mMV��Tghvf��%curlen �data']��TghXc &���curlen �3*:��long integer���data ��TEXT ��� BINARY5�3'K�+>@,3p\w���data vf�.*1��Tgh'eQ�%W�[m����

�����

������ ������

���

����

��������

��������

DECLARE��MAX���� ���

���

wkPY &%��Tgh�vf curlen ���vf data �k�����^5�3l'8*6jF�dm &�����5�3l��+�B�7 MAX �[m��i� EG���Tgh�vf data ���5�3;�0�wkdm &���

wk'data vfn�PY��R�C QS�TghL`s'Zu����vf�),20�����

�����BINARY��TEXT�

Page 34: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

C"*+/ 1�#3��0$5��������

9990$�&2�.��������(

!���

24 ~#Q!J-=A0�2@C�a�}

���/C8.0�6{f*U�����q Gl�['^�)��Fu�(�� �� ��111?�3��/C8.0�6{f`��*Tc������

��� data ����

Ono utxtbuf � ubinbuf *jM�(��I_V MAX *U����Ono�mDATA �8�6r*Ws�(�� �� ��data �1/5��8�6>�4��q�;/9r \���(���p��������' �+�

TEXT 8�66/=����8�6>�4�&LS�)(��:B]Xy*xD�)�8�6>�4�a���)(��$�:B�H )� ���Ono�

m curlen ���:B�8�6>�4��1/5��H ) �+��

Ono�m data �z��r�*{N�(dP��8�6>�4�Ne*��(k��Ono�m curlen �1/5*Ne����w� �' ��SQL/A���curlen ��8�6>�4�a�Q"���Ono�m data �;/9f*Ks�(��U��) ��

DECLARE i��1000;/9�;7<,1/5:B]Xy��#�F|�)(���;7<,��999;/9 ��8�6 hsEv��' ��

EXEC SQL BEGIN DECLARE SECTION; utxtbuf speech MAX 1000;EXEC SQL END DECLARE SECTION;

EXEC SQL SELECT words INTO :speech FROM talk_table WHERE id=5;

printf (”The speech is %s”, speech.data);

Z�%�Ono Rg�) ��

���

�� ����5�-� '��

�����

"*+4) data �,�%���-�����

����

�������

� words �&t![��q��speech.data �hs�) ��:B]Xy*b�hsq�zYf��speech.curlen �hs�) ��������� words �zYf��850�!��) ��

Page 35: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

25�"] U)AK2�3IN�i �

�����

� �

C WY Zsu-BM�:*N134:F� C WYK@(MN4E=H)L

TEXT ;�77+A� BINARY ;�77+A

�Unify DataServer: Writing InteractiveSQL/A Queries���;�77+A�>Lx�a��

The utxtptr ��� ubinptr ��

utxtptr �k� ��� ubinptr �k'nW�%��}T^ �Zsu�q��%curlen� dataptr 'c��Zsu�_l�&���curlen �;�77+A� longinteger ���dataptr �/GJ07�b���D+N7���/GJ07�b����TEXT �� BINARY ;�7�R�&���

����� ��� ����������

����� ���������������

�x�V`�&%��Zsu��q curlen ���;�7����e;�7{�?+<wO�m}�&���Zsu�q dataptr ���TEXT ��� BINARY ;�7Oy��D+N7�m}�&���

data �q~��x'V`��X�C WY�ZsuSg�'a������q�)054� ���

��uxtptr ��� ubinptr 7+A�C4<�k� BINARY � TEXT x'@,98�%� ����a�z�)AK2�3IN�@,98�&�;�7'h��f�

�#�.�6L�#t�['@,98��$�wP[� SELECT 'e[������d�@,98���ovr_��;�7'p�r_� TEXT ���BINARY x'R!~�?9@(�i ] ���

�k utxtptr ��� ubinptr �x'|Q�%j\�|Q�%;�7{'�qcurlen �m}�%����$���

Page 36: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

�NacjHo'Sq��lUr�*.32�%�

���������

������� �

26 p!O J*;D0�1CG�Y�n

DECLARE _��utxtptr 4,;�m\ speech '`L����

EXEC SQL BEGIN DECLARE SECTION; utxtptr speech;EXEC SQL END DECLARE SECTION;

EXEC SQL SELECT words INTO :speech FROM talk_table WHERE id = 5;

printf (”The speech is %s”, speech.dataptr);

V�#�Nac Q]�&���

���� ��������� ����

������

���

�� ����" �����������

�� ���� ���

r words �$�e��?,G4��speech.dataptr �^h�&���9EXTk'Z�^he�lU\��speech.curlen �^h�&��������words r�lU\��850 � ��&���

���

�� ��

C LM -=F�5+G/125A�CLMD:)FG2@8B*E

TEXT6�44,;� BINARY6�44,;

�Unify DataServer: Writing InteractiveSQL/A Queries���6�44,;�9Ee�Sq�

9Ee��f$&��6�4e����iq���6�4e���6�4<�2�rg�9Ee����r I�[d��%��'W����

6�4<�2�r�9Ee KR�&%��>27m\�9Ee ^h�&�

��6�4<�2�r�9Ee"�>27m\�9Ee"jW�%������

�(�����9Ee�bP'527�%��������

!

�������� �

Page 37: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

27Q�<�8 -2$�%04�C�P

)�'.�&�T�+3K��NULL 7� NOT NULL 7�?R���,�35>A�(&*�����,�35>A��SELECTN�UPDATEN�DELETEN����?R����

/&*OFL�+3K��"4)!$�'OF�?R��(&*�����"4

)!$�'OF�/&*OF�6U����)�'�K/&*OFL�:=

������"4)!$�'OFGM ����"4)!$�'OF�?R�

���T�+3K�GM����������

�����

� ��

"4)!$�'OF �#1��E9BS�

+3K �Unify DataServer: Writing Interactive SQL/AQueries� �)�''"-�+3K�?R�

NOT NULL � NULL �Unify DataServer: Writing Interactive SQL/AQueries��;�T�IJ�D��E9�@M�WHERE 7�H

Page 38: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���� � �������� ������������

�������

����������

���

�������

��

28 K�5�1"*,$�%+.�<�J

��������

UPDATE I��(�)-D�4!3>�� �SET 0����3>N��3>C!8E�� �WHERE 0����3> �4!8E�� �

3>/G�#�'-!7L��(�)-24!3> ������ �34 ��&��(�)-���H?4�@B�!6=������

company (�)-�1��4�A���N co_sales_rep �C!3>�� �3> �>�� co_key �C��:49�FM� � �C�;�� �

#include <include/rhlierr.h>

main (){USTATUS status;char linein[80];

EXEC SQL BEGIN DECLARE SECTION; int key, salesno;EXEC SQL END DECLARE SECTION;

printf (”Enter the company key: ”);gets (linein);key = atoi(linein);

printf (”Enter the sales rep no: ”);gets (linein);salesno = atoi(linein);

EXEC SQL UPDATE company SET co_sales_rep=:salesno WHERE co_key = :key;

if ( SQLCODE != UENORM) printf (”%s\n”, ufchmsg(SQLCODE, &status));}

Page 39: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

29<�-�(��$���"&�0�:

�����

� ��

UPDATE9�+9 �Unify DataServer: SQL/A Reference�

UENORM �5�:;�=��#��!��

��#��1)/>�

*2'7 ���%�.=����

�%*2

34 �������%���83,�46�

Page 40: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

��������

��

����������

����������

���

30 <�0�-�$'���&)�3�;

��������

INSERT :�� �#(�.�7*���VALUES ,�7*��.�28���SELECT ,� SELECT :�28���:�7*��6�'�!�14���

��?���company �#(��.59 ����+@�6�9>�����)"%���=�/�����

#include <include/rhlierr.h>main (){ USTATUS status; EXEC SQL BEGIN DECLARE SECTION; char name[31], addr1[31], addr2[31], city[25], state[3], zip[10], phone[15], linein[80]; int key, salesrep; EXEC SQL END DECLARE SECTION;

printf (”Enter the company key: ”); key = atoi(gets(linein)); printf (”Enter the company name: ”); gets (name); printf (”Enter the company address (line 1): ”); gets (addr1); printf (”Enter the company address (line 2): ”); gets (addr2); printf (”Enter the city: ”); gets (city); printf (”Enter the state: ”); gets (state); printf (”Enter the zip code: ”); gets (zip); printf (”Enter the phone: ”); gets (phone); printf (”Enter the sales rep number: ”); salesrep = atoi(gets (linein));

EXEC SQL INSERT INTO company VALUES (:key, :name, :addr1, :addr2, :city, :state, :zip, :phone, :salesrep);

if ( SQLCODE != UENORM) printf (”%s\n”, ufchmsg(SQLCODE, &status)); else printf (”Row inserted.\n”);}

?

Page 41: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

������ ������

����������

�����

31@�/�+�$&���%(�1�?

�C��company �#'���ca_company ��A7� �#'��=5.�8<����

#include <include/rhlierr.h>

main (){USTATUS status;

EXEC SQL INSERT INTO ca_company SELECT * FROM company WHERE co_state=’CA’;

if ( SQLCODE != UENORM) printf (”%s\n”, ufchmsg(SQLCODE, &status));}

�����

� ��

!'9� TEXT 9�"��'���<B9���*;9�8<

�Unify DataServer: Writing InteractiveSQL/A Queries��:��.�8<�,4�02�3

INSERT >�->)6 �Unify DataServer: SQL/A Reference�

C

Page 42: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

������

���

���������

����

������

32 R�<�8$,/&�'.1�A�Q

��������

DELETE P��*�+0 �������OE;#=B����WHERE 7�=B�!;#@L����

9D4N�%�)0#?T��*�+0�;#=B�!��������34 -�(��*�+0 OE;�GJ�#>C��3��

��U��company *�+0 �;=B�����M�<�"���K�

I2�!;�=B�"���

#include <include/rhlierr.h>

main (){USTATUS status;char linein[80];

EXEC SQL BEGIN DECLARE SECTIONint key;EXEC SQL END DECLARE SECTION

printf (”Enter the company key: ”);key = atoi(gets(linein));

EXEC SQL DELETE company WHERE co_key = :key;

if ( SQLCODE != UENORM) printf (”%s\n”, ufchmsg(SQLCODE, &status));}

���DELETE P�:P�6�!5H�FS���Unify DataServer: SQL/A Reference�#>C�� ���

U

Page 43: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

��������

����

��������

���

������

���

33H�6�1�)-!�",/�;�G

���������� ���

SELECT E��&�(.���1�����D=4�@A������4� �@A��<5��@AB�+$'F=�>C���� WHERE 0:9�7J���@A��4�2C����

D=4�@A��<5����%.�7J����

��K��18 � co_key �7J���company &�(.��1��4�@A����

#include <include/rhlierr.h>

main (){char linein[80];USTATUS status;

EXEC SQL BEGIN DECLARE SECTIONchar name[31], phone[15];int key;EXEC SQL END DECLARE SECTION;

printf (”Enter the company key: ”);key = atoi(gets(linein));

EXEC SQL SELECT co_name, co_phone INTO :name, :phone FROM company WHERE co_key = :key;

if ( SQLCODE != UENORM) printf (”%s\n”, ufchmsg(SQLCODE, &status));else printf (”Name: %s\nPhone: %s\n”, name, phone);}

���

�� ��

SELECT E�3E?I �Unify DataServer: SQL/A Reference�

��%.�7G 34 *�# �&�(.���D=4�@A�

K

Page 44: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

�����

������

34 w#X!Q,?D3�4BG�b v

�� ���������

;�>E�%tgV*jm�'���jm�'V*L"0�7E*[z� ��

0�7E*[z�'���HI�5;:?*V ��

1. DECLARE CURSOR u�0�7E*iS� ��

2. OPEN CURSOR u�0�7E*/�?G� ��

3. FETCH u�0�7E�%n*=.:9� ��

4. r{�%�� WHERE CURRENT OF P*]� UPDATE u ��DELETE u��;�>E*Uf� ��

5. CLOSE u�0�7E*1F�6� ��

DECLARE CURSOR u��q8-<@:10�7E� ��8-<@:1�iS�(�0�7E*iS� �� DECLARE CURSOR u��0�7E*Zd�'_VJp�u�k��w#X!Q SQL/A ?F2CA�b����(��& �+�

q8-<@:10�7E*iS�'� �0�7Ex�yW)�N`^*\o

� ��yW)�N`^��0�7E�K}�';�>EjmMa*oO�

��

0�7E*[z��V*Uf��&Yc�'eW�/?4BG�5;:? step4��0�7E*iS�'� � SELECT u�hTs �R^*[z�������Unify DataServer: SQL/A Reference�� DECLARE CURSOR *Zd������

DECLARE CURSORu��0�7E company_cursor *iS� ��0�7E��co_key �n��$&l company ;�>E�����V*L! ��

EXEC SQL DECLARE CURSOR company_cursor FOR SELECT * FROM company WHERE co_key > 1;

�� ����� ���

|

Page 45: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

�������������������������������� �

35�"`!T+?B1�2AE�p �

� �!���������

DECLARE CURSOR �� WHERE S��@3;�t�h��� ��@3;�t�|��/�5C.�?Ej� S�~�} N$' ��/�5C�����/�5C.�?E\�@3;�t�|�HR�'&����% �)�

@3;�t(g��&��+?B1�2AE~��t(h���l^j����

t�|(h��&���� ��

DECLARE CURSOR ��#%�/�5C company_cursor (wY� ����/�5C��@3;�t�|(g����x{�&^(U�� ��/�5C.�?Ej��key_var �t�|�} N$'�/�5C�dv�' ��

EXEC SQL DECLARE CURSOR company_cursor FOR SELECT co_name FROM company WHERE co_key > :key_var;

OPEN ���/�5C(.�?E��/�5C�Q�O��& SELECT �(l^��n�VK(��<8=*�M�� ��

@3;�t�wY�'�/�5C�.�?E�'&��} N$'�@3;�

t�|��/�5C(0D�4�CLOSE �(^���a�.�?E���Z%�]� �)��'��/�5C(aoPJ���s��@3;�t|(i

�/�5C(�Q��� ��

FETCH ���/�5C�$�1��1^��:�6(Wf��@3;�t��Wf:�6(M�� ��L^��@3;�t�O�� ��@3;�t�:�66,?�[Nu���'��% �)�

/�5Cr�l^�'&bo�=-87n���/�5C�z1^�(=-87� ��F_�=-87n����mk�k�^(=-87� ��

WHERE CURRENT OF S(i� UPDATE �� �� DELETE ��#%�9�>C�^(]s��%�eq�&���� ��

WHERE CURRENT OF S(i� DELETE ���Xc�/�5CG}�yI�&9�>C�$^(eq� ��

��� �����������

��� ��������� ���

��� �������"����������

Page 46: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

�����������

���

��������

������

����������

����

36 Y�@�:#.0'�(/2�HX

TZ��WHERE CURRENT OF 9!D� UPDATE V��;B�%�)14R�+�-1�?�8���,�*4R!>K ���

>K=�;B�%�)14R��>KE�?�[�����%�)14R��

FETCH V�G?=��F�?�L����F�?�����UEEOSCN JP�W�����

CI=�;B�%�)14R��CI���?�= �?�MS������

%�)14R��FETCH V�G?=��?�[�����A=�?�CI�����%�)1U�A=�?�= �R�����

36�V��%�)1 key_cursor!N< ���key_cursor ��co_key �Q�36� company +�-1�?!8"����� DELETE V��%�)1�#&+$-?�O5��+�-1��?!CI ���

EXEC SQL DECLARE key_cursor CURSOR FOR SELECT co_key FROM company WHERE co_key < 4;

EXEC SQL OPEN key_cursor;

EXEC SQL FETCH key_cursor into :key;

EXEC SQL FETCH key_cursor into :key;

EXEC SQL DELETE FROM company WHERE CURRENT OF key_cursor;...

;B�%�)14R�7]�����?�CI�����

� ����� ����

����

���������!

���� ���!�

�#��"�

�� ����

���

���"!��

��� ��$

���%�

����� ��

�!����

��#�������!

����

���� ����

�� ����!�� �

���� ��

��� � ���

����

����

������� �

\

Page 47: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

37�']&V0DJ7�9HM"h��

��� �

�� ��

UEEOSCN "?;@ 106 E�:"�;4FM"f-*"?;@�

YmO} 3�=K"qX �Unify DataServer: SQL/AReference�"DECLARECURSOR

CLOSE �#�cz��3�=K.5L�<�%��

COMMIT WORK ��%�# ROLLBACK WORK �!(*�t3�=K.5L�<��%��@IM859HMf�d!2�DM��%%"3�=K��+

k\#�SQL/A !(��5L�<�%��

�"o�#�?�CK�)�n[.rx�+��![���";?>D!� ��Pt �.�{e�%��^g"��#�2D9HM��+;?>D.R/� %�/��$�"�#�company ?�CK!Q��� %��company ?�CK"p�#�x E�:.aj����� �

^g"��#��$�"[�)���.rx�%��

�~�"��#�1MAG�8�|��+co_key "y!S� ���.rx�%��

~�"��#�YmO}3�=K�[.`i�%��

� �sqlca 6L�BK�n#�s"�']&VSQL/A ��u_�,+[!� �"l�.{T�%���"Zvw.b���INSERT ��UPDATE ��DELETE �!(��NU�,+[n.Wz�%��sqlca �n!� �#���� E�:�p��%��

������� �����

� ���

Page 48: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���� �

������"������

��������

���� �

����� ����

������� ����!���

���� �

����������

��

���� �

����������

��

38 2�'�$��!��� #�)�1

��3 �company ���"����&���4�/SELECT -������"�+%������.* �!��#,�0(���

#include <include/rhlierr.h>

EXEC SQL BEGIN DECLARE SECTION long key; char name[31]; char phone[15];EXEC SQL END DECLARE SECTION;

EXEC SQL DECLARE company_cursor CURSOR FOR SELECT co_name, co_phone FROM company; main (){

EXEC SQL OPEN company_cursor; while (SQLCODE != UEEOSCN){ EXEC SQL FETCH company_cursor INTO :name, :phone; if (SQLCODE != UENORM) printf (”%s\n”,ufchmsg(SQLCODE,&status)); else printf (”Company name: %s\n,\tPhone:%s\n”, name, phone); } EXEC SQL CLOSE company_cursor;}

3

Page 49: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���� �

������ ����

���������

���� �

����� ����

���� �

��������!�

���������

���� �

����������

39<�)�%��!��� #�/�;

��?�����:1�-8��46�(�&8� SELECT9 $����"�3'������:1�=5��DECLARE 9�+0��������:1�7�����"���#. ,>������"�*2���

#include <include/rhlierr.h>EXEC SQL BEGIN DECLARE SECTION int cokey1, cokey2, cokey3; char name[31]; char phone[15];EXEC SQL END DECLARE SECTION;

EXEC SQL DECLARE key_cursor CURSOR FOR SELECT co_name, co_phone FROM company WHERE co_key IN (:cokey1, :cokey2, :cokey3);

main (){ char linein[80]; printf (”Enter the 1st company key: ”); cokey1 = atoi(gets(linein)); printf (”Enter the 2nd company key: ”); cokey2 = atoi(gets(linein)); printf (”Enter the 3rd company key: ”); cokey3 = atoi(gets(linein));

EXEC SQL OPEN key_cursor; do { EXEC SQL FETCH key_cursor INTO :name, :phone; if (SQLCODE != UENORM && SQLCODE != UEEOSCN) printf (”%s\n”, ufchmsg(SQLCODE, &status)); else if (SQLCODE == UEEOSCN) printf (”End of records.\n”); else printf (”Company name: %s\n Phone: %s\n”, name, phone); } while (SQLCODE == UENORM);

EXEC SQL CLOSE key_cursor;}

?

Page 50: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���� �

�!�'����"�

���������)�%���+�

���� �

$��*������&

(��

���� �

������#����

��

���� �

���� ����

���� �

����������

40 P�=�7&02)�*14�CO

�R��:F5M�'�-3$I9����'�-3$K��company .�/3� ���<$>D����'�-3$:F5M��"���'�-3I9A� SELECT N� SELECT N�BG��8$@L���#��!��%�

#include <include/rhlierr.h> EXEC SQL BEGIN DECLARE SECTION int key; char name[31]; char phone[15];EXEC SQL END DECLARE SECTION;

EXEC SQL DECLARE key_cursor CURSOR FOR SELECT co_name, co_phone FROM company WHERE co_key > :key;

main (){ char linein[80]; USTATUS status;

printf (”Enter the company key: ”); gets(linein); key = atoi(linein);

EXEC SQL OPEN key_cursor;

EXEC SQL FETCH key_cursor INTO :name, :phone; EXEC SQL DELETE FROM company WHERE CURRENT OF key_cursor;

if (SQLCODE != UENORM) printf (”error is %s\n”, ufchmsg(SQLCODE, &status));EXEC SQL CLOSE key_cursor; }

�����'�-3&(,+N�6J�;N�HQ���Unify DataServer: SQL/A Reference �$?E�������

R

Page 51: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

41

�� ��������������

Page 52: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

42 4*8=5-�);B.�0@C�\�r

��� ���

��_���4*8=5-�);B.�0@C�\�r����cv����4

*8=5-�);B.�0@C���);B.�0@CXMU� SQL/A p(e O ���p��f�e O�&�i?�/m|�#��XMU�Lb�&

���

w�N'��g��Pk�[z�%4*8=5-SQL/A p�IV(dh�%����4*8=5-SQL/A p�IV�(R]�� ����

w�N'�XM�l�q'%j`�Tjrs�������4*8=5-�9A

>�3�(R]�� ����

<27q`(XMU�4*8=5-�Qb�%rs�������GYS{E�(

R]�� �����&�#���XMU�Zo�&%nD� SELECT p(yx��%#��$�<27q`�`�6�33*;(Jj��dh�&�i(

F!�����%#��$���

,:1+-7�4*8=5-u^�);B.�0@C�4*8=5-�aW(�

�#�XK�%�������t"O H SQL/A,:1+-7�4*8=5-u^�(R]�� ����

Page 53: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

43,$/3-%=#29'�)7<�KZ

���������� ����

,$/3-%�#29'�)7<��IDH� SQL/A Y"P�^��ID� �������!��Y��+�*2;&84�>WX�����#29

'�)7<"ID� ���569�CN !���

IDH�Y"FN� ���,$/3-%SQL/A Y�A�! SQL/A Y�&:�2"G\����

��IDH� SQL/A Y"FN� #29'�)7<���V,$/3-%#29'�)7<��MUBL����OJ]�E(<0$:����[��RF"

D� #29'�)7<������

,$/3-%Y�@?"G\���IDH� SQL/A Y"CS���������IDH�FN ! .�1:�D"QT� #29'�)7<"K���

����

Page 54: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

44 1(372+�'5;,�-9=�U�d

������ SQL/A ��

1(372+ SQL/A a�O�P����@][�EQ%M�����

YXRHa

T^a�RHa

T^a�*�/<%Ke�#RH SELECT a

FS��EQ��C%LZ�#���!��WG��#bE%M����

YXRHa�EQ��D"c��RH�#_f��1(372+a%RH�#

��J\�������SELECT a����EQ��RH����&�

T^a�RHa�EQ��a%D"c��RH�#��J\���)5-9=�

ARHN�?�#4:8�0%K�� ������H� %c� SELECT a����EQ�RH�����

*�/<%B�T^a�RHa�EQ��`V�H%c�SELECT a%D"c��RH�#��Ke�$���

AEQ�g%>I�6�.�P����

Page 55: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

UPDATE company SET

co_sales_rep = 7

WHERE co_key = 3

UPDATE company SET

co_sales_rep = 8

WHERE co_key = 3

�������������

��

�����

����� ����

����

45*#-0+%6".4&�'25�HQ

EXECUTE IMMEDIATE O��>�KG�*#-0+% SQL/A O��� �O� SQL/A O!8M��E=����

CREATE DATABASE 7:����� DDL O!@R�� ��������79� DML O����!E=�� �����

COMMITDELETEINSERTROLLBACKSET CURRENTSCHEMA

SETTRANSACTIONUNLOCKUPDATESLOCKXLOCK

E=�� SQL/A O��$13%)OBU/(,PJ�AL�������

�T���E=C�NS� �AD� � UPDATE O!E=����

EXEC SQL BEGIN DECLARE SECTION; char dynamic_stmt[100];EXEC SQL END DECLARE SECTION;

...printf (”Enter a statement: ”);gets (dynamic_stmt);

EXEC SQL EXECUTE IMMEDIATE :dynamic_stmt;...

�����DDLO�4(,�������Unify DataServer: Writing Interactive SQL/A Queries�

��SQL/A R<�;F�!?I�������

��

Page 56: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

46 /'390)�&5=*�+;>�N]

PREPARE Z� EXECUTE Z��SQL/A Z%MX��LG���� $!�Z��Z%F"\�LG�#� �I`����CREATE DATABASE ?B����� DDL Z%MX��LG��������?A�E�#DML Z����%LG����

COMMIT SET CURRENT SCHEMA

DELETE UNLOCK

INSERT UPDATE

ROLLBACK SLOCK

SELECT �@G�\�$��� XLOCK

SET TRANSACTION

MXZ%LG�#� ��?A�@WV�-105%G������

1. ���������SQL/A Z%D�(:<).7-2[P%K�MXZ%I`����

2. �����������EXECUTE Z%I`����

3. ������������ ������DEALLOCATE PREPARE Z%I`����

�� ������

PREPARE Z�^S%Z�MX4�,;>�CbY����^S�?A�U������"���

+>8=0)^O

(:<).ZJa

T�(:<).ZJa��#(:<).7-2[P

MXZ�^O�(:<).ZJa����7-2[P%I`�#��MXZ�C

�#/'390)^O�HQ�$���/'390)^O������76 6�,�R_����

�������

Page 57: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

475)9>6,G(;D-�/BF�g�

PREPARE |��w���+AC,4=18}k���=18}k�r��SQL/A |���Jy��|�V_��HK�����M&h���p�U26/BF�[��$V_�v����

2>.EFd^{�*;/BF���

|�o�tk��5)9>6,:C@�4�sO�$�������(5)9>6,:C@�4������53<�0HX�l�����)

w�|� SELECT |�"��INTO T�Q ������'�

���� ������ �

fz|&aW�$���EXECUTE |&[�����fz|� SELECT |�"��EXECUTE |� INTO T&]t����INTO T����=18}k�Re\�I�mq %�r&c�b$�&]t����

���� �������������

fz|�tS&N#u�Lh�$���DEALLOCATE PREPARE |&[�����|�N#u�&Lh�$��fz|�tS�Yh %���|��HX�Z

i�`x��#���tS�P��$/17?D3�1!L~����

fz|�N#u��Lh %$��HnP������n&j��|�[��

���

Page 58: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

������

������������&��%�

���� �� ����������( �)��

������

�%&��������'! ������*��

������

�� ���������#�������

���'!�"����

&�,�&�$ ��

orders

48 ��!$����#&���%(�1�@

�D���/+-�;C���,.��� SELECT >�0<��/+�� �0<>�A2��prepared_stmt � �

�0<>��8> �"'7�8>�53�= 436�?�� �>��:

/+���/+������B����-)�� �"'7�8>53�9*

�� �

EXEC SQL BEGIN DECLARE SECTION char single_select[100]; char table_name [44]; int total;EXEC SQL END DECLARE SECTION;

USTATUS msgstat;EXEC SQLWHENEVER SQLERROR EXECUTE ’{printf (”SQLERROR: %s\n”, ufchmsg(SQLCODE, msgstat));}’;

main(){int loop;

printf (”Enter a table name: ”);gets (table_name);

sprintf (single_select, ”SELECT COUNT (*) FROM %s”, table_name);

EXEC SQL PREPARE prepared_stmt FROM :single_select;

for (loop=1; loop<4; loop++){ EXEC SQL EXECUTE prepared_stmt INTO :total; printf (”The total number of rows at this time is: %d\n”,total); /* Assume a time delay before next execution */

}EXEC SQL DEALLOCATE PREPARE prepared_stmt;}

+

Page 59: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

494(9>6,D'<@-�.?C�Uj

PREPARE h�+�3A`Mh��gZ�K%i� SELECT h%Sf��"�RK�#���Om����PREPARE h� SELECT h%Om���gZK%i� SELECT h%Sf��RK����+�3A%Om���^a $�K�268%Tn����

+�3A%Om��Sf SELECT h%RK�#���EF�076<%K���� ��

1. Sfh�kW���+�3A%]I����

2. 076<��!�Sfh�kW%Q� SELECT h%Sf�#���PREPARE h%Om����

3. +�3A%*�<C�#���OPEN h%Om����

4. +�3A�b%:)65�NV�JY�#���FETCHh�DELETEWHERE CURRENT OFh�UPDATE WHERE CURRENT OF h%Om����

5. +�3A%,B�1�#���CLOSE h%Om����

�� ��������

DECLARE CURSOR J�ALLOCATE CURSOR J�9L��(!*-)# ,/$�&.1�9L����(!*-)#"�'0���5�E�4G"�

'0�A6����9L�"�'0�>N�� ,/$�&.1�HM?�

� �3����(!*-)#�A6���"�'0��8@���%1+!

0C2���F<����5�E�"�'0�����%1+!0C2�F

<����5�E�"�'0�KB��(!*-)#�I�������

��=7;�"�'0�KB�:D��������

+�3A�!�b%JY��"�NV�#�!�+�3A%JYGe�+�3A

���]I���� ��JYGe�+�3A�b%JY��"NV�#��

RL���+�3AM[ $#7�;A%JY������

�� ������

Sfh�k_��XH�������Pc��d�k_���$��"��&�

46 =�/�������\l�� ���PREPARE h%Om�� SELECT h%Sf���� ��

��������SELECT�������

Page 60: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

50 1%6;2(�$8?)�+=B�Te

��� ����������

'�/@#&�8B�!���OPEN b#Nk����'�/@#&�8B�!��S` SELECT b#-328��gZ#a��'�/@�Ema��S`b#QJ������'�/@#HM�"�J�f�����

��� ������������������

FETCH b#Nk��'�/@ [#HM����HM�"�[#^X�4�00%8�:-5cW�\�������WHERE CURRENT OF G#O�UPDATE b#Nk���'�/@�Em�!3�7@#IV����_j��WHERE CURRENT OF G#O� DELETE b#Nk���'�/@�Em�!3�7@#LU����

��� �������������!"��� ���

'�/@#(A�.�!���CLOSE b#Nk����'�/@#(A�.�! ������'�/@�Em�!+-3<?/�-#Dd��'�/@�]

F#LU����V�� SELECT b#S`��'�/@#K&�8B�! ������'�/@#V��J�f�� ������

47 9�,� �����Yh������

&�8B�"��!'�/@��5>B*(+=B�RlP�Ci�(A�.�

"���

Page 61: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���� �

���� % ��

���� �

���� ����

��#(* "!

��

���� �

#(* �����-)

���

���� �

���� ������

���� �

������& ����

�����+$'���

��

SELECT co_key, co_name

FROM company

51, 05.%<�29&�'7;�J�V

�Y���F@D�QX����CE��� SELECT T�F@�� ��T�AI�GS���=Z �$�*:�#�2;������F@��� �$�*:���P�4)/UMco_key�co_name�1!.-�����>�29;/��� � .

EXEC SQL BEGIN DECLARE SECTION char select_input[100]; int co_key; char co_name[31];EXEC SQL END DECLARE SECTION;

EXEC SQL DECLARE company_cursor CURSOR FOR a_select_stmt;main (){printf (”What is your query? ”);gets (select_input);

EXEC SQL PREPARE a_select_stmt FROM :select_input;

EXEC SQL OPEN company_cursor;while (1){ EXEC SQL FETCH company_cursor INTO :co_key, :co_name; if (SQLCODE == UEEOSCN) break; printf (”%d %s\n”, co_key, co_name);} EXEC SQL CLOSE company_cursor;

EXEC SQL DEALLOCATE PREPARE a_select_stmt;}

��O�GST��SQL/TP ";(;�HW��� � �";(;����T�GS �8;+ 6NR�?L��� �SQL/TP ";(;�HW���T������87 3�(�BK������

,

Page 62: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

52 &�+0( ��.2!�"15�C�T

�����

� ��

&�+0( ��%3���

=F8P���%3�H<

�Unify DataServer: SQL/AReference��DECLARECURSOR

9�O�8P���%3�

H<

76 /�#�� �-#� *�&�+0( UE�

�Unify DataServer: SQL/AReference�� ALLOCATECURSOR

DELETE , UPDATE, PREPARE, FETCH , CLOSE �:J�>S

�Unify DataServer: SQL/AReference�

��%3��?�

,�('���%3�M ��=F�@D

34 /�#��)�-3��RG?�IL�

��%3�AKB;

(��%36V� 4�$�����)

** ** /�#��&�+0( �-#� *�NWQ7�AKB;�

Page 63: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

531%8>3)F$;C*�,AE�at

����� ���

1%8>3)�9B?�0��q�����h^S[�n] "����`

oq�Wx "���`oq#^S�!k��G�!h1%8>3)9B?�

0�Wx "���

1%8>3)9B?�0#Wx�!�����`oqG�!gV#^S��

��'E7@�+����$;C*�,AE��$;C*�,AE^S�!�

�9B?�0�h#Xi����

��.),AE���\�YT����L_����

1%8>3)�9B?�0�W�t

1%8>3)�9B?�0�5�00%;

1%8>3)�9B?�0b�dQ

(�/D�1%8>3)�9B?�0

1%8>3)�9B?�0#Xi�!���1%8>3)�9B?�0��!Ih�q�)&-2AE=�) (?) #my����

1%8>3)�9B?�0#Z�`oq#^S�!���USING N#Z�EXECUTE q��� OPEN #Wx�����" �q��1%8>3)9B?�0#je�h�Kzp��q#^S����

1%8>3)�9B?�0��u�U�O SQL/A q�<-6sc�lw���������� INSERT q��company 4�:D�fm "!h#Pi�!<-6sc#Wx����

EXEC SQL INSERT INTO company(co_key) VALUES (:ins_value);

<-6sc ins_value �h��^S[�iM "���1%8>3)9B?�0�`oq�l�vJ#H�����\�q#`o��R�fm "!r�h�q

^S�!���my "���

INSERT INTO company(co_key) VALUES (?)

����� �������

Page 64: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

54 6.;A70�->F1�2DH�`�r

6.;A70<EB�5�j�]S�)���@4:qd�&��lQ�*)&

(�O^XvK '$lQ�*!��

O^XvK�&���->F1�2DH 6.;A70<EB�5�sk�d%

5.>+Z�p+I�)&���(!��

�����O^XvK���b�� �59 ?�3JT�O^XvK+Va������

x� ����<EB�5+Z� INSERT p+_o��]S�!��6.;A70<EB�5�j �ins_value @4:qd�&��lQ�*!��

INSERT p+Lh�6.;A70��)� �8�=G%y�tg+/CE05pYy�m"U,������*'�j �]S[�nw��!��

��x� �in�*)j�c�edj�)�Mz�)@4:qd ins_value �ed���fR�*)�#���+gl��!��O^XvK+Wu���i

n�*)j�9�55.>+84:��!���*�&���->F1�2DH

+�'�6.;A70���!��

O^XPN+Wu��6.;A70<EB�5�j+lQ�)x � 71 ?�3�\�!��

Page 65: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

company

(co_key)

22

23

24

25...

�������!����

������$.��

'12-��� �� #

�������3*

���������,+0��

���"4�64/�

&��

�!��)%(5

55�� ��������������

#include <include/rhlierr.h>#include <stdio.h>

EXEC SQL BEGIN DECLARE SECTION char dynamic_stmt[100] , column_value[30]; int ins_value;EXEC SQL END DECLARE SECTION;

USTATUS ustatus;main(){char table_and_column[100];

EXEC SQLWHENEVER SQLERROR EXECUTE ’printf(”Error is: %ld, %s\n”, (long)SQLCODE, ufchmsg(SQLCODE, ustatus));’;

EXEC SQLWHENEVER NOT FOUND CONTINUE;

printf (”Enter a table and column name: ”);gets (table_and_column);

sprintf (dynamic_stmt, ”INSERT INTO %s VALUES (?)”, table_and_column);

EXEC SQL PREPARE prepared_stmt FROM :dynamic_stmt;

printf (”Enter the column value: ”);while (ins_value = atoi( gets(column_value))) { EXEC SQL EXECUTE prepared_stmt USING :ins_value; printf (”Enter another value: ”); }

EXEC SQL DEALLOCATE PREPARE prepared_stmt;

EXEC SQL COMMIT WORK; }/* end of main */

Page 66: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

56 :/@F;2�.CK3�5IM"m��

:/@F;2�BJG�9#E7>�o"' !q\�*)=�99/C#g�

%�-�����:/@F;2�BJG�9"=�99/C#�l��"y��"U��

)��]Tp,g�&"����j�*%��

PREPARE �#�:/@F;2�BJG�9"4M<17>,z$)��!'���"=�99/C,Z{�%��BJG�9�Wki!tb�) (�=�9

9/C#BJG�9!U��)x�(Yc�)�����%��

NR"�#�:/@F;2�BJG�9"=�99/C��"4M<17>!V

����"' !Yc�*)�,Wk�%��

BJG�9"d��� BJG�9"=�99/C

A/@KPc"0DJM?

�UXi"0DJM?

i"y"u"0DJM?�=�99/

C�|�

BETWEEN Pce!^s�)w0DJM?

i"y"w0DJM?�=�99/

C�|�

BETWEEN Pce!^s�)w%�#w�0DJM?

i"y"w0DJM?�=�99/

C�|�

8;>/M2L�6IMK

7>}

w"x"=�99/C�����a

+�"[S��|�

IN k�"~O"x i"=�99/C�|�

�W`��k��ANY, ALL ,EXISTS�"=�99/C!^k�)i����

���a+�"[S��|�

LIKE k�} 1HJ29�f�

UPDATE �"_nx _n�"=�99/C�|�

BJG�9��INSERT �!tb�) (�=�99/C#vQ�)�"=�99/C�(Yc�*%��

Nr"��h" INSERT ��l��*��%���

INSERT INTO company(co_key) VALUES (?);

������ ���������

Page 67: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

57?4EKA8R3HO9�:MQ&k��

?4EKA8�FNL�>��company B�GP&� co_key %s{�/ �.w! .&!�?4EKA8�FNL�>&C�>>4H'�� co_key "z�!��

.m]%'�f%85<@MQ�J�81by�.�"%,� C�>>4H

1pZ!�)���"�(�>4H 0 'qo$&!�d&~'�?4EKA8�FNL�>&C�>>4H1qo%�)��

SELECT (0 + ?) FROM company;

���� ?4EKA8FNL�>'Xha�T!+`��/)��Xha�T%`��%

�� &r�'�59 I�;&�Xha�T1_l� �����

i|~%'�SU&#&m]!+?4EKA8FNL�>1`��.�"�!�

)�2�

SELECT Y&x%�/en��� .�f&t0-%�

v\& + )�' – &6INQD! ."�

BETWEEN h}%u"u�6INQD��1W*��)�'u"u�6INQD��1W*"�

IN h}%f"^j&w1W*"�

?4EKA8FNL�>'7�=P%V��.i|~%`0/)��i|~�g[�/."��7�=P�6�HQ�/."���85<@MQJ�8&t0-

%�FNL�>&w�t{�/)��

USING Y1c� OPEN ~1`�� �?4EKA8FNL�>1c�i|~"V��.7�=P16�HQ�)��

������������

��������������

Page 68: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

� �&,�. ���

��(#��

���������

��&,.�%$��

����������)�+"��

&,.������!1

-���

������)�����

���� )����/

'�*��

SELECT co_key, co_name

FROM company WHERE

co_key > ?

3

58 "�$'#���&+���)-�5:

�<���402�8;���13��� SELECT 9�40�� �"�$'#�%*(�!�6�402�8;��� �"�$'#�%*(�!�6�WHERE /������ ,���&-�����7.��� �

EXEC SQL BEGIN DECLARE SECTION char dynamic_stmt[100]; int co_key, key_value; char co_name[31], linein[80];EXEC SQL END DECLARE SECTION;

EXEC SQL DECLARE company_cursor CURSOR FOR a_select_stmt;main (){EXEC SQLWHENEVER SQLERROR EXECUTE ’printf(”Error is: %ld, %s\n”, (long)SQLCODE, ufchmsg(SQLCODE, ustatus));’;

EXEC SQLWHENEVER NOT FOUND CONTINUE;

printf (”What is your query? ”);gets (dynamic_stmt);

printf (”Keys greater than? ”);key_value = atoi (gets(linein));

EXEC SQLPREPARE a_select_stmt FROM :dynamic_stmt;

EXEC SQL OPEN company_cursor USING :key_value; while (1){EXEC SQL FETCH company_cursor INTO :co_key, :co_name; printf (”%d %s\n”, co_key, co_name);}

EXEC SQL CLOSE company_cursor;

EXEC SQL DEALLOCATE PREPARE a_select_stmt;}

0

Page 69: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

597+>E9.L)BI/�1GK�c }

�����

R`\�M��7+>E9. SQL/A x�;�6'R`�$e|'Pv�$A*�J=T���R`\�M'[����awx�"z�%��!�awx�

rS�%$7+>E9.@HF�6����e|'{]����

����^� SELECT x'7+>E9.�_Y�$�����

SELECT * FROM COMPANY;

Zb��x'aw����^��jm�%�Y'{]�$-�5J'iV��

���%�"�pd�-�5J�"Ns��Y'A,98��������jm

�%$�n�;�66+B�&�"����n'Pv�$� �C2<yf�

iV�}~�&�#��(�

���l'OU�$���R`\�M'[�����R`\�Mx'[��$�

���jm�%������ku�%$���R`'R`\�M�o�����

���R`\�M�).42���Q��$C2<yf�;�66+B�0+

3'Uq� ���

e|�R`\�M�Pv�%�W����e|'yX��#�).42�$��

�� ���

��g���^�t����h�����

R`\�MA*�J=

R`\�M'[��$2:9B

R`\�M?K=J

R`\�MD+K6

Page 70: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

60 ,'04-(�%37)�*69�MY

?ALH];��COUNT 2&�8/<���$J��^�O$IT����?^ ��������2&�8/����^�.�+AL�#���

ALH];XJ�"^O��ALH];$@!U�"��CT�#���

COUNT 2&�8/��ALH];�DF�#� ��^OAL�#��"�$K����:=�N����� COUNT$J�ALH];$K����

������ � ������ � ������ �

��������� �

���� ����� �������� ���� �������� ������� ���� ���

������ � ������ �

ALH];2&�8/$:=�Q\�AL����

COUNT COUNT 2&�8/��ALH];�S�^�O$K������2&�8/�.�++'3��PO���

TYPE 2&�8/��^�.�++'3$K������2&�8/�.�++'3��POR���

POR��Z�E�B SQL/A W�G[�"��V>�151-($J������

��������

Page 71: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

61"�'/#�8�-4���27�J�V

9;�T��TYPE ,��5&O�?Y�$�!!�-���6�&�H��

�������� ���������

$�!.� X!�-

!�-,��5&O R<�(0(#�

character, char 1 SQLCHAR

numeric(5–9), decimal,dec, integer, int

2 SQLNUMERIC

smallint, numeric(1–4) 5 SQLSMINT

float, double precision

8 ���������

real 7 SQLREAL

date –3 SQLDATE

amount –4 SQLAMOUNT

huge amount –6 SQLHUGEAMT

time –7 SQLSMTIME

text –9 SQLTEXT

binary –10 SQLBINARY

huge date –11 SQLHDATE

LENGTH LENGTH ,��5&��$�!��13�!� ��X$�!�P��H��P���)5�!�/*�!�@�������,��5&�$�!!�-

�MK��

�13�!9=�$�!!�-�����,��5&�QB������

��,��5&��AIFW:�NQ� ��$�!,��5&�>S���

$�!�+�%K�LD��$,�5%O��?Y�X��CHARACTER$�!�UGX�P���

LENGTH ,��5&�CE�+�%K�NQ����

Page 72: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

62 .'27/(�%6;*�+9>�Rb

PRECISION PRECISION 5&�<1��Ic�0�--'6 AMOUNT, DECIMAL,DOUBLE PRECISION, FLOAT, HUGE AMOUNT, INTEGER, NUMERIC, REAL,SMALLINT �SJ�g0�-�V\#O������0�--'6��UT���

X�����0�--'6�����5&�<1�[G "��$�

SCALE SCALE 5&�<1��g0�-�,*�<#O������5&�<1�0�--'6��UT���

,*�<�?C�0�--'6�Dh����

0�--'6 ,*�<

DECIMAL, INTEGER, NUMERIC, SMALLINT @P #W[�!

DOUBLE PRECISION, FLOAT, REAL 0

AMOUNT, HUGE AMOUNT 2

X�����0�--'6�����5&�<1�[G "��$�

NULLABLE NULLABLE 5&�<1��g0�-�Dh�!g2<Y#N�����#O������5&�<1�Y 1 ��#E�������Y 1 ��0�-Ic3<��!��#O����

INDICATOR INDICATOR 5&�<1��FQLfB�0�-#^Z�!������FQLfB��.'27/(4:8�-#M[�!��A��H`��Ke "�����5&�<1�0�--'6�=>)UT���

FQLfB�0�-#^Z�!��FETCH _�]d��INDICATOR 5&�<1��g�Dh�!'>0&*�-aT�Y�W[ "���

Page 73: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

639/>F:3N-BJ4�5HM�i�}

Uhb�Q 9/>F:3@IG�8�r+cu�)�&�a��*$��

NULLABLE A.�K=� 1 �pu�*��)l\�INDICATOR A.�K= �9/>F:3�@IG�8�?K�pu�*)�DATA A.�K=�r�pu�*)+cu�$��

��A.�K=�1B5HM �nmr 0 –1 ���~&^%X-BJ4�5HM z� �2�L�= IND_NULL IND_NORM +a��)�����$��

1B5HM 2�L�= q�

– 1 IND_NULL @IG�8�?K�pu�*)�

0 IND_NORM @IG�8� DATA A.�K=�r�pu�*)�

INDICATOR A.�K=�;A0K<r –1 ���

DATA DATA A.�K= ��;�8�r+T%$��TYPE�LENGTH�PRECISION�'" SCALE A.�K=��8/B�t��ov�'"74�K��*�*�r+Zu�$��

DATA A.�K= �Uhb�Q�;�8+ys�)�$� �Uhb�Q(9/>F:3@IG�8+cu�)�P��W{��a��*$��

Uhb�Q�;�8+ys�)��FETCH z�x���INDICATOR A.�K=� O1 �NULL�+cu���*!�DATA A.�K= gR�*�r�pu�*$��

Uhb�Q�9/>F:3�@IG�8�r+cu�)�&�a��*)��

INDICATOR A.�K=� O1 �NULL�+cu���*!��� DATA A.�K= �9/>F:3@IG�8�r+cu�$��

TEXT '" BINARY ;�8�S���DATA A.�K= f;�8r#�E/M8+e�$��DATA A.�K= �8/B utxtptr $� ubinptr �D7<|m���w_�$��25 C�6��*(�;�88/B�S�)Y]+`j�� ����

NAME NAME A.�K= ��[��S��)���k+T%$����A.�K=�;�88/B zd��������*!���A.�K= uV�*$�

,�

��A.�K=+pu�)�� ��$�,�

Page 74: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

64 4,9?5.�*=C/�0AE�a�{

�����

��

�m�6�33,=�

q�� $ gt

�Unify DataServer: Writing InteractiveSQL/A Queries��6�33,=�:Dm�Y��

:Dm �Unify DataServer: Writing InteractiveSQL/A Queries��6�33,=�:Dm�Y��

,E6+/�3ye �-B��dRSW��b

BINARY $ TEXT>17ye

�}#V"Q*=C/�0AE�a�

{��b��TMf�'6�33,=�

N|r��*=C/�0AE�[���(��~r��P^Z�H�%cz)S

X�'���v����

sh�>17ye�kJ�'�m�Io��'$���'���_u

SELECT x�il�('��P^�v����

_u SELECT, UPDATE, INSERT , DELETE x)]U�'���4,9?5.;B@�3�P^�6�3m�v����

*=C/�0AE�P^Z�H�%�G�6�3)SX�'j��*=C/�

0AE��P^Z�H)`OL��m)��p� �� �v��&!��F

K�w��P^Z�H�m)n�x�P^Z�H�%m)SX�'x)\���

�x�P^Z�H���<+�D8)*.21��'�)\�!��

�������

Page 75: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

65+$04,%;"38&�'6:�M[

������� �

G^��X S!OT��2#�9/

DESCRIBE OUTPUTDESCRIBE INPUT

DATA 2#�9/� INDICATOR 2#�9/<?�2#�9/

SET DESCRIPTOR NAME 2#�9/<?�2#�9/

EXECUTE INTOFETCH INTO

DATA 2#�9/� INDICATOR 2#�9/��

����������

G^��X S!OT��2#�9/

GET DESCRIPTOR ����2#�9/

OPEN USINGEXECUTE USING

DATA 2#�9/� INDICATOR 2#�9/��

BJH_>!G^�����BJH_>�@a��KWX+$04,%17

5�*!A������=Q����

BJH_>�+$04,%175�*A� �����"38&�'6:�B

JH_>!G^��+$04,%175�*�S!UC����

BJH_>�+$04,%175�*A� �� ��"38&�'6:�B

JH_>!G^���@a��KWX�PR �`�����NZ!YI�

���

��)%'6:������(-,3�),.!BJ����EL�),.�

��KW SELECT X �����NZ!DF��BJH_>�G^[\!BJ�����V]�),.���+$04,%175�*!I�KWX�BJH_>

�G^[\!BJ����

Page 76: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

66 *#04+%�!28&�'6;�Se

� SELECT ������ ��

DPKg=�Jf �Qa SELECT b�����Wd�EH��(,+2�<>�DP ���

1. ALLOCATE DESCRIPTOR b�Jf �DPKg=�B�^����

2. DESCRIBE OUTPUT ��� SET DESCRIPTOR b�Jf �DPKg=�RCY] ���

3. EXECUTE INTO ��� FETCH INTO b�Jf �DPKg=�-�)[�\���

4. GET SQL DESCRIPTOR b�Jf �DPKg=��[�A_ ���

5. DEALLOCATE DESCRIPTOR b�Jf �DPKg=�B�^��?T ���

����b��DPKg=�$57%)bMi�$57%)3(.cX� �I

U�����

DPKg=�B�^�

ALLOCATE DESCRIPTOR b�Jf �DPKg=�B�^����SQL/A DPK�B�^��VF���WITH MAX $�:�/�Jf �DPKg=N�-�)[�i�GZX�L] ���

DPKg=�RCY]

DESCRIBE OUTPUT b��Qab�Oh�i�DP ���i�DP��L]���DPKg=�`\�����DATA 1"�9/�`\���-�)����� �

SET DESCRIPTOR b��NAME 1"�9/<@�����1"�9/�[�Y]��������

(,+2 ��

ステップ ��

Page 77: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

671(8<3+A&:>,�-=@�Wm

HURrB��5�0b�`d

EXECUTE INTO j��Vhj%SL��_��s�5�0b%HURrB�gc����

FETCH INTO j��Vhj�Gt�"*�/?� �b%9)32��5�0b%HURrB� DATA 9'�?7�gc����

��#�ZM���Gt�" INDICATOR 9'�?7�(@5',�0k]�b�`d #���

HURrB� �b�Df

GET DESCRIPTOR j��HURrB� [l%JO����HURrB�����9'�?7� 5�0%JO�"������

HURrB� b%JO�"ZM��KF^��"5�00(:�;.6k]�

b%gc���� ��TYPE 9'�?7%Qn��JO #�b�5�00(:%Id����

HURrB�E!e�CX

HURrB�io���#��DEALLOCATE DESCRIPTOR j�E!e� #�HURrB�E!e�%CX����

HURrB�E!e�%CX�"a$!��HURrB�\��b%`d�"�

��HURrB%Npn�����.43: 2 %PY�

&:>,�-=@Tq�"��E!e� #�HURrB�E!e��CX

#���

.43: 3:

.43: ��

.43: 5:

Page 78: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

SELECT * FROM company

WHERE co_key=4

&!%1�" 5�(

4���

���� �

(45�#.���=�,8

� '$;��)�����

���� �

���6- �3:7�

��=� ���������/���0���

���� �

����� ������������

9+� '$;����0

���

���� �

'$;����0���

*���

���� �

'$;����/�2

���

68 #�'+$���)/ �!-2�>H

��K���DESCRIBE OUTPUT F�9I��7<:J3 company_descriptor �=65�� ��� GET DESCRIPTOR F�9I��B��.,(co_name)�7<:J3� DATA (��0&C�*"%G@�AD�� �(��1�& SQL �47�F���)!-2� �;���KFE����1�& SQL �9I�����?8��� )

ALLOCATE DESCRIPTORDEALLOCATE DESCRIPTORGET DESCRIPTOR

EXEC SQL BEGIN DECLARE SECTION char dynamic_stmt[80], company_name[31], name[31];EXEC SQL END DECLARE SECTION;main(){printf (”Enter a dynamic statement: ”);gets (dynamic_stmt);

EXEC SQL PREPARE prepared_stmt FROM :dynamic_stmt;

EXEC SQL ALLOCATE DESCRIPTOR ’company_descriptor’ WITH MAX 22;

EXEC SQL DESCRIBE OUTPUT prepared_stmt USING SQL DESCRIPTOR ’company_descriptor’;

EXEC SQL EXECUTE prepared_stmt INTO SQL DESCRIPTOR ’company_descriptor’;

EXEC SQL GET SQL DESCRIPTOR ’company_descriptor’ VALUE 2 :company_name = DATA;printf (”name is %s\n”, company_name);

EXEC SQL DEALLOCATE SQL DESCRIPTOR ’company_descriptor’;

EXEC SQL DEALLOCATE PREPARE prepared_stmt;

}

<

Page 79: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

69.'49/)A%7>*�+<@�[p

�� ������������������

.'49/)5=:�-#U�Ylm��KXRsC�Qrpq�Dkg�,

0/7#BE�V ���

1. ALLOCATE DESCRIPTOR m#Qr �KXRsC#I h����

2. DESCRIBE INPUT ��� SET DESCRIPTOR m#Qr �KXRsC#ZJaf ���

3. EXECUTE INTO�FETCH INTO���� SET DESCRIPTOR m#Qr �KXRsC� DATA 6&�?3�c#i"� �af ���

4. EXECUTE USING ��� OPEN USING m#Qr �Ylm#WM �.'49/)5=:�-#Sf ���

5. DEALLOCATE DESCRIPTOR m#Qr �KXRsC�I h�#G\ ���

�"��m��KXRsC�(;=)-mTt�(;=)-8,2n`� �P

]�"���

KXRsC�I h�

ALLOCATE DESCRIPTOR m#Qr �KX sC#I h����SQL/A KXR#I h�!^N���WITH MAX L#Qr �KXRsC�oU�!1�-c�t�Ob`#Sf ���

KXRsC�ZJaf

DESCRIBE INPUT m��Ylm�.'49/)5=:�-#KX ���.'49/)5=:�-�KX��Sf�"�KXRsC�jd�"���DATA 6&�?3�i!1�-�� ��$�

DATA 6&�?3��e_������af�"��� SET DESCRIPTOR m#Qr � DATA 6&�?3ZJF�!�������DATA 6&�?3�c#af ��!^N��INDICATOR 6&�?3� 0#S ��!��#H�������

,0/7 ��

,0/7 ��

Page 80: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

70 8.>B:2�,AF3�4DH�f |

Sb\�J"�<�7o�vp$��mr

SET DESCRIPTOR z��Sb\�J�o+mr��'�{V� $��SETDESCRIPTOR z��NAME @-�G=IO��#��@-�G=�o+mr�(���� $��DATA @-�G=�o+mr�(jX��[}�(o�<�77.A+ LENGTH, PRECISION, SCALE, %! TYPE @-�G=�%��]r�)(<�77.A�Kq�������

EXECUTE INTO z$�� FETCH INTO z���)&�UM�8.>B:2?EC�7�[}�)(o��(� �[}� $��

EXECUTE INTO z��cwz+^W��l����<�7o+Sb\�J�u)$��

FETCH INTO z��cwz�Q��(1�6G�&�o+@/:9��<�7o+Sb\�J�u)$��

��5;:A���������8.>B:2?EC�7�o+sT�(@-�

G=+eRL�$��

cwz�^W�8.>B:2?EC�7�]r

Sb\�J��EXECUTE USING z�8.>B:2?EC�7o+]r�(���� $��?EC�7�o��yS�)�dg�Sb\�J�&_'a�)

$��

OPEN USING z��8.>B:2?EC�7�1�6G+0�AH�$��?EC�7�o��Sb\�J�&_'a�)$��

Sb\�J�P't�Nh

Sb\�J�x~����) �DEALLOCATE DESCRIPTOR z�P't�&)�Sb\�J�P't�+Nh�$��

Sb\�J�P't�+Nh�(n*'��Sb\�J�k�o+]r�(�

��Sb\�J+Y�}� $�������+Zi��

,AF3�4DH�`��(��P't�&)�Sb\�J�P't��Nh�

)$��

5;:A 3:

5;:A ��

ステップ ��

Page 81: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

SELECT co_key, co_name

FROM company WHERE

co_sales_rep = ?

3

������ +���

���� �

���0���)� �

"���

���� �

��������0��

& �/�� +, ��

���

���� �

�������������������

�.#���0� ��

)���

���� �

+,�� ���0

�*'���

���� �

���-$������ ������

&�!���& %

(���

71��!%��+�#)���'*�5�;

��=���DESCRIBE INPUT �$* �/< �49:���!%��"(&���08��������,7�-3�� SELECT :�2.1�49� ���68���

EXEC SQL BEGIN DECLARE SECTION long key, new_sales_rep; char dynamic_stmt[80]; char name[31];EXEC SQL END DECLARE SECTION;

main(){char salesrep[40];

printf (”Enter a select statement: ”);gets (dynamic_stmt);

EXEC SQL PREPARE prepared_stmt FROM :dynamic_stmt;

EXEC SQL ALLOCATE SQL DESCRIPTOR ’company_descriptor’ WITH MAX 22;

EXEC SQL DESCRIBE INPUT prepared_stmt USING SQL DESCRIPTOR ’company_descriptor’;

printf (”\nEnter a sales rep number: ”);new_sales_rep = atoi(gets(salesrep));

EXEC SQL SET SQL DESCRIPTOR ’company_descriptor’ VALUE 1 DATA = :new_sales_rep, INDICATOR = 0;

EXEC SQL EXECUTE prepared_stmt INTO :key, :name USING SQL DESCRIPTOR ’company_descriptor’;

EXEC SQL DEALLOCATE SQL DESCRIPTOR ’company_descriptor’;}

1

Page 82: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���� �

���������

���� �

���������

� �����

72 2*6<3,�(:@.�/>C�W�`

][(:@.�/>C�FUOcD&Nb�$ZK�FUOcD7C5A&Nb

�$���!����'��(:@.�/>C�89+�;C0&IY �$�

������

FUOcDa&��7C5A�E#\�%��FUOcDa&MX��$_��

%���_���� �FUOcD&��7C5A�!��MX�$����

���FUOcD�7C5A&Nb�$���P� 3 ��SV&J����

�� 7C5Aa&4�1G UDAHNDL ���������

�� 7C5Aa&FUOcD��������

�� DEALLOCATE �DESCRIBE�EXECUTE�FETCH�GET�OPEN�SET �_�������7C5Aa�FUOcD&������

P�:B-?=��FUOcD7C5A&Nb��FUOcD&MX�����

�:B-?=� SELECT _&^�L'�QJ��FUOcD" 1 H�9)�A5&R#T����

#include <rhli.h>#include <rhlierr.h>

EXEC SQL BEGIN DECLARE SECTION char dynamic_stmt[80], company_name[31], name[31]; int count_columns; UDAHNDL da_ptr;EXEC SQL END DECLARE SECTION;

main(){printf (”Enter a dynamic statement: ”);gets (dynamic_stmt);

EXEC SQL PREPARE prepared_stmt FROM :dynamic_stmt;

EXEC SQL ALLOCATE SQL DESCRIPTOR ’company_descriptor’ WITH MAX 22;

EXEC SQL GET :da_ptr = SQL DESCRIPTOR ’company_descriptor’;

EXEC SQL DESCRIBE OUTPUT prepared_stmt USING SQL DESCRIPTOR :da_ptr;

� �����

Page 83: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���� �

����������

���� ����

73������!������� �(�*

EXEC SQL EXECUTE prepared_stmt INTO SQL DESCRIPTOR :da_ptr; VALUE 2 :company_name = DATA;

printf (”name is %s\n”, company_name);

EXEC SQL DEALLOCATE SQL DESCRIPTOR ’company_descriptor’;

EXEC SQL DEALLOCATE PREPARE prepared_stmt;}

�����"$� SQL/A )� �%'&� ������ �+#�����

ALLOCATE DESCRIPTOR , DEALLOCATE DESCRIPTOR , DESCRIBE,EXECUTE , FETCH , GET, GET :descriptor, SET

Page 84: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

74 8.=D91�,@H3�4GL�h�|

Ug`�N� DATA ?-�I<��Ug`?-�I<�Ug�)(Z��!'��:�7*Px�(?-�I<���BINARY $ TEXT MO�:�7��j[�Ug`�N�:�7?-�I<*�:�7,<J5*a�C.L7�r�R�(

�����!��:�7*a�C.L7���*�DATAPTR ?-�I<�X !��

c�k��DATA ?-�I<��� DATAPTR ?-�I<*b�Ug`�N*d���!��

������ � ������ � ������ �

���� ����� �

���� ����� �������� ���� �������� ������� ���� ������

������ � ������ �

DATAPTR ?-�I<�w���:�7q*Px��(B5;{l*a�C.L7���

Ug`�N�:�7?-�I<*a�C.L7*_��)��GET �SQLDESCRIPTOR�z�_����(/�>�A9<*]V�(�����!��

GET SQL DESCRIPTION *_�� DATA ?-�I<q*e'f�B5;{l�Px�(���� �EXECUTE z$ EXECUTE IMMEDIATE z�sY�B5;{l�sm,165��(&���

� DATAPTR ?-�I<*_��(j[�DATAPTR ?-�I<�C.L7�%��^i�)(:�7*Px��(���EFH*Q'v�(y���'!��

DATAPTR ?-�I<�T~u�nW|}�_�|}��c��'���

�� 0�K�< USING DATAPTR * ALLOCATE SQL DESCRIPTOR z�o"\#���%���DATA ?-�I<��� DATAPTR ?-�I<*Ug`�N�_��(��*at�!� (TEXT �� BINARY ��j[�DATA ?-�I<*_����)��'!�+)�

�� :�7*Px��(B5;{l�EFH*Q'v�!��4L2Iq�j[�

{lnW�%��EFH*Q'v�(�����!��p��q�j[���

malloc ���EFHQ'v�Sl*_��(y���'!��

�� :�7�_��(B5;{l* SET SQL DESCRIPTOR z�at�!��

��������

����

Page 85: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���� �

������ ��

����� ����,

���� ���� ��+�(/

���

���� �

���2)3� !�$�0

��������&�

*)�������� �

��'-�"����5)�

������

���� �

���2)#.�����

%61���

75���#��(�!%���$'�0�2

��5���72 "�� *,�*/.4)5�-3���������DATAPTR ��&��-3��� 1+�����

#include <include/rhlierr.h>#include <stdio.h>#include <signal.h>

EXEC SQL BEGIN DECLARE SECTION char dynamic_stmt[80], company_name[31], name[31]; char company_key_name[20]; int count_columns, inx; long my_count; UDAHNDL da_ptr;EXEC SQL END DECLARE SECTION;

main(){

USTATUS ustatus;int keyid[10];

printf (”Enter a dynamic statement: ”);gets (dynamic_stmt);

EXEC SQL PREPARE prepared_stmt FROM :dynamic_stmt;

EXEC SQL ALLOCATE SQL DESCRIPTOR ’company_descriptor’ WITH MAX 22 USING DATAPTR;

EXEC SQL DESCRIBE OUTPUT prepared_stmt USING SQL DESCRIPTOR ’company_descriptor’;

. . . for (inx=0; inx<10; inx++) { EXEC SQL SET SQL DESCRIPTOR ’company_descriptor’ VALUE :inx DATAPTR = ’&keyid[inx]’; }EXEC SQL EXECUTE prepared_stmt INTO SQL DESCRIPTOR ’company_descriptor’ ;

EXEC SQL DEALLOCATE SQL DESCRIPTOR ’company_descriptor’;

EXEC SQL DEALLOCATE PREPARE prepared_stmt;}

4

Page 86: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

76 ;.?C<3�-AG4�6EI ]�l

����� ����� ������� �����

;.?C<3n_!B8=ka jXs+Vo���Y�Z�m%R$P

SQL/A 0@7/3= ��+U^�#��

\hj

O[WqK

1�9H

�*' 0@7/3=+U^�)B8=ka 2DF3:jXs+Vo���S

poLg�5�>+]������#�����"�j+\h�)Na!�J�

)nc�J�)j+\h�)�����#��

\hj+;.?C<3�n_i�)�!�jXB8=ka jXs+Vo�#

��O[WqK n_!�2DF3:B8=ka 2DF3:jXs���

��O[WqK n_!�`�;.?C<3���

1�9H+;.?C<3�n_i�)�!M(e�1�9H+Tb��M(e�

1�9Hn�!B8=ka 2DF3:jXs+Vo�#��

PREPARE j+Vo��n_�\hj+Nti�)�����#��j�\h�*�Q�� n_+Vo��U^�)�����#��

� r�!�j+f$R,�\h��big_select ��B8=kaj n_�Nti��#��\hj!�d��big_select��)B8=ka �jXs�big_select��&��U^��#��

EXEC SQL BEGIN DECLARE SECTION; char statement_name[20]; char dynamic_stmt[80];EXEC SQL END DECLARE SECTION;

...gets (dynamic_stmt);

strcpy (statement_name, ”big_select”);EXEC SQL PREPARE :statement_name FROM :dynamic_stmt;

���

Page 87: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

774*7:5-A)8>.�/<@�Y�i

��o�!�f'c K(�Xd����Xdf'�little_query ����j[�����

EXEC SQL BEGIN DECLARE SECTION char statement_name[20]; char dynamic_stmt[80];EXEC SQL END DECLARE SECTION;...printf (”Enter a statement: ”);gets (dynamic_stmt);...EXEC SQL PREPARE ’little_query’ FROM :dynamic_stmt;...

fR906g\�j['k�%���� ALLOCATE DESCRIPTOR f�,;=-3fRp���GWPmD�j['Fqe ���BI�Fqe �&�I�GWPmD��NZ������j['Ol�������

��o���906g\ descriptor_name �"��je #&%GWPmD'E$b����da_count g\��GWPmDGW��%p�L`\'Qa����

EXEC SQL BEGIN DECLARE SECTION; char descriptor_name[20]; int da_count;EXEC SQL END DECLARE SECTION;

strcpy(descriptor_name, ”DA”);da_count=30;

EXEC SQL ALLOCATE SQL DESCRIPTOR :descriptor_name WITH MAX :da_count;

,;=-3906g\�j['k�%���� ALLOCATE CURSOR f�fRp���GWPmD�j['Fqe ���ALLOCATE CURSOR f�UJT�+�2?'M]����_�Vn�+�2?�C�$�E$b�+�2?�

^H���(�

E$b�+�2?�Xdf�Fq����Xd SELECT f#M]�&%J�156�+�2?�hS�&���

� �

��������

Page 88: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

78 �������������� �#�(

��* �'�!+������������)$�&��'�"%��

EXEC SQL BEGIN DECLARE SECTION; char statement_name[20]; char dynamic_stmt[80]; char cursor_name[20];EXEC SQL END DECLARE SECTION;

strcpy (cursor_name, ”my_cursor”);strcpy (statement_name, ”delete1”);strcpy (dynamic_stmt, ”DELETE orders WHERE ord_number=10002”);

EXEC SQL ALLOCATE :cursor_name CURSOR FOR :statement_name;

EXEC SQL PREPARE :statement_name FROM :dynamic_stmt;

Page 89: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

79��!# �+�"(���&*�7�=

������������� �

")���%��38�-<�.@�����")���%��9�2� C ")�'$�: 4?���� ���,/��stored_procedure��;0 �

create numeric procedure stored_procedure ( numeric val ) as (beginreturn (val + 1);end

);

��A��stored_procedure �1�6=>�5����

EXEC SQL BEGIN DELCARE SECTIONlong ssparam, spresult;char dyanmic_stmt[80];

EXEC SQL END DECLARE SECTION;

main (){strcopy (dynamic_stmt, “EXECUTE stored_procedure(?)”);

printf (”Enter the integer parameter: “);scanf (”%d”, $spparam)

EXEC SQLPREPARE prepared_stmt FROM :dynamic_stmt;

EXEC SQLALLOCATE SQL DESCRIPTOR ‘parameter_descriptor‘ WITH MAX 22;

EXEC SQLDESCRIBE INPUT prepared_stmt

USING SQL DESCRIPTOR ‘parameter_descriptor‘;

EXEC SQLSET SQL DESCRIPTOR ’parameter_descriptor’

VALUE 1 DATA = :spparam,INDICATOR = 0;

EXEC SQLEXECUTE prepared_stmtINTO :spresultUSING SQL DESCRIPTOR ’parameter_descriptor’;

Page 90: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

80 �� ��������������

EXEC SQLDEALLOCATE SQL DESCRIPTOR ’parameter_descriptor’;

printf (”The sotored procedure returned %d\n”, spresult);}

Page 91: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

817*<B8/I)@E0�3CH�p��

���������� ����������

h����7*<B8/,?4+/:���]�X SQL/A �1H9.5:��|_�� �

yZ-�6F

R#��-�6F

n��

Vmd�M

,?4+/:����L��,?4+/:�����%$�M� ���,?

4+/:��br���T� $,?4+/:&�� $����� �

,?4+/:�f{gS��,?4+/:�`v�%$g�"aq�%$g��

�gS�SQ� ���f{gS��,?4+/:���������'�

%"�W���)@E0�3CH��u�>(*F����%$����l�

� �JN�P�&i�� �

,?4+/:�zo� 1H=*Fg�br��$����,?4+/:����L�Y��%� �

,?4+/:�j[g�br��$����,?4+/:�f{gS�Y��%� �

yZ-�6F����L��1H=*Fg�|_�� �DECLARE CURSOR ��"1H=*F~K�k���&�L��� �yZ-�6F��}�1H=*F~K�"br $������'�

1H=*F~K&U�:DH2/3CH�Oc $���yZ-�6F���f

{gS&Oc�� �����-�6F�f{gS�JN�*AH:���%�

�w�����k��� �

COMMIT WORK �� DEMOTING .�G�;&e� $��!��:DH2/3CH�k������s\�:DH2/3CH�k������DEMOTING .�G�;�!��� ��,�@H�%��$-�6F��h�:DH2/3CH����,�@H�%��$-�6F��h�:DH2/3CH����,�@H�%�����#� �

-�6F���t��n���j[�^x��%� �

�����

Page 92: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

82 4(8=5,�':A-�0?D�az

K#t�*�2B�r|vG��^Q\�qN %��� ALLOCATECURSOR x�"COMMIT WORK x�DEMOTING +�C�7&Yq�$���!��6@D/,0?D_}�����eR�6@D/,0?D�_}��

&vG������%�!������)�:D���$*�2B�]�6@D/,0?D�� �)�:D %������

K#t�*�2B��':A-�0?D�m�.D9(BvG�"Vc�$��

����

K#t�*�2B��ALLOCATE CURSOR x^Q�$����[k\L&IX����K#t�*�2B�[k\L��COMMIT WORK x�DEMOTING +�C�7&Yq�$���!��6@D/,0?D_}�����eR��6@D/,0?D_}�$��_}����

`wx�r|vG�� x�Yq %�`wx�{d�Fl����`wx�{d��]�{d�������Ug %�#�Vc %���

0D<A5,{d

{d&M�+>@,3xZ~����o{d��$+>@,3;16yf

����� & �����#$

0D<A5,{d�Vc %$`wx�r|vG��.D9(B\���lT�

���PREPARE x&M�.D9(BnE�hu�"SP��&vG�������� ��`wx&iO�$j�Vc�$������

��� �$�'������%!�����#$

4(8=5,{d�Vc %$`wx�r|vG��^Q\�qN %���

PREPARE x�^Q %$\s�"]���%��^Q�\s��Jp %���

`wxK#t�&Hb %$�

`wx��DEALLOCATE PREPARE x&W|��K#t�&Hb %���

��"�����

�#$

Page 93: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

837*=B8/M(?F0�2DK�q�

���t�{��&p��$��d��%$�

`v�p������N����Re�%���

���t�,�?K-�5G�d��%���%�������t�_

�����'�

COMMIT WORK �� DEMOTING .�J�<&g}�$���!��;EK1/2DK�n� ����u^�;EK1/2DK�n��$�

DEMOTING .�J�<��-HK;;EK1/2DK��i�%$�����{~I8/��k�;EK1/2DK�Z�I8/�]S�%$��&l ����%�������p��%��&(/9)L����

i�$���[P�i����

������

p���iyjV��PREPARE ��"Re ���

p����iyjV�V�EXECUTE ��DESCRIBE ��d��$�������p���W��$-�5G��p���iyjV�V�,�?K�%��

�%��#��'�p���iyjV��{� PREPARE ���t&�"%���������U#��&Qr�%���n� ���

��p��%$���%�cs ��$����:�6@�4�,>3+/;

��COMMIT WORK �� DEMOTING .�J�<&g}�$���!��;EK1/2DK�n� ����u^��;EK1/2DK�n��$��:�

6}YI8/&T� ���

Xof�O���N��m\j�za ���Xof�O��N�iyjV��ALLOCATE DESCRIPTOR ��m\�%$��Re ������N�iyjV��DEALLOCATE DESCRIPTOR ��m\�%$��� ���DEALLOCATE DESCRIPTOR ��m\�%�%��(?F0�2DKn�j����N�iyjV�n� ���

Xof�O��.CE/6�h� A4;�w�|� �7*=B8/�g}�

%���Xof�O��ALLOCATE DESCRIPTOR ��bx�%��t��"%���

��� �

Page 94: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

������������

��������

�� ����

SELECT co_key,

co_name, co_city FROM

companySELECT ord_company,

ord_ship_via FROM or-

ders

OR

84 ( -/)"��.1#�$03�DU

����

��H�����E�( -/)"SQL/A 6P�A�8J�X�:< �����

��X���30 Y���S�( -/)"SELECT R�K= ���S���Y�' .��GF;�R?;����������

OW����� SELECT R�5L�A ���CQ SELECT R�:B>��:B>V4�N�����!�&2�1'�3M�T@ ���7Y�+�''

.��.13,���I���+�'' .�9 �*%,�����

#include <include/rhlierr.h>main (){int i;

EXEC SQL BEGIN DECLARE SECTION char stmt_text[100], stmt_name[10] char cursor_name[10]; char name1[31], proj_string[31]; int proj_count, proj_numeric int proj_ind, loop_index; int proj_type;EXEC SQL END DECLARE SECTION;

EXEC SQL DECLARE dyn_cursor CURSOR FOR dyn_stmt;

EXEC SQL ALLOCATE SQL DESCRIPTOR ’proj_descriptor’ WITH MAX 30;

printf (”Enter a select statement: ”);gets (stmt_text);

EXEC SQL PREPARE dyn_stmt FROM :stmt_text;

EXEC SQL DESCRIBE OUTPUT dyn_stmt USING SQL DESCRIPTOR ’proj_descriptor’;

Page 95: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

) *���3�.-�

������

���!���/�%+

'2#�������

%+'2#�$�"� �

�����������

��01&(�,�/�

� "����

85�� ��������������

EXEC SQL GET SQL DESCRIPTOR ’proj_descriptor’ :proj_count = COUNT;

EXEC SQL OPEN dyn_cursor;

while (SQLCODE != UEEOSCN){ EXEC SQL WHENEVER NOT FOUND GOTO :done; EXEC SQL FETCH dyn_cursor USING SQL DESCRIPTOR ’proj_descriptor’; for (loop_index =1;loop_index <= proj_count; ++ loop_index) { EXEC SQL GET SQL DESCRIPTOR ’proj_descriptor’ VALUE :loop_index :proj_type = TYPE; if (proj_type == SQLCHAR) { EXEC SQL GET SQL DESCRIPTOR ’proj_descriptor’ VALUE :loop_index :proj_ind = INDICATOR, :proj_string = DATA; if (proj_ind != –1) { printf (”%s”, proj_string); } else { printf (”NULL string”); } } else { EXEC SQL GET SQL DESCRIPTOR ’proj_descriptor’ VALUE :loop_index :proj_ind = INDICATOR, :proj_numeric = DATA; if (proj_ind != –1) { printf (”%d”, proj_numeric); } else { printf (”NULL numeric”); } } /* end of else clause */ } /* end of for loop */ } /* end of while loop */

done:

Page 96: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

86 �� ��������������

EXEC SQL CLOSE dyn_cursor;

EXEC SQL DEALLOCATE SQL DESCRIPTOR ’proj_descriptor’;

EXEC SQL DEALLOCATE PREPARE dyn_stmt;} /* end of main */

Page 97: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

876+;B7.M*@H/�1FL�u��

SQL/TP ��������

s� INSERT �, DELETE�, UPDATE�, SELECT ���������#%~ pb��&!���%���~ pb�&|o(l������YT�'��

&a��{^�'�\n(i�����

���SQL/TP ,L2L�t��'&���#%~ pb�����SQL/TP ,L2L���s SQL/A @K43,L2LSQL/CP �e�S<�2FL���

|��_w���&#��&���NR�c��y���'��%��)�

:GL0.1FL(q%O :GL0.1FLK7.JAI��1 $ 7�U��&���

���P8�?I�(k��&���>E���YT�'����)�

��gv�&�� TEXT ��� BINARY �9�55+@������

P���YT�'��&a��m��%���

SELECT ����SELECT H3:���� ROWID 138C�z��(W ��������WHERE Z��AND, OR, BETWEEN Qhj�]d�'&V[Qhn����=5�LP�r�� SHLIKE, REGLIKE , LIKE �Xrn��(W �������

INSERT ����}��'&���z6+;B7.=GD�5���'��%��)�

UPDATE " DELETE ����WHEREZ��ROWID 138C�z�CURRENT OF Z�����c1=1 AND c2=2 AND ... cn=n ��#��m-�H3:(W ��������`x�f���x�����z6+;B7.=

GD�5���'��%��)�

Page 98: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

88 2)694-�'8=.�0<?�N [

CW�"��I]�$'8=.�0<?��%"�Y&S�`���QW�FO

&^]������

EDQ�\U�� ��SQLTPENABLE /?7(,;>�0<?ZP&FALSE �RT�$����LXY&HVB��!��JT� ���

�����

� ��

SQLTPENABLE /?7(,;>�0<?ZP

�Unify DataServer: ConfigurationVariable and Utility Reference

SQL/TP *?1?�!� Unify DataServer '�+5-3:

�Unify DataServer: Managing aDatabase �� Unify DataServer '�+5-3:�

@A�Y��LX�%�#�KG�%$� � SQL/TP *?1?�M_�%���

SELECT co_name FROM company WHERE co_key=3;

SELECT co_name FROM company WHERE co_key=3 or co_key=4;

����� ������� ���� ������" � ��� �����"�� � �����"�� ��

���!���!� �������

SELECT co_name FROM company WHERE co_key BETWEEN 5 AND 10 ANDco_sales_rep = 7;

SELECT co_key, co_name FROM company WHERE rowid=5;

SELECT co_key, rowid FROM company;

SELECT AND XLOCK * FROM company;

INSERT INTO company VALUES (11, ’Upriver Associated’, ’2020st’,’A’, ’Sacramento’, ’CA’, ’95762’, ’(916)555–6276’, 7);

INSERT INTO company VALUES (?, ’Upriver Associated’, ’2020 st’,’A’,’Sacramento’, ’CA’, ’95762’, ’(916)555–6276’, 7);

UPDATE company SET co_sales_rep = 7 WHERE co_key = 1;

Page 99: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

89�� ��������������

UPDATE company SET co_sales_rep = 7 WHERE rowid = 9;

UPDATE company SET co_sales_rep = 7 WHERE CURRENT OF comp_cursor;

DELETE company WHERE co_key = 1;

UPDATE company WHERE rowid = 9;

DELETE company WHERE CURRENT OF comp_cursor;

Page 100: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

91

RHLI ����

Page 101: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

92 RHLI�'�+

��� ���

��(���RHLI �!/�*-����� RHLI �'.������� SQL/A ,�&�%������� � RHLI #)�$��� ���� �"0���*-���

Page 102: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

93RHLI�6�A

��

Relational Host Language Interface(RHLI) � Unify DataServer #�"&�!�6C��/8��+�%��3:����B�4�1 SQL/A %,�)'�;2����$.� RHLI /8�6C���������

RHLI /8�6C����B�4�1 SQL/A @�6C�����?5����RHLI /8��B�4�1 SQL/A �%*�� (-��7>9�<�=0����

Page 103: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

94 RHLI�]��

SQL/A � RHLI ���

RHLI Mi$�"Y!R SQL/A �)]� ��p��z�53.)aX�(���� ����&�5-;)]��(� �#����x)t(���%�

���� RHLI )]� ���� SQL/A )]��(�)Sv�(���� ��

SQL/A � RHLI c���x���x)EH�d� ��

T[ �\�T[��RHLI Mi%'#�"Y!R SQL/A �)]� ��%'g����T[ �� � �RHLI �uhe�Mi$B�6D)]��(���sf�T[��RHLI Mi)]��(����o�' ��sf�T[�����7�:B$X�T[���

=�7,D/k��bk SQL/A �~eUW�N����(���+;A0�2?D�=�7,D/$�b�Ls�a^� ��RHLI Mi��Unify DataServer 8�5<�3�{��#����

739 SQL/A ���r�R SQL/A JQ�739 �C UW+;A0�2?D�F����� ��RHLI Mi��r�w�739�(���� �*�

[email protected]?DK� SQL/A �[email protected]?DK�O|��z_�}m�(8�5<�3+.43)jV ��>�1��sqC<B#nv�(���� ��RHLIMi)]��(��[email protected]?D)�`w�K� �����RHLI �Gy�+.7,:��(�i�[email protected]?D)PI ��

8�5<�3�Zl 8�5<�3)Zl�(���"Y!R SQL/A �)]��(���� �*�RHLI Mi uadddb )]� ��8�5<�3)Zl�(���� ��

Page 104: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

95RHLI�B�O

����������

SQL/A � RHLI .�,2�+JA$15(�*37�?@�!���SD�%7,0&�+�9�/47)'*37FR#LI���� ��

���:Q/47)'*37�����=N�/47)'*37��SQL/A �RHLI JA#M"!������

SQL/A � RHLI JA.�,�6-'#:Q�!�������:Q/47)'*37� SQL/A � RHLI JA#M"��� ��

SQL/A � RHLI �9�.�,2�+JA.�,�6-'#:Q���G>��=N�/47)'*37#C��������� �SQL/A JA�/47)'*37����RHLI JA�/47)'*37�����;>����

��������

���� ��

�� ����� ���� ���������

��� ��������

��� ��������

�� ����� ���� ���������

���/47)'*37

�����������

�����������

���������

���� ��

��� ��������

��� ��������

�� ����� ���� ���������

�� ����� ���� ���������

���/47)'*37�6-'�H<�E���/47)'*37K�/4

7)'*37�.�,2�+JA#P8����������

Page 105: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

96 RHLI�Q�c

���;BF425AF� SQL/A a� RHLI J[+Qf�)�����\�KY�)1.<B.F�W�������

:�9>�6+/�=F�!��

;BF425AF+HR�!��

;BF425AF+Vh�!��

:�9>�6+2E�7�!��

���������

RHLI J[%d#P"L SQL/A a+^��:�9>�6�-286�)�'�RHLI J[�d#P"L SQL/A a�ic��#�:�9>�6 �-286+Ig�� *��(!�,�

��:@-C-286+Ig�)���T�2����+N�������

RHLI J[ uopndb +Qf���RHLI -286��#�:�9>�6+/�=F�!��

CONNECT�!�� OPEN DATABASE�a+Qf���d#P"LSQL/A -286��#�:�9>�6+/�=F�!��d#P"LSQL/A a+`N���d#P"L SQL/A -286�:�9>�6+Ge�/�=F�)��$��!��

�����������

:�9>�6 CONNECT a!�� OPEN DATABASE a�/�=F�*)��;BF425AF�Ge�HR�*!��:�9>�6d#P"L

SQL/A +S_�)���Ge�/�=F�*)��;BF425AF��aUN�*����Ge�HR�*!��

��&�ZO�sqlebtx J[+Qf��0DF;;BF425AF ID+b�!����=E3B?�]�T� RHLI J[M�X���;BF425AF+HR��!��

:�9>�6 uopndb J[�/�=F�*)��sqlebtx J[+Qf���;BF425AF+HR��!��

������������� ���

Page 106: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

97RHLI I�_

����������

5:<.,/9<)bLY�Mf���("�5:<.,/9<)?J�� �

[�*<2�6+�0�Mf�������CONNECT, OPEN DATABASE, #�!>Z a%E$B SQL/A]�?J��5:<.,/9<)Mf�'�!�COMMIT WORK ROLLBACK WORK ��( a%E$B SQL/A ])Id�#��

5:<.,/9<!�=cY�U _`�Mf�'�����#��UnifyDataServer: Writing Interactive SQL/A Queries �5:<.,/9<�;3, @e�)HO�������

COMMIT ]!�FQ 5:<.,/9<�?J�� &�4�27�0�V�������^D)-835�#���5:<.,/9<�?J�'S��

ROLLBACK ]!�C PW�4�27�0)\C�#��

�� �������

RHLI TG)Mf�'�!�RHLI AR uclsdb )Id�#��SQL/A TG)Mf�'�!�CLOSE DATABASE #�! DISCONNECT ])KX��4�27�0),;�1�#��

�����

�� ��

uopndb, uclsdb AR Unify DataServer: RHLI Reference

sqlebtxAR Unify DataServer: SQL/A Reference

COMMIT WORK , ROLLBACKWORK ]

Unify DataServer: SQL/A Reference

5:<.,/9<Ne Unify DataServer: Managing aDatabase �5:<.,/9< @e�

Page 107: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���)$&�

��

���)$��'(

&���

��������

����

��� ����

�#��

*�!�� ����"

+�� �����%

��

98 RHLI����

������� ������������� RHLI ��SQL/A ����� ��

#include <include/rhlierr.h>#define NCOL 9

EXEC SQL BEGIN DECLARE SECTION; long key, salesrep, key_select; char name[31],addr1[31],addr2[31],city[25],state [3],zip[10], phone[15] ;EXEC SQL END DECLARE SECTION;

extern char * ufchmsg();

main(){ UDBID dbid; /* database ID (returned) */ UTXID txid; /* Transaction ID (returned)*/ URID erid; /* Row ID for #emp” table */ UNIPCOLL keycoll; /* unipcoll for key column */ UCID kcidl[1]; UDBVAL kdbvall[1]; UNIPCOLL unipcoll; /* unipcoll for retrieval */ UCID cidl[NCOL]; UDBVAL dbvall[NCOL]; USTATUS status; /* returned function status */ USTATUS fstatus; /* ufchmsg() return status */ USTATUS cstatusl[NCOL];/* column status list */

if ( ! uopndb((char *)0, DB_NORMAL, &dbid, &status) ) { printf(”database cannot be opened.\n”); printf(”Error = %s\n”, ufchmsg(status, &fstatus)); uexit(1); }

if ( ! sqlebtx(&txid, &status) ) { printf (”database cannot be opened.\n”); printf (”Error: %s\n”, ufchmsg(status, &fstatus)); uexit(1); } EXEC SQL SELECT co_key INTO :key_select FROM company, orders WHERE co_key = ord_company AND co_state=’NY’ AND ord_ship_via=’UPS’ ;

,

Page 108: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

��������

!����

��"����"�

(/��

����-*�%+,�)

$#��

�' ��&.����

� ��������

��-*���"��

99RHLI����

keycoll.ncol = 1;keycoll.cidl = kcidl;keycoll.dbvall = kdbvall;kcidl[0] = $company.co_key$;kdbvall[0].unip.hintp = &key_select;kdbvall[0].valopts = UNORMAL;unipcoll.ncol = NCOL;unipcoll.cidl = cidl;unipcoll.dbvall = dbvall;cidl[0] = $company.co_key$;cidl[1] = $company.co_name$;cidl[2] = $company.co_address_1$;cidl[3] = $company.co_address_2$;cidl[4] = $company.co_city$;cidl[5] = $company.co_state$;cidl[6] = $company.co_zip_code$;cidl[7] = $company.co_phone$;cidl[8] = $company.co_sales_rep$;dbvall[0].unip.hintp = &key_select;dbvall[0].valopts = UNORMAL;dbvall[1].unip.strp = name;dbvall[1].valopts = UNORMAL;dbvall[2].unip.strp = addr1;dbvall[2].valopts = UNORMAL;dbvall[3].unip.strp = addr2;dbvall[3].valopts = UNORMAL;dbvall[4].unip.strp = city;dbvall[4].valopts = UNORMAL;dbvall[5].unip.strp = state;dbvall[5].valopts = UNORMAL;dbvall[6].unip.strp = zip;dbvall[6].valopts = UNORMAL;dbvall[7].unip.strp = phone;dbvall[7].valopts = UNORMAL;dbvall[8].unip.hintp = &salesrep;dbvall[8].valopts = UNORMAL;

if ( upkfrow(txid, $company.$, USLCK, &erid, &keycoll, &unipcoll, cstatusl, &status) ) {printf(”Company Info:\n”%ld, %s, %s, %s, %s, %s, %s, %s, %ld”

key, name,addr1,addr2,city,state,zip,phone,salesrep);}else printf (”Error : %s”, ufchmsg(status, &fstatus)); EXEC SQL COMMIT WORK;

if ( ! uclsdb(dbid, DB_NORMAL, &status) == USUCCESS ) { printf(”Error closing database:%s”, ufchmsg(status &fstatus)); }uexit(0);}

Page 109: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

100 RHLI�<�K

7J�*02" #/2��SQL/A I� RHLI 4E�<M �����F�5B ���+0�2�A������

)�'-�$���,2�� �

*02" #/2�=�� �

*02" #/2�@N�� �

)�'-�$� 1�%�� �

����������

)�'-�$���,2 ����RHLI 4E uopndb �<M�� �

����������

L�9�6 SQL/A I�*02" #/2�3= ����)�'-�$�� &$ �:C � SQL/A I�?8�� �

RHLI 4E�*02" #/2�3= ����ubegtx 4E�<M�� �

����������

L�9�6 SQL/A G;�*02" #/2�@N ����COMMIT I�ROLLBACK I�<M�� �

RHLI 4E�*02" #/2�@N ����ucmttx � uabttx �<M�� �ucbgtx 4E�<M���RHLI*02" #/2�!.(*���D��*02" #/2�3= � ����� �

���������

RHLI G;�@N ����RHLI 4E uclsdb �<M�� �SQL/A G;�@N ���� CLOSE DATABASE � DISCONNECT I�>H ������)�'-�$� 1�%�� �

��� ��������������

Page 110: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

101

��������

Page 111: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

102 ������(

��� ���

������%���� SQL/A "��!�����#$�'������������(#$� &� ��

Page 112: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

1030>��VIUo

SQL/A ��������

l$M#F SQL/A h�JX,Pn��l$M#F.;?3�4=@e� SQL/A 0>�,7/81��0>�(gE�*����"��

59�65iW��l$M#F SQL/A h�RK���Z^�+"��iW\,7/81��0>�&d^�VIfY����,H^�������

WHENEVER h,Pn��0>�UobN,Q^�*����"��

��[��BC���,T!"��

l$M#F SQL/A e�D�)c*0>��_a

59�65iW���P�j

WHENEVER h�'*0>�<:6?@2

]m`0>��A�j

l$M#F SQL/A hRK�+*�BC�'��0>�,Y�"��

0>� Y�*bN

GL h�RKSp,k *����)"�-�

0>� h�RK,Sp�*����"�-�

]m`0>� h��' ��*O)� �����h%RK,Sp�*��

��"�-�

�����

Page 113: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

104 ,;��VHTe

SQL/A b'RL�%�����.=�7</3�0/cW�Z_�& ��

SQLCODE long int0*9�cW

SQLWARN long int0*9�cW

SQLSTATE CHAR[6]0*9�cW

SQLCODE cW^'1+2-�%��,;��Y�����'G_�%���� ��SQLWARN cW^'1+2-�%��FM�Y���'G_�%���� ��

���SQLSTATE cW��ANSI SQL2 5;84aS��KBX��!�`E�& ��

��[��?@���'\d� ��

/3�0/cW^��&$�A'Q���

/3�0/cW�]J

/3�0/cW^�3/4

/3�0/cW�Cf�%3/4�IN

����SQLCODE WP�6:62-�^�C�%\d���Unify DataServer: ErrorMessages�'OU�������sqlerr.h #� rhlierr.h *>-<�58)*<" SQLCODE ̂ ��&�Cf�%6:62-'D(�� ��

������

Page 114: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

105,A��YLVi

�������

g Q�I SQL/A e�UON�15�21fZa�,A�!JP&d[���&T����

\b KF

,A���

JP��

SQLCODE = 0SQLWARN = 0SQLSTATE class = 00

,A���

JP�d[

SQLCODE = 0SQLWARN � 0SQLSTATE class = 01

,A��d[ SQLCODE � 0SQLWARN = 0 or SQLWARN � 0SQLSTATE class � 00 and � 01

���������

15�21fZ�^M� sqle_usr.h =43;(+Cc��#�����=43;(+C�)<B.�0@E& EPP �_Vi�$���`�Q�%���

rhlierr.h =43;(+C�,A�/�8�9?94-�bH&G����,A�/�8�9?94-&)<B.�0@E�RW�$�"����=43;(+C

&`�Q'� ����

rhlierr.h =43;(+C�+E-C�86*D-7B��#���)<B.�0@E& ucc />E8�/E:+C�$�����6*D-7B&Sb����

����ucc />E8�������)<B.�0@E�UO��X�]h����

Page 115: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

106 +:��QEOh

�����������

SQLCODE Y(Kg��+:�(4/5� ��

SQLCODE Y( 0 � ��UENORM6863.��`@�%���� ����&�+:��^U�����(L� �� � SQLCODE Y(]Z+:��`@�%��"� ��SQLCODE (]Z+:��`@�%� �TS+:�_H�Ak+:�6863.(Kg�%���� ��

\f� SQLWARN (Kg��DJ(4/5�%���� ��

SQLCODE Y#� SQLWAR Y� SQL/A a(MG�%[�VZ�&%���b� SQL/A a(MG�%W�cSY(4/5���&��$ �)�

=?�����+:��RX(2*3.�%��eF���

/-9<�Ni

+:���

/-9<QE�Ni��,�1;�G�035�N'����(>d� ����QE��SQLCODE Y 100 ��Ak6863. UEEOSCN (Kg��4/5�%���� ��

�� while;�7��,�1;�C��% �MG� ��

while(1) { EXEC SQL FETCH company_cursor INTO :key; IF(SQLCODE == UEEOSCN) break; fprintf (keylist, ”%d”, key); }

0 Y(g%���+:����QE� SQLCODE cS(4/5�%���� ��0 Y�+:���� ��6863. UENORM (L� ��SQLWARN cS��DJ��(L��0� ��6863. UENORM��`@��4/5�%���� ��

+:����a(MG�%��SQLWARN cS����DJ(B! ��

/-9<�Ni�4/5

j

+:��^U��PI�

4/5

Page 116: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

107+<��TERb

�� while >�8��+<�� ��DK\W�% �PJ� ��

while(1) { EXEC SQL FETCH company_cursor INTO :key; IF(SQLCODE != UENORM || SQLWARN != UENORM) break; fprintf (keylist, ”%d”, key); }

��������������� �

+<�� ��DK�Ae�%4,/6'FL�%���RHLI AU ufchmsg 'Na� ��SQLCODE ^U� �� SQLWARN ^U'��AU�[���AU��,;<-1]Od���+<�4/6� ��DK4,/6'_� ��

/4�1/^U' ufchmsg �[���"�$ ��ufchmsg AUVH�� &��/4�1/^U'N��+<�'`K� ��AUVH����'4/6

�%�"/4�1/^U���rhli.h 9327)*>#�#�!ZC�&�5�11*8 USTATUS �����/4�1/^U'XG�� &��$ �(�

���ufchmsg AU�I]�@Y�BQ�A����Unify DataServer: RHLI Reference�'MS�������

��c��OPEN ]+<�'\W������+<�:30�.'8=?6� ��

USTATUS status;...EXEC SQL OPEN cursor1;if ( SQLCODE != UENORM ) printf(”sqlerr: %s\n”, ufchmsg(SQLCODE, &status));

c

c

Page 117: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

108 "3��WCSi

WHENEVER g��!-4%�&28����� SQL/A g�PG >M ���SQL/A g PG��a�WHENEVER g� SQLCODE _����SQLWARN _ )'* ���

���WC )'*���������WC�Y����!$&28 L`

���9;�d��)'*��WC�L`��bI O ���

WHENEVER ����

)'*]U Kh#�7�+

e SQLCODE _����cZ �"3����:VX^ O ���

SQLERROR

(69<� SQLWARN _����cZ �BH O ���

SQLWARNING

SQLCODE=UEEOSCN ���100_�����'#08�Qj O ���

NOT FOUND

WHENEVER ����

PG Kh#�7�+

g3.5��f@ GO TO

PGN\ CONTINUE

C DEg�PG EXECUTE

����WHENEVER g�Fg�=[�AR�? ����Unify DataServer: SQL/AReference�/,1!5 JT �����

WHENEVER������� ������

Page 118: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

���('��&#

����������!�"

%��

���������!

�����!���!�

���!� �����

���� ����$)

��

109����'�&/

��1������+)����WHENEVER ,�". ���&/�(�$!���

EXEC SQL BEGIN DECLARE SECTION int key; EXEC SQL END DECLARE SECTION;

void func_A();

EXEC SQL WHENEVER SQLERROR EXECUTE ’func_A();’;

main(){ char linein[80];

printf (”Enter the company key: ”); gets(linein); key = atoi(linein);

EXEC SQL UPDATE company SET co_sales_rep = 7 WHERE co_key = :key;} void func_A()USTATUS ustatus;{ printf (”The following error has occurred: %s”, ufchmsg(SQLCODE, ustatus)); EXEC SQL ROLLBACK WORK; exit(99);}

��1��WHENEVER ,�". � FETCH ,�$!����������%0'����������'��)���-#���WHENEVER ,� *��,�$!���

EXEC SQL WHENEVER NOT FOUND GOTO :done ;for (;;) { EXEC SQL FETCH company_cursor INTO :key; fprintf(keylist, ”%d\n”, key); }...done: EXEC SQL WHENEVER NOT FOUND CONTINUE;

1

1

Page 119: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

110 )5��N@K[

SYU)5�VP�!��C <O sqleftl A�I�"���

=T��� �<O�?���SYU)5�VP�!��HC�! �<O

�)5�K[,�0#L� ����� �<O�:O#G���$�

sqleftl <OX�2%(7��!����&36+�-49� � sqleftl <O#QK[��,91(7��8�0���"�� ��$�

� sqleftl7�.'9�)5�,�0# stderr �369/��ulogmsg����<

O#FZ��)5�8*�SYU)5�O#LD����

#include <stdio.h>

USTATUS ustatus;

sqleftl(){ fprintf (stderr, ”Fatal error occurred: %ld\n”, SQLCODE); ulogmsg(”sqleftl”, (USTATUS)SQLCODE,”Fatal error”,&ustatus);}

����sqleftl <O�BW�;R�>J�<�����Unify DataServer: SQL/A Reference�#EM�������

�����

\

Page 120: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

111)7��KBIY

������� ��

V E�@ SQL/A ���0�/4�-O�CF #�5-1TL�;S #���(:0'+�/TL��CFO�<�"JU$R?����

(:0'+�/TL��CFO29O��"����$H����29O��

WQ>�WP�O���29O$=�5-1TL��38:1���%�5-

1TL29O$=�����$AQ�"���(:0'+�/TL$GX��

�� ��

(:0'+�/TL��V E�@ SQL/A &38+�,6:� DECLARE .*,6:�ND����

(:0'+�/TL�MLO$=����int , short, ��� long @���ND #��#��!��%�(:0'+�/TL TEXT � BINARY 0�/4�-ZO�GX #"����(:0'+�/TL$ long @���ND����

������� ���

Page 121: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

112 4I��mXg�

FETCH ��%�! SELECT �.`���?�;E�:�*?�;.Y^�%��Y^�,?�;!�F:@�n�P{�-%��OF:@�n�u��2M?18�;�n.ay�,�� ��%��

F:@�n z��T�,l� �(�2M?18�;�nw.<3=7�%

��

2M?18�;�n T�F:@�n�U'w

–1 AKw

0 }AKw

>0 BINARY, TEXT, CHARACTER � &�`��-�?�;5�BCL�.d�%��w!�� ]o�-��� � x����d�-,6GI7;n.

d�%��

F:@�n�?�;.P{��� SQLSTATE%�! SQLCODE�n ;2D�R4I�.d������%�!~n 2M?18�;�n!���ry�-�%���-* 2M?18�;�n!�?�;�R4I�.c���u

N�%��

O FETCH ��%�! SELECT �.e[��Z�4I��u���nSQLCODE .>:@�%��4I� |q���-"�� �!p��e[�-�����+%��

BINARY, TEXT, CHARACTE R ��T��,F:@�n Y^�-,?�;.U'$� v��.c���*"�2M?18�;�n!�p w�ry�-%

��w!?�;E�:� ?�; 6GI7;n.d�%��F:@�n�!�

�c��,��t� ?�;.U'�� ��%��

FETCH ��%�! SELECT �.`����F:@�nz ?�;.Y^��,S��?�;�R4I� |q�,��SQLCODE � SQLWARN UECONVERR��R4I���ry�-%��SQL/A !�4I�.|q��� e[.b(%�/�� � pk�Q��,%��g�.s[�)��%

��

����SELECT ��)# FETCH � Vf�T��!��(\&W0DJ8�9HM h��� j._i������

��������

Page 122: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

113�������!

�"���� ������ ������������������

��

#include <include/rhlierr.h>

EXEC SQL BEGIN DECLARE SECTION int key; int name_ind, phone_ind; char name[31]; char phone[15];EXEC SQL END DECLARE SECTION;

EXEC SQL DECLARE key_cursor CURSOR FOR SELECT co_name, co_phone FROM company WHERE co_key < :key;

main (){ char linein[80]; USTATUS ustatus; EXEC SQL WHENEVER SQLERROR GO TO :err; printf (”Enter the company key: ”); gets(linein); key = atoi(linein); EXEC SQL OPEN key_cursor; do { EXEC SQL FETCH key_cursor INTO :name INDICATOR :name_ind, :phone INDICATOR :phone_ind; if (name_ind >= 0) { if (phone_ind <0) strcpy(phone, ”no phone in db”); printf (”Company name: %s\n, Phone: %s\n”, name, phone); } else if (SQLCODE == UEEOSCN) printf (”End of records.\n”); else printf (”That key does not exist.\n”); }while (SQLCODE != UEEOSCN);

err: if (SQLCODE != UENORM && SQLCODE != UEEOSCN) printf (”Error Occurred: %s\n”, ufchmsg(SQLCODE, ustatus));EXEC SQL CLOSE key_cursor; }

"

.�!��3,�+4

���%�����3

,�-)���

�����*�%��

���3,�'!��3

,(2���

�$0/���%��

���3,������

��

�#��"����+�

����%�$��

��$�1&���

Page 123: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

114 �-� @7?K

�����

RHLI 5A usetitr �<J�� !"*3�:��?K��� !"*3�:����1$,����(�#���2���=9�ED�����I�F;�

=9�� �GB���

����

�� �

signal 5A�8H�4C�6>

�'0�"�1� !"*� C .&�01!)%+�/

usetitr 5A �Unify DataServer: RHLI Reference�

Page 124: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

115�-��=4;H

�J��company_cursor���G<���%/��A�*�'&�� �# ,1�9I ��2�7��D? ���A�*�'&�� �2�7��D? ���E�86�B@���int_handler 3>�5�:��� �

2�7��D? ���SQLCODE F>��UEENORM �C���� ������-�"�)�+.1(�����%/�!0�$��� �

#include <stdio.h>#include <signal.h>#include <include/rhlierr.h>

EXEC SQLBEGIN DECLARE SECTION char name[31], phone[15];EXEC SQLEND DECLARE SECTION;

EXEC SQL DECLARE company_cursor CURSOR FOR SELECT co_name, co_phone FROM company;

USTATUS status;void int_handler(){ printf(”Interrupt received – aborting program\n”); usetitr(DB_NOEXIT, &status); return; }main(){ signal(SIGINT, int_handler); EXEC SQL OPEN company_cursor; do { EXEC SQL FETCH company_cursor into :name, :phone; if ( SQLCODE == UENORM ) printf(”Name: %s\nPhone: %s\n\n”, name, phone); } while ( SQLCODE == UEENORM );

if (SQLCODE == UEEOSCN) printf (”End of records”);elseif (SQLCODE != UEENORM) printf (”Error Occurred: %s\n”, ufchmsg(SQLCODE, ustatus));

EXEC SQL CLOSE company_cursor;}

J

,"'F>�@6���

4�8��C��.���

���$/�<G�E?��

��*�&%�B���

4�8��E?����4

�8�! )/����;

7���

��+2��$/��1�

#���02' �����A

9����-�'���

! )/5>�:=��

� ��2�/�(*��

/�D3���

Page 125: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

116 '2��L>Ja

sqlca ���

sqlca )4�.3[O��Q�^�C�< SQL/A Z����TE�! B�8� K\"W: ���sqlca )4�.3[O��Q�^�C�<SQL/AZ����TE�! 4&�8� K\"W: ���

��AUV"F_ ��INSERT Z�UPDATE Z���� DELETE Z�6;"H B�O"=� �����������AUV"F_ ��SX���

�@M�!�DIB� ROWID "=� �������

��AUV���57�N�G����/$�3-������nrows /$�3-��INSERT Z�UPDATE Z�DELETE Z�#(+* �B�O"G �����/$�3-��long int ,%0���rowid /$�3-��SX����@M�!�DIB� ROWID "G ���

sqlca ���

�����

������� ���� �������� ��

�������������

����� ���������� �������

C AUV�Y9]"F_ �`R�#(+* ���SQLCA.HAS 1(4"F_ �� nrows /$�3-��� rowid /$�3-��#(+*"P?� �������

Page 126: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

117�������$

� %��SQLCA_HAS �����#���� "���� ROWID � "�����(NROWS) ��!����

EXEC SQL BEGIN DECLARE SECTION int newrowid; int numrows;EXEC SQL END DECLARE SECTION;

EXEC SQL INSERT INTO company(co_key) VALUES (20);

if (SQLCA_HAS (SQL_ROWID)) { newrowid = sqlca.rowid printf (”Rowid is : %d\n”, newrowid); }

if (SQLCA_HAS (SQL_NROWS)) { numrows = sqlca.nrows printf (”Number of rows inserted: %d”, numrows); }

%

�� ������

�� �����

� ��������

��

� �������

��

Page 127: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

119

���������

Page 128: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

120 �!$���#%�+)

��� ���

��.���2�*�'SQL/A�!$���#%�+)����(�,���-6�/3������"�����&5�14���0� � �!�/

3���

Page 129: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

121#;?*�-=C�PI

���������� ���� ��

Z�J�H SQL/A #;?*�-=C!PI�����DE�W�/43;������� ��

1. SQL/A ;?;B03, EPP !L[��1�/9"$@!VQ\����

2. Unify DataServer +C8$>ucc !L[��TS��9"$@!+C8$@����

3. SQL/A ?C' sqla.ld !L[�������F]9"$@��#;?*�-=C!?C)����

4. #;?*�-=C!PI����

� ��/43;�KS �9"$@�GX�9"$@UYO!M����U

YO!DE�R�N����

��������������

���

���� �����

1�/9"$@

��������

�������

�����

��������

���������

���

��������

TS �

�1�/9"$@

5�2<�/&:.%)6

?9"AC/�9"$@

#�'$:>$:>?

9"$@573(>$:>?

9"$@

&:.%)6

9"$@

Page 130: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

122 -FL6�8JP�aZ

EPP 7IPB��u%[#U SQL/A ;�:D,/M*kcz�"��kcz��SQL/A r* C VX�tx�"��

EPP ��SQL Yr�wm*>0?5��/P5M�BD,/M rhli.h �sqle_usr.h *nQ�"��

EPP ��3NPA:4�I*To:4�I�jo�"���)�-FL6�8JP�R|�(:4�I���) �–s 2F8JP�R|:4�I*_o���) �'"�+�

��{��prog.ec��vk�;�:D,/M*kcz�"��1K����) �EPP� prog.c ��vk�;�:D,/M*\i�"��

EPP prog.ec

�����EPP 7IPB�R�(f��gs�������Unify DataServer: ConfigurationVariable and Utility Reference�*]d�� ����

Unify DataServer 7PC/Kucc ��.c ;�:D,/M*7PC/M�"��;�:D,/M�@�<H�:2E905A!�]d*`���) �qb C 7PC/Kcc *^y����D,/M*7PC/M�(�����"��

��)�7IPB��–c 2F8JP*_o���O�B*hW��2E905AD,/M*��\i�"��

;�:D,/M� Unify DataServer G?=D,/M�LD,NP:*S$�& �–I 2F8JP�l�� $UNIFY/[email protected]*_o�"����D,/M*��@.N5AL�/P5M�BD,/M���^y�� ��) �

–Onoinclude 2F8JP*_o�� ����

��{��ucc7PC/K*^y�� ������*7PC/M�"��$UNIFY/[email protected]�/P5M�BD,/M*^y�"��1K����) �ucc � prog.o��ve�D,/M�prog.u*\i�"��

ucc –c –I$UNIFY/.. prog.c

�����ucc 7IPB�R�(f��gs�������Unify DataServer: ConfigurationVariable and Utility Reference�*]d�� ����

���� ������� SQL/A ��������

{

���� ������� � �������

{

Page 131: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

123%<B.�0@F�PK

SQL/A BF* sqla.ld ��ucc �MT��:$'C .o #N��);1(,7:$'C#%�*';����A';AB�BF,����SQL/A 694+�694-�!%<B.�0@F#E�8�!���–d )<0@F#OV����

��^��sqla.ldE�3� prog.o#E�8����%<B.�0@F�PKGX9�1@F��prog.run �[U���

sqla.ld prog_run prog.o

��^��sqla.ld E�3� prog.o #E�8��SQL/A 694+�N\� !������

sqla.ld –d prog_run prog.o

�����

�� ��

sqla.ld/>F8�JY���HQ �Unify DataServer: ConfigurationVariable and Utility Reference�

SQL/A694+�HQ �Z�L�I SQL/A %<B.�0@F�694-�S

)=D�5&F-025?� %<B.�0@F#PK�!���254< 3 �MT�"�:$'C�PKGX�9�1@F�[R#W]����

��^��prog.run �[R�:$'C#PK����

prog_run

�� �������� �����

^

�� �������� ����

^

Page 132: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

124 .FL5�8KO�e]

������� �

.FL5�8KOr�v%^#X SQL/A t�:3�H�S|�"��:3�H��.FL5�8KO�v%^"*) SQL/A t�sz�qY+c�� *��("�,�

��k���.FL5�8KO�S|�):3�H��:3�H�sz�qY�

��lx�"��

Uo���S|:3�H�J�7�Uo:3�H��("��EPP 6HOB�–s 1F8KO+ay��P�):3�H+bo�)�����"��.FL5�8KO�J�7��.FL5�8KO+mf{�)���ay�):3�H

�.4;:Y[+c�"��

.FL5�8KO+mf{�)���ay�):3�H��.FL5�8KO+

e]d�ay�):3�H���

.FL5�8KO+mf{�"��e]��)�����.FL5�8KO�`g�)@�=G�:+T$:3�H �.4;:C�I?8KO+c���

*��("�,�

2NOA:3�H��.FL5�8KO�bo�*�@�=G�:1E904A

�.4;:�)�%�sz��!��qY+WQ�*� *��("�,�

����:3�H admin �1E904A�.4;:�)<�:D-/M+mf{�)�'��EPP �ay��)J�7&�J�7�2NOA:3�H�n��Z_WQ�*�qY+>0?4�"��:3�H admin �n�):3�H.4;:WQY+c����sz���:3�H admin ��v%^#XSQL/A t�`g�*)1E904A�.4;:�)pi�qY+c�� *��("�,�

����

�� ��

@�=G�:�

Vwu\

�Unify DataServer: Managing a Database���Vwu\�jo�R{��h

�����

��������

Page 133: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

125

����������� ����

Page 134: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

126 h�J�G�7>&�(=A�15/%

��� ���

SQL/A15/#��,�*@8?�15/#��SQLe�h�J�GSQL/A �7>&�(=A�RI�����FP����

RI�`O �C^�VH�����RI�`O����15/#':A3�

cj����7>&�(=A�!6) $2�����Uf�dQ�����

����������7>&�(=A�RI�]I�����

�T���SQL/A 15/#����BD�Z�[i����

SQL/A 15/#�EN�`O

6@�$9�A2�Ya�LS

h�J�Ge��\K

"�,?��\K

.�4;/$e��\K

_X<�3��M�g

*-0�*0�/$�bW

SQL/A 15/#�M�g�+/(=Ak

Page 135: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

127}(]'V-EL6�8KO"?B=5

SQL/A ����������

SQL/A ?B=2,a��*o!�QR"<:4,\����� �

sqla.ld " –d 0E8KO,a���-EL6�8KO,N�A�&��

SQLDBGON7OC.3JM�8KOzm, TRUE !nu�&��

SQL/A ?B=2#�-EL6�8KO,f\�*���P�!-4>.F/@�+&��^h! SQL/A y�X������!�S�l! sql_debug> ENOE@�xe�+&��ENOE@!q��?B=27IOA,v��&��

SQL/A ?B=2,w��1MO@-EL6�8KO,g��*!#�sql_debug> ENOE@� quit�&�# q �,v������ �-EL6�8KO"f\,tb��!?B=2,~Z!�*!#��%�"DM�4H/O

@�db *�,`i��continue (c) ,f\�&��

d!-EL6�8KO,f\�*��!�?B=2,f\���� �+$�

SQLDBGON 7OC.3JM�8KOzm,FALSE !nu����� �

�?B=27IOA,v��*!#�Up 7IOA��7IOA"j�W"��"{|��)&��j�W,_*!#�7IOA�"s"TY"r 1 yc,a��&�����$�set breakpoint # sb � )&��?B=5;=8KOs!����*?B=57IOA"L:@,xe�*!#�help (h) 7IOA,v������ �

���

� ��

SQLDBGON 7OC.3JM�8KOzm

Unify DataServer: ConfigurationVariable and Utility Reference

sqla.ld 7IOA 119 G�9"�-EL6�8KO"f\�"k

?B=27IOA"[y Unify DataServer: SQL/A Reference"?B=27IOA

Page 136: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

128 q O�G(:@.�0?C�584-

����� �������

9B�,=)C6��(:@.�0?C�WN�����WN�ETj�hS

�%Df� ����9B�,=)C6��WN�hS�%���n\e�*�

3A�kt�#���c�[o'lV�% �������<26n\e'n

L�% �!�����

lV����[o'lV���J�WN'Ib�����U�9B�,=)C

6�U�aP����U� SQL/A m�XF��WN'Ib�����

U�l��9B�,=)C6']K�%584+/>C7'V����

Ru�%584+/>C7����ZwH� sj

set breakpoint (sb) 9B�,=)C6'^i����

delete breakpoint (db) 9B�,=)C6'QY����

continue (c) c�9B�,=)C6�XF��W

N'Ib����

list breakpoints (lb) ����9B�,=)C6^i�Ev

'lV����

9B�,=)C6^i�d&$��next operation " next statement />C7'R���Rug�(:@.�0?C�WN�g��U�aP"U�m�hS��

���

�_���9B�,=)C6�^i�QY����`r����

����

�� ��

next operation />C7�next statement />C7�Mm

�Unify DataServer: SQL/AReference�

*�3A'R��584+

/>C7�R�p

140 ;�1��*�3A��aP�

Page 137: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

129u�U�Q$;A,�.@E�583+

set breakpoint ->E7����:C�*=%E6#bl ���

583(13.@E�$;A,�.@E#]R�!���59&B6���V_

�:C�*=%E6��V_�u�U�Q SQL/A t�bl�"�����Gh��jL�:C�*=%E6#bl � �g�583(->E7#pz�!�

�������

[����yH��$;A,�.@E�:C�*=%E6#bl�����

nl� SQL/A t�]RGh( ]R�t�]R�"!ie�kZ ���)

$;A,�.@Eo�nlR

.04?N U��qa�!Gh

nl�'�2B#X`�!nl� SQL/A t�]RGh(]R��t�]R�"!ie�kZ ���)

nl�'�2B#X`�! SQL/A t�]RGh (]R��t�]R�"!ie�kZ ���)

�"������FS�c�dw ���

��������������

nl�t�:C�*=%E6#bl�!���:C�*=%E6����t�^

M�m�bl�"���nl�'�2B�fW�!nl�t�:C�*=%E6

#bl�!���132 <�/#X` �����

nl�t�^M�m�:C�*=%E6#bl�!��7BOT ($) #e�s��t�ve�)�D�7#Yl ���

FK�r��t�)�D�7��JP�!t�Ix#\ ���

���� UPDATE t��:C�*=%E6#bl�!���$update )�D�7#Yl ���

sql_debug> sb $update

���� PREPARE t�:C�*=%E6#bl�!���$prepare )�D�7#Yl ���

sql_debug> sb $prepare

���������

{

Page 138: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

130 (#�"�������!�����

������������

����� !��%&�'set breakpoint��!��$)��� ��

���� ALLOCATE DESCRIPTOR '

$alloc_da

���� COMMIT WORK ' $commit

���� CONNECT ' $connect

���� DEAllOCATE DESCRIPTOR ' $deAlloc_da

���� DEAllOCATE PREPARE ' $deAlloc_prepare

���� DELETE ' $delete

���� DESCRIBE' $describe

���� DISCONNECT ' $disconnect

���� EXECUTE ' $execute

���� EXECUTE IMMEDIATE '

$execute_immediate

���� GET SQL DESCRIPTOR '

$get_da

���� INSERT ' $insert

���� PREPARE ' $prepare

���� ROLLBACK WORK ' $rollback

���� SELECT ' $select

���� SET SQL DESCRIPTOR '

$set_da

���� UPDATE ' $update

���� LOCK TABLE ' $lock_table

���� UNLOCK TABLE ' $unlock_table

Page 139: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

131K�=�:�.4!�#38�'*%

��������� ������

�.4!�#38,��5�;I<�-6��0�8(�BE��������

��GE�;I<�-6��0�8(�BE�����@?�;I<�>E

�����.#38��;I<�C��.4!�#38,��5+$�>E�

���������

',�5(��.4!�#38,��5� 46 ;L�-6��0�8(�BE�����set breakpoint J�D 46 �>E���

sql_debug> sb 46

������������ ������

#$&29�=��HA�����-6��0�8(�BE��������

��#$&29�=��HA��F�-6��0�8(�BE�����setbreakpoint "18)��#$&29�=��/8(���7�) $interrupt �>E���

#$&29�=��HA�����-6��0�8(�BE�������7�

) $interrupt �>E���

sql_debug> sb $interrupt

M

M

Page 140: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

132 h�L�F%8<,�-;@�362+

�������������� ������

ca�(�1=$OW�"g�7>�*:&@4$\a�"��������A

C�Y��7>�*:&@4$\a�"(�1=i g$Qa�"���Pj�

"GU$T����

� ������ ������

����������

������

������������

������

� �����������

������

�����

��� ���������

��� �

�����

�����������������

� �!

��������������

��GU�ek� cursor_name �'8-;@� source file ����� 9�.��(�1=�^N�$OW�� ����

��GU�ek�g�)�?�5��7>�*:&@4$\a�"������

El��" SQL/A g$T������)�?�5�_B�"g������]V�f�HM������

'8-;@� count ��7>�*:&@4$\a�"g�^NDZ$Qa����^N��K�%*0/�#"b�d[����������� UPDATE g��K�JX�#"b�JX^N$K������!�������� 5 D�JX^N�`R�"!�7>�*:&@4$\a�����

S�f��7>�*:&@4$\a�"g$Ia�"���)�?�5$T��

��

Page 141: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

133X�D�A�38&�(7<�-0,%

� �������������

2:�$5�<.�PT �W G[ �#�;�/

AllOCATE CURSOR $Alloc_cursor

!�*9[�CLOSE $close

BN=V�!�*9�I�

DELETE . . . WHERE CURRENT$delete_cursor

!�*9�I� FETCH $fetch

!�*9[�OPEN $open

BN=V�!�*9�I�

UPDATE . . . WHERE CURRENT$update_cursor

���-0,"'6</��!�*9�FK����L��� ���4�)��!�*9��RE��FK������

S key_cursor !�*9��1 ,+���U�2:�$5�<.�PT ����J����!�*9�CW� $fetch #�;�/�HT�� �

sql_debug> sb key_cursor:$fetch

key_cursor !�*9�@] �CLOSE W�2:�$5�<.�PT ����J�����!�*9Y�I� $close #�;�/�HT�� �

sql_debug> sb key_cursor:$close

key_cursor !�*9M� 3 >Z�1 ,+RE�2:�$5�<.�PT ����J�����$fetch #�;�/�!�*9Y�OS 3 �HT�� �

sql_debug> sb key_cursor:$fetch 3

key_cursor !�*9�@] �close RE�2:�$5�<.�PT ����J�����?Q�!�*9FKCW�G[�� �

sql_debug> sb /s3/acct/wri_14.ec:key_cursor:$close

\

Page 142: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

134 _�O�K%<D,�.CI�483+

������������ ����

(�1EPV\W� [��;F�*>&I5#XZ� �����;

F�*>&I5��(�1E OPEN, DECLARE , FETCH , AllOCATECURSOR, UPDATE, DELETE , ��� CLOSE ^�PV�! [�\W����

set breakpoint -?I6�(�1E�`Y#RZ� ��141 =�/��(�1EPV��JU��� LT#Qa����

company_cursor (�1EPV�! [�;F�*>&I5#XZ� ���S����(�1E`#RZ����

sql_debug> sb key_cursor

2&7@3*(�1E cursora PV�! [�;F�*>&I5#XZ� ���S�����N"�-GI( : ) ]�A/B�E`)�H�6 DYNAMIC #Y�]��(�1E`#RZ����

sql_debug> sb DYNAMIC:cursora

RZ� (�1E4:'E5�1�0:$&E�M��������S��

���1�0:$&E�90`#RZ�������

sql_debug> sb /s3/acct/lcc/embedded/wri_14.ec:key_cursor

b

Page 143: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

135N�=�: -1$�&04�(+'#

list breakpoints %/4*��<>�,2�".!4)IK�6P�MC�����%/4*�EQ��57�� ���;D�@O�����,2�".!4)�IK������AK����

pathname : line_number count

pathname : cursor_name : stmt_keyword count

count ��%34(:) �9H������GJ�MC����

#_breaks_left_to_skip : total_#_breaks_to_skip

,2�".!4)�IK������8L�����list breakpoints %/4*�AK����

sql_debug> sb key_cursor:$close...sql_debug> lb

*:key_cursor:$close 1:1

delete breakpoint ��,2�".!4)�?F����set breakpoint %/4*�,2�".!4)�AK�����@O��;D�@���?F��,2�".

!4)�AK�����

,2�".!4)�?F�����57�;D�� ���AK����

sql_debug> db $prepare

sql_debug> db $interrupt

sql_debug> db key_cursor:$close

sql_debug> db key_cursor:$fetch

sql_debug> db DYNAMIC:cursora

����,2�".!4)�?F�����B�;D�@O����

sql_debug> db *

�����������

R

����������

R

Page 144: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

136 ]�H�D�39$�&7=�,/*#

����������

]�H�D[�UM����]�H�D[��"+�2 �):�PY[�B�

W����COLb?� ���Q\�AX������R��� ;=-]

�H�D[�Q\�ZN��,/*!%5=.� ��S_���

]�H�D[��C FG3<#86�]�H������ SQL/A [���

AllOCATE CURSOR

AllOCATE DESCRIPTOR

CLOSE

COMMIT WORK

DEAllOCATE CURSOR

DEAllOCATE DESCRIPTOR

DEAllOCATE PREPARE

DECLARE CURSOR

DECLARE CURSOR

DECLARE SECTION

DELETE

DESCRIBE

EXECUTE

EXECUTE IMMEDIATE

FETCH

GET

INSERT

OPEN

PREPARE

ROLLBACK WORK

SELECT

SET

SET TRANSACTION LEVEL

SLOCK

UNLOCK

UPDATE

WHENEVER

XLOCK

����

�� ��

PY[ 146 4�'��PY[��TJ�

COb? 148 4�'��COLb?��TJ�

>@�N�Z��]�H�D[�Ka���,/*!%5=.���

�����������������

,/*!%5=. `V

list defaults EI�,1�:-�0(^� �):�PY[�

COLb?�ZN���

������

�������������

Page 145: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

137K�7�3�*.���-1�$'"�

���������������� (continued)

$'"��,1& MF

print current definitionsubstituted

��!/�I�9@�SQL/A I�H<� ��+ %J?B��+ %J?:>C�2��� ��

print current definitionunsubstituted

��!/�I�9@� SQL/A I�H<� ��+ %J?B��+ %J?:>�C�2��� ���

print current line D;�I�)��/L�5G6�=N�H<�

��

print current operationsubstituted

�01%K�7�3I�#� %�H<� ��

+ %J?B��+ %J?:>C�2��� ��

print current operationunsubstituted

�01%K�7�3I�#� %�H<� ��

+ %J?B��+ %J?:>�C�2��� ���

set default cursor $)�/%��!/�AE� ��

set default pathname 48�$)�/%( L�AE� ��

Page 146: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

138 I�7�5�,0 �"/2�'*%�

68�'+�1(��$1�JA�F>����=���� list defaults !.2)�;E���

sql_debug> ld

default filename is <wri_14.ec>default cursorname is <key_cursor>

FETCH �������$1�4M�G D<����print currentdefinition unsubstituted (pcdu) !.2)�:K�����$1�9@�� G�F> ���pcdu ��-#(H?B�-#(H?�C�3������

sql_debug> pcdu

select co_name, co_phone FROM SQL_books.company WHERE co_key IN ( :a , :b , :c )

��$1�4M�G D<����print current definition substituted (pcds) !.2)�:K�����$1�9@�� SQL/A G�F> ���pcds ��-#(H?B�-#(H?�C�3�����

sql_debug> pcds

select co_name, co_phone FROM SQL_books.company WHERE co_key IN ( 1 , 2 , 3 )

68D<����I�7�5G�&�#(�F>����=�L >��

��print current operation unsubstituted (pcou) !.2)�:K���

sql_debug> pcou “execute :prepared_select into :key, :name using sql descriptor ’company_descriptor’”

L

Page 147: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

139F�8�6�+2���03�%)#�

<BD 5H��D�A:�����print current definition unsubstituted (pcdu)�-3'�9G��<BD�$� &�C;�������=7�, &E>

?�"�(.#�*1/�! @�4������

sql_debug> pcdu select co_key, co_name from company where co_sales_rep = ?

<BD 5H��D�A:�����print current definition substituted (pdds) �-3'�9G��<BD�$� &�C;�������=7�, &E>

?�"�(.#�*1/�! @�4������

sql_debug> pcds select co_key, co_name from company where co_sales_rep = 4

Page 148: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

140 ~�[�U(BH1�3GK�<@:0

��������

eY�p`�%�-�8I�(/;)A�,�BK��$� �<@:.2E

K>&_���-�8I����i}&xd� ���<@:.��S#s�

-�8I�S#s�"%�� i}&xd���"��-�8I�,�BK�%

�� �i}&xd����<@:.��/J�6�$!��nX�%�-�8

I����i}�xd���'�

-�8I����xd�%$i}��-�8I�f��!��O�#���<

@:07:3GK���c��f��-�8I�#���

L�-�8I SQL/A �!��]k�%$tyq�-�8I��SELECT,UPDATE, DELETE , INSERT z�_��%$Y&|a����

nX-�8I DECLARE CURSOR z�nX�%$w9*?F:/-�8I���

9*?F:/-�8I

DECLARE CURSOR ��� AllOCATE CURSOR �nX�%$9*?F:/-�8I���

MQ�x��-�8I�_�� $<@:.2EK>&d����136 C�4�x�V\��$~�[�Uz�2EK> _�� ���

��l���MQ�Z�&m�����

-�8I^h

-�8I2EK>g�

D5={j

����

� �

-�8I�Puq�m� 9 C�4��-�8I�R��

-�8I�(/;)A�$�W��

%$�

81 C�4��9*?F:/,A4+/=�r�vN�aobT�

Page 149: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

141s!X�T)BI3�5HL�<?:2

��������� �����

<?:/4EL> ul

edit cursor variable .�8JjS�Zv�%D7=qb�i'qV�

�%"�����

list active cursors ����)1;*A�-�BL�.�8J���

��`r'o\����

list referenced cursors )BI3�5HL�Y^�&%.�8J�`r'

o\����

print cursor operation type .�8J�]w'o\����

print cursor ���������.�8J'o\����

print cursor variable .�8JjS�Zv�&%D7=qb�i'o\

����

�#��.�8J79;*7;*:1;*:17'kc��$�o\�%�!

�Zv��%4EL>�$���.�8J79;*7;*:1;*:17����_����152 C�6'Y^�������

<?:/4EL>�.�8Jt'[j�%�����%� h��`r'R!�

md�.�8J'\�����%"�����

.�8Jt<@,J=�8�7@(+J�eU�&�Zv�&%�#

��.�8Jt� '[j����

.�8J<@,J=�8�7@(+JMO�@(+J�eU�&%�#

��.�8Jt�f��.�8JeU'R 8�7@(+J'[j����

.�8JP$n�.�8J�#��.�8Jt�f��F6G�Jt

0�K�> DYNAMIC '[j�������

MN�a��.�8JY^�Qg�Wp'\����

����

����������� ��������

� ����� ��������� ��������

������

�����

Page 150: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

142 �$Y"U.EI8�:HN�?B=7

2E:HN�3�<J�d~^��.EI8�:HN+R# .ec C-0J��h��Q'v�3�<J����DYNAMIC 5�M�A���d~^��9LN� : ) Tm'SW�3�<J��Tm�� ����

<�;C-0J�% DYNAMIC 5�M�A%_r���)��?C1J@�<�;C-0J�]��)!��?C1J@�<�;C-0J��3KN@<�

;C-0J�set default pathname 9GNA�_r�)(C-0J���

3�<J�.EI8�:HN�Z���)(�|lP2�EN�)(��&��

3�<J\f��t���(� ��jX�t��)!������b�9G

NA���C-0J���3�<J+2�EN�(u�?B=4�q`�!��

sb inventory_cursor:$open

�z�� OPEN }�q`�(jX�Pl+g��!��[e� }�J�Ew��(���z�� }�o���Pl+g���%xd�)!�,���jX��z�� }�VzWi�DK�6F0N@+p*'�nr�� ����

3�<J�����Oys�k�+{c�(���3�<J�+a� printcursor 9GNA+_r�!��

sql_debug> pc key_cursor

dirname = filename = wri_14.eccursorname = key_cursorcurrent line = 33definition text = select co_name , co_phone FROM SQL_books. company WHERE co_key IN ( 3 , 4 , 5 ) number of rows to buffer = 2collect statistics = FALSEcursor kind = Declaredcursor id = 0

Variable Name Var. Type Variable Value––––––––––––––––––––––––––––––––––––––––––––––––a E_INT 3b E_INT 4c E_INT 5no operation variables

� ��.6>/D3�<J�����k�+{c�(��� list active cursors 9GNA+_r�!��

Page 151: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

143r�Y�U(BJ1�3HN�;?90

sql_debug> lac

maximum number of active cursors = 5number of active cursors = 1current transaction id = 4current scan lock level = 2current update lock level = 10

Cursor Cursor Bkend Scan Update Current Cursorid state id level level Row id Name ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––0 not positioned 4 2 10 0 wri_14.ec:

key_cursor

,�6K�_y&l]�#��� print cursor operation type (pcot) 2CN=&[h����

sql_debug> pcot

cursor kind : Declared

����

�� �

;@+K<�6�5

@'*K�bh

�Unify DataServer: SQL/A Reference�� set default pathname ;?9-2CN=

��� print cursor (pc) 2CN=&Zw��,�6K�����`q&l]�#���`q�,�6K�Waxet�l]�$���Waxet���Qs�����PS�cu����

6�5@'*Kg� DECLARE CURSOR o��� AllOCATE CURSOR o�[h�$�,�6K�td�,�6K�Ov,�6K�!��td�jnt��# o\�V%�,�6K�_y�^pkX�m��Wa�$���,�6K�8*>D9/,�6KT"i�,�6K�!��,�6Kt�d�F4G�Kt.�

M�= DYNAMIC �m��V%�2LN( : ) �m����

ID ��SQL/A IN7*E35:E� ��,�6K�T"i�!$��� �ID��list active cursors 2CN=� ��l]�$#(/:)A,�6K�:�AK�,�6KkX�fR����

��������

Cursor Name�,�6Kt�

Cursor ID�,�6K ID)

Page 152: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

144 |�]�W$CJ/�2HN�;?9.

*�6K�d��nX�8&>F9-����O��b !���O�*�6K

���*�6K"sV� z�7&CJ3<wb (�����SELECT,INSERT, DELETE, UPDATE) !���

*�6K�sV� SQL/A z�:,3<�8&>F9-*�6K�fv !�z�:,3<"wb�����"PQ�b����

SELECT * FROM orders WHERE ord_qty > 0 ORDER BY ord_part_no

sV:,3<�|�]�! D3<{j�Ue�

*�6Kh�p^� SQL/A z"wb������z��ZiSt�*�6Kh�� UPDATE . . . WHERE CURRENT OF ��� DELETE . . . WHERECURRENT OF p^�*�6Kh�� OPEN p^������

*�6KnX ! 6�3A#&K���

*�6KnX ! 6�3A#&K�;%L-<J@3}����!��6�3 EPP CJCM591�g� ! ���`s ! @3���

c[ !�� z� 6�3A#&K�[u\�

*�6Kp^:,3<�wb ! D3<{j�m~�

SELECT INTO ��� FETCH p^�c[�l� T[�?&<1&4�

SQL/A IN7&G23:G�AMN<(N=xy����M�*K�?9A# ! Ro[�j���

D3<{j��*�6KnXz�_� !���$-:%B�)�CN�*�6

K�D3<{j�q"wb�����;?9.592HN�c[r�D3<{j�q"{Z�����

a�w��D3<{j"kY� ;?9+0EN="b����

Cursor Kind�*�6K�d��

Definition Text�sV:,3<�

Cursor Definition Variables�*�6KsV{j�

Cursor Operation Text�*�6Kp^:,3<�

Source File�6�3A#&K�

Path of Source File�6�3A#&K�@3�

Line Number�[u\�

Operation Variables�p^{j�

Number of Bytes in theVirtual Row

�RoM'�?&<j�

Number of Rows to Buffer�?9A# ! [�j�

�����

Page 153: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

������ ��

����

145`�I�E$9=+�-<A�361*

�������������� ��

Kd� 361(,;A5 bZ

edit cursor variable PGM�:.4^U�X#QV �

��

print cursor variable :.4^U�X#9=A4 ���

361*,;A5���!�:.4^U#LY� ���:.4^Ua#LY

���:.4^U'?A4�37&>4'�/>BC�'�/>�� �

��:.4^Ua�W�'�/>a�,@A#]����

'?A4$)2%8'�/>�����:.4^U�'?A4X#=.4\O� ���N�����$.0=.)� print cursor variable (pcv) ,;A5#Kd ���

sql_debug> pcv *Variable Name Var. Type Variable Value–––––––––––––––––––––––––––––––––––––––––––a E_INT 1b E_INT 2c E_INT 3no operation variables

[Y�:.4^U�����S_#=.4\O� ���:.4^Ua�N�e

��'�/>JR#D��]�� print cursor variable (pcv) ,;A5#Kd ���

sql_debug> pcv key_cursor:avariable name = avariable type = E_INTvariable value = 1

:.4^U�X#^F� ���:.4^Ua]�� edit cursor variable (ecv) ,;A5#Kd ���361(��:.4^U�]���S_#\O �T

�X#c�H"������

sql_debug> ecv avariable name = avariable type = E_INTvariable value = 1new variable value ? 8variable value = 8

e

Page 154: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

146 [�E�C�6<%�(:>�.2,$

�������

KUY��?M��\O�@aW��Y���.2,!&7>0�F^ �

�� �KUY�<)/VI�RP�#-�5KUY��� �LZ�VI

���

H�V��KUY��� �LZ�VI��.2,!&7>0�I���

������������� �

F^��.2,!&7>0 ]Q

list active dynamic statements �� ��#-�5KUY�\O�6<>

/���KUY��ND����PREPARE Y�A�/;>'#(:>�J_�����#-�5���

print dynamic statement SXKUY�PB�6<>/�@a��

+�18,#3;9�*�LZ�<)/VI���

print dynamic statement &7>0�T`�����Y�\O�GP�����pds ��.4 =/�+�18,#Y�-")/�VI���

Page 155: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

147@�3�2�*.�� -0�%)#�

�/0&5=>�A;�*.0&�����list active dynamic statements (lads) �+0'�<B���

sql_debug> ladsStatement Names–––––––––––––––CustomerInsertprepared_stmt_name

5=>�$�!&�*.0&�����print dynamic statement (pds) �+0'�<B���

sql_debug> pds CustomerInsert

Prepared Statement ’CustomerInsert’Text: Insert Into customer (customer_number, name) Values (?, ?)

�����5=>� ��:����@�3�2 SQL/A �91��8��"�(,#��*.�� -0�6�?��8�47�����

C

Page 156: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

148 V�B�A!6;(�*:=�/3-'

���� ����

@JE[>��,#29-&�CL��7+0UK�;+0��M��V�B

�AT�DZ�����!&."5@JE[>��?�P������@JE[

>���

/3-%)8=1�DZ���!&."5@JE[>�QY�SI������

��!&."5@JE[>�;+0SI����

H�S��@JE[>�DZ���/3-%)8=1�I����

���� �����������

DZ��/3-%)8=1 XO

list active descriptor areas ����!&."5�?�P���

��@JE[>�6;=0����

print descriptor area @JE[>�QY�6;=0����

T�/4$<0�@JE[>�G������@JE[>W�FN���

���� �

pda )8=1�R\�����@JE[>W�FN�����pda ��/4$<0�@JE[>�SI����

Page 157: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

149S�<�9�.2#�%13�)-("

:=7�N������8B?W5�TJ�.23* ����list activedescriptor areas (lada) $/3+�PX�� �

sql_debug> lada

Descriptor Area Names–––––––––––––––––––––IntoDANameCountDescriptor

8B?W5�OV�.23* ����print descriptor area (pda) $/3+�PX�� �

sql_debug> pda IntoDAName

Descriptor Area ’IntoDAName’Allocated Size: 100 Count:3ITEM TYPE LENGTH Data––––––––––––––––––––––––––––––––––––––1 SMAllINT 4 0 null short NAME: MAX(num)2 NUMERIC 9 0 0 NAME: COUNT(*)3 SMAllINT 4 0 null short NAME: MIN(num)

LENGTH Z��CHARACTER & .�;U�L��Q@��HK& .�NUMERIC , FLOAT ����;U�IM�4A��Q@�� �

�����8B?W5����G����S�<�9 SQL/A �F6��E��' ,0(!�.2#�%13�CR��E�>D������

Y

Page 158: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

150 X�I�D�3:&�(8=�.1,%

��������

TP7�0�"=� ��3:&�(8=�.1,%����TP6,+�)

��3:&�(8=�MHSVL�����TP6,+�)��3<%95�M

H ��*-,3�\@����ZG���

TP6,+�)�R�.1,#���2 �01,$�CW������TP

6,+�)��JABE� ��S�VL�����

>?�V��TP7�0�OF��'4=0�L ���

K[��.1,#'4=0 YU

begin trace mode TP7�0�"=� ���

end trace mode TP7�0�"2� ���

.2!;/���TP7�0�"2���

TP6,+�)��continue '4=0��N] ����6,+�)�VL��Q����

Page 159: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

151-�'�&��!����#����

$%����#�155 ����!��,)�� �"� �/�(.���� +*������

% wri_14.rund...sql_debug> btmTrace mode engaged.sql_debug> next statement<query processor started><query action performed><cursor opened>sql_break@ wri_14.ec:38 key_cursor:$fetchsql_debug> next statement<row fetched>Company name: Hewitt Stone Associates Phone: (415) 622–7002sql_break@ wri_14.ec:38 key_cursor:$fetch

�������

sql_debug> sb $closebreakpoint set on embedded statement *:*:$close 1:1sql_debug> continue<row fetched>Company name: H. B. W. Investors Group Phone: (212) 521–3400<row fetched>Company name: G. O. Computers, Inc. Phone: (408) 340–7100<end of scan reached>End of records.sql_break@ wri_14.ec:52 key_cursor:$closesql_debug> next operation<cursor closed>...

�������

/

Page 160: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

152 \�C�@�27$�&5:�-0+#

������������

�27$�&5:�JBU�'*,�',�+"'�WR����������

19:. :/���0+" :/VO-�*�?�Z_'*,�',�+"

'�����!�)8�^��TD��"('��H>P�?�'*,�'

,�+"'�?�!�)8�WR�����

;<��'*,�',�+"'�WR�QA��%3:/�I���

F_��-0+#%3:/ ]X

begin statistics Z_'*,�',�+"'�KM�=G

���

begin cursor statistics !�)8'*,�',�+"'�KM�=

G���

list general statistics ��HY�KM��Z_'*,�'

,�+"'�[I���

print cursor statistics ��HY�KM��!�)8'*,�'

,�+"'�[I���

list referenced cursors '*,�',�+"'�KMU��27

$�&5:29#64�EN���� �!�)8�[I���

reset cursor statistics !�)8'*,�',�+"'�MS�7

(+.���

reset general statistics Z_'*,�',�+"'�MS�7(+

.���

end cursor statistics !�)8'*,�',�+"'�KM�L

`���

end statistics Z_'*,�',�+"'�KM�L`

���

Page 161: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

153& "�!������������

� (�list general statistics (lgs) ������%���$'�#����

sql_debug> begin statisticsstatistics gathering engaged....sql_debug> list general statistics bcm

General Cursor Statistics––––––––––––––––––––––––– number of open cursor operations : 0 number of fetch cursor operations : 0 number of close cursor operations : 0 number of update cursor operations : 0 number of delete cursor operations : 0 number of select operations : 0 number of insert operations : 0 number of delete operations : 0 number of update operations : 0 number of lock operations : 0 number of commit operations : 0 number of rollback operations : 0 maximum number of open cursors : 1

General Backend Statistics–––––––––––––––––––––––––– number of backends opened : 1 number of backends closed : 0 number of backends started : 0 number of backends stopped : 0 number of backends fetches : 0 maximum number of open backends : 1

General Communications Statistics––––––––––––––––––––––––––––––––– number of messages sent : 1 number of messages received : 1 number of read system cAlls : 1 number of write system cAlls : 4 number of bytes sent : 130 number of bytes received : 12 maximum number of bytes sent : 130 maximum number of bytes received : 12 average message size sent : 130.000000 average message size received : 12.000000

(

Page 162: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

154 & "�!������������

� (�print cursor statistics (pcs) ������%���$'�#����

sql_debug> begin statisticsstatistics gathering engaged.sql_debug> begin cursor statisticsstatistics for requested cursor enabled....sql_debug> print cursor statistics

Current Activation Statistics––––––––––––––––––––––––––––– number of open cursor operations : 0 number of fetch cursor operations : 2 number of close cursor operations : 0 number of update cursor operations : 0 number of delete cursor operations : 0

Cumulative Statistics––––––––––––––––––––– number of open cursor operations : 0 number of fetch cursor operations : 0 number of close cursor operations : 0 number of update cursor operations : 0 number of delete cursor operations : 0

Page 163: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

155\�@�;�+2!�"05�(*'

SQL/A�������� �����

�O���(*' %'"05�_�G����

AI�%'"05_���\�@�;�+2!�"05�J�[��L� 39 ,�#�9H����+4 1.�D^����

+4 1.��QR��>�<V�� ��-$)YM�EV�� SELECT X���&3�P=����-$)YM]�DECLARE X�CK�������&3���+5�����-$)YM�T����&3�BN�� ��D^����

F�_��8S�CK�6�[�:�Z����>W?�(*'�/'%�#�

D^�����>/'%�#�U7��� �

1 /* This program opens a cursor and checks for UEEOSCN. */2 /* This is a non–dynamic application. */3 /* This appears in chapter 3 of E/SQL/A 45 */#include <include/rhlierr.h>6 EXEC SQL BEGIN DECLARE SECTION7 int a, b, c;8 char name[31];9 char phone[15];10 EXEC SQL END DECLARE SECTION;1112 EXEC SQL 13 DECLARE key_cursor CURSOR FOR14 SELECT co_name, co_phone FROM SQL_books.company 15 WHERE co_key IN (:a, :b, :c);1617 main ()18 {19 char linein[80];20 USTATUS status; 2122 printf (”Enter the 1st company key: ”);23 a = atoi(gets(linein)); 24 printf (”Enter the 2nd company key: ”);25 b = atoi(gets(linein)); 26 printf (”Enter the 3rd company key: ”);27 c = atoi(gets(linein)); 2829 EXEC SQL

�����������������

Page 164: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

��������

�� �� ����

���

156 J�=�9�/2#�%16�),("

30 OPEN key_cursor;31 32 do 33 {34 EXEC SQL 35 FETCH key_cursor INTO :name, :phone;36 37 if (SQLCODE != UENORM && SQLCODE != UEEOSCN)38 printf (”%s\n”, ufchmsg(SQLCODE, &status));39 else if (SQLCODE == UEEOSCN)40 printf (”End of records.\n”);41 else42 printf (”Company name: %s\n Phone: %s\n”,43 name, phone);44 } 45 while (SQLCODE != UEEOSCN); EXEC SQL46 CLOSE key_cursor;47 }

),("'(%16�8?�����SQLDBGON $6-� 04�%16ID�TRUE ���–d �/%16�@ sqla.ld��/2#�%16�5�+����

setenv SQLDBGON TRUE

sqla.ld –d example6.run example6.o

�.&�!*-��3K�FL���/2#�%16�A<���� SQL/A ),(���>C�A<7G�J�=�9 SQL/A H�A<�� ��8?����SQL/A E:H��),(��;�B�����

Page 165: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

�����#'

���������

�����"%������

� ����������!(

��� �

����#'

���&$�����!

(�� �#'

157^�D�?$58)�+7;�03/(

�NC�EL�^�D�? SQL/A \��OPEN CURSOR� �$58)�+7;�=W��Xb0�.!a�C ��@�SQL/A 03/'� OPENCURSOR \�TH�� �\�JA����"�SQL/A 03/'��-�,4#%9�_R�&:;1AZB�&�-9_�&�-9PS ($open) ![I�� �

# example6.runEnter the 1st company key: 1Enter the 2nd company key: 2Enter the 3rd company key: 3sql_break@ wri_14.ec:30 key_cursor:$opensql_debug>

�&�-9�O]![I ����&�-9>c�*6;2!Xb�� ��

����&�-9�����<YV�O]![I ����print cursor (���pc) *6;2!GU�� �

sql_debug> pc

dirname = filename = wri_14.eccursorname = key_cursorcurrent line = 30definition text = select co_name , co_phone FROMSQL_books . company WHERE co_key IN ( 1 , 2 , 3 ) number of rows to buffer = 10collect statistics = FALSEcursor kind = Declaredcursor id = 0

Variable Name Var. Type Variable Value––––––––––––––––––––––––––––––––––––––––––––––––a E_INT 1b E_INT 2c E_INT 3no operation variables

�����print cursor *6;2���Kb�Q`���Unify DataServer: SQL/A Reference� �*6;2!FM�������Unify DataServer: SQL/A Reference�

Page 166: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

1�!��8.�2�&

����

������ #��"

�$��/4����

�%5��

���������7 �'6(

���� #��"�$��3+

��

)-�����0*�,9

��

158 k�P�L&;B-�/@G�583,

print cursor .>G7���Zn��fK4*06$J����fK4*06��)�1C$_N�!���Tm "�4*06���)�1C_N�d�X

"!fK4*06$S[�!���print current definition unsubstituted (pcdu).>G7$gn����

sql_debug> pcdu

select co_name , co_phone FROM SQL_books . company WHERE co_key IN ( :a , :b , :c )

i�d�<06j]l��j]���hX "���fK4*06�<06j]

�YQ�b�cI�!���print current definition substituted (pcds) .>G7$gn����

sql_debug> pcds

select co_name , co_phone FROM SQL_books . company WHERE co_key IN ( 1 , 2 , 3 )

W��W�9(32`R�:D�+='G6$^f�!o$X����:D�+

='G6$^f�!���set break (sb) .>G7$V� $fetch *�F�7$Uf����

sql_debug> sb $fetchbreakpoint set.

:D�+='G6��&;B-�/@G�YO$Ma�!��� continue (c) .>G7$gn����

sql_debug> csql_break@ wri_14.ec:35 key_cursor:$fetch

FETCH i�YO "����%�;E,A?�o$e�!�� FETCH i����9(32`R��!��#� ����� �key_cursor )�1C�HO�`R����"��`R$����\�������next operation (no) .>G7$gn����

sql_debug> no<row fetched>

Page 167: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

3�8/��+0���-�#

&) �-<.� ����

���<@�"(��%�)

;2��

�<@�!���8/� 5

-�*9�

���&���������

�$� ?6�=4���

�4

���> 1A���$�

?6��() :

���'7, 1A���$

� ?6��() :

159Y�B�?"5:(�*9=�/2.'

next operation )8=1��;�5�Q�CK�3$.-ND�J\�����SF����H�ND��IA @O�����next operation )8=1 U]����

sql_debug> noCompany name: Athena Development Corporation Phone: (503) 246–2400sql_break@ wri_14.ec:35 key_cursor:$fetch

2 VZ� FETCH W���IA���� !�3 VZ�3$.-ND�M�4<�&7#=0��IA @O�����continue )8=1 U]����

sql_debug> cCompany name: Brooks Management Consultants Phone: (212) 543–1200sql_break@ wri_14.ec:35 key_cursor:$fetchsql_debug>

�GT��%<=0W�E[��6+0XL�%<=0P R�����

��������print cursor variable (pcv) )8=1 E[����

sql_debug> pcv *

Variable Name Var. Type Variable Value––––––––––––––––––––––––––––––––––––––––––––––––a E_INT 1b E_INT 2c E_INT 3

Variable Name Var. Type Variable Value––––––––––––––––––––––––––––––––––––––––––––––––name E_CHAR Brooks Management Consultants phone E_CHAR (212) 543–1200sql_debug>

3 VZ�3$.-ND���IA��������name ��� phone 6+0XL��%�,;� 2 VZ�A��3$.-��P >����

Page 168: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

����� �����

�� ������

160 P�>�;�16&�(5:�+.*%

8:,08�$2�:, (FETCH ND�)�?C����� delete breakpoint(db) '3:-�@I���

sql_debug> db $fetchbreakpoint deleted.

key_cursor �)7� CLOSE N�08�$2�:,�FI����� $close "�9�-�A �)7Q�@I���

sql_debug> sb key_cursor:$closebreakpoint set.

08�$2�:,�JH�����16&�(5:�B=�<G�����

continue '3:-�KT���

sql_debug> cCompany name: G. O. Computers, Inc. Phone: (408) 340–7100End of records.sql_break@ wri_14.ec:48 key_cursor:$closesql_debug>

SQL/A +.*!��L��(�7�R����quit (q) '3:-�KT���

sql_debug> q#

���SQL/A +.*!��16&�(5:�B=��MS������SQLDBGON ':/�#48�(5:OE� FALSE �FI�����

Page 169: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

163

%��

������IZ`?;@Y`2c��¿��IZ`?;@Y`#�'�#µ�2^�\LF;�(��

����X�?���sfz��X�?�H�DQ�A+A:�T23;BA�/�����/� ��2x©�(��

#��"w�2���/�)"SQL/A³��¾�(�� wo�$�COUNT, MIN,MAX, AVG, SUM ���

��$��� �E5KUF;3P[=�@Y`��¾�/9�C\#�À���l.¬�9�C\$�>`M5\�"�#®¼�1�-!��*�¾�/�����(��l.¬�9�C\$�3P[=�@Y`�¥#P^<ZV¦a�3;BA��(��

ANSI(American National Standards Institute)�qkui�>`NW�D}��COI673#��#£»#qk2�©�/�����

� �!�©��9ZVº#<\�P����d��",��v�-0(��

ASCII(American Standard Code for InformationInterchange)�·�m¾#´�°�>�J�>`NW�D#®²#G:AI2±|��.�>`NW�Dn+�>`NW�D��¶¡¨#n#G:AI2«¢�/�)"�¾�/qk���

������­©#�¹"o�/COI673jx�3P[=�@Y`"$�P^<ZV�h»½��ACCELL/SQL�2¾ �.�H�DQ�A"k¯�0/�·"3;BA��.����y����]S�I�p(0(��

�"X�G4[G4+��¤�/³#:�_�J2���/�)#>T`J���o�~&��2ªt�/§��#§$�³¸"b���~&��o�#µ��r��#yg�©�"!.(��

� �����r�����#8RZ`J2y��/�)"�¾�/d������%�SQL/A $�#��#��d��2��� (��e�����{���������������

Page 170: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

164 ���

!SQL/A S�9���j_s�XKW����S�9��y����>;5�j_-SQLS�9�����+��-sv��+���$��sv� �;4�Nsv�DBAsv�����*$��

�0����GR�-}��+�'��»�+@�IW�

B ����©\(¬®¡F>�Z�z�h� y-t��+�'��®��r~-�»�+/5=;³��

�0,�+��BCU�lº¾��[�BCU ��=ZB�ªu�,$��

�.�#����+��t�+$��®À|�V;B-n*±�¨®��®c�������r~��� ³´���

����A0;5/5=;�¤¬/CX;� ��'�hµ�[�IY?581< "#2048 E1B���

����$'fo]���6W�J�¼]���m�),$��

%�������VZ5������@�IW�SD�5�Á(Á=?B-��Á-g&@�IW�

1@�IW��A�>>1J-ªu�+H0�WC�y)���+�����+A�>�{��[���

1����ÁA�>�A�>H.1W��¦�,+�·z��q`�ª��,+���ÁA�>-m�+¯��

����BUZ95:TZ-���½��A�>K�;!�°w-²��$��

-&("*¢���­��BUZ95:TZ�¼-��§¿�

����������/)/JV7�:TZx��£�-� �+Unify DataServer �°����A0X5BV�H.1W¶�k¹PQV�/CX;�vb�BUZ95:TZ�Y?5d¼i§�MVR�OAH2WB�3LX�@0Z6:;@O�JY=;��¸�¥«(�e(�a^��ª�p�-g%$��

Page 171: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

165���

$&*@�;J�8�����¤¦�Z��@�;J�8?�HT)q��&��q�b·��e»�& B >S��D=6O?�HT���r��^�� ��

.+���!preallocated file )w��������

"#����+3?,H82�K�mv�P�5x³��&82�K���

"#���#����#]z�'�� ��·�����ARV536QV�

��!±�t(��ª�'&s�9=A�Z¢��1�:T�x³­®������|��¹�1�:T�% ��W°1�:T�q�\¡�1�:T�<-CL=3�n1�:T�<-CL=3���1�:T�a%��1�:T�

���#E=34R.VB�~s��@�;J�8�e»�&G*-T68?M�ARV536QV�2N=6O�¥k�$�3S�V+=I)c¶�&IU98���

���82�K�f '&�����¬����

����#�� ��@�;��µ��@�;�y��t�)Z����@�;J�8�`�@�;)f! �)«�� ��

����#�� ��� �����º����lu�x³�&�"��g��#²p��$��@�;J�8�º��)�j��&$���&h¡�

������º�_ �'&@�;�;-I������NUMERIC, AMOUNT,CHARACTER, BINARY ���

�������'%*@�;)}(����&��@�;;-I)¨�@�;;-I�©q�&h¡�

������o��¼¶��e»�&?�HT�FO��$���@�;J�80H7/3A)f!i[¸Y�

������������¯�£��@�;J�8r�´�������82�K�?�HT�FO����

������(-SQL/A §�e»�&@�;J�8�~s�'&�¶������INSERT §�����'&����s����¶��% �

������),�&{d��X��������@�;J�80H7/3A���

Page 172: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

166 ���

DBA ���S�9�r��)�C�?L�<���,4=<��(c]e�?.K�

DBA "$S�9���)�<2�M�#,4=<]���C�?L�<���C�?L�<0J;/4D#n���'��n�(�����(c]e�?.K�DBA eg+t�S�9��DBA eg+c]��'�y'}��'�(�����!��

DDL (Data Definition Langusge)C�?�afh�SQL/A ��=AD��C�?L�<0J;/4D+�a��'�n��!��

�-,S�9��+r�������q��)(��`����:<BO�a�!��C�?.ZB5VB-�8J:<BO+q���S�9�a��!��

%(�delete�B�JW&���k�!�����k+o|��'�}b�!��

'&1�@.FNA4SQL/A��^¡�(��+_"�\�

������CG.<����KVZ?�C-<4�B�K������CG.<#p~�� ����

���������v2� �+q���k+[���(,4=<�w�

��������j�{���C�?�

DML(Data Manipulation Language)C�?�nfh�C�?L�<���+�j�( SQL/A ��=AD���

����r� �^�(�i��=AD������m�>�:QW=2RVB-�l�EP.Z��v�dw�� ���s �=AD���nnn–nn–nnnn ���*��0 &9 ��s���

%(�drop�B�JW$<2�M�%��C�?L�<0J;/4D+o|��'�}b�!�

�����*#�� �@.FNA4,KV6�:TZ�q��(1�>W�z��SELECT �+q���7ZH.Wu��&)����1�>W+n��(���@.FNA4�f1�>W+q��!��1�>W��xku�n��)!��

�!0)7ZI-3RX�:TZ��+p~�� ����

/+.��k��YA4����DUZ94:TZ�k�_!)(C�?+�j����%���!��

Page 173: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

167���

�����G�C!��!%�%+/»��,F�O[!a¶�N1�[I"�{�Æ!y�/´u�%��

�������Æ KD>]:h�/¬Ã��{�G�CQ�@F�O[!�� `¦µ�*-,�/s©�,09A@¼��

��������$KD>V8�Æ¥��-�´u�,{!ID �

�� "�½'~&r C 0PZ;�>X]!º��R@Hº�"�SQL/A ¹�R@Hvx¹!�&|�/ªo�%��R@Hº�/�Ã�����!vxgqb�G�C¥/­�%��

�#���¹��v�����6�B[!a¶��,{!ADH 09A@�,� �®¶« ���-,6�B[!�Å�_¿6�B[ 09A@� ,!"�SQL/A GLD7/�Ã�,� �����

�����F�O[�¡/§$� {/t��,���� ,{!09A@¼��2]GD9@"�G�CQ�@!F�O[ f°�-%��2]GD9@"�Z]9�KD>V�%�" B EZ����

!F�O[ {/�¯�%�"¨c�%��

IRMA(Integrated Recovery Manager)�|�·mSJ�?U�P\:YT(>@FT�e!w�^©��¬���£ G�CQ�@/·m�,·m>@FT!O�H�z�Ä����

ISO(Internatioal Standards Organization)}�³�bjz�<]MV�CvxBNH340!��!�¾!kf/�©�,�����

��W�=���!À�|.��¸�!F�O[/t�� ,SQL À�|.�!C2P�

����8�/���������

����¢ Z]9�����!F�O[/hǵ�,09A@¼��

���!HY]=9>X]�{({!:[�P/09A@� ��) �,�Á�\D9 "�pÂ\D9�±�«\D9��+%��

�����Unify DataServer �HY]=9>X]!\D9Äl/nd�,���� ,���/s©�%���-"�\D9�-,G�CQ�@5O?49H�\D9!C2P�\D9/Äl���,HY]=9>X]�)#HY]=9>X]��� 5O?49H� \D9/»����,��� i���²¤�%��

Page 174: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

168 ���

"���"����#I�ES�A8Q@7:J�"^G:1�"}`"8Q@7:J%b� UnifyDataServer "r«�I�ES�A^G:"�)!|^G:�,H�Q\^G:!]5B�'��

"�°q®�th�£�?AHW�k!� ,/.­��´½^;�JZ_>:?Y_^;*���������

:9$)*�½¯��»�.��"Q�\f��8TZ_K����.�½1¯z�.t~�Q�\f��¡1¶�'��Á½f��!#�AND, OR, NOT�-'��

/1/�#��H�Q\"³�|"¿¡���H�Q\"��"|"¿¡�ª��.��"H�Q\n"[_:�

50,&I�ES�A"eu¦ th­�1¬i�.�k"E5R�

4*���8�(�²º��0�1���������

6������ �� F5LVG:� �3R[<�?Y_��»�.9�D\"�¾�SELECT µ1�»���=_O5\�!¢,/�� �9�D\1���.��!�F5LVG:� �9�D\1�»�'��

non-volatile storagestable storage 1���������

.'%dÀ"+-yl �sw!p��w�¦I�ES�A�x½Á����sw�,¡c1¥)���sw1¤��Boyce–Codd �sw"+� +-}§ �sw'�.�

� 2��"P4�\K#¡1�� ����1a¸�.P4�\K¡�

�1/�#��H�Q\"³�|"¿¡���H�Q\"�|"¿¡�ª��.��"H�Q\n"[_:�

+9I�ES�A�½1���������

��!��I�ES�Am½�!�¹�/�´½¦©�1¼v�.j±5S_J!g¨�.���� $�NG:3GRP25\1���-�:[�_3GR�.��!H�R1U6_J�'��

ordinary fileregular file 1���������

���´½¦ I�ES�Athc"p·" `�

-��� ���[_:���H�Q\!��/�XM�: ¿�'�#1¿"CGJ1o(H�Q\�

793"�°q®�th�£��{��/��&�"I�ES�A"T�@1o(P25\�

Page 175: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

169���

� �! ������K>-,u��������U*�"(C+.Q��v��a��C+.Q���&�",S5�?�)!��V�����C+.Q�R2LO��C+.Q�� �h���>A.9%'������R2LO��C+.Q�|>A.9�g#kr��W���

)*x����cxm�_x�

&,-Y}�)�7THP<3�s�\��(SQL/A ��

�%��$��4Q�E��z��$��4Q�E���=�DQ����Vf*M@�3�o��(��*n�!��

������������n��91�I��,3:9*]X�)�M�6� �,3:9��(91�I�

���������n��91�I��,3:9*]X�)�M�6� �,3:9��(91�I�

+#91�I,3:9�(����(>�;F�90D8/3?��%�91�I0D8/3?�pf�(����(q�*yb�!��

�!���'"ES4OJ�A4&|�(tZ�;.E��wf��?OT637NT*,H�?�!��

�������������M�6�#,3:9��(>�;F�9�

��������>�;F�9i{�)(��� UnifyDataServer �i{�)(91�I�>�;F�9�,3:9��(� ��M�6�BDP<391�I�,3:9�(����!��

PUBLIC ���.BDP<3>�;F�9i{�)(����Unify DataServer ~��(M�6��BDP<3>�;F�9�BDP<391�I��,3:9*]X�)���M�6�#�PUBLIC M�6�*l��(����!��

/�$��>�;F�9�>�;*`j��'��d�( SQL/A ��

(�����0GR�=-T479=J��"�e{�)�>-93u�^�����&�"['��&)(|>�;�a���C+.Q��&�"['��&)(C+.Q��vC+.Q#kr�������

Page 176: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

170 ���

RDBMS(Relational Database ManagementSystem)`b�=^JaG�BT�?=?FY-pÄ�*AQH23/��!)�UnifyDataServer 6�La���1dBQ3�? RDBMS -���!��Unify DataServer 1dBQ3�?��ACCELL�RHLI�jÈ{SQL/A�¾$�"{SQL/A�]�<Sc9_Y�=3abTa�DBAE�a��' ZK\�MdI_-s"!��

����������

�AQH23/�l&M�I23/�l�'��G�BT�?qf��%���(�� �-mµ�*Sc@?�¸uSc@?���;XDH�+�H_d<8=^d�gw-¼§��)�c�aND8�!��!��;XDH�+�����)�oÅ�����H_d<8=^d�gw-£��¨�Á�!��

���G�BT�?ND8/DS-³"�*]�F0`F0�

���������F�Ra�Æ��F�Ra���Æ����§��*ª-�¥¯�s# �-¼��* �-��!��

�� ���5Ub�F0d9=?FY�C1JXD8Q.1a�°{¯�¬�Q.1a��ǦQ.1a&GN1?')%«��)!���(�$n)±�(+�Q.1a� GN1?-���������

��F�Ra-���������

���rzh���x¡(+�ƪ���t���=?FY»��!��´+���+�Â��,�|i�9a�S�

#"!� Unify DataServer �²º�e¿-���G�BT�?5R>38HÀ��Ã�* �����¹�������y¶�P`5I(.) �Iat�($) �/DHW�8 (@) �O2dIt�MD=\t�(#) �48?8_Z�=^d(!) �/?B`?8(*) ���

#"�Unify DataServer �²º�e¿-���G�BT�?5R>38HÀ��Ã�* ������������SELECT, NUMERIC , SORT���

RHLI (Relational Host Language Interface)`b�=^JaV?H~�1dBQ3�?�Unify DataServer /S`:�=^d��Ã��* Unify C Sc9_Xd9r���!)�RHLI ��­���1dBQ3�?�?7[d�/8@?O?¢©�?7�W¤��A�H��' �½-®v�!��!��START,COMMIT , ABORT r��H_d<8=^dpÄ�k·1dBQ3�?%®v�!��

�����6bdHH_d<8=^d�;XDH�+��»�-}�Á�!��

Page 177: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

171���

���� ����H�ET�CWa]�Y!DFI!��!Wa]�Y�Wa]�Y·� 1 ��DBPATH ?eQ5;]c�A_eN`Z�E �¯�0�H5c<Ia!9QDFI 0 �¬�'��

�G�Rb�Æ£�/Å!DFI����#�company G�Rb���!n�2¸~�/Å����"�G�Rb ­l��.�G�Rb�-����/H�E!��ªf���

�IDSQL/A p.±�-0�«���2^K�< �½�'��

�����«!§��+�!��!¼$���°!j!z����

����sÆ�/³}2��G�Rb�O]��6eHF<C2t)H�ET�C9RB8<I!=b�S�

�������^�@ �¯�0�C:�X��24<DC��/, xm�/xm}!E6S�

������C:�X�À� 4<DC��/C:�X%!4<DC2xm��.��.���.�/!�²Á C:�X2����.��.���.��/^�@³}!E6S�

����"�C:�Xr xm�0�³}��¨�C:�X!^�@ ��!��À�!�C:�X ¢��/H�ET�C9RB8<I2 ��/�� ��'��

�����9Uc�G5e=ACGYQ36b oµ�0�SQL/A»!=b�S�

����VCIXAe!L�J784 g¤�/H�ET�C!wkÄh�U�B!p.±�ªf�

�!G�Rb�-�2�©��.�|��'��®���"�{ u���©�0'��

����G�Rb�-�!i¹+²�G�Rb!i�?P�2�Â��¿�1�'��

$ ���H�ET�CG�Rb����!��-�*�������'��&�!�2´(�(C:\e�/4<DC¾��

�#��¥!I`e@<A_e H�E2���'�, �/dF<�

�#���Unify DataServer �4Sa>�A_edF<�MFQ32����.�qÃ�/Z[ayr�MFQ3"�H�ET�C�I`e@<A_e �H�E2t('��¦�SdDC24<DC��H�E�¡ �º��!SdDCyr��/, �²�H�E�¡2²� �Â��/9Uc�G5e=ACGY!v¶�

Page 178: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

172 ���

;=(0@93L:�BQ �£»�%$f��@93L:�BQ}¹�²ÁA.9<�"��8+>G9/�@93L:�BQ���'�Z�����

SQL/A;�7D�5��·'a¬ �#�u��$����»�%$ Unify SQLx{�SQL��Structured Query Language �¥³����A ��ANSI��¾r���

SQL/A ����$VÃ�]Æq SQL/A ³����1FT=��SQL 1FT=�z�«À�%���END 1FT=�"���SQL/A 693NT��¿ ���

9)81*%2335:H�_�Wn�%��jX���������i:�C�;*5/�ABQIJP���

:<�.��SQL/A ³�p�g�%$º�~&��«%���%�º�~&�� y�%���

6+-Â!:�BQ'�$´¸�

���!Â!|�µ��%$Ž¢�fà �;�7�69<�`|��§�Â��§�7+C'g����

� $� ��$;�7D�5����$Ž¢�����o��U�<OT2/3NT��;�7D�5')/65�$�|[­�³'g����

� $� ��$/'m~^s�CS0OH�_����M�2c#���t\�<OT2/3NT)E�<�%���

� $� ��$����!��!<OT2/3NT4K�>Q��A9/)9C;A+5'¶� ���4K�>Q���I;*)�_k$���z�d¿ �<OT2/3NT�;�7D�5'±w�$�²��·g�%���

� $� ��$�#� "�!Unify DataServer �S9/!S9/^�����M?�/�¦�'¡l�$16�RDQ�

� $� ��$#�Ž¢<OT2/3NT���°h®�jX���jÄ���S0��35:H�_�z�1G9<�%����<OT2/3NT'�#� �#�1G9<�%��$<OT2/3NT'��|�$��¯¼������·'g����

5&4�7,5.�Fe�M�2�¤��%$5.�F©v�

�����#� <OT2/3NT�;�7D�5-B4,/<'ª(�#����#�$���S9/'b¨ �S9/'^� �z��S9/'b¨ ��S9/CS<1Q�

$����<OT2/3NT1G9<�%$���35:H�_�)E�<�%$�c#��%�<OT2/3NT�

$��;�7D�5�Y Wn ��"���1G9<�%����<OT2/3NT'S�QA9/ ���

Page 179: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

173���

� ���2�.:�,1�8?�HR���R�B� c"V���"rK� u�uc��R">5�'�Wl ���

� ����������h[�60+=&�c"L���60+=1�8?�

��R�c"Q^����mQ ���

��������1�8?�R"Q^ ���T\� ��Uq� %�-?�Zt�Q^Fi�%�-?��/$4<0'AG�`P�!�%�-?��/$4<0'�`P�!�%�-?�����I�g��!�%�-?���

�������Q^"R� 7=��Q^Fi7=�"Q^� ��7=��O1�8?�Q^�! �

�������]n"dM ���Z��.,'"XR� );@3�(?�9�

��� ID2�.:�,�>�*"Wl� >5�'�_�

���1�8?���2�.�vsefY�kse�JDC�bS ���>�*��bS� ���N� Ea�j���#��op�1�8?� �Uq����

�����2�.:�,2�.�kse(?�9�

Page 180: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

175 ��

��

��

20&$*", $)"1"$3&1� ��

�((1&("3& '4.$3*/.2�%"3" 380&2� ��

�������� ���������� 23"3&-&.3�

42"(&� �

�,,/$"3&% $412/12

%&2$1*03*/.� ��

%8."-*$ ."-& '/1�

2$/0& ".% ,*'&3*-& /'� ��

������ %"3" 380&

$/-0"3*#,& )/23 5"1*"#,&� ��

*. )/23 5"1*"#,&2� ��

� � '4.$3*/.�1&24,3 %"3" 380&2� ��

����� ������� ������� +&86/1%2�42"(&��

�����! %"3" 380&

$/-0"3*#,& )/23 5"1*"#,&� ��

*. )/23 5"1*"#,&� ��

�,".+ 0"%%*.(�*. $)"1"$3&1 )/23 5"1*"#,&2� ��

�1&"+0/*.3

%&,&3*.(� ���

%&2$1*03*/.� ���

�!�� %"3" 380&�$/-0"3*#,& )/23 5"1*"#,&� ��

$)"1 %"3" 380&� ��

�)"1"$3&1�)/23 5"1*"#,&� �

��������� %"3" 380&

$/-0"3*#,& )/23 5"1*"#,&� ��

*. )/23 5"1*"#,&2� ��

����� 23"3&-&.3�42"(&� �

�/,/. 20&$*", $)"1"$3&1� ��

�/,4-. 5",4&2�*. %&2$1*03/1 "1&"2� �

�/-0"3*#,& %"3" 380&2� ��

����� '*&,%� �

����� '4.$3*/.�1&24,3 %"3" 380&2� ��

$41,&. 2314$341& &,&-&.3� �����

�412/12

$,/2*.(� %8."-*$� ��

$,/2*.(� ./.%8."-*$� �

%41*.( %&#4((*.(� ���

%&$,"1*.(� ./.%8."-*$� ��

6*3) %8."-*$ 0"1"-&3&12� �

'&3$)*.( 5",4&2 '1/-� %8."-*$� ��

'&3$)*.( 5",4&2 '1/-� ./.%8."-*$� ��

'/1-"3 %41*.( %&#4((*.(� ���

��� ���

�*.%� ���

6*3) ./.%8."-*$ ������ 23"3&-&.3� ��

/0&.*.(� %8."-*$� ��

/0&.*.(� ./.%8."-*$� ��

/5&15*&6� �

0/2*3*/.� �

40%"3&"#,&�&7"-0,&� ��

40%"3*.(� %8."-*$� ��

40%"3*.(� ./.%8."-*$� ��

Page 181: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

176 ��

���� (+'.&� �

&#5# 4536%563' '.'/'05� ��

�#5# 5:2'4

1( #))3')#5' (60%5+104� ��

%1/2#5+$.'� ��

1( &'4%3+2513 (+'.& %1.6/04� �

1( &:0#/+% 2#3#/'5'34�

&#5#253 4536%563' '.'/'05� �

���� &#5# 5:2'�%1/2#5+$.' *145 7#3+#$.'� �

���������� ���������� 45#5'/'05�64#)'�����

���������� ������� 45#5'/'05�64#)'� ����

�'$6))'3�'/$'&&'& ������ ��

������� &#5# 5:2'�%1/2#5+$.' *145 7#3+#$.'� �

������� ������ 45#5'/'05�64#)'� ��

�'%.#3'& %634134�4%12' #0& .+('5+/' 1(� ��

�'(#6.5�(+.' 46((+9'4� '/$'&&'& ������ ���

&'.'5' $3'#-21+05 %1//#0&�64#)'� ��

������ 45#5'/'05�'/$'&&'& 64#)'� ��

�������� ����� 45#5'/'05�64#)'�

�������� ������ 45#5'/'05�

�'4%3+2513 #3'#4

&'4%3+25+10� ���

&63+0) &'$6))+0)� ���

&:0#/+% 0#/' (13� ��

(+'.&4� �

+0+5+#.+;+0)� �

3'53+'7+0) 7#.6'4 (31/� �

4%12' #0& .+('5+/'� ��

&16$.' &#5# 5:2'� �

������ ��������� &#5# 5:2'�%1/2#5+$.' *1457#3+#$.'� �

�:0#/+%

#22.+%#5+10�83+5+0)� ��

#22.+%#5+10 17'37+'8� ��

0#/'4� �

1$,'%54

.+('5+/' 1(� ��

4%12' 1(� ��

2#3#/'5'34

+0 %634134� �

&#5# 5:2'�

&'4%3+25+10� �

3'453+%5+104 10� �

42'%+(:+0)� �

8+5* 23'2#3'& 45#5'/'054�

����� 45#5'/'054� ��

�:0#/+%#..: &'%.#3'& %634134�&'4%3+25+10� ��

�/$'&&'& �����

&'$6))'3� ��

&:0#/+% #22.+%#5+10 17'37+'8� ��

17'37+'8� �

3600+0) #0 #22.%+%#5+10� ���

45#5'/'054�17'37+'8�

83+5+0)� ��

��� ������� ������� -':813&4�64#)'� ��

�0&<1(<4%#0 %10&+5+10� ��

��� 65+.+5:�3600+0) #0 '/$'&&'& #22.+%#5+10� ���

�33134

&'4%3+25+10� ���

/10+513+0) 8+5* !���� ��� ���

4'7'3+5:� ���

�"�� ��� -':813&�64#)'� �

�"����� ��������� 45#5'/'05

#..18#$.' ����� 45#5'/'054�

64#)'� �

�"����� ���� 45#5'/'05�64#)'� ����

�"����� 45#5'/'05�64#)'� ����

�"����� ����� 45#5'/'05�64#)'� ��

Page 182: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

177 ��

�#5#. '33134

&'4%3+25+10� ���

*#0&.+0) +0 �/$'&&'& ������ ���

����� 45#5'/'05

('5%*+0) 7#.6'4 (31/ %634134� ����

64#)'� �

�+'.&4

��� �'4%3+2513 #3'#4� (+'.&4

�+.'4�%3'#5+0) 8*'0 3600+0) #0 #22.+%#5+10� ���

����� &#5# 592'�%1/2#5+$.' *145 7#3+#$.'� �

(.1#5 &#5# 592'� �

��� ��� ���������� 45#5'/'05� �

�.1$#. � 7#3+#$.'4� ��

�145 7#3+#$.'4

#441%+#5'& &'$6))'3 %1//#0&4� ���

�����" &#5# 592'� ��

%*#3#%5'3 &#5# 592'� �����

%1/2#5+$.' &#5# 592'4� ��

+0 %63413 &'%.#3#5+104� �

&'%.#3+0)� ��

&'4%3+25+10� �

06.. 7#.6'&� �

3'('3'0%+0)� ��

��!� &#5# 592'� ��

64#)'� ��

8+5* ��� �� &#5#� ��

� �� ��� �� &#5# 592'�%1/2#5+$.' *1457#3+#$.'� �

� �� ���� &#5# 592'�%1/2#5+$.' *145 7#3+#$.'��

�/2.+%+5 %634134�&'4%3+25+10� ��

�0%.6&' (+.'4� ���

��������� (+'.&� �

�0&+%#513 7#3+#$.'4

&'%.#3+0)� ���

&'4%3+25+10� ���

+0 ��������� (+'.&4� �

5'45+0) (13 06.. 7#.6'4� ��

7#.6'� ���

������ 45#5'/'05�'/$'&&'& 64#)'� ��

�05'336254�*#0&.+0)� ���

������ (+'.&� �

�+('5+/' 1( # &90#/+% 1$,'%5� ��

.+45 $3'#-21+054 %1//#0&�64#)'� ��

�1%#. � 7#3+#$.'4� ��

.10) &#5# 592'� �

��! (60%5+10�3'46.5 &#5# 592'4� ��

��! -'9813&� ��

��� (60%5+10�3'46.5 &#5# 592'4� ��

���� (+'.&� �

�1:'3313 %10&+5+10� ��

�10&90#/+% %634134�&'4%3+25+10� ��

�6.. 7#.6'4�+0 *145 7#3+#$.'4� �

� ������ (+'.&� �

�6..4 +0 &'4%3+2513 #3'# %1.6/04� �

Page 183: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

178 ��

������� # 3 38/$�".,/ 3(!+$ '.23 5 1( !+$� �

���� 23 3$,$-3�42 &$� �

���� ����� 23 3$,$-3�42 &$� ��

/"�$7 ,/+$2� ��

/"#4�$7 ,/+$2� ��

��������� %($+#� �

������� 23 3$,$-3�42 &$� ���

�1$/ 1$# 23 3$,$-32

++.6 !+$ ����� 23 3$,$-32�

-# 3'$ ������ $-&(-$� ��

6(3' "412.12� �

#$ ++." 3(-&� ��

#$2"1(/3(.-�

#41(-& #$!4&&(-&� ��

#8- ,(" - ,$� ��

#8- ,(" - ,$ %.1� �

#8- ,(" - ,$2� ��

$7$"43(-&� ������

(-/43� ��

- ,$� �

2"./$ -# +(%$3(,$ .%� ��

������2�

6(3' #8- ,(" / 1 ,$3$12�

0�$7 ,/+$2� ��

���� # 3 38/$�".,/ 3(!+$ '.23 5 1( !+$� �

�����%4-"3(.-2 (- $,!$##$# �����

��� ����

���� -# $,!$##$# ������ ".,/ 1(2.-� �

���� %4-"3(.-2�(- $,!$##$# ������ �

����� 2823$, 5 1( !+$�(- ����� 2314"341$� ��

�.62

#$+$3(-&�3'1.4&' - 4/# 3 !+$ "412.1� �

#$+$3(-&� -.-#8- ,(" $,!$##$#� ��

%$3"'(-&� �

(-2$13(-&� -.-#8- ,(" $,!$##$#� ��

2$+$"3(-& ,.1$ 3' - .-$ 1.6� -.-#8- ,("$,!$##$#� ��

2$+$"3(-& .-$ 1.6� -.-#8- ,(" $,!$##$#� ��

4/# 3(-&�3'1.4&' - 4/# 3 !+$ "412.1� �

4/# 3(-&� -.-#8- ,(" $,!$##$#� ��

5(134 +� 2(9$ .%� ���

������ %($+#� �

�"'$,

""$22�&4(#$+(-$2 %.1 42$� ���

/1(5(+$&$2�(- �,!$##$# ���� � ���

�"./$ .% #8- ,(" .!)$"3� ��

������ 23 3$,$-3

$,!$##$# 42 &$� �����

/1$/ 1(-&� �

2$3 !1$ */.(-3 ".,, -#�42 &$� ��

��� ��� ���������� 23 3$,$-3�42 &$� ���

2'.13 # 3 38/$� �

�������� # 3 38/$�".,/ 3(!+$ '.23 5 1( !+$��

�����

�$!4&&$1

#$2"1(/3(.-� ��

$7 ,/+$� �

04(3(-&� ��

$,!$##$#�.5$15($6� �

������ $-&(-$�%.1 /1$/ 1$# 23 3$,$-32� ��

Page 184: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

179 ��

750&*+(9- 463148� ��

750'�0* 98/0/8=

,36 *+(9--/2-� ��

97'-+� �

750)' -03('0 :'6/'(0+� ��

������� 1')63� ��

������ 78'897 :'6/'(0+� ���

������� )32,/-96'8/32 :'6/'(0+

'2* 78'68/2- 8.+ �+(9--+6� ��

97'-+� �����

750+,80 ,92)8/32� ���

750+/28 ,92)8/32� ���

�� !�!� 78'897 :'6/'(0+� ���

��!������� )32,/-96'8/32 :'6/'(0+�97'-+� ��

��#����78'897 :'6/'(0+� ���

8'8+1+287

�1(+**+* �����3:+6:/+;� �

�1(+**+* ���� ,361'8� �

46+4'6'(0+�

8'8/78/)7�)300+)8/2- *96/2- *+(9--/2-� ��

8'897�:'6/'(0+7

*+)0'6/2-� ���

*+7)6/48/32� ��

6+86/+:/2- '773)/'8+* 8+<8� ���

:'09+ 3,� ������

"� ,92)8/32�6+7908 *'8' 8=4+7� �

!'(0+7

*+0+8/2- ,631� 232*=2'1/) +1(+**+*�

*+0+8/2- 8.639-. ' )96736� �

/27+68/2-� 232*=2'1/) +1(+**+*� �

7+0+)8/2- 136+ 8.'2 32+ 63;� 232*=2'1/)+1(+**+*� �

7+0+)8/2- 32+ 63;� 232*=2'1/) +1(+**+*�

94*'8/2- 8.639-. ' )96736� �

!�$! *'8' 8=4+

)314'8/(0+ .378 :'6/'(0+� ��

/2 .378 :'6/'(0+�

!��� *'8' 8=4+�)314'8/(0+ .378 :'6/'(0+� ��

!6')+ 13*+� ���

!6'27')8/327��1(+**+* ���� '2* ����� ��

!692)'8/32�;/8. ).'6')8+6 .378 :'6/'(0+7�

!%�� ,/+0*� �

9'18 *'8' 8=4+� ��

9(/2(9, *'8' 8=4+� ��

9(/2(9, 7869)896+�

9(/2486 *'8' 8=4+� ��

9(/2486 7869)896+� �

9)) )311'2*� �

9*'8+ *'8' 8=4+� ��

"��� �� )32*/8/32�

9,).17-�� ,92)8/32�/2 �1(+**+* ����� ���

9.'18 *'8' 8=4+� ��

9.*'8+ *'8' 8=4+� ��

"2/,= �'8' +6:+6�+2:/6321+28� �

"���!� 78'8+1+28�+1(+**+* 97'-+� �

"4*'8+'(0+ )967367

*+7)6/48/32� ��

97'-+� �

98<8(9, *'8' 8=4+� ��

98<8(9, 7869)896+�

98<8486 *'8' 8=4+� ��

98<8486 7869)896+� �

Page 185: Unify DataServer: Embedding SQL/A Into C SQL/A · xi company 1 Athena Development Corp. 5800 S.W. Washington St. 2 Brooks Management Cons. 1200 Fifth Avenue 3 G. O. Computers, Inc.

180 ��

��& ��"�'

��� �$� ��(%& *�& ��"�'� �(�()'� *�& ��"�'

� &()�" &%+� ���

��&$ $�'��&&%&� ���

�������� '(�(�#�$(�)'���� ��

����� ������� � !�,+%&��)'���� ��

���� �� !�,+%&�'� ��


Recommended