Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Community > Tech > [PostgreSQL]Transazioni e php
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
khelidan
.grande:maestro.

User info:
Registered: Jun 2003
Posts: 1196 (0.14 al dì)
Location: Milano
Corso: Informatica
Anno: Finito....
Time Online: 13 Days, 12:08:03: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
[PostgreSQL]Transazioni e php

Ciao,per fare una transazione base base in postgre basta dare:

BEGIN;
UPDATE mytable SET eccc;
COMMIT;

?

Dalla documentazione sembrerebbe di si,e in caso di risposta affermativa,come faccio ad integrarla in una instruzione php?

pg_query($handle,"BEGIN;UPDATE mytable SET eccc;COMMIT;)

Funzionerebbe?

Grazias... :)

__________________
Khelidan

04-07-2006 11:34
Click Here to See the Profile for khelidan Click here to Send khelidan a Private Message Find more posts by khelidan Add khelidan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
yeah
.grande:maestro.

User info:
Registered: Nov 2003
Posts: 1644 (0.20 al dì)
Location: Cologno Monzese
Corso: Informatica Magistrale
Anno: II
Time Online: 12 Days, 21:36:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Non ho mai usato PostgreSQL, cmq penso che per le transazioni segua lo standard SQL.

In PHP le query a MySQL non dovrebbero andare inserite tutte in una chamata di funzione, ma non ho mai provato e penso vadano bene lo stesso.

Tuttavia, sempre penso, se cominci una transazione in un thread la puoi continuare nelle query successive -> non è necessario mettere tutta la transazione in una sola chiamata a funzione :)

__________________
?

04-07-2006 12:01
Click Here to See the Profile for yeah Click here to Send yeah a Private Message Find more posts by yeah Add yeah to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
khelidan
.grande:maestro.

User info:
Registered: Jun 2003
Posts: 1196 (0.14 al dì)
Location: Milano
Corso: Informatica
Anno: Finito....
Time Online: 13 Days, 12:08:03: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by yeah

Tuttavia, sempre penso, se cominci una transazione in un thread la puoi continuare nelle query successive -> non è necessario mettere tutta la transazione in una sola chiamata a funzione :) [/B]


In efeftti,non ci avevo pensato,così la query va a buon fine,credo che funzioni,sai mica se c'e un modo di testarlo?

__________________
Khelidan

04-07-2006 12:42
Click Here to See the Profile for khelidan Click here to Send khelidan a Private Message Find more posts by khelidan Add khelidan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
yeah
.grande:maestro.

User info:
Registered: Nov 2003
Posts: 1644 (0.20 al dì)
Location: Cologno Monzese
Corso: Informatica Magistrale
Anno: II
Time Online: 12 Days, 21:36:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Visto che sono transazioni dovresti poter fare rollback / commit per vedere se funziona.

Poi, se non ricordo male, i valori modificati in una transazione valgono solo per il thread corrente, gli altri thread vedono la base di dati immodificata -> ti basta avviare una nuova connessione al db (per esempio con un client standalone) e verificare ad ogni sotto-query se funziona o meno :)

O, per parafrasare una delle poche lezioni di IS che ho potuto seguire: fai un pò di prove, se non trovi errori vuol dire che è giusto :D

__________________
?

04-07-2006 13:33
Click Here to See the Profile for yeah Click here to Send yeah a Private Message Find more posts by yeah Add yeah to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 14:41.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.088 seconds (55.86% PHP - 44.14% MySQL) con 25 query.