[SQL] uso de dblink en php
hola a todos
estoy programando en php
tengo el siguiente esquema de BD
BDACADEMICA
personas(idpersona, nombres, paterno)
BDSIAP
PersonasDatosActualizables(idpersona, direccion, telefono)
son dos bases de datos, de las cuales mediante una sola consulta quiero unir
los datos de la misma persona, creo que se puede hacer con dblink, no se si hay
otra forma mejor.
$result=pg_query( $linkacademica,"SELECT personas.nombres, personas.paterno,
s.direccion, s.telefono, FROM personas INNER JOIN dblink('dbname=bdsiap
port=5432 host=localhost user=usuario password=clave,'SELECT idpersona,
direccion, telefono FROM personasdatosactualizables') AS s(idpersona
character(15), direccion character varying(50), telefono character varying(25))
ON personas.idpersona = s.idpersona");
usando db link me da el siguiente error, supongo que es por las comillas, he
intentado con comillas dobles y simples pero nada, tambien he intentado usar
variables.
Warning: pg_query() [function.pg-query]: Query failed: ERROR: error de sintaxis
en o cerca de «FROM» at character 69 in /var/www/finanzas/prueba.php on line 16
espero su ayuda
saludos
jhonvels
_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/
[SQL]
hola a todos
estoy programando en php
tengo el siguiente esquema de BD
BDACADEMICA
personas(idpersona, nombres, paterno)
BDSIAP
PersonasDatosActualizables(idpersona, direccion, telefono)
son dos bases de datos, de las cuales mediante una sola consulta quiero unir
los datos de la misma persona, creo que se puede hacer con dblink, no se si hay
otra forma mejor.
$result=pg_query( $linkacademica,"SELECT personas.nombres, personas.paterno,
s.direccion, s.telefono, FROM personas INNER JOIN dblink('dbname=bdsiap
port=5432 host=localhost user=usuario password=clave,'SELECT idpersona,
direccion, telefono FROM personasdatosactualizables') AS s(idpersona
character(15), direccion character varying(50), telefono character varying(25))
ON personas.idpersona = s.idpersona");
usando db link me da el siguiente error, supongo que es por las comillas, he
intentado con comillas dobles y simples pero nada, tambien he intentado usar
variables.
Warning: pg_query() [function.pg-query]: Query failed: ERROR: error de sintaxis
en o cerca de «FROM» at character 69 in /var/www/finanzas/prueba.php on line 16
espero su ayuda
saludos
jhonvels
_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/
[SQL] Writing a generic delete rule for a view
Hello, I have a relatively straight forward set up with two schemas, the main public schema and a private schema (called "testschema" here). The tables in both schemas are nearly identical: for each table "foo" in the public schema, there is a table "testschema._foo" and a view "testschema.foo" in the private schema, where testschema.foo is a simple union of the public and private tables, to make it appear when querying in the private schema that the tables are exactly the same as the public schema, and that the tables have a union of what is in the private and public schemas. Now, I would like to allow insert, update and delete rules on the private views to do the same actions in private tables (that is, an insert into testschema.foo should really do an insert into testschema._foo). Writing rules to do the update and inserts was fairly straight forward. What I don't understand how to do is a general rule for doing deletes on testschema._foo. What I would like would be a way to "grab" the where clause and append it onto the DO INSTEAD for the rule. I'm thinking something like this: CREATE OR REPLACE RULE testschema_delete_foo AS ON DELETE TO testschema.foo DO INSTEAD (DELETE FROM testschema._foo WHERE $where); So, what I want to know is, is there a "magic" way to get that $where? Thanks, Scott -- Scott Cain, Ph. D. scott at scottcain dot net GMOD Coordinator (http://gmod.org/) 216-392-3087 Ontario Institute for Cancer Research -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] uso de dblink en php
Escribe tu duda en ingles, por favor Saludos, Oliveiros - Original Message - From: Jhonny Velasquez c. To: [email protected] ; [email protected] Sent: Thursday, March 05, 2009 3:50 PM Subject: [SQL] uso de dblink en php hola a todos estoy programando en php tengo el siguiente esquema de BD BDACADEMICA personas(idpersona, nombres, paterno) BDSIAP PersonasDatosActualizables(idpersona, direccion, telefono) son dos bases de datos, de las cuales mediante una sola consulta quiero unir los datos de la misma persona, creo que se puede hacer con dblink, no se si hay otra forma mejor. $result=pg_query( $linkacademica,"SELECT personas.nombres, personas.paterno, s.direccion, s.telefono, FROM personas INNER JOIN dblink('dbname=bdsiap port=5432 host=localhost user=usuario password=clave,'SELECT idpersona, direccion, telefono FROM personasdatosactualizables') AS s(idpersona character(15), direccion character varying(50), telefono character varying(25)) ON personas.idpersona = s.idpersona"); usando db link me da el siguiente error, supongo que es por las comillas, he intentado con comillas dobles y simples pero nada, tambien he intentado usar variables. Warning: pg_query() [function.pg-query]: Query failed: ERROR: error de sintaxis en o cerca de «FROM» at character 69 in /var/www/finanzas/prueba.php on line 16 espero su ayuda saludos jhonvels -- check out the rest of the Windows Live™. More than mail–Windows Live™ goes way beyond your inbox. More than messages
Re: [SQL]
On Thu, 5 Mar 2009 11:48:17 -0400
Jhonny Velasquez c. wrote:
>$result=pg_query( $linkacademica,"SELECT personas.nombres,
> personas.paterno, s.direccion, s.telefono, FROM personas INNER
^
> JOIN dblink('dbname=bdsiap port=5432 host=localhost user=usuario
> password=clave,'SELECT idpersona, direccion, telefono FROM
> personasdatosactualizables') AS s(idpersona character(15),
> direccion character varying(50), telefono character varying(25))
> ON personas.idpersona = s.idpersona");
Please don't cross post and this is supposed to be an English list
(am I right?).
Most of the people here will see your post as noise here.
--
Ivan Sergio Borgonovo
http://www.webthatworks.it
--
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
