CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Serious Bug Found in Codecharge SQL Generation

Print topic Send  topic

Author Message
Intexk
Posted: 06/28/2005, 2:06 AM

This is a custom delete using TABLE

A)

'Delete Method @2-1A1E9E4B
Sub Delete(Cmd)
CmdExecution = True
CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeBuildDelete", Me)
Set Cmd.Connection = Connection
Cmd.CommandOperation = cmdExec
Cmd.CommandType = dsTable
Cmd.CommandParameters = Empty
With Cmd.WhereParameters
Set .Connection = Connection
Set .DataSource = Me
.AddParameter 1, "dsarticle_id", ccsInteger, Empty, Empty, Empty, False
.Criterion(1) = .Operation(opEqual, False, "article_id", .getParamByID(1))
.AssembledWhere = .Criterion(1)
Cmd.Where = .AssembledWhere
If NOT .AllParamsSet() Then
Errors.AddError(CCSLocales.GetText("CCS_CustomOperationError_MissingParameters", Empty))
End If
End With
Cmd.SQL = "DELETE FROM articles" & IIf(Len(Cmd.Where) > 0, " WHERE " & Cmd.Where, "")
CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeExecuteDelete", Me)
If Errors.Count = 0 And CmdExecution Then
Cmd.Exec(Errors)
CCSEventResult = CCRaiseEvent(CCSEvents, "AfterExecuteDelete", Me)
End If
End Sub
'End Delete Method

This is a Custom Delete Using SQL instead TABLE

B)
'Delete Method @2-20B7EB92
Sub Delete(Cmd)
CmdExecution = True
CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeBuildDelete", Me)
Set Cmd.Connection = Connection
Cmd.CommandOperation = cmdExec
Cmd.CommandType = dsSQL
Cmd.SQL = "DELETE FROM articles WHERE article_id = {article_id}"
With Cmd.WhereParameters
Set .Connection = Connection
Set .DataSource = Me
.AddParameter "", "dsarticle_id", ccsInteger, Empty, Empty, Empty, False
End With
CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeExecuteDelete", Me)
If Errors.Count = 0 And CmdExecution Then
Cmd.Exec(Errors)
CCSEventResult = CCRaiseEvent(CCSEvents, "AfterExecuteDelete", Me)
End If
End Sub
'End Delete Method

Notice these lines
They are the responsibles to retrieve the parameters to use it later in building the sql.

A) .AddParameter 1, "dsarticle_id", ccsInteger, Empty, Empty, Empty, False
.Criterion(1) = .Operation(opEqual, False, "article_id", .getParamByID(1))
.AssembledWhere = .Criterion(1)

B) .AddParameter "", "dsarticle_id", ccsInteger, Empty, Empty, Empty, False

Notice that in the B...there are a lot of code missing and this code has being generated with version 3.0 of codecharge.
Oks CodeCharge 3.0 is beta...but i get the same result using version 2.3.x
But i get it work properly using 2.2.3.60

I Think there is a serious bug that is going to "destroy" many projects.
I hope u understand my bad english.
Thx

peterr


Posts: 5971
Posted: 06/29/2005, 12:24 PM

This code is OK and works correctly in all versions of CCS. No known problems and no bugs here. Custom SQL must always contain the WHERE statement, so no code is needed to handle this.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Intexk
Posted: 06/30/2005, 5:30 AM

In earlier version of codecharge...when u set the custom code u can still use parameters so in
"DELETE FROM articles WHERE article_id = {article_id}"

Codecharge will replace the {article_id} for a value coming from url,expessions,etc...what i'm saying is that now that has stopped...and doesn't translate anymore the {article_id}cause of this:

.AddParameter "", "dsarticle_id", ccsInteger, Empty, Empty, Empty, False

they set up the paramenter....but they forgot do assign them a VALUE

Conclusion CODECHARGE SEND THIS SQL TO THE SERVER

"DELETE FROM articles WHERE article_id = {article_id}"

INSTEAD OF

"DELETE FROM articles WHERE article_id = 5"

Understood?
peterr


Posts: 5971
Posted: 06/30/2005, 10:30 AM

Yep, I understood most of it the first time and even asked our developers about this.
Again, there is not a problem in the program that we know of, and it works fine in both versions 2.2 and 2.3. Most people use CCS 2.3 now, so I'm sure that everybody would be contacting our support if there were any major problems.
If you have such problem then perhaps it happens only to you, for some specific reasons not related to CCS version. Or possibly it happens under certain conditions on some pages.
I just tested it with CCS 2.3 and this worked OK for me. I used data source "SELECT * FROM employees WHERE emp_id = {emp_id}" and Custom Delete with emp_id = emp_id (shown as emp_id = {emp_id}).
And my generated code looks different from yours.
In any case, please always contact product support with technical issues, rather than issuing official statements that may not be correct.
Thanks.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Intexk
Posted: 06/30/2005, 11:35 AM

oks peter...it seems u tested it and it didn't generated the same code as me..can u paste here the code that it generated?..i just want to see the Delete Method asp portion....
peterr


Posts: 5971
Posted: 06/30/2005, 11:41 AM

This is my generated Custom Delete code, based on SQL type data source:
'Delete Method @5-47DD9191  
    Sub Delete(Cmd)  
        CmdExecution = True  
        CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeBuildDelete", Me)  
        Set Cmd.Connection = Connection  
        Cmd.CommandOperation = cmdExec  
        Cmd.CommandType = dsTable  
        Cmd.CommandParameters = Empty  
        With Cmd.WhereParameters  
            Set .Connection = Connection  
            Set .DataSource = Me  
            .AddParameter 1, "urlemp_id", ccsInteger, Empty, Empty, Empty, False  
            .Criterion(1) = .Operation(opEqual, False, "emp_id", .getParamByID(1))  
            .AssembledWhere = .Criterion(1)  
            Cmd.Where = .AssembledWhere  
            If NOT .AllParamsSet() Then  
                Errors.AddError(CCSRunTimeMessages.GetMessage("CustomOperationError_MissingParameters", Empty))  
            End If  
        End With  
        Cmd.SQL = "DELETE FROM employees" & IIf(Len(Cmd.Where) > 0, " WHERE " & Cmd.Where, "")  
        CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeExecuteDelete", Me)  
        If Errors.Count = 0  And CmdExecution Then  
            Cmd.Exec(Errors)  
            CCSEventResult = CCRaiseEvent(CCSEvents, "AfterExecuteDelete", Me)  
        End If  
    End Sub

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Intexk
Posted: 06/30/2005, 11:44 AM

what kind of database are u using?....i use ansi-sql...cause i access to a raining data server (Pick)....
Intexk
Posted: 06/30/2005, 11:50 AM

the code u posted it looks similar the same i posted.....so i need a favour....i will create tomorrow a project with beta 3.0 and i would like to send it to someone to try to regenerate it to know if i have a problem in the instalation (beta 3.0 is in another machine). And i would like u send me an small project to see after i regenerate it...it changes ur code.
Thx
peterr


Posts: 5971
Posted: 06/30/2005, 12:03 PM

Please do this via the support. I cannot provide support via forums, just answer basic questions.
Thanks.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Intexk
Posted: 06/30/2005, 12:04 PM

oks peters..thx for ur help...i think i more near to fix the problem....cause i really want to install version 3...it will make my life more easy..lol..
Intexk
Posted: 07/01/2005, 3:28 AM

peter...last question...the object u created were a Record codecharge object or a Editable Grid....cause the place where i'm having the problems is in the Editable Grid.can u test that?

Thx.
Intexk
Posted: 07/02/2005, 11:10 AM

peter...type something here to know if u are going to do it or not....i wanna know if i must wait or just leave it.
peterr


Posts: 5971
Posted: 07/02/2005, 11:22 AM

I used regular grid. Please go ahead and contact the support if you need further help.
Thanks.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.