Franke Gordon | 2 Feb 2007 08:19

int column update

Hello,

i have in the db and schema a int column so when i write:
$table->setColumn('1'); // string int

And the value in the db is 1 he will make an?

So it is not better to convert the value to int before compare?

System:
Symfony-1.0.0rc2
Php 5.2.0

greetings
Gordon
Hans Lellelid | 2 Feb 2007 13:06

Re: int column update

Hi Gordon,

Franke Gordon wrote:
> Hello,
> 
> i have in the db and schema a int column so when i write:
> $table->setColumn('1'); // string int
> 
> And the value in the db is 1 he will make an?
> 
> So it is not better to convert the value to int before compare?
> 

Well, for integer (numeric) fields we may want to check whether the
string is a number & then cast it before checking.  We cannot, however,
blindly cast to an int before compare, because then this would no longer
work:

$table->setColumn(null);

(NULL would get converted to 0)

I think, though, that we could make this more usable, as suggested --
using is_numeric().

I created a ticket (http://propel.phpdb.org/trac/ticket/344) and added
you to CC, so you will get notified when it is completed (which will be
for 1.3 branch).

Thanks,
(Continue reading)

Franke Gordon | 2 Feb 2007 13:31

AW: int column update

Thanks.

-----Ursprüngliche Nachricht-----
Von: Hans Lellelid [mailto:hans <at> velum.net] 
Gesendet: Freitag, 2. Februar 2007 13:07
An: users <at> propel.tigris.org
Betreff: Re: [propel] int column update

Hi Gordon,

Franke Gordon wrote:
> Hello,
> 
> i have in the db and schema a int column so when i write:
> $table->setColumn('1'); // string int
> 
> And the value in the db is 1 he will make an?
> 
> So it is not better to convert the value to int before compare?
> 

Well, for integer (numeric) fields we may want to check whether the
string is a number & then cast it before checking.  We cannot, however,
blindly cast to an int before compare, because then this would no longer
work:

$table->setColumn(null);

(NULL would get converted to 0)

(Continue reading)

Torsten Zander | 6 Feb 2007 17:05
Picon

executeQuery in 1.3


Hi

there seems to be some diffrences in 1.3 concerning "SELECT SQL"

$con = Propel::getConnection();
	  $query = '
	    SELECT .. FROM 
	    FROM Table
	     ORDER BY count DESC LIMIT;

	  	$stmt = $con->beginTransaction();
	
		try {
			$rs = $stmt->executeQuery($query);
		} catch (PDOException $sqle) {
		  	$con->rollack();
		  	throw $sqle;
		}
an I Am getting

Call to a member function executeQuery() on a non-object in 

is there a new method in PropelPDO for executeQuery I could not find
anything

Thanks Torsten
Hans Lellelid | 6 Feb 2007 17:05

Re: executeQuery in 1.3

Hi Torsten,

See this page for a guide to upgrading to 1.3 -- and what this means for
the API: http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/Upgrading

Hans

Torsten Zander wrote:
> Hi
> 
> there seems to be some diffrences in 1.3 concerning "SELECT SQL"
> 
> $con = Propel::getConnection();
> 	  $query = '
> 	    SELECT .. FROM 
> 	    FROM Table
> 	     ORDER BY count DESC LIMIT;
> 
> 	  	$stmt = $con->beginTransaction();
> 	
> 		try {
> 			$rs = $stmt->executeQuery($query);
> 		} catch (PDOException $sqle) {
> 		  	$con->rollack();
> 		  	throw $sqle;
> 		}
> an I Am getting
> 
> Call to a member function executeQuery() on a non-object in 
> 
(Continue reading)

Ron Rademaker | 6 Feb 2007 17:09
Picon

Re: executeQuery in 1.3

PDO doesn't use executeQuery, try:

$stmt->prepare($query);
$stm->execute();

Ron

Torsten Zander wrote:
> Hi
>
> there seems to be some diffrences in 1.3 concerning "SELECT SQL"
>
> $con = Propel::getConnection();
> 	  $query = '
> 	    SELECT .. FROM 
> 	    FROM Table
> 	     ORDER BY count DESC LIMIT;
>
> 	  	$stmt = $con->beginTransaction();
> 	
> 		try {
> 			$rs = $stmt->executeQuery($query);
> 		} catch (PDOException $sqle) {
> 		  	$con->rollack();
> 		  	throw $sqle;
> 		}
> an I Am getting
>
> Call to a member function executeQuery() on a non-object in 
>
(Continue reading)

Hans Lellelid | 6 Feb 2007 17:07

Re: executeQuery in 1.3

I realize now that the upgrade page currently doesn't link to PDO api.
I'll fix that; in the meantime, see http://www.php.net/pdo for PDO API
guide.

Thanks,
Hans

Hans Lellelid wrote:
> Hi Torsten,
> 
> See this page for a guide to upgrading to 1.3 -- and what this means for
> the API: http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/Upgrading
> 
> Hans
> 
> 
> Torsten Zander wrote:
>> Hi
>>
>> there seems to be some diffrences in 1.3 concerning "SELECT SQL"
>>
>> $con = Propel::getConnection();
>> 	  $query = '
>> 	    SELECT .. FROM 
>> 	    FROM Table
>> 	     ORDER BY count DESC LIMIT;
>>
>> 	  	$stmt = $con->beginTransaction();
>> 	
>> 		try {
(Continue reading)

Torsten Zander | 6 Feb 2007 17:13
Picon

AW: executeQuery in 1.3

thanks I know that page but the methods in the example always need a
Criteria Object
i "just " have a sql Statement 

Torsten

-----Ursprüngliche Nachricht-----
Von: Hans Lellelid [mailto:hans <at> velum.net] 
Gesendet: Dienstag, 6. Februar 2007 17:06
An: users <at> propel.tigris.org
Betreff: Re: [propel] executeQuery in 1.3

Hi Torsten,

See this page for a guide to upgrading to 1.3 -- and what this means for the
API: http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/Upgrading

Hans

Torsten Zander wrote:
> Hi
> 
> there seems to be some diffrences in 1.3 concerning "SELECT SQL"
> 
> $con = Propel::getConnection();
> 	  $query = '
> 	    SELECT .. FROM 
> 	    FROM Table
> 	     ORDER BY count DESC LIMIT;
> 
(Continue reading)

Torsten Zander | 6 Feb 2007 17:30
Picon

AW: executeQuery in 1.3

Thanks

but $stm->execute(); return a boolean true I want the resultset 

Thanks Torsten

-----Ursprüngliche Nachricht-----
Von: Ron Rademaker [mailto:r.rademaker <at> virtualbuilding.nl] 
Gesendet: Dienstag, 6. Februar 2007 17:09
An: users <at> propel.tigris.org
Betreff: Re: [propel] executeQuery in 1.3

PDO doesn't use executeQuery, try:

$stmt->prepare($query);
$stm->execute();

Ron

Torsten Zander wrote:
> Hi
>
> there seems to be some diffrences in 1.3 concerning "SELECT SQL"
>
> $con = Propel::getConnection();
> 	  $query = '
> 	    SELECT .. FROM 
> 	    FROM Table
> 	     ORDER BY count DESC LIMIT;
>
(Continue reading)

Hans Lellelid | 6 Feb 2007 17:29

Re: AW: executeQuery in 1.3

There is no resultset in PDO, please see the upgrade page (I just
updated it) for an example of prepare/execute w/ PDO.  It's easy, but
the API is a little different.

Cheers,
Hans

Torsten Zander wrote:
> Thanks
>
> but $stm->execute(); return a boolean true I want the resultset 
>
>
> Thanks Torsten
>
>
> -----Ursprüngliche Nachricht-----
> Von: Ron Rademaker [mailto:r.rademaker <at> virtualbuilding.nl] 
> Gesendet: Dienstag, 6. Februar 2007 17:09
> An: users <at> propel.tigris.org
> Betreff: Re: [propel] executeQuery in 1.3
>
> PDO doesn't use executeQuery, try:
>
> $stmt->prepare($query);
> $stm->execute();
>
> Ron
>
> Torsten Zander wrote:
(Continue reading)


Gmane