[PHP-DB] PDO::quote is only *theoretically* safe ?

2023-03-24 Thread Tobias Petry
The documentation for PDO::quote [0] says that a processed string is "theoretically safe to pass into an SQL statement". Understandably, prepared statements should be preferred when possible. But I need to change some stuff where integrating them is impossible, and some values must be securely

[PHP-DB] Re: [External] : [PHP-DB] PDO to Oracle db and secure external password store aka wallet for authentication

2021-09-28 Thread Christopher Jones
On 28/9/21 6:59 pm, Mathias Zarick wrote: Hi there, I am wondering how it would be possible to use authentication using a secure external password store aka wallet with PDO OCI. See Oracle external authentication and OCI_CRED_EXT in the underground php oracle manual. and

[PHP-DB] PDO to Oracle db and secure external password store aka wallet for authentication

2021-09-28 Thread Mathias Zarick
Hi there, I am wondering how it would be possible to use authentication using a secure external password store aka wallet with PDO OCI. See Oracle external authentication and OCI_CRED_EXT in the underground php oracle manual. and

Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-27 Thread Alko Kotalko
Your answer in the part of SAP HANA (J)ODBC driver not supporting named parameters actually makes sense. However I don't understand why would there be a difference between PDO and regular odbc (odbc_connect, etc.) commands since they're obviously using the same driver. My testing machine is on

Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Karl DeSaulniers
On Jan 26, 2016, at 7:10 AM, Alko Kotalko wrote: > Hi, > > I have a working connection from PHP to SAP HANA through PDO and regular > ODBC commands. > > The issue is that through PDO I can not get any prepared statements to > work. None of the notations (?, $, :) work.

Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Jeff
Greetings, On 01/26/2016 08:18 AM, Karl DeSaulniers wrote: > On Jan 26, 2016, at 7:10 AM, Alko Kotalko wrote: > >> Hi, >> >> I have a working connection from PHP to SAP HANA through PDO and regular >> ODBC commands. >> [...snipped...] >> >> For example: >> "SELECT *

Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Lester Caine
On 26/01/16 13:10, Alko Kotalko wrote: > ODBC commands actually work with the ? and colon ($) notations. But not > with colon (:). I suppose this is due to the lack of named parameters > support in ODBC commands (haven't actually confirmed that though). The $ > notation brings me the closest to

Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Alko Kotalko
I've tried all the notations with PDO as well and none of them work with SAP HANA. It works with MySQL though. So I presume that there is either a bug in PDO driver or there is some mismatch between PDO and SAP HANA. The queries get executed but the returned result (if I fetch one) is an

Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Alko Kotalko
It shouldn't be like that because I'm preparing a statement, which would later have had parameters passed to. I'm not trying to concatenate a string. (Sorry, forgot to reply to all before) On Tue, Jan 26, 2016 at 8:18 AM, Karl DeSaulniers wrote: > On Jan 26, 2016, at 7:10

Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Alko Kotalko
This (my code) actually works so it's not part of the problem. The problem is that I can NOT use the colon notation for named parameters, even though that's my goal :) If I use the colon notation with MySQL (PDO) it works fine. With ODBC and SAP HANA database it doesn't. I have to use either ? or

Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Karl DeSaulniers
Oh ok, thanks for the clarification. Sorry for the noise. Best, Karl DeSaulniers Design Drumm http://designdrumm.com On Jan 26, 2016, at 1:07 PM, Alko Kotalko wrote: > It shouldn't be like that because I'm preparing a statement, which would > later have had

Re: [PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Lester Caine
On 26/01/16 19:06, Alko Kotalko wrote: > I've tried all the notations with PDO as well and none of them work with > SAP HANA. It works with MySQL though. So I presume that there is either a > bug in PDO driver or there is some mismatch between PDO and SAP HANA. Firebird does not support named

[PHP-DB] PDO and SAP HANA prepared statements issue

2016-01-26 Thread Alko Kotalko
Hi, I have a working connection from PHP to SAP HANA through PDO and regular ODBC commands. The issue is that through PDO I can not get any prepared statements to work. None of the notations (?, $, :) work. The response from the server (fetch) gets me empty field values for all selected columns

[PHP-DB] PDO::ATTR_TIMEOUT with unixODBC not working the way I expect?

2014-04-11 Thread Rob Crowell
I'm connecting to a closed-source database called Vertica via unixODBC and PDO. Everything is working great but I am having trouble getting PDO::ATTR_TIMEOUT attribute working when I create a connection via: $this-conn = new PDO($dsn, $user, $password,

[PHP-DB] PDO Connection problem

2014-01-10 Thread Jim Giner
History: I'm trying to help a friend who is hosting his domain with the same company that I use. I've been using this company for several years and have used a certain 'connection' script all the time. Part of it looks like this:

Re: [PHP-DB] PDO Connection problem

2014-01-10 Thread Aziz Saleh
On Fri, Jan 10, 2014 at 10:13 AM, Jim Giner jim.gi...@albanyhandball.comwrote: History: I'm trying to help a friend who is hosting his domain with the same company that I use. I've been using this company for several years and have used a certain 'connection' script all the time. Part of it

Re: [PHP-DB] PDO Exceptions

2013-04-25 Thread Niel Archer
Greetings, I am new to this list. I have a question about which functions need to be included in a try block. Of new PDO, prepare, bindParam, execute, fetch, and query, it seems that bindParam is the only one that throws an exception. So is this the only that needs to be put into a

Re: [PHP-DB] PDO Exceptions

2013-04-25 Thread Jim Giner
On 4/25/2013 6:49 AM, Niel Archer wrote: Greetings, I am new to this list. I have a question about which functions need to be included in a try block. Of new PDO, prepare, bindParam, execute, fetch, and query, it seems that bindParam is the only one that throws an exception. So is this the

[PHP-DB] PDO Exceptions

2013-04-22 Thread Onatawahtaw
Greetings, I am new to this list. I have a question about which functions need to be included in a try block. Of new PDO, prepare, bindParam, execute, fetch, and query, it seems that bindParam is the only one that throws an exception. So is this the only that needs to be put into a try

Re: [PHP-DB] pdo ?

2013-01-25 Thread Jim Giner
On 1/24/2013 7:07 PM, Matt Pelmear wrote: On 01/24/2013 04:02 PM, Jim Giner wrote: I took my 6 line override php.ini file and replicated (with a script) into all of my possible folders under my web root. NOt exactly an elegant solution, but with the script, easy to maintain. Honestly, you

Re: [PHP-DB] pdo ?

2013-01-25 Thread Jim Giner
On 1/25/2013 10:56 AM, Jim Giner wrote: On 1/24/2013 7:07 PM, Matt Pelmear wrote: On 01/24/2013 04:02 PM, Jim Giner wrote: I took my 6 line override php.ini file and replicated (with a script) into all of my possible folders under my web root. NOt exactly an elegant solution, but with the

[PHP-DB] pdo ?

2013-01-24 Thread Jim Giner
ok - new to using pdo functions, but I thought I had a handle on it. I'm writing out to my page an input tag with the following value in it: 49'ers I can confirm it by using my browser's view source to see that is exactly how it exists in the page. When I hit a submit button and my script

Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear
http://stackoverflow.com/questions/5801951/does-php-auto-escapes-quotes-in-string-which-is-passed-by-get-or-post Every pro has this feature (magic_quotes_gpc) turned off. If you understand SQL Injection vulnerabilities, and properly bind things into your queries, I would recommend disabling

Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner
On 1/24/2013 12:05 PM, Matt Pelmear wrote: http://stackoverflow.com/questions/5801951/does-php-auto-escapes-quotes-in-string-which-is-passed-by-get-or-post Every pro has this feature (magic_quotes_gpc) turned off. If you understand SQL Injection vulnerabilities, and properly bind things into

Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear
On 01/24/2013 09:23 AM, Jim Giner wrote: On 1/24/2013 12:05 PM, Matt Pelmear wrote: http://stackoverflow.com/questions/5801951/does-php-auto-escapes-quotes-in-string-which-is-passed-by-get-or-post Every pro has this feature (magic_quotes_gpc) turned off. If you understand SQL Injection

Re: [PHP-DB] pdo ?

2013-01-24 Thread Richard Quadling
On 24 January 2013 17:48, Matt Pelmear mjpelm...@gmail.com wrote: On 01/24/2013 09:23 AM, Jim Giner wrote: On 1/24/2013 12:05 PM, Matt Pelmear wrote: http://stackoverflow.com/questions/5801951/does-php-auto-escapes-quotes-in-string-which-is-passed-by-get-or-post Every pro has this feature

Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner
On 1/24/2013 1:41 PM, Richard Quadling wrote: On 24 January 2013 17:48, Matt Pelmear mjpelm...@gmail.com wrote: On 01/24/2013 09:23 AM, Jim Giner wrote: On 1/24/2013 12:05 PM, Matt Pelmear wrote:

Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear
On 01/24/2013 12:00 PM, Jim Giner wrote: On 1/24/2013 1:41 PM, Richard Quadling wrote: On 24 January 2013 17:48, Matt Pelmear mjpelm...@gmail.com wrote: On 01/24/2013 09:23 AM, Jim Giner wrote: On 1/24/2013 12:05 PM, Matt Pelmear wrote:

Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner
If you are using another web server or running PHP as FastCGI you may need to consider other options (changing the setting globally or doing a require_once() of your config changes?, or see the FastCGI example here: http://www.askapache.com/php/php-htaccess-tips-tricks.html) -Matt It sounds

Re: [PHP-DB] pdo ?

2013-01-24 Thread Karl DeSaulniers
On Jan 24, 2013, at 2:15 PM, Matt Pelmear wrote: On 01/24/2013 12:00 PM, Jim Giner wrote: On 1/24/2013 1:41 PM, Richard Quadling wrote: On 24 January 2013 17:48, Matt Pelmear mjpelm...@gmail.com wrote: On 01/24/2013 09:23 AM, Jim Giner wrote: On 1/24/2013 12:05 PM, Matt Pelmear wrote:

Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear
On 01/24/2013 01:37 PM, Karl DeSaulniers wrote: On Jan 24, 2013, at 2:15 PM, Matt Pelmear wrote: On 01/24/2013 12:00 PM, Jim Giner wrote: On 1/24/2013 1:41 PM, Richard Quadling wrote: On 24 January 2013 17:48, Matt Pelmear mjpelm...@gmail.com wrote: On 01/24/2013 09:23 AM, Jim Giner wrote:

Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear
On 01/24/2013 01:34 PM, Jim Giner wrote: If you are using another web server or running PHP as FastCGI you may need to consider other options (changing the setting globally or doing a require_once() of your config changes?, or see the FastCGI example here:

Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner
On 1/24/2013 4:37 PM, Karl DeSaulniers wrote: On Jan 24, 2013, at 2:15 PM, Matt Pelmear wrote: On 01/24/2013 12:00 PM, Jim Giner wrote: On 1/24/2013 1:41 PM, Richard Quadling wrote: On 24 January 2013 17:48, Matt Pelmear mjpelm...@gmail.com wrote: On 01/24/2013 09:23 AM, Jim Giner wrote:

Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner
On 1/24/2013 6:03 PM, Matt Pelmear wrote: On 01/24/2013 01:37 PM, Karl DeSaulniers wrote: On Jan 24, 2013, at 2:15 PM, Matt Pelmear wrote: On 01/24/2013 12:00 PM, Jim Giner wrote: On 1/24/2013 1:41 PM, Richard Quadling wrote: On 24 January 2013 17:48, Matt Pelmear mjpelm...@gmail.com

Re: [PHP-DB] pdo ?

2013-01-24 Thread Jim Giner
On 1/24/2013 6:09 PM, Matt Pelmear wrote: On 01/24/2013 01:34 PM, Jim Giner wrote: If you are using another web server or running PHP as FastCGI you may need to consider other options (changing the setting globally or doing a require_once() of your config changes?, or see the FastCGI example

Re: [PHP-DB] pdo ?

2013-01-24 Thread Matt Pelmear
On 01/24/2013 04:02 PM, Jim Giner wrote: I took my 6 line override php.ini file and replicated (with a script) into all of my possible folders under my web root. NOt exactly an elegant solution, but with the script, easy to maintain. Honestly, you would be better off just putting those 6

[PHP-DB] PDO ?

2013-01-15 Thread Jim Giner
Doing some conversion - looking for a solution. Currently I do something like this: while (list($var1,$var2) = mysql_fetch_array($qrslts)) { handle the vars } Is there something in the PDO functions that emulates this same ability? Some of my uses of the sql syntax have many more vars

Re: [PHP-DB] PDO ?

2013-01-15 Thread Kapu®
On 15. 1. 2013 18:25, Jim Giner wrote: Doing some conversion - looking for a solution. Currently I do something like this: while (list($var1,$var2) = mysql_fetch_array($qrslts)) { handle the vars } Is there something in the PDO functions that emulates this same ability? Some of my uses

Re: [PHP-DB] PDO user question

2012-09-10 Thread Matt Pelmear
Brandon: RAM is cheap, but not always expendable depending on what you're doing. Using count() on results from PDOStatement::fetchAll() is fine on small result sets. Keep in mind that this will certainly blow up on very large result sets, especially depending on your memory_limit for php.

Re: [PHP-DB] PDO user question

2012-09-09 Thread Stefan Wixfort
Hi Jim I've had some success with querying using pdo and prepared statements as well. One thing that I'm curious about is How does one handle the need to get the number of rows returned by a Select? The documentation is very clear that PDO doesn't return that value for a Select statement

Re: [PHP-DB] PDO user question

2012-09-09 Thread Michael Stowe
How are you using the number? Probably the easiest way is to utilize PDOStatement::FetchAll() and then do a count() on that result set. - Mike Sent from my iPhone On Sep 9, 2012, at 11:42 AM, Stefan Wixfort stefan.wixf...@gmx.de wrote: Hi Jim I've had some success with querying using

Re: [PHP-DB] PDO user question

2012-09-09 Thread brandon
That's how I'd do it. Extend the PDO interface on your abstract class to include a num_rows() method that utilizes that higher level count($this-result). It might be a little more overhead... but RAM is cheap... and there's always forking/extending the library in C/C++... -Brandon On

Re: [PHP-DB] PDO user question

2012-09-09 Thread Lester Caine
Michael Stowe wrote: How are you using the number? Probably the easiest way is to utilize PDOStatement::FetchAll() and then do a count() on that result set. There are two things to bear in mind here. Often you are only displaying a subset of records - ten per page perhaps - and so a count

[PHP-DB] PDO user question

2012-09-08 Thread Jim Giner
I finally delved into learning how I was going to replace my MYSQL calls with a different interface. Had to go with PDO since my hoster doesn't support MYSQLI for my plan. I've had some success with querying using pdo and prepared statements as well. One thing that I'm curious about is

[PHP-DB] PDO Mysql data truncation missing error

2012-08-20 Thread Matt Pelmear
Hello, I'm trying to detect data truncation on insert to MySQL using PDO. As far as I can tell, this gets reported at least in some cases (ex: http://drupal.org/node/1528628), but I have been unable to see this myself. The test table I'm using has a column that is VARCHAR(5): mysql describe

Re: [PHP-DB] PDO Vs MySQLi Vs SQL Queries.

2012-02-28 Thread Donahue Trevor
Hi Vinay, No, using native mysql_* statement isn't always faster. Advantages are obvious, as mentioned in the article you shared (object mapping, security, performance), there's always things like caching and other stuff you don't want to reinvent the wheel for and on big projects tend to be

Re: [PHP-DB] PDO Vs MySQLi Vs SQL Queries.

2012-02-28 Thread Vinay Kannan
Hi Trevor, Thank You for your suggestion, yeah i think caching is something i definitely want to look at and something thats important, and there is a big project coming up, its pretty much the biggest i've taken up so far, theres also a mobile app for android which needs to be done, so caching

[PHP-DB] PDO Vs MySQLi Vs SQL Queries.

2012-02-27 Thread Vinay Kannan
Hey Guys, I came across this article. http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/ Though I've been working with PHP for over 2 yrs, i never bothered to use the techniques mentioned in the articles like this. What i do for DB connections and queries..is just simple

[PHP-DB] PDO + The Role of PHP + SQLite - Am I missing something?

2010-05-11 Thread Lawrance Shepstone
Hi List, It seems that I'm a little confused (and thus frustrated) with PDO in general, and especially when it comes to PECL php_sqlite3. I understand that PDO is a data-access abstraction layer, and as one, is really good. However, the way I see it, is that PDO should just be an added extra,

Re: [PHP-DB] PDO + The Role of PHP + SQLite - Am I missing something?

2010-05-11 Thread Niel Archer
Hi List, It seems that I'm a little confused (and thus frustrated) with PDO in general, and especially when it comes to PECL php_sqlite3. I understand that PDO is a data-access abstraction layer, and as one, is really good. However, the way I see it, is that PDO should just be an added

Re: [PHP-DB] PDO include table name prefixes in FETCH_ASSOC

2010-03-25 Thread Richard Quadling
On 24 March 2010 18:04, Aaron Paetznick aar...@critd.com wrote: Thanks for the advise.  I wanted a more automatic method of prefixing column names, but I ended up just aliasing them all. I know I could always just issue multiple SELECTs, but I wish MySQL would support this sort of

[PHP-DB] PDO include table name prefixes in FETCH_ASSOC

2010-03-24 Thread Aaron Paetznick
Many of my MySQL tables have columns with the same name. I want to have PDO include table names in named result sets. For example: $sth = $dbh-prepare(SELECT * FROM table0, table1); $result = $sth-fetchAll(PDO::FETCH_ASSOC); I want $result to be organized like: echo

Re: [PHP-DB] PDO include table name prefixes in FETCH_ASSOC

2010-03-24 Thread Niel Archer
Many of my MySQL tables have columns with the same name. I want to have PDO include table names in named result sets. For example: $sth = $dbh-prepare(SELECT * FROM table0, table1); $result = $sth-fetchAll(PDO::FETCH_ASSOC); I want $result to be organized like: echo

Re: [PHP-DB] PDO include table name prefixes in FETCH_ASSOC

2010-03-24 Thread Richard Quadling
On 24 March 2010 16:05, Aaron Paetznick aar...@critd.com wrote: Many of my MySQL tables have columns with the same name.  I want to have PDO include table names in named result sets.  For example:  $sth = $dbh-prepare(SELECT * FROM table0, table1);  $result = $sth-fetchAll(PDO::FETCH_ASSOC);

Re: [PHP-DB] PDO include table name prefixes in FETCH_ASSOC

2010-03-24 Thread Aaron Paetznick
Thanks for the advise. I wanted a more automatic method of prefixing column names, but I ended up just aliasing them all. I know I could always just issue multiple SELECTs, but I wish MySQL would support this sort of functionality natively. I'd really like to reference my results as

Re: [PHP-DB] PDO and PostgreSQL - RAISE NOTICE

2009-10-05 Thread Lester Caine
Samuel ROZE wrote: Hi, Thanks for your reply. In fact, my request returns a result which i get with the fetch method. But, it must returns other informations, which are not in the result... This informations are neturned before the result in console... So, i don't know how I can get that.

Re: [PHP-DB] PDO and PostgreSQL - RAISE NOTICE

2009-10-05 Thread Samuel ROZE
Thanks a lot ! I'm now understanding why PDO exists.. It is not for replace the actual PostgreSQL/MySQL/SQLite/Firebird/... PHP drivers but for help to developp with many DB with one code. Well... I can developp an extension to PDO PostgreSQL driver, is that correct ? It may help many users like

[PHP-DB] PDO PgSQL: _pdo_pgsql_notice

2009-10-05 Thread Samuel ROZE
Hi ! I'm reading the source of PDO PostgreSQL driver and i see that there's an empty function, _pdo_pgsql_notice, which is very interesting ! I think that it is used when PostgreSQL throw Notices. But, nothing is done... I want to know if somebody know why the content of the function is

Re: [PHP-DB] PDO PgSQL: _pdo_pgsql_notice

2009-10-05 Thread Samuel ROZE
To use PostgreSQL's Notices with PDO, i'm modifying the source for trying to store into errmsg (which I can get with PDO::errorInfo) the notice. The _pdo_pgsql_notice function is called everytime that there's an notice. The notice message is in the message var. This what i had tried:

Re: [PHP-DB] PDO PgSQL: _pdo_pgsql_notice

2009-10-05 Thread Chris
Samuel ROZE wrote: To use PostgreSQL's Notices with PDO, i'm modifying the source for trying to store into errmsg (which I can get with PDO::errorInfo) the notice. The _pdo_pgsql_notice function is called everytime that there's an notice. The notice message is in the message var. This what i

[PHP-DB] PDO and PostgreSQL - RAISE NOTICE

2009-10-04 Thread Samuel ROZE
Hi ! I'm new on this mailling list, so i don't realy know if you know the response and if it is realy here that I have to ask my question :-) I'm working with PostgreSQL (8.3 form sources) and PDO (PHP 5.2.10 from sources). In a Postgres function, I have a RAISE NOTICE command. My function works

Re: [PHP-DB] PDO and PostgreSQL - RAISE NOTICE

2009-10-04 Thread Kesavan Rengarajan
Hi, Query returns an iterable object (thanks to the comments in the php site) and that's why when you do a dump you just see the String, If you just want to get one row from the resultset you can get it like this: $stat = $sql-query('SELECT * FROM public.test_info()')-fetch(); More

Re: [PHP-DB] PDO and PostgreSQL - RAISE NOTICE

2009-10-04 Thread Samuel ROZE
Hi, Thanks for your reply. In fact, my request returns a result which i get with the fetch method. But, it must returns other informations, which are not in the result... This informations are neturned before the result in console... So, i don't know how I can get that. Samuel. Le lundi 05

[PHP-DB] PDO - SP Return Values supported?

2009-06-15 Thread Chris Schroll
Hey Guys, I'm working with a SQL Server stored procedure that returns error codes; here is a very simple snippet of the SP. DECLARE @ret int BEGIN SET @ret = 1 RETURN @ret END I can't figure out how to access the return value in PDO; I'd prefer not to use an OUT parameter, as

[PHP-DB] PDO buffered query problem

2009-02-23 Thread Stewart Duncan
Hi there, I'm having some serious problems with the PHP Data Object functions. I'm trying to loop through a sizeable result set (~60k rows, ~1gig) using a buffered query to avoid fetching the whole set. No matter what I do, the script just hangs on the PDO::query() - it seems the query is

Re: [PHP-DB] PDO bindValue ORDER BY

2008-11-02 Thread Chris
Matthew Peltzer wrote: ok... this makes more sense now. I know in the past I tried to do something similar with table names in the WHERE clause, and that didn't work in the same manner. Is there a better way to do what I'm trying to do? that is, sorting within the SQL statement based on a

Re: [PHP-DB] PDO bindValue ORDER BY

2008-11-02 Thread Chris
Chris wrote: Matthew Peltzer wrote: ok... this makes more sense now. I know in the past I tried to do something similar with table names in the WHERE clause, and that didn't work in the same manner. Is there a better way to do what I'm trying to do? that is, sorting within the SQL statement

Re: [PHP-DB] PDO bindValue ORDER BY

2008-11-01 Thread Matthew Peltzer
ok... this makes more sense now. I know in the past I tried to do something similar with table names in the WHERE clause, and that didn't work in the same manner. Is there a better way to do what I'm trying to do? that is, sorting within the SQL statement based on a supplied column name without

Re: [PHP-DB] PDO bindValue ORDER BY

2008-11-01 Thread Post TUDBC
Your workaround is probably what I would do myself. Note: mysql_real_escape_string() is technically expecting a string value, although there is no harm using it, and it's not a bad idea to avoid possible SQL malicious codes. Alternately, you can also write a simple function using regular

[PHP-DB] PDO bindValue ORDER BY

2008-10-31 Thread Matthew Peltzer
Are pdo bound parameters within an ORDER BY clause broken in php 5.2.5? I find that in php 5.2.6 this works as expected: ?php $sql = 'SELECT * FROM `table` ORDER BY :sort'; $stmt = $pdo-prepare($sql); $stmt-bindValue(':sort', $sort, PDO::PARAM_STR); $stmt-execute();

Re: [PHP-DB] PDO prepared statements and value list for MySQL IN

2008-07-10 Thread Thodoris
O/H TK ??: At 03:21 AM 7/9/2008, Thodoris wrote: At 04:16 PM 7/8/2008, Philip Thompson wrote: On Jul 8, 2008, at 11:55 AM, TK wrote: I'd like to use a PDO prepared statement to perform a MySQL query that uses the IN function. I.e.: $stmt = $pdo-prepare(' select *

Re: [PHP-DB] PDO prepared statements and value list for MySQL IN

2008-07-10 Thread TK
At 05:53 PM 7/8/2008, TK wrote: I'd like to use a PDO prepared statement to perform a MySQL query that uses the IN function. I may have found my answer (in the PHP manual, under PDO-prepare(). Go figure!): You cannot bind multiple values to a single named parameter in, for example, the IN()

Re: [PHP-DB] PDO prepared statements and value list for MySQL IN

2008-07-10 Thread TK
At 03:23 AM 7/10/2008, Thodoris wrote: Why don't you work this around. Since you may do anything with strings in php using the (.) operator try this: ?php $a = array('string1','string2'); $str = implode(',',$a); $str = '.$str.'; print $str; ? Thanks, but this is missing the entire point of my

Re: [PHP-DB] PDO prepared statements and value list for MySQL IN

2008-07-10 Thread Dee Ayy
As you already know, you will dynamically create the $contents. See if you can dynamically create the entire prepare statement which includes the $contents, as well as dynamically create the bindValue statement; then see if you can eval those dynamically created statements. $commandPrepare =

Re: [PHP-DB] PDO prepared statements and value list for MySQL IN

2008-07-09 Thread Thodoris
At 04:16 PM 7/8/2008, Philip Thompson wrote: On Jul 8, 2008, at 11:55 AM, TK wrote: I'd like to use a PDO prepared statement to perform a MySQL query that uses the IN function. I.e.: $stmt = $pdo-prepare(' select * from mytable where myfield IN (:contents) );

Re: [PHP-DB] PDO prepared statements and value list for MySQL IN

2008-07-09 Thread TK
At 03:21 AM 7/9/2008, Thodoris wrote: At 04:16 PM 7/8/2008, Philip Thompson wrote: On Jul 8, 2008, at 11:55 AM, TK wrote: I'd like to use a PDO prepared statement to perform a MySQL query that uses the IN function. I.e.: $stmt = $pdo-prepare(' select * from mytable where myfield IN

[PHP-DB] PDO prepared statements and value list for MySQL IN

2008-07-08 Thread TK
I'd like to use a PDO prepared statement to perform a MySQL query that uses the IN function. I.e.: $stmt = $pdo-prepare(' select * from mytable where myfield IN (:contents) ); $stmt-bindValue(':contents', $contents); $stmt-execute(); Here's the problem: If $contents is set to a single

Re: [PHP-DB] PDO prepared statements and value list for MySQL IN

2008-07-08 Thread Philip Thompson
On Jul 8, 2008, at 11:55 AM, TK wrote: I'd like to use a PDO prepared statement to perform a MySQL query that uses the IN function. I.e.: $stmt = $pdo-prepare(' select * from mytable where myfield IN (:contents) ); $stmt-bindValue(':contents', $contents); $stmt-execute(); Here's the

Re: [PHP-DB] PDO prepared statements and value list for MySQL IN

2008-07-08 Thread TK
At 04:16 PM 7/8/2008, Philip Thompson wrote: On Jul 8, 2008, at 11:55 AM, TK wrote: I'd like to use a PDO prepared statement to perform a MySQL query that uses the IN function. I.e.: $stmt = $pdo-prepare(' select * from mytable where myfield IN (:contents) ); $stmt-bindValue(':contents',

[PHP-DB] [PDO] Cannot execute queries while other unbuffered queries are active

2008-03-23 Thread Fabian Golle
Hey, I'm using a PDO-MySQL in a class of my Accounting-Framework. The problem: if I call my function query(), see below, multiple times, I get the error: Array ( [0] = HY000 [1] = 2014 [2] = Cannot execute queries while other unbuffered queries are active. Consider using

[PHP-DB] PDO::TIME_ZONE and or Initializing Query

2007-12-20 Thread Paul Rogers
It would be helpful if the time zone of a session could be specified at the time of the connection. This would avoid the overhead of a separate database query and round-trip to the database server when a single, non-default time zone is needed for the duration of the connection. Naturally there

Re: [PHP-DB] PDO::TIME_ZONE and or Initializing Query

2007-12-20 Thread Chris
Paul Rogers wrote: It would be helpful if the time zone of a session could be specified at the time of the connection. This would avoid the overhead of a separate database query and round-trip to the database server when a single, non-default time zone is needed for the duration of the

[PHP-DB] PDO and Oracle

2007-11-19 Thread Roberto Mansfield
Folks, I was looking at rewriting some old DB classes using PDO with the Oracle driver, but I'm a bit confused about the current state of things. Some docs said the PDO Oracle driver was experimental and subject to change. I also had a hard time trying to get the driver to compile against

Re: [PHP-DB] pdo::mysql and unbuffered queries

2007-10-07 Thread Chris
I tried using pdo (www.php.net/pdo) as it would be nice for my projects to be portable to another database systems, but quickly ran into problems. The lesser important: One time, there was a simple typo in one of my queries and I got an error that php is not able to save session variables

[PHP-DB] pdo::mysql and unbuffered queries

2007-10-05 Thread Thomas Tschernich
Hello there, I tried using pdo (www.php.net/pdo) as it would be nice for my projects to be portable to another database systems, but quickly ran into problems. The lesser important: One time, there was a simple typo in one of my queries and I got an error that php is not able to save session

[PHP-DB] PDO Contact ?

2007-08-29 Thread Nicolas Boiteux
Hello, I'm leading the PhpMyObject (PMO) Project: official website: http://pmo.developpez.com It's an object abstraction layer that permits to convert data from PDO to unitary PHP object (not row). Example: | require_once

Re: [PHP-DB] PDO Contact ?

2007-08-29 Thread Chris
I wish to know who i can contact from PDO Team to submit evolutions ? No particular person. I think Wez was in charge when it was being built but it's all integrated into the core php now - so join the -internals list and make a proposal/suggestion. -- Postgresql php tutorials

[PHP-DB] PDO and MS Sql Server

2007-07-05 Thread Bruce Cowin
I'm using PHP 5.1. The documentation for PDO doesn't list MS Sql server as one of the drivers that support PDO but there is a php_pdo_mssql.dll which seems to work so I'm using that. I need to get the id of a new record just inserted. I can't use lastInsertId() as I get a message saying it's

Re: [PHP-DB] PDO and MS Sql Server

2007-07-05 Thread Chris
Bruce Cowin wrote: I'm using PHP 5.1. The documentation for PDO doesn't list MS Sql server as one of the drivers that support PDO but there is a php_pdo_mssql.dll which seems to work so I'm using that. I need to get the id of a new record just inserted. I can't use lastInsertId() as I get

Re: [PHP-DB] PDO and MS Sql Server

2007-07-05 Thread Bruce Cowin
Thanks for replying. According to the PDO doco: If the database driver supports it, you may also bind parameters for output as well as input. So maybe this driver doesn't support it? I don't know. I'll try and get the stored proc to return the value, but not sure how I'll capture that yet.

Re: [PHP-DB] PDO and MS Sql Server

2007-07-05 Thread Chris
Bruce Cowin wrote: Thanks for replying. According to the PDO doco: If the database driver supports it, you may also bind parameters for output as well as input. So maybe this driver doesn't support it? I don't know. I'll try and get the stored proc to return the value, but not sure how

[PHP-DB] PDO prepared statements sometimes returns empty resultset

2007-04-23 Thread Emil Ivanov
Hi, I'm trying to get some data form a MySQL db using PDO and prepared statement, but I noticed that sometimes it fetches an empty result set, but sometimes does what it's supposed to do - returns the whole result set. The environment is WinXP SP2 Home, Apache 2.2.4, PHP 5.2.1 and MySQL

[PHP-DB] PDO setAttribute return value

2007-04-20 Thread Jerry Schwartz
Is it my imagination, or does setAttribute return FALSE on success and TRUE on failure? I've tested it with getAttribute, and it definitely seems to work the reverse of what the documentation states. I'm using MySQL, and I am setting the error handling. -- PHP Database Mailing List

Re: [PHP-DB] PDO Exception Handling Question

2007-04-20 Thread Jerry Schwartz
I hope by now you figured this out, but you have to use $dbh-setAttribute() to enable exception handling for anything but the initial object creation. Worse yet, as of 2007/04/20 the return values of setAttribute are reversed. It returns TRUE on failure and FALSE on success. Rodney Topor

[PHP-DB] PDO stored procedures php5.1 mysql5

2007-02-19 Thread gxjw-3301
Hello, I've some problems with calling stored procedures. When I try to execute the demonstration example on php.net I get no result, but it works with normal SQL-commandqueries software: MAMP-package: php 5.1.6, mysql 5.0.19, apache 2.0.59 my stored procedure is for this example returns a

[PHP-DB] pdo parameter in limit?

2006-12-14 Thread Patrick Felt
i'm running php PHP Version 5.1.6-pl6-gentoo and have run into a bit of a snag with pdo prepared statements and parameters. we use parameters in all our queries, but just recently tried to add limits to some of the queries so we can do paging. when attempting to add a parameter to the limit

Re: [PHP-DB] PDO, fetch prepared statement

2006-11-26 Thread Chris
Rudi Worm wrote: Hi Using PDO to prepare a query, bind som values to it (using ? Placeholders) and then executing it - how do i get the actual query afterwards? With the correct inserted values. Use your system database logs. PDO doesn't give you the opportunity to grab them. --

[PHP-DB] PDO, fetch prepared statement

2006-11-24 Thread Rudi Worm
Hi Using PDO to prepare a query, bind som values to it (using ? Placeholders) and then executing it - how do i get the actual query afterwards? With the correct inserted values. It is needed logging purposes. I haven't been able to find any method or property that gives me this information.

RE: [PHP-DB] PDO and Exceptions

2006-06-22 Thread Vandegrift, Ken
] Sent: Wednesday, June 21, 2006 5:39 PM To: Vandegrift, Ken Cc: php-db@lists.php.net Subject: Re: [PHP-DB] PDO and Exceptions Vandegrift, Ken wrote: Good Afternoon, I have an instance of a PDO object set to throw a PDOException on errors. However, it does not appear to do this when

[PHP-DB] PDO and Exceptions

2006-06-21 Thread Vandegrift, Ken
Good Afternoon, I have an instance of a PDO object set to throw a PDOException on errors. However, it does not appear to do this when a primary key violation error occurs on an insert sql statement. An exception should be thrown in this case correct? The insert statements are part of a

  1   2   >