Valentina : VCursor.importText problem on Win/ works on mac
[SOLUTION]
Aldwin Pollefeyt
realbasic at datalinesolutions.net
Thu Sep 23 11:45:59 CDT 2004
Ruslan,
Thanks for the help, but it was in an other place.
After checking every byte,eol, every character, I discovered
accidentally the problem.
Solution : close the textinput in windows, this isn't necessary on Mac
This now works on Windows and mac. (our cvs-files always have
Windows-EndOfLines)
> 'amount of files to import
> j=ubound(importFiles) 'importfiles(-1) as string
>
> 'converting each file seperatly
> for i=0 to j
>
> 'clean the table 'SQLTables(-1) as string / PPDB as VDatabase
> testSQL=app.PPDB.SQlExecute("DELETE FROM "+SQLTables(i))
>
> 'copy the file changing the EndOfLines
> myFolderItem=targetFolder.child(importFiles(i))
> myTextInput = myFolderItem.OpenAsTextFile
> myTextInput.Encoding=Encodings.WindowsLatin1
> firstFromFile=myTextInput.readline
> firstFromFile=replaceall(firstFromFile,chr(9),chr(44))
''''''''''''''''''THIS LINE IS NECESSARY ON WINDOWS
myTextInput.Close
> 'Setting the cursor
> myCursor=nil
> myCursor=app.PPDB.SQlSelect("SELECT "+firstFromFile+" FROM
> "+SQLTables(i),kv_Server,kv_readWrite,kv_Random)
>
> 'Informing the user of the program
> stImportText.Text="Converting :"+SQLTables(i)
> me.refresh
>
> 'import the changed file
> myCursor.importText(myFolderItem)
>
> 'Delete the first line because the tablenames are putted in there
> testSQL=app.PPDB.SQLExecute("DELETE FROM "+SQLTables(i)+" WHERE
> RecId='1'")
> app.PPDB.Flush
>
> next ' CVS file
>
> 'indexing the files
> stImportText.Text="Database Indexeren"
> me.refresh
> testSQL=app.PPDB.SQLExecute("REINDEX DATABASE")
More information about the Valentina
mailing list