Paradox Community

Items in pnews.paradox-programming

Subject:Re: Query Delete, file size before and after deleting majority of records
Date:17 Sep 2017 20:39:43 -0400
From:"bob shin" <shins2222@removegmail.com>
Newsgroups:pnews.paradox-programming

Thank you guys

so I am going to 
1. loop for three table on scheduled task.
2. query delete
3. compact()

uses objectpal
cmquestionok(straa  string) string
enduses

method packTable(date1 string)


var
tb        table
sourcefile,destFile,selectedFile String
fbi filebrowserinfo 
lib library
t, tc  tcursor
f  form
COMP  STRING
hodge query
desttbl  string
ansTbl  table
P  NUMBER
ENDVAR

for i from 1 to 3

if i = 1 then selectedfile = ":workretail:ginv#" endif
if i = 2 then selectedfile = ":workretail:b-transaction" endif 
if i = 3 then selectedfile = ":workretail:ginv#hold" endif


HODGE = QUERY

		~selectedFile		  	| DATE           |  
			delete				|  <= ~date1  |


		ENDQUERY
if	not EXECUTEQBE(HODGE,":PRIV:answerendofday") then
errorshow("query not done,ginv sales query")
return
endif

;  copies deleted file to folder

dat = day(date1)
mon  = month(date1) 
yy = year(date1)
timestppp = string(yy)+string(mon)+string(dat)
		
	  selectfilename = selectedfile.substr(13,selectedfile.size())
		destTbl = ":backup:"+selectfilename+date1
		ansTbl.attach(":PRIV:deleted")

		 if ansTbl.copy(destTbl) then
		 else
		 msgstop("copy error","redo pack table again")
		 return
		 endif


; packs table

tb.attach(selectedFile)
tb.setexclusive(True)
if not tb.compact() then
else
endif
tb.setexclusive(False)
tb.unattach()
endfor

endMethod



"Steven Green" <greens@diamondsg.com> wrote:
>besides what Tom said.. another facet of the same issue.. when you do a

>"NOT" query, it gathers all the potential results, from whatever other rules

>are part of the query, then deletes the ones that are "NOT".. you can have
a 
>200 meg, empty Answer table, if you started out with a 200 meg real table
>
>
>--
>
>Steven Green
>Myrtle Beach, South Carolina, USA
>
>http://www.OasisTradingPost.com
>
>Collectibles and Memorabilia
>Vintage Lego Sets and Parts
>- and Paradox support, too
>"bob shin"  wrote in message news:59bc9d10$1@pnews.thedbcommunity.com...
>
>
>Hi
>
>I am using following query delete function to delete and to reduce file
size
>but the file size in window is the same.
>
>ex  before query delete
>number of rec = 669035
>file size 487186 kb
>index size 1654 kb
>
>
>after deleting 99% of the records the file size is
>
>number of rec = 150
>file size 487186 kb
>index size 1654
>
>Records were delete but the system file size does not change.
>
>I have refreshed and reopen the folder to verify but still the same.  Also
>when I run a query the table it take as long, when the records size was

>669035.
>
>Any idea?
>
>
>qbe = query
>
>:workretail:ginv#  | date |
>delete |<~date1|
>
>EndQuery
>qbe.createauxtables(true)
>qbe.executeqbe()
>
>
>
>bob shin 
>


Copyright © 2004 thedbcommunity.com