[geeklog-devel] SQL Server 2005 - MSSQL Driver

Kevin J. Peno kevin at metalaxe.com
Tue May 6 22:58:28 EDT 2008


	I guess I should background a little more. I have been working
with PHP for 7 years developing private projects under a variety of dbs.
I still have a stronger feel for MySQL than MSSQL, but I have a large
resource of people to talk to about MSSQL issues here at Microsoft.
	I was assigned the project with no prior knowledge of Geeklog.
Due to my deadlines, I did not have time to background the project all
too much (other than a review of the code). However, I was briefed on it
and it was my understanding that someone had at least been in contact
with the core team of this project, as is the case for every other
project we've worked on. Also, I noticed little actual activity on the
list regarding the mssql driver (changes to anyway) since the time I
started monitoring it. So, until recently when I saw much more split
development, I didn't see a need to interact with the list since some
sort of status updates go through my superiors, which I assumed was
getting relayed and thus the lack of activity.
	As far as the process I must follow. I must provide my superiors
a working testable driver before I release it to your group (this is one
reason why I can't release it now). While I'll be contributing to you in
my name, I'm still bound by an internal review beforehand in order to
catch things (such as memory issues) before they go crazy. The purpose
of my work on this driver is to get programs working with the new
driver, not the reversed engineered and VERY outdated php mssql driver.
And hopefully have it in the release sometime around the time the driver
is released.

This driver's requirements will be high. This driver alone will not work
in any version of php below the current version (5.2.6) because it's a
CTP, not a final, and because it will be released in the coming months.
So I've taken advantage of many PHP 5.2 only items that are enabled by
default (SPL, etc). Even that is done in limited quantity (ie. Removing
the need to store a cache of query resources in favor of returning a
result object that can be destroyed at any time).

> You seem to be making some hopeful assumptions about Geeklog sorting
> it's SQL out properly to be agnostic and work better

I'm not making assumptions, the only way you are going to get both
working is to fix issues like using double quotes in column values.
Otherwise they will never work without hacks. It's my job to make sure
the driver works by fixing these issues. If it is not the expectation of
the project to get things working without endless hacks, please let me
know. However, from what I've seen so far in your code, I don't think
there is a need for very much other than to make sure that very certain
bad practices aren't done (i.e. the double quote issue). 

> we're always going to get MySQL specific
> syntax and queries from other plugins.

	99% of the queries made for MYSQL work without conversion. As
you previously mentioned, only some very specific queries will cause
issues. If I really have to, I'll run a huge amount of
preg_match/replace on every single query sent in, but I find that a
complete waste of the purpose and will only cause more issues down the
line (like addslashes has). I think it is a better idea for your group
to be sure that at minimum certain best practices for portable SQL are
used. Everything else can be converted from MySQL if best practices are

> As for the add/strip/add/strip slashes -- well, as Dirk said, this is
a bit of a sticky issue.  I couldn't
> really count on anything being in the right escaped order.  I would
suggest getting Geeklog and install as
> many plugins as you can download and then do a global search for
add/remove slashes to get a sence as to how > many times its done and
then how we could manage that in moving forward for ALL databases.

I have, that's why I wanted to ask if anyone has simply tried turning on
quote_sybase. On top of all the addslashes, I've seen a ton of bad
str_replace that swap things they shouldn't be when Sybase should be
used instead. I guess I'll keep cracking out fixing the installer and
try out Sybase in the process.

Sorry for the marathon. And I hope that I didn't come off like I'm
taking things over. I've just got a lot to get done still and it appears
as though thing were not as I was told. So, I will need to have a
meeting with my superiors tomorrow about some issues as well. Any
ammunition that you can give me for that meeting will be most

Kind Regards, (and thank you for all the responses)

Kevin Peno

-----Original Message-----
From: geeklog-devel-bounces at lists.geeklog.net
[mailto:geeklog-devel-bounces at lists.geeklog.net] On Behalf Of Michael
Sent: Tuesday, May 06, 2008 12:28 PM
To: Geeklog Development
Subject: Re: [geeklog-devel] SQL Server 2005 - MSSQL Driver

> If all the SQL queries
> are using proper syntax (anything that uses double quotes needs to be
> re-written anyway because it conflicts with SQL Server) this could
> problem temporarily while the addslashes are phased out. You probably
> more experience with the Geeklog core than I, so I'm hoping you can
give me
> some good news here.

As previously noted by others, MySQL is the primary platform for
Geeklog 1.x, the community plugin authors likely do not have MS SQL
knowledge or environments, we're always going to get MySQL specific
syntax and queries from other plugins. Primary reason for the whole
big deal of the MS SQL abstraction that Randy produced is this
compatibility issue.

Of course Geeklog 2 is powered by Propel which supports MS SQL and
prevents all this stuff (unless I've missed the point).

I think it's unrealistic to expect Geeklog to be fully database
agnostic any time soon, strip/add slashes not withstanding. (Though
the story system should be suitably clean for that by now).

> Also, in regard to MySQL....I think it is important to move that
driver to
> mysql improved (mysqli) and start slowly implementing
> mysql_real_escape_string instead of addslashes, that way we can all
> together in creating a better abstraction layer, hopefully making it
> extremely easy for anyone to drop in new support for other DBs any

Er, as noted mysqli is pretty limited in many hosting environments.
Dreamhost who allow one hell of a lot (SVN server? No problem!
PHP4/PHP5 switched on per domain/subdomain? No problem...) don't have
mysqli installed, I'd have to compile and install my own PHP (allowed)
to get it (and I'm not about to be doing that...)

> Anyway, long story short, I hope that I can finish up the installer
> driver by tomorrow and send file + patches through to you all soon.
Should I
> be on the CVS mailer for that process?

It wouldn't hurt, but, the digest is sent to this list.

Now, other issue...

What exactly are your rules of engagement here? I'm a little puzzled
at the moment.

I'm a little disconcerted that you've apparently been working on this
for three weeks without even saying "hi" to the community, the core
team, or the maintainer of the version.

You seem to be making some hopeful assumptions about Geeklog sorting
it's SQL out properly to be agnostic and work better, which haven't
been discussed (hopefully it's not too depressing after my comments)
which maybe would have changed your approach etc.

At the very least, your life could have been less painful if you'd
asked about CVS clients on Vista and getting them working earlier!

You mention the inability to supply a patch or anything until it's
been through Microsoft QA, but I would have said it's a bit more
important it goes through us than them. Since it's not going to go
into our repository (ever) if it relies on breaking all Geeklog
plugin's SQL to work! ;-)

What's your background with geeklog? Totally new to it before MS put
you on the case? Did you pick it or were you assigned it? How much
time did you spend getting to grips with the
platform/codebase/community etc before starting to look at the SQL
server support? What's your SQL Server experience/PHP experience etc?

Don't mean to come across like the Spanish inquisition [1],  but it
would be really good to know what's going on...



[1] - NOONE expects the Spanish inquisition, etc.
geeklog-devel mailing list
geeklog-devel at lists.geeklog.net

More information about the geeklog-devel mailing list