In the code I pasted above, I'm using the Cake DBO mssql driver. In
your description of your tables, you're describing a lot of
relationships, but some of them seem like they should be HAMBT -- are
you using HAMBT relations, or are you specifying hasMany and belongsTo
in the samel model separately? Feel free to send your models.

On May 30, 5:26 pm, bingo <[EMAIL PROTECTED]> wrote:
> hi Joshua,
>
>                 $user_id = $this->params['form']['user_id'];
>                 $role = $this->params['form']['role'];
>                 if(empty($user_id)){
>                         $this->set('failed', "Error: no user id found");
>                 }else{
>
>                         $criteria = array("UsersWorkspace.user_id" => 
> "{$user_id}");
>                         if(!empty($role) && in_array($role, array('creator', 
> 'observer')))
>                                 $criteria['UsersWorkspace.role'] = $role;
>
>                         $fields = array('Workspace.id', 'Workspace.title',
> 'UsersWorkspace.role');
>
>                         $this->Workspace->recursive = 2;
>                         $this->Workspace->expects("UsersWorkspace");
>                         $this->set('data', 
> $this->Workspace->findAll($criteria,
> $fields));
>                 }
>
> here is the snippet of code that produced the above ouput..i have
> three tables
> Workspaces ---> has many ---> artifacts_workspaces  and
> artifacts_workspaces --> belongsTo -->Workspaces
> artifacts ---> hasMany ---> artifacts_workspaces and
> artifacts_workspaces --> belongsTo --> artifacts
> workspaces <-- HABTM ---> artifacts
>
> can you tell me more on how you are connecting to MSSQL..are you using
> cakephp mssql_dbo.php class or something different
>
> Regards,
> Ritesh
>
> On May 30, 12:02 pm, Joshua Benner <[EMAIL PROTECTED]> wrote:
>
> > We use MSSQL when working with CakePHP 1.2 here, and I've never seen
> > Cake output any SQL like that. Can you send some details about your
> > model(s), etc?
>
> > We run PHP 5.1 on Linux and connect to MSSQL using ODBTP-overrided PHP
> > mssql extension functions, so our database setup looks like this:
>
> >     var $default = array('driver' => 'mssql',
> >                                 'connect' => 'mssql_connect',
> >                                 'host' => 'server',
> >                                 'login' => 'user',
> >                                 'password' => 'password',
> >                                 'database' => 'db',
> >                                 'prefix' => '');
>
> > bingo wrote:
> > > hi,
>
> > > at my workplace, we are using MSSQL server. I have never used cakephp
> > > with MSSQL before and this the first time I am using. I am using
> > > CakePHP 1.2 on PHP 5.1. Although, I am able to connect to database, I
> > > am not able query the data. The search query created by the
> > > mssql_dbo.php looks funny and wrong..here is a sample search query
>
> > > SELECT [Workspace].[id] AS [Workspace__id] AS [Workspace]__[id] AS
> > > [Workspace__id] AS [Workspace]__[id] AS [Workspace__id] AS
> > > [Workspace]__[id] AS [Workspace__id], [Workspace].[title] AS
> > > [Workspace__title] AS [Workspace]__[title] AS [Workspace__title] AS
> > > [Workspace]__[title] AS [Workspace__title] AS [Workspace]__[title] AS
> > > [Workspace__title], [UsersWorkspace].[role] AS [UsersWorkspace__role]
> > > AS [UsersWorkspace]__[role] AS [UsersWorkspace__role] AS
> > > [UsersWorkspace]__[role] AS [UsersWorkspace__role] AS
> > > [UsersWorkspace]__[role] AS [UsersWorkspace__role], [Workspace].[id]
> > > AS [Workspace__id] AS [Workspace]__[id] AS [Workspace__id],
> > > [Workspace].[id] AS [Workspace__id] FROM [srs_workspaces] AS
> > > [Workspace] WHERE [UsersWorkspace].[user_id] = '2'
>
> > > There are two problems
> > > 1. all the fields are getting repeated
> > > 2. Association is not working..
>
> > > Is there other way to get MSSQL working with CakePHP


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to