Guest User

Untitled

a guest
Dec 1st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. select column1 from schema1.table1 where column1= ?
  2.  
  3. select column1 from schema1.table1 where column1= 'value'::text;
  4.  
  5. LOG: execute pdo_stmt_00000001: select column1 from schema1.table1 where column1 = $1
  6. DETAIL: parameters: $1 = 'value'
  7. LOG: statement: DEALLOCATE pdo_stmt_00000001
  8.  
  9. select column1 from schema1.table1 where column1 = 'value';
  10.  
  11. column1
  12. ---------
  13. VALUE
  14. (1 row)
  15.  
  16. try {
  17. $db = new PDO('pgsql:dbname=database1;user=user;password=pass;host=localhost');
  18. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  19. $sql = "SELECT column1 from schema1.column1 where column1 = 'value'::citext ";
  20. $retval=$db->query($sql);
  21. foreach ($retval as $row) {
  22. print $row['uname'] . '<br>';
  23. }
  24. }catch (PDOException $PDOerr) {
  25. echo 'An error occured : <br>';
  26. var_dump($PDOerr);
  27. exit;
  28. //some thing went wrong while performing the action on db.
  29. }
  30.  
  31. object(PDOException)#10 (8) { ["message":protected]=> string(211) "SQLSTATE[42704]:
  32. Undefined object: 7 ERROR: type "citext" does not exist LINE 1: ...
  33.  
  34. select nspname from pg_type t join pg_namespace n
  35. on n.oid=t.typnamespace where typname='citext';
  36.  
  37. $sql = "SELECT column1 from schema1.column1 where column1 = 'value'::public.citext";
Add Comment
Please, Sign In to add comment