1. problem

I need help.   I made these two routines:

include svga.e
include graphics.e

atom destination, what, howmuch, junk
destination = allocate (10000)
what = 4
howmuch = 10000
junk = graphics_mode (261)

procedure putregion(atom x, atom y,  atom xwidth, atom ywidth, atom location)

     object data

    -- read & write picture data 1 line at a time
    for counter=0  to xwidth * ywidth by xwidth do
        data = peek ({location+counter,xwidth})
        pixel (data, {x,y})
    end for

end procedure

 procedure test_putregion(atom destination, atom what, atom howmuch)
    atom x, y, xwidth, ywidth
    mem_set (destination, what, howmuch)
    x=10
    y=10
    xwidth=100
    ywidth=100
    putregion(x,y,xwidth, ywidth, destination)

end procedure

...and there are other things so I don't think i missed anything obvious
When I run it I get an error that says bytes_per_line has no value in Pete's
svga.e
I'm inclined to think that my program is at fault.  Anyway, this is part of
ex.err:

xwidth = 100'd'
 ywidth = 100'd'

in both procedures putregion and test_putregion!
I assigned them 100.  Could someone tell me what is wrong?

TIA,
Charn

new topic     » topic index » view message » categorize

2. Re: problem

At 03:05 PM 5/30/98 EDT, you wrote:
>---------------------- Information from the mail header -----------------------
>Sender:       Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU>
>Poster:       CHARN1407 at AOL.COM
>Subject:      problem
>-------------------------------------------------------------------------------
>
>I need help.   I made these two routines:
>
>include svga.e
>include graphics.e
>
>atom destination, what, howmuch, junk
>destination = allocate (10000)
>what = 4
>howmuch = 10000
>junk = graphics_mode (261)
--- snip ---
>in both procedures putregion and test_putregion!
>I assigned them 100.  Could someone tell me what is wrong?
>
>TIA,
>Charn


If you are using Pete's svga.e you'll have to
call svga_mode(261) instead of graphics_mode(261)
This initializes it's internal variables (such as
bytes_per_line)

Graeme



----------------------------------------------------

new topic     » goto parent     » topic index » view message » categorize

3. problem

I'm trying to write a functon  to convert a sequence (of numbers and
strings) to a long string sequence.
i.e {1,2,{2002,12,30}} to "(1,2,"2002-12-30")"

the problem is to distinguish between the string "123" and the sequence
{1,2,3}.
they both have a length of 3 and all their elements are atoms.

can you improve on this? as it stands it has problems.
--        would be how it is used.
    for i = 1 to length(s) do
        if atom(s[i]) then
            out &= str(s[i])  else          ---<- this "str" function I
wrote to convert a number to a string
            if length(s[i]) = 3 then
                if atom(s[i][1]) and atom(s[i][2]) and atom(s[i][3]) then
                out &= "\"" & s[i] & "\", "
            end if
        end if
    end for
    out[length(out)] = ')'
    return out
end function

thanks for any suggestions

george

new topic     » goto parent     » topic index » view message » categorize

4. Re: problem

I'm not quite sure what you mean george.... the string "123" is identical to 
{49,50,51}, not {1,2,3}

If sequence a = {1,2,{2002,12,30}}, and you want sequence b to be 
{1,2,"2002-12-30"}
then you can write it as  b = a[1..2] & {sprintf( "%4d-%02d-%02d", a[3] )}

If you wanted a generic function to turn sequences into a string (though 
just why you want to do it escapes me) then look at the pretty_print 
function.

At the moment, there is the procedure printf, which allows you to put 
variables into a string in a particular format, and print them out. There is 
also a function sprintf (used above), which is identical, except that it 
returns a string containing that formatted data.

Rather than reinventing the wheel, how about adapting pretty_print to become 
spretty_print?
Last I heard, it was in misc.e
=====================================================
.______<-------------------\__
/ _____<--------------------__|===
||_    <-------------------/
\__| Mr Trick


>From: George Walters <gwalters at sc.rr.com>
>Reply-To: EUforum at topica.com
>To: EUforum <EUforum at topica.com>
>Subject: problem
>Date: Sun, 12 Oct 2003 10:21:41 -0400
>
>
>I'm trying to write a functon  to convert a sequence (of numbers and
>strings) to a long string sequence.
>i.e {1,2,{2002,12,30}} to "(1,2,"2002-12-30")"
>
>the problem is to distinguish between the string "123" and the sequence
>{1,2,3}.
>they both have a length of 3 and all their elements are atoms.
>
>can you improve on this? as it stands it has problems.
>--        would be how it is used.
>     for i = 1 to length(s) do
>         if atom(s[i]) then
>             out &= str(s[i])  else          ---<- this "str" function I
>wrote to convert a number to a string
>             if length(s[i]) = 3 then
>                 if atom(s[i][1]) and atom(s[i][2]) and atom(s[i][3]) then
>                 out &= "\"" & s[i] & "\", "
>             end if
>         end if
>     end for
>     out[length(out)] = ')'
>     return out
>end function
>
>thanks for any suggestions
>
>george
>
>
>
>TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: problem

On Sunday 12 October 2003 02:21 pm, you wrote:
>
>
> I'm trying to write a functon  to convert a sequence (of numbers and
> strings) to a long string sequence.
> i.e {1,2,{2002,12,30}} to "(1,2,"2002-12-30")"

sequence s
s = {1,2,{2002,12,30}}

printf(1,"(%d, %d,\"%d-%d-%d\")",
       {s[1],s[2],s[3][1],s[3][2],s[3][3]})

--output:
(1, 2,"2002-12-30")

Press Enter...

Irv

new topic     » goto parent     » topic index » view message » categorize

6. Re: problem

You're over simplifing the problem. The sequence is an unknown sequence of
both length and content. I have to somehow test each field to determine
whether it's a number, string, or date sequence. If this is not possible,
I'll have to resort to a lot more grunt work.

george

----- Original Message -----
From: <irvm at ellijay.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: problem


>
>
> On Sunday 12 October 2003 02:21 pm, you wrote:
> >
> >
> > I'm trying to write a functon  to convert a sequence (of numbers and
> > strings) to a long string sequence.
> > i.e {1,2,{2002,12,30}} to "(1,2,"2002-12-30")"
>
> sequence s
> s = {1,2,{2002,12,30}}
>
> printf(1,"(%d, %d,\"%d-%d-%d\")",
>        {s[1],s[2],s[3][1],s[3][2],s[3][3]})
>
> --output:
> (1, 2,"2002-12-30")
>
> Press Enter...
>
> Irv
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

7. Re: problem

On Sunday 12 October 2003 05:47 pm, George wrote:

> You're over simplifing the problem. The sequence is an unknown sequence of
> both length and content. I have to somehow test each field to determine
> whether it's a number, string, or date sequence. If this is not possible,
> I'll have to resort to a lot more grunt work.

Forget it; you're wasting your time, because there's no way for Euphoria to 
know.

Take, for example:  {72,69,76,76,79}

Is that a list of the ages of 5 residents of the "Happy Acres Retirement 
Community", 
or is it the word "HELLO"?

Hmmm?

Irv

new topic     » goto parent     » topic index » view message » categorize

8. Re: problem

On Sun, 12 Oct 2003 10:21:41 -0400, George Walters
<gwalters at sc.rr.com> wrote:

>I'm trying to write a functon  to convert a sequence (of numbers and
>strings) to a long string sequence.
>i.e {1,2,{2002,12,30}} to "(1,2,"2002-12-30")"
>
>the problem is to distinguish between the string "123" and the sequence
>{1,2,3}.
>they both have a length of 3 and all their elements are atoms.

George,
I had a little play with one of my routines so it now handles the
above pretty well. As for the dates, I went with:

		-- date handling added for George Walters 12/10/2003
		if length(ppp_Date) and length(cl)=3D3=20
		and integer(cl[1]) and integer(cl[2]) and integer(cl[3])
		and ((cl[1]>=3D1 and cl[1]<=3D31 and cl[3]>=3D1900 and cl[3]<=3D3000)
		 or  (cl[3]>=3D1 and cl[3]<=3D31 and cl[1]>=3D1900 and cl[1]<=3D3000))
		and (cl[2]>=3D1 and cl[2]<=3D12) then
			if prnt then sput('\"'&sprintf(ppp_Date,cl)&'\"') end if

However, I'm having a little trouble uploading things at the moment,
so it will be a few days before I can let you have a play with it, if
you can wait. I'll let you know when it's up.

Meantime, I suspect there are many other conditions you'd like covered
(text strings and floats to name two), if you post a few more examples
then I'll write a test program so you can better see how to use it.

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

9. Re: problem

After listening to forum comments (thank you) and thinking a bit I don't
beleive this problem has a solution. What I have done is to use a modified
version of Matt's ODBC function getColumnData which returns the data from an
SQL statement. I now have a getColumnTypes which returns data_type for each
column of the table. Using this I know how to convert the data into an SQL
statement to insert or replace the row..... at least that's my approach. I'm
getting an error back as follows.

syntax error near " at line 2

anyone know what line 2 is?? The statement is

tmp = execDirectODBC(connId, "insert into arCust values " & record )

record is the string I've converted using data_type from the data base. I
see nothing wrong with record, but it does have lots of "s.  I'm beginning
to wonder if my string is too long and the system is breaking it into
multiple lines and is breaking it at an inconvinent place?? record is approx
259 chars long. Any body know?

george

----- Original Message -----
From: "George Walters" <gwalters at sc.rr.com>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, October 12, 2003 1:47 PM
Subject: Re: problem


>
>
> You're over simplifing the problem. The sequence is an unknown sequence of
> both length and content. I have to somehow test each field to determine
> whether it's a number, string, or date sequence. If this is not possible,
> I'll have to resort to a lot more grunt work.
>
> george
>
> ----- Original Message -----
> From: <irvm at ellijay.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Sunday, October 12, 2003 7:49 AM
> Subject: Re: problem
>
>
> > On Sunday 12 October 2003 02:21 pm, you wrote:
> > >
> > >
> > > I'm trying to write a functon  to convert a sequence (of numbers and
> > > strings) to a long string sequence.
> > > i.e {1,2,{2002,12,30}} to "(1,2,"2002-12-30")"
> >
> > sequence s
> > s = {1,2,{2002,12,30}}
> >
> > printf(1,"(%d, %d,\"%d-%d-%d\")",
> >        {s[1],s[2],s[3][1],s[3][2],s[3][3]})
> >
> > --output:
> > (1, 2,"2002-12-30")
> >
> > Press Enter...
> >
> > Irv
> >
> >
> > TOPICA - Start your own email discussion group. FREE!
> >
> >
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

10. Re: problem

This is a multi-part message in MIME format.

------=_NextPart_000_004B_01C39167.CA49D080
	charset="iso-8859-1"

Matt,

The error reported from "odbcError(-tmp)" is: I can't cut and paste it, I've
type'd it

ODBC Error #42000: 42000[MySQL][IDBC 3,51 /druver][mysqld-3,23.54-nt]You
have an error in your SQL syntax
near " at line2

"record" var is attached.

Here's the code for getColumnTypes.... all I've done is to change the name
of getColumnData to getColumnTypes and return data_type instead of data.
Seems to work.

--/func getColumnTypes( atom hstmt )
--Pass the handle for the statement in question, and a sequence of column
types
--will be returned to be used on converting outbound data going back to the
--data base.  If hstmt is 0, uses the current handle.
global function getColumnTypes( atom hstmt )
    object data, data_type
    atom h_ptr, ok, mset, handle, ptr1, ptr2, ptr3, ptr4, ptr5, ptr6,
        ptr7, len, hs, rec_count
    integer cols, row

    if not hstmt then
        hstmt = current_handle
    else
        current_handle = hstmt
    end if

    hs = getHandleODBC( hstmt)

    h_ptr = allocate( 4 )
    poke4( h_ptr, 0 )
    ok = c_func( SQLNumResultCols, { hs, h_ptr } )

    if not find( ok, { SQL_SUCCESS, SQL_SUCCESS_WITH_INFO } ) then
        --odbcError( hstmt )
        free( h_ptr )
        return -hstmt
    end if

    cols = peek4u( h_ptr )
    data = { repeat( {}, cols ) }
    data_type = repeat( 0, cols )

    ptr1 = allocate( 256 )
    ptr2 = allocate( 4 )
    ptr3 = allocate( 4 )
    ptr4 = allocate( 4 )
    ptr5 = allocate( 4 )
    ptr6 = allocate( 4 )
 poke4( ptr3, 0 )

    row = 1
    for i = 1 to cols do
        ok = c_func( SQLDescribeCol, { hs, i, ptr1, 256,
            ptr2, ptr3, ptr4, ptr5, ptr6 } )

        data[row][i] = peek_string( ptr1 )
        data_type[i] = peek4s( ptr3 )
        if data_type[i] > #8000 then
         data_type[i] -= #10000
        end if
    end for

    last_datatype = data_type
    free( ptr1 )
    free( ptr2 )
    free( ptr3 )
    free( ptr4 )
    free( ptr5 )
    free( ptr6 )

    return data_type
end function

----- Original Message -----
From: "Matt Lewis" <matthewwalkerlewis at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, October 13, 2003 8:35 AM
Subject: RE: problem


>
>
> > From: George Walters [mailto:gwalters at sc.rr.com]
> >
> > After listening to forum comments (thank you) and thinking a
> > bit I don't beleive this problem has a solution. What I have
> > done is to use a modified version of Matt's ODBC function
> > getColumnData which returns the data from an SQL statement. I
> > now have a getColumnTypes which returns data_type for each
> > column of the table. Using this I know how to convert the
> > data into an SQL statement to insert or replace the row.....
> > at least that's my approach. I'm getting an error back as follows.
>
> Can you post the code for getColumnData?
>
> > syntax error near " at line 2
>
> Is this the exact error report?
>
> > anyone know what line 2 is?? The statement is
> >
> > tmp = execDirectODBC(connId, "insert into arCust values " & record )
> >
> > record is the string I've converted using data_type from the
> > data base. I see nothing wrong with record, but it does have
> > lots of "s.  I'm beginning to wonder if my string is too long
> > and the system is breaking it into multiple lines and is
> > breaking it at an inconvinent place?? record is approx 259
> > chars long. Any body know?
>
> Can you post the value of record?
>
> I suspect that the solution is to probably use a prepared statement using
> parameters:
>
> -- use however many ?'s as there are fields
> ins = prepareSQL( connId, "insert into arCust values ( ?, ?, ?,..." )
>
> -- to insert a record:
> for i = 1 to length(record) do
>     -- where c_type is a sequence of the c data types you're using
>     -- and sql_type is a sequence of the sql data types
>     setParameter( ins, i, record[i], c_type[i], sql_type[i] )
> end for
> result = executeSQL( ins )
>
> For instance, for a date, you could use a string c type and a sql date
type.
> That tells the ODBC driver that it needs to parse the date from its string
> format into whatever internal format it needs, and the sql type allows it
to
> do type checking on the data.  I'll try to make the docs clearer on this,
> but part of the problem is that I'm learning as I go, too.
>
> Matt Lewis
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

------=_NextPart_000_004B_01C39167.CA49D080
Content-Type: text/plain;
	name="record.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="record.txt"

(1.000000,1001.000000,"ACCUTECH MACHINE","1110 NORTHPOINT BLVD.","APT =
505","BLYTHEWOOD","SC","29016","735-8111","RAY =
BICKAR","735-0096",53.000000,1001.000000,1.000000,1998-09-16,102.270000,1=
998-08-15,10.980000,1420.770000,5.000000,13.000000,908.980000,"Y","01","N=
","",500.000000,437.650000,"NT","N","","","",0000-00-00,0.000000,"BW","D"=
,"","N")

------=_NextPart_000_004B_01C39167.CA49D080--

new topic     » goto parent     » topic index » view message » categorize

11. Re: problem

Matt, I don't know what the sql_type is? Is that a string like
"float(8,2)"?? or is it some numeric representation.

george

----- Original Message -----
From: "Matt Lewis" <matthewwalkerlewis at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: problem


>
>
> > From: George Walters [mailto:gwalters at sc.rr.com]
> >
> > After listening to forum comments (thank you) and thinking a
> > bit I don't beleive this problem has a solution. What I have
> > done is to use a modified version of Matt's ODBC function
> > getColumnData which returns the data from an SQL statement. I
> > now have a getColumnTypes which returns data_type for each
> > column of the table. Using this I know how to convert the
> > data into an SQL statement to insert or replace the row.....
> > at least that's my approach. I'm getting an error back as follows.
>
> Can you post the code for getColumnData?
>
> > syntax error near " at line 2
>
> Is this the exact error report?
>
> > anyone know what line 2 is?? The statement is
> >
> > tmp = execDirectODBC(connId, "insert into arCust values " & record )
> >
> > record is the string I've converted using data_type from the
> > data base. I see nothing wrong with record, but it does have
> > lots of "s.  I'm beginning to wonder if my string is too long
> > and the system is breaking it into multiple lines and is
> > breaking it at an inconvinent place?? record is approx 259
> > chars long. Any body know?
>
> Can you post the value of record?
>
> I suspect that the solution is to probably use a prepared statement using
> parameters:
>
> -- use however many ?'s as there are fields
> ins = prepareSQL( connId, "insert into arCust values ( ?, ?, ?,..." )
>
> -- to insert a record:
> for i = 1 to length(record) do
>     -- where c_type is a sequence of the c data types you're using
>     -- and sql_type is a sequence of the sql data types
>     setParameter( ins, i, record[i], c_type[i], sql_type[i] )
> end for
> result = executeSQL( ins )
>
> For instance, for a date, you could use a string c type and a sql date
type.
> That tells the ODBC driver that it needs to parse the date from its string
> format into whatever internal format it needs, and the sql type allows it
to
> do type checking on the data.  I'll try to make the docs clearer on this,
> but part of the problem is that I'm learning as I go, too.
>
> Matt Lewis
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

12. Re: problem

Matt, on the first step you outlined (prepareSQL) i get a positive number
returned, so I assume it went OK. The 2nd step (for i = 1 length /
setParameter(ins.....) when i is 1 I get an error (subscript value 1 is out
of bounds, reading from a sequence of length 0.)

hstmt = 23
paramnum = 1
val = 1

any ideas?

george
----- Original Message -----
From: "Matt Lewis" <matthewwalkerlewis at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, October 13, 2003 8:35 AM
Subject: RE: problem


>
>
> > From: George Walters [mailto:gwalters at sc.rr.com]
> >
> > After listening to forum comments (thank you) and thinking a
> > bit I don't beleive this problem has a solution. What I have
> > done is to use a modified version of Matt's ODBC function
> > getColumnData which returns the data from an SQL statement. I
> > now have a getColumnTypes which returns data_type for each
> > column of the table. Using this I know how to convert the
> > data into an SQL statement to insert or replace the row.....
> > at least that's my approach. I'm getting an error back as follows.
>
> Can you post the code for getColumnData?
>
> > syntax error near " at line 2
>
> Is this the exact error report?
>
> > anyone know what line 2 is?? The statement is
> >
> > tmp = execDirectODBC(connId, "insert into arCust values " & record )
> >
> > record is the string I've converted using data_type from the
> > data base. I see nothing wrong with record, but it does have
> > lots of "s.  I'm beginning to wonder if my string is too long
> > and the system is breaking it into multiple lines and is
> > breaking it at an inconvinent place?? record is approx 259
> > chars long. Any body know?
>
> Can you post the value of record?
>
> I suspect that the solution is to probably use a prepared statement using
> parameters:
>
> -- use however many ?'s as there are fields
> ins = prepareSQL( connId, "insert into arCust values ( ?, ?, ?,..." )
>
> -- to insert a record:
> for i = 1 to length(record) do
>     -- where c_type is a sequence of the c data types you're using
>     -- and sql_type is a sequence of the sql data types
>     setParameter( ins, i, record[i], c_type[i], sql_type[i] )
> end for
> result = executeSQL( ins )
>
> For instance, for a date, you could use a string c type and a sql date
type.
> That tells the ODBC driver that it needs to parse the date from its string
> format into whatever internal format it needs, and the sql type allows it
to
> do type checking on the data.  I'll try to make the docs clearer on this,
> but part of the problem is that I'm learning as I go, too.
>
> Matt Lewis
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

13. Re: problem

I found the mistake, but I don't understand the difference. The very end of
the string was incorrect...

out[length(out)] = ')' -- replace trailing comma with paren.
was wrong.
out = out[1..length(out)-1] & ")"
was correct. Here I clipped off the trailing comma and appended the")" and
mysql did not complain. I don't understand the difference. If any one does
please explain. when put "puts(1,out)" you can't tell the difference.

george

----- Original Message -----
From: "George Walters" <gwalters at sc.rr.com>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, October 13, 2003 8:55 AM
Subject: Re: problem


>
> Matt,
>
> The error reported from "odbcError(-tmp)" is: I can't cut and paste it,
I've
> type'd it
>
> ODBC Error #42000: 42000[MySQL][IDBC 3,51 /druver][mysqld-3,23.54-nt]You
> have an error in your SQL syntax
> near " at line2
>
> "record" var is attached.
>
> Here's the code for getColumnTypes.... all I've done is to change the name
> of getColumnData to getColumnTypes and return data_type instead of data.
> Seems to work.
>
> --/func getColumnTypes( atom hstmt )
> --Pass the handle for the statement in question, and a sequence of column
> types
> --will be returned to be used on converting outbound data going back to
the
> --data base.  If hstmt is 0, uses the current handle.
> global function getColumnTypes( atom hstmt )
>     object data, data_type
>     atom h_ptr, ok, mset, handle, ptr1, ptr2, ptr3, ptr4, ptr5, ptr6,
>         ptr7, len, hs, rec_count
>     integer cols, row
>
>     if not hstmt then
>         hstmt = current_handle
>     else
>         current_handle = hstmt
>     end if
>
>     hs = getHandleODBC( hstmt)
>
>     h_ptr = allocate( 4 )
>     poke4( h_ptr, 0 )
>     ok = c_func( SQLNumResultCols, { hs, h_ptr } )
>
>     if not find( ok, { SQL_SUCCESS, SQL_SUCCESS_WITH_INFO } ) then
>         --odbcError( hstmt )
>         free( h_ptr )
>         return -hstmt
>     end if
>
>     cols = peek4u( h_ptr )
>     data = { repeat( {}, cols ) }
>     data_type = repeat( 0, cols )
>
>     ptr1 = allocate( 256 )
>     ptr2 = allocate( 4 )
>     ptr3 = allocate( 4 )
>     ptr4 = allocate( 4 )
>     ptr5 = allocate( 4 )
>     ptr6 = allocate( 4 )
>  poke4( ptr3, 0 )
>
>     row = 1
>     for i = 1 to cols do
>         ok = c_func( SQLDescribeCol, { hs, i, ptr1, 256,
>             ptr2, ptr3, ptr4, ptr5, ptr6 } )
>
>         data[row][i] = peek_string( ptr1 )
>         data_type[i] = peek4s( ptr3 )
>         if data_type[i] > #8000 then
>          data_type[i] -= #10000
>         end if
>     end for
>
>     last_datatype = data_type
>     free( ptr1 )
>     free( ptr2 )
>     free( ptr3 )
>     free( ptr4 )
>     free( ptr5 )
>     free( ptr6 )
>
>     return data_type
> end function
>
> ----- Original Message -----
> From: "Matt Lewis" <matthewwalkerlewis at yahoo.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Monday, October 13, 2003 8:35 AM
> Subject: RE: problem
>
>
> > > From: George Walters [mailto:gwalters at sc.rr.com]
> > >
> > > After listening to forum comments (thank you) and thinking a
> > > bit I don't beleive this problem has a solution. What I have
> > > done is to use a modified version of Matt's ODBC function
> > > getColumnData which returns the data from an SQL statement. I
> > > now have a getColumnTypes which returns data_type for each
> > > column of the table. Using this I know how to convert the
> > > data into an SQL statement to insert or replace the row.....
> > > at least that's my approach. I'm getting an error back as follows.
> >
> > Can you post the code for getColumnData?
> >
> > > syntax error near " at line 2
> >
> > Is this the exact error report?
> >
> > > anyone know what line 2 is?? The statement is
> > >
> > > tmp = execDirectODBC(connId, "insert into arCust values " & record )
> > >
> > > record is the string I've converted using data_type from the
> > > data base. I see nothing wrong with record, but it does have
> > > lots of "s.  I'm beginning to wonder if my string is too long
> > > and the system is breaking it into multiple lines and is
> > > breaking it at an inconvinent place?? record is approx 259
> > > chars long. Any body know?
> >
> > Can you post the value of record?
> >
> > I suspect that the solution is to probably use a prepared statement
<snip>

> > parameters:
> >
> > -- use however many ?'s as there are fields
> > ins = prepareSQL( connId, "insert into arCust values ( ?, ?, ?,..." )
> >
> > -- to insert a record:
> > for i = 1 to length(record) do
> >     -- where c_type is a sequence of the c data types you're using
> >     -- and sql_type is a sequence of the sql data types
> >     setParameter( ins, i, record[i], c_type[i], sql_type[i] )
> > end for
> > result = executeSQL( ins )
> >
> > For instance, for a date, you could use a string c type and a sql date
> type.
> > That tells the ODBC driver that it needs to parse the date from its
string
> > format into whatever internal format it needs, and the sql type allows
it
> to
> > do type checking on the data.  I'll try to make the docs clearer on
this,
> > but part of the problem is that I'm learning as I go, too.
> >
> > Matt Lewis
> >
> >
> > TOPICA - Start your own email discussion group. FREE!
> >
> >
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu