Re: Model Association 'limit' not working

2007-12-07 Thread sanderken

People looking for the answer to  defining limit row in oracle  :

in the model , use the
'conditions' = ' WHERE ROWNUM = 3 '
option.

Limit is the implementation in mySQL.
Hope this helps someone...

On 8 dec, 01:53, sanderken [EMAIL PROTECTED] wrote:
 Maybe I should mention I'm using oracle for DBMS.

 On 7 dec, 21:54, sanderken [EMAIL PROTECTED] wrote:

  Hey,

  I defined a user (named Gebruiker in my native language ) model
  where when I call a $this-find() , needs to retrieve only a limited
  amount of related information.

  When I add the 'limit' = '10' to the association info, it doesn't
  work. For example: I call
 $gebruiker = $this-find(
  array(Gebruiker.id = $gebruikerid)
  );
   in the model and it retrieves 11 'kommentaars'.

  Does anyone know why this happens? I searched the internet for model
  information, and even the example 
  onhttp://manual.cakephp.org/chapter/modelsshowthe same way of doing
  this. But it works in their example and not in my situation ;)

  Does anyone know how to solve this problem?

  Thanks,

  Here's the code:

  class Gebruiker extends AppModel
  {
  var $name = 'Gebruiker';

  var $hasMany = array(
  'Blog' = array(
  'className' = 'Blog',
  'order' = 'Blog.created DESC',
  'limit' = '10',
  'foreignKey' = 'gebruiker_id',

  ),
  'Kommentaar' = array(
  'className' = 'Kommentaar',
  'order' = 'Kommentaar.created DESC',
  'limit' = '5',
  'foreignKey' = 'gebruiker_id'
  ),
  'Message_sent' = array(
  'className' = 'Message',
  'order'= 'Message_sent.created DESC',
  'limit'= '10',
  'foreignKey'= 'sender_id',
  ),
  'Message_received' = array(
  'className' = 'Message',
  'order'=
  'Message_received.created DESC',
  'limit'   = '10',
  'foreignKey'= 'receiver_id',
  )
  );
   !-- Model logic here --

  }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model Association 'limit' not working

2007-12-07 Thread sanderken

Maybe I should mention I'm using oracle for DBMS.

On 7 dec, 21:54, sanderken [EMAIL PROTECTED] wrote:
 Hey,

 I defined a user (named Gebruiker in my native language ) model
 where when I call a $this-find() , needs to retrieve only a limited
 amount of related information.

 When I add the 'limit' = '10' to the association info, it doesn't
 work. For example: I call
$gebruiker = $this-find(
 array(Gebruiker.id = $gebruikerid)
 );
  in the model and it retrieves 11 'kommentaars'.

 Does anyone know why this happens? I searched the internet for model
 information, and even the example 
 onhttp://manual.cakephp.org/chapter/modelsshow the same way of doing
 this. But it works in their example and not in my situation ;)

 Does anyone know how to solve this problem?

 Thanks,

 Here's the code:

 class Gebruiker extends AppModel
 {
 var $name = 'Gebruiker';

 var $hasMany = array(
 'Blog' = array(
 'className' = 'Blog',
 'order' = 'Blog.created DESC',
 'limit' = '10',
 'foreignKey' = 'gebruiker_id',

 ),
 'Kommentaar' = array(
 'className' = 'Kommentaar',
 'order' = 'Kommentaar.created DESC',
 'limit' = '5',
 'foreignKey' = 'gebruiker_id'
 ),
 'Message_sent' = array(
 'className' = 'Message',
 'order'= 'Message_sent.created DESC',
 'limit'= '10',
 'foreignKey'= 'sender_id',
 ),
 'Message_received' = array(
 'className' = 'Message',
 'order'=
 'Message_received.created DESC',
 'limit'   = '10',
 'foreignKey'= 'receiver_id',
 )
 );
  !-- Model logic here --

 }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CLOB in cakephp 1.2

2007-12-07 Thread sanderken

Hello Lauwens,

What a coincidance, yes :)

I'm still trying to bind the 4000 string from php to the CLOB field.
I manage to READ the data ( I manually put into the database ) with no
problem, I just can't push the data back into the database.
I read about the ticket, the solution lies there indeed, but I have no
idea how to do it.

Does someone know how to save a model with a clob inside?

Thanks in advance

On 7 dec, 16:55, Lauwens [EMAIL PROTECTED] wrote:
 I am trying to do the exact same thing (what a coincidance)

 I only found a ticket with a patch about this
 here:https://trac.cakephp.org/ticket/2294

 But that doesn't seem to do the trick...

 Maybe we can get in contact with cedsav  for our problem ?

 On 5 dec, 01:28, sanderken [EMAIL PROTECTED] wrote:

  Hello everybody.

  After a long quest on the internet and through the cakephp API, I
  can't find a solution to my problem .

  Here goes:
  Cakephp is working great with my oracle database. Now I want to store
  messages  4000 chars (VARCHAR2). So I want to go with aCLOB.

  When I fill the data straight in the database with some 20k
  characters , all happens as wanted: model reads theCLOBand prints
  it. No problem.

  Now the REAL problem: I can't get the data BACK into the database !

  This is the error: Warning (2): ociexecute() [function.ociexecute]:
  ORA-01704: string literal too long [CORE/cake/libs/model/datasources/
  dbo/dbo_oracle.php, line 291]

  Help would be greatly appreciated !

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Model Association 'limit' not working

2007-12-07 Thread sanderken

Hey,

I defined a user (named Gebruiker in my native language ) model
where when I call a $this-find() , needs to retrieve only a limited
amount of related information.

When I add the 'limit' = '10' to the association info, it doesn't
work. For example: I call
   $gebruiker = $this-find(
array(Gebruiker.id = $gebruikerid)
);
 in the model and it retrieves 11 'kommentaars'.

Does anyone know why this happens? I searched the internet for model
information, and even the example on
http://manual.cakephp.org/chapter/models show the same way of doing
this. But it works in their example and not in my situation ;)

Does anyone know how to solve this problem?

Thanks,

Here's the code:

class Gebruiker extends AppModel
{
var $name = 'Gebruiker';

var $hasMany = array(
'Blog' = array(
'className' = 'Blog',
'order' = 'Blog.created DESC',
'limit' = '10',
'foreignKey' = 'gebruiker_id',


),
'Kommentaar' = array(
'className' = 'Kommentaar',
'order' = 'Kommentaar.created DESC',
'limit' = '5',
'foreignKey' = 'gebruiker_id'
),
'Message_sent' = array(
'className' = 'Message',
'order'= 'Message_sent.created DESC',
'limit'= '10',
'foreignKey'= 'sender_id',
),
'Message_received' = array(
'className' = 'Message',
'order'=
'Message_received.created DESC',
'limit'   = '10',
'foreignKey'= 'receiver_id',
)
);
 !-- Model logic here --
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CLOB in cakephp 1.2

2007-12-05 Thread sanderken

I read throught the oracle php cookbook and probably searched on the
wrong searchterms ;) Thanks for the response. I encountered such an
example of binding here: 
http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_lobs.html

eg:
?php
// etc.

$sql = INSERT INTO
  mylobs
  (
id,
mylob
  )
VALUES
  (
mylobs_id_seq.NEXTVAL,
:string
  )
;

$stmt = oci_parse($conn, $sql);

$string = 'INSERT: '.date('H:i:s',time());

oci_bind_by_name($stmt, ':string', $string);

oci_execute($stmt)
or die (Unable to execute query\n);

// etc.
?

I was trying this last night but there seems to go something wrong
when i execute sql in my model...


On 5 dec, 09:28, AD7six [EMAIL PROTECTED] wrote:
 On Dec 5, 1:28 am, sanderken [EMAIL PROTECTED] wrote:





  Hello everybody.

  After a long quest on the internet and through the cakephp API, I
  can't find a solution to my problem .

  Here goes:
  Cakephp is working great with my oracle database. Now I want to store
  messages  4000 chars (VARCHAR2). So I want to go with a CLOB.

  When I fill the data straight in the database with some 20k
  characters , all happens as wanted: model reads the CLOB and prints
  it. No problem.

  Now the REAL problem: I can't get the data BACK into the database !

  This is the error: Warning (2): ociexecute() [function.ociexecute]:
  ORA-01704: string literal too long [CORE/cake/libs/model/datasources/
  dbo/dbo_oracle.php, line 291]

  Help would be greatly appreciated !

 At a guess you need to use a bind variable. as result one says 
 here:http://www.google.es/search?q=ORA-01704%3A+string+literal+too+long

 As 
 doeshttp://download.oracle.com/docs/cd/B10501_01/server.920/a96525/e1500.htm

 So where did you go with your quest ;)?

 AD- Tekst uit oorspronkelijk bericht niet weergeven -

 - Tekst uit oorspronkelijk bericht weergeven -

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CLOB in cakephp 1.2

2007-12-04 Thread sanderken

Hello everybody.

After a long quest on the internet and through the cakephp API, I
can't find a solution to my problem .

Here goes:
Cakephp is working great with my oracle database. Now I want to store
messages  4000 chars (VARCHAR2). So I want to go with a CLOB.

When I fill the data straight in the database with some 20k
characters , all happens as wanted: model reads the CLOB and prints
it. No problem.

Now the REAL problem: I can't get the data BACK into the database !

This is the error: Warning (2): ociexecute() [function.ociexecute]:
ORA-01704: string literal too long [CORE/cake/libs/model/datasources/
dbo/dbo_oracle.php, line 291]

Help would be greatly appreciated !

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---