[vwnc] Question about using lots of data for database record populating...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Question about using lots of data for database record populating...

Rick Flower
I'm populating a database table with zipcode data and have written  
some scripts (using cut/gawk) to break apart the SQL statement into  
the items of interest (zip,city,state).. The gawk script then  
generates Glorp statements that can be used to insert each item to the  
database.. However, I've got several thousand (2685) inserts just for  
the state of California and creating that many temp variables doesn't  
appear to work well w/ ST... This code will only be used whenever the  
database is recreated (as a side-effect of changing the layout during  
development).. I suppose I could tear apart the SQL statements w/i the  
VW environment and go that route but I've already got everything ready  
care of a few lines of gawk, cut, etc..  Whats the best way do this w/
o getting VW annoyed?

Below is some of the sample lines I've got :

createZipcodeData: session
  | zipObj1 zipObj2 zipObj3 zipObj4 zipObj5 zipObj6 zipObj7 zipObj8  
zipObj9 zipObj10 zipObj11 zipObj12 zipObj13 zipObj14 zipObj15 zipObj16  
zipObj17 zipObj18 zipObj19 zipObj20 zipObj21 zipObj22 zipObj23  
zipObj24 zipObj25 zipObj26 zipObj27 zipObj28 zipObj29 zipObj30  
zipObj31 zipObj32 zipObj33 zipObj34 zipObj35 zipObj36 zipObj37  
zipObj38 |

    Transcript show: '********** Loading Zipcode data **********'.
        zipObj1 := MSADBLocation new zipcode: '90001'; city: 'Los Angeles';  
state: 'CA'.
        zipObj2 := MSADBLocation new zipcode: '90002'; city: 'Los Angeles';  
state: 'CA'.
        zipObj3 := MSADBLocation new zipcode: '90003'; city: 'Los Angeles';  
state: 'CA'.
        zipObj4 := MSADBLocation new zipcode: '90004'; city: 'Los Angeles';  
state: 'CA'.
        zipObj5 := MSADBLocation new zipcode: '90005'; city: 'Los Angeles';  
state: 'CA'.
        zipObj6 := MSADBLocation new zipcode: '90006'; city: 'Los Angeles';  
state: 'CA'.
        zipObj7 := MSADBLocation new zipcode: '90007'; city: 'Los Angeles';  
state: 'CA'.
        zipObj8 := MSADBLocation new zipcode: '90008'; city: 'Los Angeles';  
state: 'CA'.
        zipObj9 := MSADBLocation new zipcode: '90009'; city: 'Los Angeles';  
state: 'CA'.

[ ... ]


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Question about using lots of data for database record populating...

Mark Roberts
Assuming you have some kind of domain class to hold the addresses,
why not build a collection and then do something like this:

        aSession inUnitOfWorkDo: [aSession registerAll: addresses].

This will cause them all to be inserted at once.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc