[GRASS-user] db.execute & transactions

Vincent Bain bain at toraval.fr
Thu Nov 12 08:02:01 EST 2009


Hi List,
working on grass65 svn, with the "pg" dbms driver, I am trying to run
several slq statements from a shell script. These statements are
generated within a loop and I would like them to be executed in a
transaction.
I see it might not be possible this way :

        echo "BEGIN TRANSACTION;" | db.execute
        echo "myfirststatement;" | db.execute
        echo "mysecondstatement" | db.execute
...
echo "COMMIT;" | db.execute

as it returns 

        WARNING:  there is no transaction in progress

Should I dump all the commands in a temporary file $tmp then run
db.execute input=$tmp ? or is there a better way ?

Thank you,
Vincent.




More information about the grass-user mailing list