Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #14015 > unrolled thread
| Started by | Shelly <sheldonlg@thevillages.net> |
|---|---|
| First post | 2014-06-23 11:02 -0400 |
| Last post | 2014-06-24 15:38 +0200 |
| Articles | 5 — 4 participants |
Back to article view | Back to comp.lang.php
PDO fetch with SQL server Shelly <sheldonlg@thevillages.net> - 2014-06-23 11:02 -0400
Re: PDO fetch with SQL server Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-23 12:10 -0400
Re: PDO fetch with SQL server Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-24 13:19 +0200
Re: PDO fetch with SQL server Richard Damon <Richard@Damon-Family.org> - 2014-06-24 08:33 -0400
Re: PDO fetch with SQL server Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-24 15:38 +0200
| From | Shelly <sheldonlg@thevillages.net> |
|---|---|
| Date | 2014-06-23 11:02 -0400 |
| Subject | PDO fetch with SQL server |
| Message-ID | <lo9fin$oo3$1@dont-email.me> |
I have a strange case. I have a query in SQL server that has in the
beginning to determine the action:
SELECT
CASE
WHEN x.NEW_HASH = x.PREVIOUS_HASH THEN 'SAME'
WHEN x.NEW_HASH != x.PREVIOUS_HASH AND
x.PREVIOUS_HASH IS NOT NULL AND x.[KEY] IS NOT NULL THEN 'UPDATE'
WHEN x.PREVIOUS_HASH IS NULL AND
x.count_of_tracking_records > 0 THEN 'UPDATE'
WHEN x.PREVIOUS_HASH IS NULL THEN 'INSERT'
WHEN x.[KEY] IS NULL THEN 'DELETE'
ELSE 'UNKNOWN'
END AS ACTION,
x.*
so that it will choose the action. There is a FULL OUTER JOIN at the
end to the destination table. Another, later, query, will do a merge
and perform the action specified in the results of this query.
The PHP function that this uses is a PDO statement with the fetch method
and the PDO::FETCH_ASSOC as the parameter.
When this query is run against an empty destination table, 1991 records
are obtained which are subsequently inserted into the destination table
by the second query.
When this same query is then run against this filled table, with the
same records, the PDO fetch retrieves zero records. I have put in log
files into the PHP code and it is clear that the fetch returns zero
records.
However, when this query is cut and pasted into Sqlserver Management
Studio and run, it produces 3982 records. The first 1981 are with
action DELETE and the rest are with action INSERT.
One additional point that might, or might not, have a bearing on this.
Some variables have bindings. For example a :grouping_1 has a string
value that is the same for the entire query. When I run it in Sqlserver
Management Studio I replace those bind variable with their values.
Crossposted to both the php and sqlserver news groups.
--
Shelly
[toc] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2014-06-23 12:10 -0400 |
| Message-ID | <lo9ji7$mud$2@dont-email.me> |
| In reply to | #14015 |
On 6/23/2014 11:02 AM, Shelly wrote: > I have a strange case. I have a query in SQL server that has in the > beginning to determine the action: > > SELECT > CASE > WHEN x.NEW_HASH = x.PREVIOUS_HASH THEN 'SAME' > WHEN x.NEW_HASH != x.PREVIOUS_HASH AND > x.PREVIOUS_HASH IS NOT NULL AND x.[KEY] IS NOT NULL THEN 'UPDATE' > WHEN x.PREVIOUS_HASH IS NULL AND > x.count_of_tracking_records > 0 THEN 'UPDATE' > WHEN x.PREVIOUS_HASH IS NULL THEN 'INSERT' > WHEN x.[KEY] IS NULL THEN 'DELETE' > ELSE 'UNKNOWN' > END AS ACTION, > x.* > > so that it will choose the action. There is a FULL OUTER JOIN at the > end to the destination table. Another, later, query, will do a merge > and perform the action specified in the results of this query. > > The PHP function that this uses is a PDO statement with the fetch method > and the PDO::FETCH_ASSOC as the parameter. > > When this query is run against an empty destination table, 1991 records > are obtained which are subsequently inserted into the destination table > by the second query. > > When this same query is then run against this filled table, with the > same records, the PDO fetch retrieves zero records. I have put in log > files into the PHP code and it is clear that the fetch returns zero > records. > > However, when this query is cut and pasted into Sqlserver Management > Studio and run, it produces 3982 records. The first 1981 are with > action DELETE and the rest are with action INSERT. > > One additional point that might, or might not, have a bearing on this. > Some variables have bindings. For example a :grouping_1 has a string > value that is the same for the entire query. When I run it in Sqlserver > Management Studio I replace those bind variable with their values. > > Crossposted to both the php and sqlserver news groups. > This is not a PHP question. Just because you're using PDO does not mean PHP is involved. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-06-24 13:19 +0200 |
| Message-ID | <12782647.MBttc6ZTtY@PointedEars.de> |
| In reply to | #14015 |
Shelly wrote:
^^^^^^
Please use your real name here.
> Crossposted to both the php and sqlserver news groups.
Pointless until you post *PHP* code, too.
Furthermore, comp.database.ms-sqlserver does not exist.
It is <news:comp.databases.ms-sqlserver>.
Unfortunately, Thunderbird?s Network News capabilities are still inferior
even in version 24. This mistake would not have happened with, for example,
KNode, where you can mark the checkbox from a list of newsgroups that you
want to post to.
However, a properly maintained news*server* would have issued an error
message as well, and a decent newsreader would have displayed it.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[toc] | [prev] | [next] | [standalone]
| From | Richard Damon <Richard@Damon-Family.org> |
|---|---|
| Date | 2014-06-24 08:33 -0400 |
| Message-ID | <geeqv.70169$Id2.49420@fx05.iad> |
| In reply to | #14028 |
On 6/24/14, 7:19 AM, Thomas 'PointedEars' Lahn wrote: > > Furthermore, comp.database.ms-sqlserver does not exist. > It is <news:comp.databases.ms-sqlserver>. > > Unfortunately, Thunderbird?s Network News capabilities are still inferior > even in version 24. This mistake would not have happened with, for example, > KNode, where you can mark the checkbox from a list of newsgroups that you > want to post to. > > However, a properly maintained news*server* would have issued an error > message as well, and a decent newsreader would have displayed it. > > > PointedEars > News servers should NOT give an error on an unrecognized newsgroup name, as no news server knows it has the canonical listing of newsgroups, only the list of newsgroup it maintains. It is quite allowed for a couple of peering sites (or even a single site) to create a newsgroup on their own. Even in comp, which is a managed hierarchy, it isn't "illegal" to create a "local" newsgroup in the hierarchy, just strongly discouraged. Now, if a server gets a message submitted where NONE of the newsgroups exist (in its opinion), it could be justified in rejecting the message.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2014-06-24 15:38 +0200 |
| Message-ID | <1471477.55vjKH0o0M@PointedEars.de> |
| In reply to | #14030 |
Richard Damon wrote: > On 6/24/14, 7:19 AM, Thomas 'PointedEars' Lahn wrote: >> However, a properly maintained news*server* would have issued an error >> message as well, and a decent newsreader would have displayed it. > > News servers should NOT give an error on an unrecognized newsgroup name, > as no news server knows it has the canonical listing of newsgroups, […] Nonsense. <http://tokak.us/big8/articles/c/h/e/Checkgroups.html> PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web