Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Doctrine integration with MSSQL
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
  7 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:
Follow-up To:
Add Cc | Add Follow-up 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 that you hear
 
Trevor.Lanyon  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 01:34
From: "Trevor.Lanyon" <trevor.lan...@lanyonconsulting.com>
Date: Sat, 7 Nov 2009 17:34:29 -0800 (PST)
Local: Sun 8 Nov 2009 01:34
Subject: Doctrine integration with MSSQL
Hi,

I'm stuck having to work with MSSQL at work.  I've done my best to
deal with this monster and to say at the very least Doctrine plays
nicer, a lot nicer, with MSSQL then Propel did.  But I'm having the
following problems:

1 - Mssql Dates

MS-SQL dates return an annoying '.000' at the end of them.  Doctrine
doesn't seem to handle it.  I edited the following file (just the get)
and it seems to work:

lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecord.class.php

     $type = $this->getTable()->getTypeOf($dateFieldName);
     if ($type == 'date' || $type == 'timestamp')
     {
        //cludgy fix to solve issue with timestamp of Mssql returning
000 at the
        //end of a date
        $date = $this->get( $dateFieldName );
        if( substr( $date, -6,1 ) == ':' ) {
            $date = substr( $date, 0, strlen( $date) - 6).substr
( $date, -2 );
        }
      return new DateTime($date);
     }
     else
     {
       throw new sfException('Cannot call setDateTimeObject() on a
field that is not of type date or timestamp.');
     }
   }

Outside of the no fancy regular expressions and no minimum string
length checking (which I will introduce once I collect the gambit of
errors generated) I'm wondering if this was the right way to solve the
problem or if I've missed something??

2 - Column names

I'm stuck using long column names.  DBLIB (what a bloody mystery that
thing is) drops columns that are longer the 30.  With Doctrine's
unique naming mechanism attaching characters to the column names I'm
loosing columns.  I tried the whole alias thing but really that was a
hail-marry to start with.

Outside of further introducing my crap code into the install of
Doctrine has anyone any suggestions how to get around this?

Thanks a million,


    Reply    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.
Daniel Lohse  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 02:00
From: Daniel Lohse <annismcken...@googlemail.com>
Date: Sun, 8 Nov 2009 03:00:41 +0100
Local: Sun 8 Nov 2009 02:00
Subject: Re: [doctrine-user] Doctrine integration with MSSQL
Hey Trevor,

I'm sorry that you have to deal with MSSQL, I really am. :) I have it  
at work but I conviced by employer to go with MySQL for projects I'm  
doing instead.

Now, for your first problem. What Doctrine version are you using?

As far as I know, you can use you your own record class (or, subclass  
of it) so you don't have to hack the Doctrine Core directly. That  
should clean this up a bit and doesn't keep you from updating your  
Doctrine installation.
You might also raise a JIRA ticket for this, there might be something  
that the Core developers can do about it. Can't you somehow cast the  
datetime fields returned to a real PHP Date object? I'm just shooting  
in the dark here, I'm sorry.

Maybe you might be able to install FreeTDS on a Linux server alongside  
your MSSQL server instance (virtualization?), that'd releave some of  
your pain. Just a suggestion.

@Core_Doctrine_Team: Maybe we could look into supporting the recently  
released PHP MSSQL driver by Microsoft?

--Daniel

On 2009-11-08, at 8/November, 2:34 AM, Trevor.Lanyon wrote:


    Reply    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.
Trevor.Lanyon  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 18:58
From: "Trevor.Lanyon" <trevor.lan...@lanyonconsulting.com>
Date: Sun, 8 Nov 2009 10:58:41 -0800 (PST)
Local: Sun 8 Nov 2009 18:58
Subject: Re: Doctrine integration with MSSQL
Hi  Daniel,

I'm using 1.2.0-BETA1 (packaged with the svn version of symfony).  I'm
accessing the M$SQL server from a linux server using pdo_libdb so I'm
not 100% sure what you mean when you're suggesting installing FreeTDS
on the linux server, can you elaborate?

Our billing application uses our M$SQL cluster and I'm mapping to its
tables so I'm sort of hooped as far using something more LAMPy
friendly.

I've not thought to use the customized date object (or even looked to
find where to do that!).  Sounds like I have a little project ahead,
thanks for the suggestion!

Thank you for your insight.  Very much appreciated!!

On Nov 7, 10:00 pm, Daniel Lohse <annismcken...@googlemail.com> wrote:


    Reply    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.
Daniel Lohse  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 19:39
From: Daniel Lohse <annismcken...@googlemail.com>
Date: Sun, 8 Nov 2009 20:39:11 +0100
Local: Sun 8 Nov 2009 19:39
Subject: Re: [doctrine-user] Re: Doctrine integration with MSSQL
Hello Trevor,
regarding FreeTDS. PDO_DBLIB is the oldest method/software to access  
MSSQL from Linux. FreeTDS is used in our own implementations to access  
MSSQL from a Linux server and we never had any trouble but these  
implementations don't use Doctrine, so I'm not sure if you can use  
FreeTDS. Might be worth a try, though.

And I'm also pretty sure that you aren't using the Beta1 as symfony  
1.3 packages the 1.2 branch version so you already get the latest  
bugfixes as 1.2 neares completion. :)

I'm here to help, maybe I'll try to replicate your setup but I'm not  
sure I have the time right now, sorry.

--Daniel

Sent from my iPhone

On Nov 8, 2009, at 7:58 PM, "Trevor.Lanyon" <trevor.lan...@lanyonconsulting.com


    Reply    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.
Trevor.Lanyon  
View profile   Translate to Translated (View Original)
 More options 9 Nov, 13:17
From: "Trevor.Lanyon" <trevor.lan...@lanyonconsulting.com>
Date: Mon, 9 Nov 2009 05:17:05 -0800 (PST)
Local: Mon 9 Nov 2009 13:17
Subject: Re: Doctrine integration with MSSQL
Hi Daniel,

Wow, response from the phone, that's dedication!  Thanks for the info.

Unfortunately I have to agree with you on the FreeTDS.  According to
everything I've read the only way to integrate PDO and MsSQL in PHP is
with the pdo_dblib.  I'll keep my eyes peeled though.

I'm 100% for sure using 1.2.0-BETA1, unless Symfony is lieing.  This
is a copy paste from the debug window:

Doctrine Version: 1.2.0-BETA1

According to http://www.doctrine-project.org/download Doctrine-1.2.0-
BETA1 is the most recent branch of Doctrine anyway.  If this is a
version issue I'm more then interested if fixing that.  Let me know if
I'm mistaken.

Thank you Daniel for all your help!

On Nov 8, 3:39 pm, Daniel Lohse <annismcken...@googlemail.com> wrote:


    Reply    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.
Daniel Lohse  
View profile   Translate to Translated (View Original)
 More options 9 Nov, 13:49
From: Daniel Lohse <annismcken...@googlemail.com>
Date: Mon, 9 Nov 2009 14:49:14 +0100
Local: Mon 9 Nov 2009 13:49
Subject: Re: [doctrine-user] Re: Doctrine integration with MSSQL
Hi Trevor,

here's the svn:externals definition of Doctrine in symfony 1.3 beta1: http://doctrine.mirror.svn.symfony-project.com/branches/1.2/lib

So, the beta1 subversion tag is not used, which would be: http://doctrine.mirror.svn.symfony-project.com/tags/1.2.0-BETA1/lib/

As for the version constant: it has not been updated but it should be  
'1.2.0-DEV' and not '1.2.0-BETA1'. :)

And you're right regarding FreeTDS. It would be the best method to  
access MSSQL but it doesn't work with PDO. -.-

--Daniel

Sent from my iPhone

On 2009-11-09, at 9/November, 2:17 PM, Trevor.Lanyon wrote:


    Reply    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.
Trevor.Lanyon  
View profile   Translate to Translated (View Original)
 More options 9 Nov, 17:43
From: "Trevor.Lanyon" <trevor.lan...@lanyonconsulting.com>
Date: Mon, 9 Nov 2009 09:43:42 -0800 (PST)
Local: Mon 9 Nov 2009 17:43
Subject: Re: Doctrine integration with MSSQL
Thank you Daniel,

I looked at the entries file in the lib/vendor/symfony/lib/plugins/
sfDoctrinePlugin/lib/vendor/doctrine directory and sure enough it's
pointing to  http://doctrine.mirror.svn.symfony-project.com/branches/1.2/lib
like you said.  Sorry I provided the incorrect version.  I was going
off the web tool bar.  Next time I'll try not to take less for
granted.

I submitted the mssql date issue via a JIRA ticket.  Hopefully it gets
looked at.  This problem is annoying further as it also effects
sfDateTimeWidget.  The widget has no values as it can't part the
format properly.  Uhg.

Although I wasn't able to resolve my issue I appreciate your
suggestions.  Thank you again!

On Nov 9, 9:49 am, Daniel Lohse <annismcken...@googlemail.com> wrote:


    Reply    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 »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google