Re: [dabo-users] Migration from dBaseIII+ & SQL/Client interaction

Author: John Fabiani

Posted: 2012-05-04 at 06:52:59

On Thursday, May 03, 2012 08:07:00 PM Bill House wrote:

> Thanks for taking a look at this guys.

>

> The file is sorted(indexed) md5sum + path + file_name

>

> Therefore the longer path name (and more deeply nested) will be the last

> one and therefore the one retained.

> (That was my plan anyway.)

>

> No file removal will be done at this stage, the Boolean field "del" will

> be marked as true and then on another pass (after the results are

> inspected), the files belonging to the records marked for deletion will

> be moved (not deleted) to another place where another inspection will

> take place and after the unmoved files are backed up the moved files

> will be deleted.

>

> So to traverse this file and update it without loosing my place I am

> supposing I need one cursor to maintain my position and another

> (disposable one) to update the table when necessary. I wanted to know

> if I had misunderstood what I had read.

>

> My original questions were:

>

> Is the use of an AuxCursor the only way to do what I want to do (unless

> I can get the withhold attribute to behave)(psycopg2)?

>

> If there is another way, where is the best description of it so I can

> read about it?

>

> Thanks,

>

> Bill House

I'm guessing the data is static when you do all of this?

Let's assume that you use Dabo to mark the file (change the del field to

true).

Next you will need to copy the marked rows to a different table. I would

write a postgres function to do the copy. But I'd add a field "moved" and

update the field to insure I knew it was moved/copy. You could do the copy in

Dabo but as the data size increased the time to complete would be greater than

the postgres function's time to complete.

This should help you write the postgres function:

http://stackoverflow.com/questions/955167/postgresql-return-setof-record-

virtual-table

Then when it's time to remove the "moved/del" data a simple SQL statement will

work

tempcursor = self.PrimaryBizobj.getTempCursor()

tempcursor.execute("delete from table where moved = True and del = true")

Note: SQL is not like dbaseIII - a delete removes the row forever. IOW's

delete is like doing a dbaseIII - delete and pack - which will remove the rows

in dbaseIII.

Johnf

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/10865002.nbqGAM8dva@linux-12

©2012 John Fabiani