Question about "prepare statements" 
Author Message
 Question about "prepare statements"

Hi,

My question is this, I am assured that both of these examples work on most
machines, but my Sun running Sunos 4.1.1 and I4GL v4.0 complains about the
first example.

Eg1

        prepare s1 from "insert into fred values (?,?,?,?)
        execute s1 using "andy_d","CUSTOMER","JUNK","JUNK")

Eg2

        define str char(80)

        let str = "insert into fred values (?,?,?,?)"
        prepare s1 from str
        execute s1 using "andy_d","CUSTOMER","JUNK","JUNK"

The manual uses example 2 style code, but I am assured by the programmer
that Eg1 has worked on other machines/setups.

Would somebody like to offer any explanation.

Thanks

Andy
------------------------------------------------------------------------------
HOME:                                    SITE:


                                      Voice: +44 691 666714
 Voice: +44 691 778626                  FAX: +44 691 670750
-----------------------------------------------------------------------------



Sun, 09 Jun 1996 18:48:03 GMT
 Question about "prepare statements"

Quote:
>Date: Wed, 22 Dec 93 09:54:39 GMT

>Subject: Question about "prepare statements"
>X-Informix-List-Id: <list.3251>

>Hi,

>My question is this, I am assured that both of these examples work on most
>machines, but my Sun running Sunos 4.1.1 and I4GL v4.0 complains about the
>first example.

>Eg1

>        prepare s1 from "insert into fred values (?,?,?,?)
>        execute s1 using "andy_d","CUSTOMER","JUNK","JUNK")

>Eg2

>        define str char(80)

>        let str = "insert into fred values (?,?,?,?)"
>        prepare s1 from str
>        execute s1 using "andy_d","CUSTOMER","JUNK","JUNK"

>The manual uses example 2 style code, but I am assured by the programmer
>that Eg1 has worked on other machines/setups.

How seriously are we to take your punctuation?  Example 1 should be failing
to compile with an unmatched quote error on the prepare line and an
unwanted parenthesis on the second.  When these errors are corrected, and
using 4.11.UC1 I4GL against a 5.01.UC2 OnLine engine, both versions work
correctly.  What are you doing still running antiques?

Yours,

Test code:

main

    define str char(80), c1, c2, c3, c4 char(10)

    create database ex01
    create table fred
    (
        col01 char(10),
        col02 char(10),
        col03 char(10),
        col04 char(10)
    )

    prepare s1 from "insert into fred values (?,?,?,?)"
    execute s1 using "andy_d","CUSTOMER","JUNK","JUNK"

    let str = "insert into fred values (?,?,?,?)"
    prepare s2 from str
    execute s2 using "andy_d","CUSTOMER","JUNK","JUNK"

    declare c cursor for select * from fred

    foreach c into c1, c2, c3, c4
        display c1, c2, c3, c4
    end foreach

    close database

    drop database ex01

end main



Mon, 10 Jun 1996 00:38:05 GMT
 Question about "prepare statements"
From A. J. Dibbins:
*
* Hi,
*
* My question is this, I am assured that both of these examples work on most
* machines, but my Sun running Sunos 4.1.1 and I4GL v4.0 complains about the
* first example.
*
* Eg1
*
*         prepare s1 from "insert into fred values (?,?,?,?)
*         execute s1 using "andy_d","CUSTOMER","JUNK","JUNK")
*
* Eg2
*
*         define str char(80)
*
*         let str = "insert into fred values (?,?,?,?)"
*         prepare s1 from str
*         execute s1 using "andy_d","CUSTOMER","JUNK","JUNK"
*
*
* The manual uses example 2 style code, but I am assured by the programmer
* that Eg1 has worked on other machines/setups.
*
* Would somebody like to offer any explanation.

I don't have an explanation, it's possibly a known bug,
but I have a work around.

Change Eg2 to:

         define str       char(80),
                var1      char(6),
                var2      char(8),
                var3      char(4)

         let str = "insert into fred values (?,?,?,?)"
         let var1 = "andy_d"
         let var2 = "CUSTOMER"
         let var3 = "JUNK"
         prepare s1 from str
         execute s1 using var1, var2, var3, var3

Hope this helps,

         Robert Minter             |Data Systems Support|         \\\_///
Programmer, Software Development   |     Orange, CA     |         ( _ _ )

bangpath:  uunet.uu.net!dssmktg!rob| Fax: 714.771.3028  |          \`-'/
     I used to not know, now I know I don't know.                   \_/



Mon, 10 Jun 1996 01:53:03 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. max of ("...","...","..")

2. "Count" Statement Question

3. How to make a "decimal"-field to an "integer"-field

4. "."and ","

5. "."and ","

6. The ""string""

7. aReport."Field".SetFilter("this")?

8. The+instruction+at+"0x1f90db9b"+referenced+memory+at+"0x7fa03794"+The+memory+cou

9. Record.open "", "URL=..."

10. question on a "OCP reveiw question"


 
Powered by phpBB® Forum Software