RE: problem
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Oct 14, 2003
- 455 views
You might try using single quotes instead of double. Also, some databases like to see # #s around dates: #1998-09-16# Matt Lewis > -----Original Message----- > From: George Walters [mailto:gwalters at sc.rr.com] > 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 > > <snip> > >