Re: "timer" script from SAMS book or equivalent?

From: John Wells <jb(at)sourceillustrated(dot)com>
To: John Wells <jb(at)sourceillustrated(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>, Felipe de Jesús Molina Bravo <felipe(dot)molina(at)inegi(dot)gob(dot)mx>, Owen Hartnett <owen(at)clipboardinc(dot)com>
Subject: Re: "timer" script from SAMS book or equivalent?
Date: 2007-10-10 21:23:51
Message-ID: 14252509.4211192051431489.JavaMail.root@cayman.devsea.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sorry...the first version was a bit rash and left out some features...particularly filtering by table. Here's the patch to correct:

If anyone wants the corrected version, email me off list.

Thanks,
John

# diff -w pg_timer_old.rb pg_timer.rb
18a19
> app = File.basename $0
20,21c21,25
< #{$0} <query>
< Example: #{$0} "select * from users"
---
> #{app} <query> [tablename]
> or
> #{app} /path/to/file/containing/query.sql [tablename]
>
> Example: #{app} "select * from users" "users"
54a59
>
78c83
< if !table_name.nil?
---
> if table_name.nil?
86c91
< if !table_name.nil?
---
> if table_name.nil?
194c199,211
< arg = args[0]
---
> first = args[0]
> query = nil
> if !first.nil? and File.exists?(first)
> File.open(first, "r") do |f|
> query = f.read
> end
> else
> query = first
> end
>
> table = args[1]
>
> usage() if args.size < 1
196d212
< usage() if arg.nil?
201a218
>
204,206c221,223
< begTupleValues = getTupleValues(tran1, arg)
< begBlockValues = getBlockValues(tran1, arg)
< ignore = tran1.exec(args[0])
---
> begTupleValues = getTupleValues(tran1, table)
> begBlockValues = getBlockValues(tran1, table)
> ignore = tran1.exec(query)
212,213c229,232
< endTupleValues = getTupleValues(tran2, arg)
< endBlockValues = getBlockValues(tran2, arg)
---
> tran2.start_tran()
> endTupleValues = getTupleValues(tran2, table)
> endBlockValues = getBlockValues(tran2, table)
> tran2.commit()

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Selena Deckelmann 2007-10-10 21:48:01 PostgreSQL Conference Fall 2007, Registration closing soon!
Previous Message John Wells 2007-10-10 20:39:32 Re: "timer" script from SAMS book or equivalent?