IN v postgres v pripade ze ma null rows

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
talpa
Člen | 44
+
0
-

pokud pouziju IN ve stylu tabulka a in tabulka , zbuchne mi to v postgresce na

bind message supplies 0 parameters, but prepared statement „pdo_stmt_00000008“ requires 1

		$rows=self::$connection->table(self::$table)->where('id',self::$connection->table(self::$tableref)->where('categories_id',$categoryid));

zatim me to ORM moc nepresvedcilo

enumag
Člen | 2118
+
0
-

Co takhle?

$rows=self::$connection->table(self::$table)->where('id',self::$connection->table(self::$tableref)->where('categories_id',$categoryid)->fetchPairs('id', 'id'));

Btw. NDB v podstatě ani není ORM. :-P

talpa
Člen | 44
+
0
-

kdyz opomenu to ze je tohle blbost id je na primarni tabulce (jasny ze se tezko smoli cizi tabulky :)
(zkusil jsem to fetchPairs dat categories_id, ale pro zmenu to padne na primarnim klici, ktery „nezna“, jak te sracce vysvetlim ze primarni klic je categories_id+contents_id?
jen pro info

CREATE TABLE advertisements_categories
(
  advertisements_id integer NOT NULL,
  categories_id integer NOT NULL,
  CONSTRAINT advertisements_categories_pkey PRIMARY KEY (advertisements_id , categories_id ),
  CONSTRAINT advertisements_categories_fkey FOREIGN KEY (categories_id)
      REFERENCES categories (id) MATCH SIMPLE
      ON UPDATE CASCADE ON DELETE CASCADE,
  CONSTRAINT advertisements_categories_fkey2 FOREIGN KEY (advertisements_id)
      REFERENCES advertisements (id) MATCH SIMPLE
      ON UPDATE CASCADE ON DELETE CASCADE
)
WITH (
  OIDS=FALSE
);
ALTER TABLE advertisements_categories
  OWNER TO postgres;

-- Index: fki_advertisements_categories_fkey

-- DROP INDEX fki_advertisements_categories_fkey;

CREATE INDEX fki_advertisements_categories_fkey
  ON advertisements_categories
  USING btree
  (categories_id );

-- Index: fki_advertisements_categories_fkey2

-- DROP INDEX fki_advertisements_categories_fkey2;

CREATE INDEX fki_advertisements_categories_fkey2
  ON advertisements_categories
  USING btree
  (advertisements_id );