Not enough memory to create a database

This forum is for eXpress++ general support.
Message
Author
bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: Not enough memory to create a database

#11 Post by bwolfsohn »

do you know the structure ahead of time ?

if so,
use newfile.dbf
append from mycsvfile.csv deliMITED

from the append from help file:

DELIMITED
The option DELIMITED specifies that the source file is an ASCII file with data in each line separated by commas and character fields appearing in double quotes. Fields and records can have variable lengths. ASCII files in the delimited format are managed by the database engine DELDBE.

LOOK AT ROGER'S CSV IMPORT EXAMPLE IN SAMPLES\CSV\CSVIMP.PRG
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Not enough memory to create a database

#12 Post by Eugene Lutsenko »

Like really no problem. It turns out. Thank you. And could you suggest how to convert this file (in DOS encoding)
Attachments
jet_raif_100.zip
(3.51 KiB) Downloaded 765 times

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Not enough memory to create a database

#13 Post by Auge_Ohr »

Eugene Lutsenko wrote:And could you suggest how to convert this file (in DOS encoding)
i don't think that Xbase++ can convert Cyrillic characters ... same with chinese.
when using OEM DBF Xbase++ will try to convert internal to ANSI when display with GUI XbParts.

you still need right Font / Codepage to display it :!:

if you don't want Xbase++ to convert you must use

Code: Select all

SET CHARSET TO ansi
but than ALL must be ANSI (include your Text Editor) or use

Code: Select all

XPP.EXE /go
greetings by OHR
Jimmy

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Not enough memory to create a database

#14 Post by Eugene Lutsenko »

Thank you very much! Well everything turned out! Didn't even think it's that simple

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Not enough memory to create a database

#15 Post by Eugene Lutsenko »

use newfile.dbf
append from mycsvfile.csv deliMITED

I used this method in one task very successfully. But then decided to standardize and incorporate it into the system. And when I was debugging in different examples, are faced with a problem. Sometimes it works fine and sometimes doesn't work or works incorrectly. Values are separated by delimiter and not entered in different fields and entered all or some in one field. Trying to figure out the reasons. I had the impression that this probably has something to do with different encodings of the source files. He was able to bring all this to the desired result and for a time preserved.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Not enough memory to create a database

#16 Post by rdonnay »

Try this:

Use newfile
DC_CSV2WorkArea( 'mycsvfile.csv' )
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Not enough memory to create a database

#17 Post by Eugene Lutsenko »

rdonnay wrote:Try this:

Use newfile
DC_CSV2WorkArea( 'mycsvfile.csv' )
And could not bring his new text? The fact that the appeal to a CSV file using the NUMTOKEN() and TOKEN() requires a lot of memory. When a CSV file is very large (for example, 4 million records), it just crashes from memory:

Code: Select all

 nHandle := DC_txtOpen( 'test_strings.txt' )
 DO WHILE !DC_TxtEOF( nHandle )                   // Начало цикла по строкам
    mLine = DC_TxtLine( nHandle )                 // Выделить строку из текстового файла
    aStringInp := {}                              // Входная  строка "как есть"
    FOR w=1 TO NUMTOKEN(mLine,",")                // Разделитель между показателями - запятая
        mWord = ALLTRIM(TOKEN(mLine, ",", w))
        AADD(aStringInp, mWord)
    NEXT
    ........
    DC_TxtSkip( nHandle, 1 )
 ENDDO
 DC_TxtClose( nHandle )

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Not enough memory to create a database

#18 Post by rdonnay »

When a CSV file is very large (for example, 4 million records), it just crashes from memory
That is probably correct.
I do not have an answer for you.

You could possibly break it into multiple files.
You would use FOpen(), FCreate(), FRead() and FWrite() to do this.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Not enough memory to create a database

#19 Post by Auge_Ohr »

Eugene Lutsenko wrote:

Code: Select all

 nHandle := DC_txtOpen( 'test_strings.txt' )
        mWord = ALLTRIM(TOKEN(mLine, ",", w))
        AADD(aStringInp, mWord)
why do you AADD() all Words into Array ? this Way you need double space in RAM.
write your Result into DBF after read 1 Line so only 1 Record Length overhead.
greetings by OHR
Jimmy

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Not enough memory to create a database

#20 Post by Eugene Lutsenko »

This is just an example, which has a TOKEN() so on...

Post Reply