Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Ajuda!...Como executar um comando SQL no CAKEPHP
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alberane Lúcio  
View profile   Translate to Translated (View Original)
 More options May 8, 9:45 am
From: Alberane Lúcio <alberanelu...@gmail.com>
Date: Fri, 8 May 2009 06:45:04 -0700 (PDT)
Local: Fri, May 8 2009 9:45 am
Subject: Ajuda!...Como executar um comando SQL no CAKEPHP
Olá Pessoal!

Parece ser uma pergunta tosca... mas estou com muitas dificuldades em
executar um simples comando no meu banco.

vejam o que estou tentando:

class SincronizacoesController extends AppController {

        var $uses = array();

        function index(){

        }

        function sinc(){

                $this->set('vw_dados',$this->query("SELECT * FROM `ambiente` WHERE
1;"));

        }

}

Sei que eu poderia fezer isso com o find()... mas eu quero saber como
se faz sem o find()! em outros momentos vou precisar de executar
comandos bem complexos no banco.

Obrigado!


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tulio Faria  
View profile   Translate to Translated (View Original)
 More options May 13, 10:55 pm
From: Tulio Faria <tuliofa...@gmail.com>
Date: Wed, 13 May 2009 19:55:29 -0700 (PDT)
Local: Wed, May 13 2009 10:55 pm
Subject: Re: Ajuda!...Como executar um comando SQL no CAKEPHP
Você precisa indicar para qual model vc quer dar um query. Por
exemplo: $this->Ambiente->query("select blablabla");

O ideal é fazer um método dentro do teu model e chamar a query lá de
dentro com o $this->query mesmo.

Att,

On 8 maio, 10:45, Alberane Lúcio <alberanelu...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Raphael Passini Diniz  
View profile   Translate to Translated (View Original)
 More options May 14, 8:59 am
From: Raphael Passini Diniz <raphapass...@gmail.com>
Date: Thu, 14 May 2009 09:59:01 -0300
Local: Thurs, May 14 2009 8:59 am
Subject: Re: [CakePHP-Tuga] Re: Ajuda!...Como executar um comando SQL no CAKEPHP

Alberane,

É importante manter os padrões de designs especificados pelo framework. No
caso do CakePHP que utiliza o padrão MVC, é importante que todas as
operações relacionadas ao banco fiquem no Model correspondente.

Vamos ao exemplo prático do seu caso:

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

      //relacionamentos
*
     function getAll() {
       return $this->query('SELECT * FROM `ambiente` WHERE 1');
     }*

}

class SincronizacoesController extends AppController {

       var $uses = array();

       function index(){

       }

       function sinc(){

*                $this->set('vw_dados',$this->Ambiente->getAll());*        }

}

Essa seria a forma correta de realizar a operação.
Espero ter ajudado,
Abraços!

2009/5/13 Tulio Faria <tuliofa...@gmail.com>

--
Atenciosamente Raphael Passini Diniz

Bill Cosby <http://www.brainyquote.com/quotes/authors/b/bill_cosby.html>  -
"Fatherhood is pretending the present you love most is soap-on-a-rope."


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alberane Lúcio  
View profile   Translate to Translated (View Original)
 More options Jun 22, 10:05 pm
From: Alberane Lúcio <alberanelu...@gmail.com>
Date: Mon, 22 Jun 2009 19:05:41 -0700 (PDT)
Local: Mon, Jun 22 2009 10:05 pm
Subject: Re: Ajuda!...Como executar um comando SQL no CAKEPHP
Deu Certinho.....rsrs

Valeu Pessoal!!! Muito Obrigado Mesmo.... com isso é possível seguir a
especificação de design do framework e ainda não se limitar à ele..

Concluí o projeto que estava fazendo com cake e o resultado foi
excelente. E da-lhe CakePHP daqui pra frente...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google