If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > extract .DBT file data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-13-04, 13:24
dogleg dogleg is offline
Registered User
 
Join Date: Dec 2004
Posts: 1
extract .DBT file data

I need to extract .dbt file data (memo's) that is primarily BLOB Memo data. My goal is to move this data into an MS SQL database. I can reade the .DBF files with DBASE III ODBC, but cannot read any dbf that has an associated dbt file. Any help is appreciated. I believe the original application for the data was Delphi.
Reply With Quote
  #2 (permalink)  
Old 12-29-04, 12:31
Maroonotmoron Maroonotmoron is offline
Registered User
 
Join Date: Sep 2003
Location: Dallas
Posts: 182
This needs to be run in a paradox script.

;breakApart splits a string into an array of substrings
;each substring is written to an element of an array.
;You can specify one or more delimiting characters in separators.
;If you omit separators, substrings are delimited by a space.
;Delimiting characters are not included in tokenArray.

proc fixup( strInput String ) String ;This syntax sets the procedure up to take a passed value "strinput" from another method.
; --------------------------------------------------------------
; If strInput contains CRLF's, this replaces them with "\n"
; and returns the result; otherwise, returns the original value.
; --------------------------------------------------------------
var
astrLines Array[] String
strRetval String
siCounter smallInt
endVar

strRetval = strInput
if strRetval.search( "\n" ) > 0 then ; separate CRLF's

strRetval.breakApart( astrLines, chr( 13 ) + chr( 10 ) ) ; This one step creates an array of all the "lines" in the memo field.
strRetval = "" ;This line resets the string after the array is created.

; reassemble the string using "\n" instead of CRLF's
for siCounter from 1 to astrLines.size(); This For loop puts the string back together without the CRLF's.
if ( astrLines[ siCounter ] <> "" ) then
strRetval = strRetval + astrLines[ siCounter ]
if siCounter < astrLines.size() then ; add "\n"
strRetval = strRetval + "\\n"
endIf
endIf
endFor
endIf
return strRetval
endProc

method run(var eventInfo Event)

var
tc TCursor
ts TextStream
endVar

const
DATAFILE = "riv:rtlerrors" ;Put your table and path name here
TEXTFILE = "c:\\errors.txt" ;Put the output file name you want here
STDERROR = "If [>>] is enabled, choose it for more details." ;Just a helpful error message
endConst

{enumRTLErrors( DATAFILE ) ; create the data table not needed as your table already exists}
if not tc.open( DATAFILE ) then
errorShow( "Can't Open Errors Table", STDERROR )
else

if not ts.open( TEXTFILE, "nw" ) then
errorShow( "Can't Open Output File", STDERROR )
else

scan tc :
message( "Writing ", tc.recNo(), " of ",
tc.nRecords(), "..." )
ts.writeLine( "\"", tc.(1), "\"|",;I believe the pipe translates to a tab otherwise it is the delimiter and not tab in your file.
"\"", tc.(3), "\"|",
"\"", fixup( tc.(4) ), "\"" ) ;tc.(4) is the memo field which is the fourth field in this table. You can reference it by name.
endScan

; Add additional error-checking for full sanity.
ts.commit()
ts.close()
tc.close()
beep()
message( "Done!" )
endIf
endIf

endMethod
Edit/Delete Message
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On