RE: Storing Byte data through ODBC
Posted in 1998
GETTING IT: SQL_ExecDirect lv_select, gv_hstmt 'Execute it lv_ret = SQLBindCol(gv_hstmt, 1, SQL_BINARY, ByVal gv_GlobalPtr, MAX_BYTES, lv_image_size) lv_ret = SQLFetch(gv_hstmt) ExeFree gv_hstmt PUTTING IT: 'open the file for reading hfile = OpenFile(pv_filename, fileStruct, OF_READ Or OF_SHARE_DENY_NONE) 'read the file into our memory location lv_ret_long = hread(hfile, ByVal gv_GlobalPtr, lv_file_len) ' MsgBox "File " & pv_filename & " " & Format(lv_ret_long) & " bytes read into memory" lv_ret_long = lclose(hfile) 'Close our file ' lv_string = "INSERT INTO " & gv_Scan.Server & " (batch_id,pat_number,visit_number,doc_form_id,doc_occ,page_number," & _ "page_type_status,page_flag,wip_page_number,trans_date,trans_time,create d_by,page_status,page_size," & _ "orientation,mag_page_image) VALUES(" & pv_batch_id & "," & gv_Scan.PatNumber & "," & _ gv_Scan.VisitNumber & "," & pv_doc_form_id & "," & pv_doc_occ & "," & pv_page_number & ",10,1," & pv_wip_page_number & "," & _ "TODAY,CURRENT HOUR TO SECOND,'" & "SCAN" & "','" & pv_page_status & "','" & lv_type & "'," & _ pv_orientation & ",?);" lv_ret = SQLBindParameter(gv_hstmt, 1, SQL_PARAM_INPUT, SQL_C_DEFAULT, _ SQL_LONGVARBINARY, lv_file_len, 0, ByVal gv_GlobalPtr, MAX_BYTES, lv_file_len) If lv_ret <> SQL_SUCCESS Then Call DisplayODBCError("SQL Statement Error SQLExecDirect [Error=" & lv_ret & "]", lv_string, lv_ret, gv_hstmt) Else SQL_ExecDirect lv_string, gv_hstmt End If -----Original Message----- From: Richard Spitz [mailto:richard.spitz@ana.med.uni-muenchen.de] Sent: Wednesday, April 08, 1998 3:50 AM To: informix-list@iiug.org Subject: Re: Storing Byte data through ODBC Gary Zeal wrote: > One of the columns stores an employee signature (long binary). > 1) Should this be stored as a Byte in Informix > 2) How do I get the data into the column in Informix using Intersolv ODBC driver I have a similar requirement, just the other way round: How do I retrieve BLOB data via ODBC (Informix CLI) into a Visual Basic program? Regards, Richard -- +--------------------------+------------------------------------------+ | Dr. Richard Spitz | INTERNET: spitz@ana.med.uni-muenchen.de | | EDV-Gruppe Anaesthesie | Tel : +49-89-7095-3413 | | Klinikum Grosshadern | FAX : +49-89-7095-8886 | | 81366 Munich, Germany | GSM : +49-172-8933578 | +--------------------------+------------------------------------------+