Suntower
Posts: 225
|
| Posted: 01/18/2008, 5:34 PM |
|
I'm trying to figure out why a grid is displaying no records. I can get the Grid.Datasource but that only gives me the SQL -before- the parameters are substituted.
Is there a way to print out the fully formed SQL Statement that is being sent to SQL Server?
Thanks,
---JC
_________________
---On a campaign for more examples and better docs! |
 |
 |
DonB
|
| Posted: 01/18/2008, 5:59 PM |
|
You also need to look at the 'Where' property - in the Before Execute Select
event.
--
DonB
http://ccswiki.gotodon.net
"Suntower" <Suntower@forum.codecharge> wrote in message
news:64791539e6f524@news.codecharge.com...
> I'm trying to figure out why a grid is displaying no records. I can get
> the
> Grid.Datasource but that only gives me the SQL -before- the parameters are
> substituted.
>
> Is there a way to print out the fully formed SQL Statement that is being
> sent
> to SQL Server?
>
> Thanks,
>
> ---JC
> _________________
> ---On a campaign for more examples and better docs!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
Suntower
Posts: 225
|
| Posted: 01/18/2008, 6:37 PM |
|
---I did. But again, doesn't that give one the 'parameterized' version? I need the fully formed statement... ie... what is actually being sent to SQL Server -after- all the parameters are substituted.
Possible?
Thanks.
---JC
PS: Your wiki throws an error when I tried to go there:
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
(SQL query hidden)
from within function "MediaWikiBagOStuff::_doquery". MySQL returned error "145: Table './tiytydi_ccswiki/objectcache' is marked as crashed and should be repaired (localhost)".
Quote DonB:
You also need to look at the 'Where' property - in the Before Execute Select
event.
--
DonB
http://ccswiki.gotodon.net
"Suntower" < Suntower@forum.codecharge> wrote in message
news:64791539e6f524@news.codecharge.com...
> I'm trying to figure out why a grid is displaying no records. I can get
> the
> Grid.Datasource but that only gives me the SQL -before- the parameters are
> substituted.
>
> Is there a way to print out the fully formed SQL Statement that is being
> sent
> to SQL Server?
>
> Thanks,
>
> ---JC
> _________________
> ---On a campaign for more examples and better docs!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
_________________
---On a campaign for more examples and better docs! |
 |
 |
DonB
|
| Posted: 01/19/2008, 5:55 AM |
|
It should show the final query as it's about to be executed. Set the
Container DataSource 'Debug' property to true and you will see the query as
it's being executed. Maybe the database stuff works differently under ASP,
but that's the behavior with PHP. Look at the Common file that implements
the connection class.
My wiki page broke when I attempted to 'upgrade' to a more spambot-proof
version, due to incessant vulgar spambots attacking it. Then the database
puked. I haven't had time to try fixing it yet.
--
DonB
http://ccswiki.gotodon.net
"Suntower" <Suntower@forum.codecharge> wrote in message
news:64791627c98cfc@news.codecharge.com...
> ---I did. But again, doesn't that give one the 'parameterized' version? I
> need
> the fully formed statement... ie... what is actually being sent to SQL
> Server
> -after- all the parameters are substituted.
>
> Possible?
>
> Thanks.
>
> ---JC
>
> PS: Your wiki throws an error when I tried to go there:
>
> A database query syntax error has occurred. This may indicate a bug in the
> software. The last attempted database query was:
>
> (SQL query hidden)
>
> from within function "MediaWikiBagOStuff::_doquery". MySQL returned error
> "145:
> Table './tiytydi_ccswiki/objectcache' is marked as crashed and should be
> repaired (localhost)".
>
>
>
> Quote DonB:
> You also need to look at the 'Where' property - in the Before Execute
> Select
> event.
>
> --
> DonB
>
> http://ccswiki.gotodon.net
>
>
> "Suntower" < Suntower@forum.codecharge> wrote in message
> news:64791539e6f524@news.codecharge.com...
>> I'm trying to figure out why a grid is displaying no records. I can get
>> the
>> Grid.Datasource but that only gives me the SQL -before- the parameters
>> are
>> substituted.
>>
>> Is there a way to print out the fully formed SQL Statement that is being
>> sent
>> to SQL Server?
>>
>> Thanks,
>>
>> ---JC
>> _________________
>> ---On a campaign for more examples and better docs!
>> ---------------------------------------
>> Sent from YesSoftware forum
>> http://forums.yessoftware.com/
>>
>
>
>
>
> _________________
> ---On a campaign for more examples and better docs!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
martinc
Posts: 5
|
| Posted: 02/10/2008, 10:16 PM |
|
To do live testing while users are on the system I change the OpenRecordset in Classes
Add this:
'''''''
if CCGetParam("Debug",Empty)="YES" then
response.write sSQL + " <br> "
end if
''''''''
this will display every SQL string being run on the page.
Eg.
Private Function OpenRecordset(sSQL,isCountSQL)
Dim Command
Dim Recordset
If Not isCountSQL And Options.Count>0 Then
Dim Page : Page=IIF(mActivePage>0,mActivePage,1)
Dim Size : Size=IIF(mPageSize>0,mPageSize,0)
If Options.Exists("TOP") Then
'support old variant
If Size > 0 Then
sSQL=Replace(sSQL,"{SqlParam_endRecord}", Page * Size, 1, 1)
Else
sSQL=Replace(sSQL,"{SqlParam_endRecord}", "", 1, 1)
End If
ElseIf Options.Exists("LIMIT MYSQL") And Size>0 Then
sSQL = sSQL & " LIMIT " & (Page - 1) * Size & " , " & Size
IsNeedMoveToPage=False
ElseIf Options.Exists("LIMIT POSTGRES") And Size>0 Then
sSQL = sSQL & " LIMIT " & Size & " OFFSET " & (Page - 1) * Size
IsNeedMoveToPage=False
ElseIf Options.Exists("SYNTAX") Then
'new variant
IsNeedMoveToPage = IIF(UCase(Options("SYNTAX")) = "TOP", True, False)
If Options("PLACE") = "beforeFrom" Then
If Size > 0 Then
sSQL = Replace(sSQL, "{SqlParam_endRecord}", Page * Size, 1, 1)
Else
sSQL = Replace(sSQL, "{SqlParam_endRecord}", "", 1, 1)
End If
ElseIf Options("PLACE") = "afterQuery" Then
sSQL = sSQL & Replace(Replace(Replace(Options("CLAUSE"), "{SqlParam_numRecords}", Size, 1, 1), "{SqlParam_Offset}", (Page-1) * Size, 1, 1), "{SqlParam_endRecord}", Page * Size, 1, 1)
End If
Else
sSQL=Replace(sSQL, "{SqlParam_endRecord}", "", 1, 1)
End If
Else
sSQL=Replace(sSQL, "{SqlParam_endRecord}", "", 1, 1)
End If
'''''''
if CCGetParam("Debug",Empty)="YES" then
response.write sSQL + " <br> "
end if
''''''''
Set Command = CreateObject("ADODB.Command")
Command.CommandType = adCmdText
Command.CommandText = sSQL
Command.CommandTimeOut = 60
Set Command.ActiveConnection = Connection.Connection
Set Recordset = Connection.Execute(Command)
If Connection.Errors.Count > 0 Then
Errors.AddErrors Connection.Errors
End If
Set OpenRecordset = Recordset
Set Command = Nothing
End Function
|
 |
 |
|