CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Gracefully managing mySQL errors

Print topic Send  topic

Author Message
snarf


Posts: 14
Posted: 06/11/2004, 9:17 AM

Are there functions in CCS that can capture the mySQL error code that's returned (i.e. 'duplicate key' vs. 'syntax error' vs. 'no connection') and allow you to handle it in a certain way?

If not, which interface (PHP native vs. DBI) is used by CCS's functions to interface mySQL? Can I use any functions against them, i.e. if CCS creates a database connection, is it actually a DBI object?

For that matter, is there anyplace where all of CodeCharge's functions are documented? Some of them are in the documentation, but a lot more can't seem to be found anyplace and I have to hunt them down in the common code to figure out how to use them. CCGetSession comes to mind at once.

Even in the documentation, you have to guess at a search term to get at them, there doesn't seem to be a comprehensive list. It would be easier if there was a list of functions that someone could study so they could be used in custom code blocks. (No comments on custom coding vs. interface, please -- we should have both options available to us).

All info appreciate, and I'm sorry if these questions have already been posted. I couldn't find answers after a reasonable amount of searching.

THX

Snarf
View profile  Send private message
klwillis


Posts: 428
Posted: 06/11/2004, 10:33 AM

I agree.

ALOT of the problems people are having here would
not need to be posted if the document was improved.

I've also directly asked CodeCharge Studio about books
or other resources, as well as posting that here, and I never
received even an acknowledgement.

As a paying customer of Code Charge Studio, that's very disappointing.

Struggling to get productive with a productive tool is not time effective,
and we have therefore reverted to LAMP development (by hand) to get
something actually working that we can change and debug more quickly.

If there are seasoned CodeCharge Developers out there who disagree,
then please provide some help for the rest of us who want to learn and improve our understanding through simple bugfree examples - without having to read an encyclopia of information before stumbling upon the answer.

_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
peterr


Posts: 5971
Posted: 06/11/2004, 10:45 AM

klwillis,

I just searched our support system and found only one question from you, which was answered but not related to books.
Of course we cannot guarantee that someone will answer questions on user forums.

I will try to address some of the other questions later.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
snarf


Posts: 14
Posted: 06/11/2004, 11:54 AM

petrr,

Thanks for posting your rebuttal here. Now how about answering my question? That would be really helpful!! ;-)

Thanks

snarf

PS -- Or should I open a support ticket?
View profile  Send private message
peterr


Posts: 5971
Posted: 06/11/2004, 12:08 PM

Snarf,

I was working on it. I don't use PHP too much and had to get some advice myself. Thus based on what I found out:
The undocumented functions could be a problem from certain point of view and we may need to document more or all of them. Let me only explain (can be taken as an excuse) that originally those functions were not created and not meant for CCS developers/users, but just for the generated code to be more compact by re-using the code. Since we generate the standard PHP code anyway, the developers can use all PHP functions available to them and theoretically there is no need for "CCS functions". The CCS functions could even be hidden or better yet - incorporated into the standard PHP, and then no one would even notice that such thing as "CCS functions" exists. Additionally, because CCS functions are internal, they could be changed, removed or replaced in future versions of CCS.
However as most people probably noticed some of those functions in CCS can indeed be useful because some utilize the database connection or perform other functionality that simply is nice to have. That's why we decided to document the most important/common functions, which we thought that would be useful. We didn't see the need to document every function that not necessarily had to be a function since their purpose was to reuse the code, not to provide a function for developers. If you take any piece of the generated code, or even write your own PHP code you can also convert it into a function, or do the reverse and remove an existing function but create little more of the "regular" code.
The problem on our end was probably in making the decisions about which functions are useful enough to be used on their own and therefore documented. Later we created some examples where it turned out that some of the CCS functions are more useful than previously assumed, therefore we included them in the examples but possibly they weren't documented... :-/ (I'll rely this information to the appropriate person at our company, as a request to either document all functions or all used in the examples).
I want to point though that CCS Functions are only a small part of what you can use. As an example, for a larger project (using ASP though) I actually copied and modified almost all CCS functions that I wanted to use, so that the generated code uses the standard CCS functions but my code use modified version of them for my purposes. I also added many of my own functions, utilized the standard ASP functions, and even added some functions publicly available on the Internet. In the end I almost didn't use the standard CCS functions.
Generally there is very small number of CCS functions and if you cannot find a PHP function or documented CCS function that does what you need then there is very little chance that any of the remaining functions will do that. In most cases if you need a specific function then if you don't see it in the documented CCS function list then usually you could either find it in PHP reference, on the Internet, or may need to write your own.
(not discounting that we do need to review our function documentation again)
--- end of excuse ---

Regarding working with MySQL in PHP, we utilize the standard PHP functions, which you can find here: http://php.net/mysql_connect
I believe that currently in CCS (PHP) the script just stops when there is a database error, though the error is shown by the PHP engine. We had couple requests for improving the error handling by passing the control to the developer and this will be implemented in a future version of CCS (it's already done in another version we're working on). However, if you need this only for custom code (events) that updates additional database tables then probably there is a way to catch errors. I can find out more info if this what you need.

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
snarf


Posts: 14
Posted: 06/11/2004, 3:29 PM

Thanks for the quick response!

I will play with the SQL objects and see what I can make them do. If I extend the DB MySQL class, I will send that code to you guys in the hopes you can integrate the code so I know it will be supported.

Let me start by saying that I love the product and am willing to put up with alot because it's been really good so far, and I want to see where it goes. I also know you guys must get sick of dealing with the complaints, and I can only ask for your patience and a fair effort to see things from the user's perspective.

You provide a very fair assessment of exposing some of the functions but not all. That's totally understandable. There is a flip-side, though, and people probably do feel a little "shorted" that they paid for this product and can't get their hands on solid documentation, either from Yes or from a third-party. Compare this to Eclipse -- there are books falling off the shelf about Eclipse. How did they make that happen? If Yes could foster their community enough to get some people to write some books on CodeCharge, particularly the more advanced stuff, you'd cut a brutal swath through the CASE / Code-generation market. (Hooks for Dreamweaver, an ERD tool like Case Studio, and version management tools would help too ;-) ).

From my perspective, the biggest problem with the lack of documentation is that I simply don't know what will happen to my CodeCharge-generated code if I start tossing in other "Non-CCS" code too aggressively. Without full documentation, CCS is a "black box", and it's worrisome to start tinkering around inside that black box not knowing what the next revision of CCS (or the next control you stick on a page, for that matter) might do to your "hacks". Will I break some state-management logic that I don't know about? Will I somehow hose up the SQL connection if I re-use the connection? Is some event going to leave that connection closed on me without me knowing it? Will CCStudio slap some restrictions around what I can and can't do in Custom Code blocks? Will I cause the compiler to start throwing errors if I modify a global variable outside the the "CodeCharge API" functions?

So I think what many people really want to know is "what can I safely get away with" more than "how does every function work". For example, if I could read in the documentation somewhere (maybe a document on the architecture and standards of CCS?) that...

(1) CCS addresses mySQL connections using only the native PHP functions, and

(2) the object properties and methods created by CodeCharge's DB_MySQL class is an "acme-style mySQL object" and can be learned-about at www.whatever.com, and

(3) Using the other "acme-style mySQL object" methods on a CodeCharge database object won't blow anything up

... then this conversation wouldn't be needed. Based on that information, I can read about the way CCS address mySQL without bothering you guys, and I know that the "CodeCharge Guys" approve of (and probably will not break) using other "acme-style mySQL object" methods without killing the CodeCharge project.

So anyway -- that's my .04 on the issue. I hope someone writes a good book. I wish I had the skill level and time to do it myself. In lieu of that, I hope that Yes finds the time between reading rants like this and fixing bugs to write a "Custom Code DO's, DON'Ts, and NEVER EVEN THINK ABOUT IT" document. :-P

And remember, your product generally rules. It just needs a little investment around the edges. Hang in there!
View profile  Send private message
peterr


Posts: 5971
Posted: 06/12/2004, 1:23 PM

Thanks Snarf for useful, constructive comments.

Let me also offer my point of view, hoping that this won't be taken as an argument or rebuttal :-)

The books is not exactly my department and I cannot tell you if there are or why there aren't any, but I'd think that books usually are written by authors who do not work for the product manufacturer. I'm aware that we've been in contact with several people who've expressed interest in writing books about CCS but possibly no one had sufficient time to deliver.

Regarding the "black box" I could say that CCS is less of a black box than PHP itself, or Delphi, MS Access and other tools that simply create and run the applications but you don't know what's inside and the internal code cannot be either viewed or modified (maybe except PHP and other Open Source products, but those can have very complex code inside that not many users would want to touch). CCS generates more open code from that point of view. Possibly we're too focused on implementation and less on the documentation, but I think that we will get there once a few more major features are completed. I just know that everyone at our company is very busy trying to create more miracles, and hey, how many miracles you know of that are well documented? :-)
I think though that some of the more advanced CCS users have accomplished things that we would not even know about, and several people on these forums created some interesting examples that go beyond CCS. I would compare this to PHP itself, because I'm pretty sure that the PHP authors/coders don't know the limitations of PHP and have never even thought of all the things that PHP users can do with PHP. That's why I don't think that anyone can tell how aggressively PHP can be used, and this applies to CCS as well.
Since CCS is a tool, just like a hammer, some people will use it to build a birdhouse, others will figure out a way to build the whole house, maybe even without nails :-) And this is what we've already seen happening with CCS. Therefore we actually don't know the limitations of CCS. If used together with PHP it can be probably used to achieve everything that can be done in PHP itself, but faster.
I suspect that you too will figure out a lot of "internals" of CCS within a couple of weeks and will learn its potential for your own projects. I even caught myself proposing solutions to users (often recommended by our developers) but then the users found 1 or 2 other ways to do the same thing, sometimes more efficiently, at least for their scenario.
And to make up to both the beginners and more advanced users, we offer many more examples than any other product we know of, which often can be a good eye opener. The examples actually taught us how to do some things in CCS, because only when you try to do something then you find the way to do it, even when extending your own house.
For now I only can recommend that you don't be afraid to do anything with CCS, but:
1st: learn all examples as much as you'd want to learn those internal CCS functions :-)
2nd: never modify the generated code but find a way to use events for everything you want to do. Learning the examples should take care of 90% of your needs, while asking questions will cover the rest.

So, that was my 5 cents :-)
I really appreciate your comments and will have them handy when we carry related internal discussions.
Thanks again.
_________________
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.