[isf-wifidog] MySQL support
Mina Naguib
webmaster at topfx.com
Lun 30 Mai 12:07:42 EDT 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 30-May-05, at 11:52 AM, Francois Proulx wrote:
> DB abstraction is essentially two things. First there is pure DB
> API abstraction, this is what we're doing right now. This way we
> have one way of sending a SQL query, as mysql_query != pg_query.
> Their parameters are also different and the way they react.
>
> Another problem is making sure the queries are as standard as
> possible... most of our queries are OK... The biggest issue I'm
> seeing here is the BLOBS are managed in MySQL. It's a totally
> different approach... PostgreSQL relies heavily on OIDs to grab
> data, on the other hand MySQL simply uses normal datafields... Thus
> even if we try to make the File objects ( sidenote : BLOBS are only
> used for the content management system, when using database stored
> files ) MySQL will never been as efficient on BLOB use since you
> have to escape binary chars before sending it... First it's a
> memory hog, second it can break easily if something goes wrong
> during the conversion.
>
Just as an aside here, I'm starting to get the hunch we're may be
running into some PHP awkwardnesses. I'd be happy to be enlightened
to otherwise.
Most half-decent databases (including MySQL) support what's called
"query placeholders". It is a very simple variation on any SQL
statement in which variables are pumped in. Instead of escaping the
variable, quoting it properly, and splicing it in the appropriate
place in the query, a placeholder is used instead. The placeholder
is a simple token (typically the question mark). The query ends up
looking like this:
insert into tablename (field1) values (?)
The actual variable is then passed as pure data to the DB driver as
an argument to the query string. It will take care of properly
substituting the data where the placeholder is. Most efficiently
this happens at the database server, but could be done by the client
driver.
Moving on to LOBs and BLOBs, again most drivers will allow you to
specify that a placeholder is to be satisfied from a filehandle, or a
filename, or a pipe, etc.. instead of an actual variable by copy.
This applies for insertion (read from /foo/bar.dat) and retrieval
(dump into /foo/bar.dat).
Does PHP support none of this stuff ?
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFCmzpIeS99pGMif6wRAlWrAKCqALdtWhwJoZH2t9Hn9mi8PFF7OQCg6osw
dcJnv98I+IqYF8i93gKQACM=
=WaUU
- -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFCmzpPeS99pGMif6wRAq6kAJ9wJCR+DA8LJX0q1tPpKDrJt2t/zACeMleT
nZ7vkwbO3lFW+piya8Qx6Bc=
=YgKY
-----END PGP SIGNATURE-----
Plus d'informations sur la liste de diffusion WiFiDog