Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Mostly I was thinking that the issue is more of a translation tables that passes what you know about how an existing view returns the data that can enable Cake to map it into what it needs to deal with the data in the Cake types of structure. Since inevitably there will be many 'views' that were not built with cake in mind. My thinking was that one could look at the step between when the data returns from the db before cake begins to apply it's 'special sauce' to the data to see if there might be a way to use a data map that is supplied. More like a plan of attack to offer as a way for cake to become more friendly to existing views. I have used views with cake but always they were not pre-existing ones and so I could really tweek them to return data to cake's liking. Sam D On 1/29/07, Bernard Grosperrin <[EMAIL PROTECTED]> wrote: > > Samuel DeVore wrote: > > I wonder if some kind of model extension could be proposed by people > > who are deeply involved in the use of views in their database > > environments, one that could create a mapping from what a view returns > > to what it would equate to in cakephp constructed style model queries. > > That could then be used to create the CakePHP style of results > > > That's where my limited knowledge of the classes used by Cake does not > help me: For me, a query on a view return a dataset, just like a query > on a table. They are not different at all, in that regard. > > Bernard > > > > > -- == S. DeVore (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Samuel DeVore wrote: > I wonder if some kind of model extension could be proposed by people > who are deeply involved in the use of views in their database > environments, one that could create a mapping from what a view returns > to what it would equate to in cakephp constructed style model queries. > That could then be used to create the CakePHP style of results > That's where my limited knowledge of the classes used by Cake does not help me: For me, a query on a view return a dataset, just like a query on a table. They are not different at all, in that regard. Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
ralph > And Bernard, I actually enjoy admitting that I don't understand > everything. That gives me a chance to learn something new. Learning is > one of the greatest pleasures in my life, and I would feel deprived > without it. As a result, I have a powerful and continuing need for > significant quantities of my own ignorance. Fortunately, I haven't > come close to running out yet. > There are a lot of things I don't know and/or don't understand, be it about PHP, SQL, or female psyche, and I love to learn too. I was simply disturbed by the affirmation that, because one has never used a specific feature, that feature had no use and/or "raison d'etre". Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Jeff > Be warned that you have to be explicitly clear in aliasing your complex > queries, or Cake will not know what to do. > > SELECT User.first_name, User.last_name FROM users User > > If you're using SQL functions, don't forget to alias those as well... > The aliases are the foundation to RDBMS -> ORM mapping in this > implementation.. > Will remember that, thank you. Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Chris > Um, I never said I was a DBA or looking to work as a DBA. I've never > been discounted from a position as a developer because I didn't know > what a view was or how to use it. And on top of it, you continue to > be incredibly rude towards me. Your little joke about exposure to the > sun is a perfect example of that. > > Do all DBA's have this type of attitude towards developers? Wow. > Oddly enough, the other DBA that I have worked with displayed the same > level of disdain for developers and shock that not everyone understood > database systems the way he did. He wasn't even that good at his job > either. > I am sorry if my tone was rude, I was simply trying to say that to never had the opportunity to ever create and/or use a view, in 9 years of experience , (or 20, for that matter), is not good enough of a reason to discard their use. I am a programmer, and never had a position as a DBA. It might surprises you, but it's true. I develop client applications, or, more exactly, help other programmers (all my clients are programmers) to develop or improve their applications. And, very, very often, my job is to open their eyes on SQL, as they upgrade their applications from Sequential ISAM files to SQL. Problem is, generally speaking, they continue to program with the same ISAM mindset, which is far from optimal. As an example, I have recently wrote ONE stored procedure, replacing 3 "process", with the result to go from about 1 hour of heavy processing on their machine, to about 0.30 second on the Postgresql server. ( Not comparing with MySQL, as before version 5, this was impossible in MySQL). So, I am a programmer, like you. I have been developing applications (Desktop and Lan) for businesses of all sizes, and now my experience allow me to work in the background, for other programmers. I am mostly a beginner in PHP, and have a lot too learn in that field, which I admit very easily. But I am learning. And if I manage to learn to the point where I would be able to help modify Cake core classes, I will be very happy to do so. But for now, I was mostly pointing out that, discarding the ability to use back end views was a disturbing choice for me. Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Jeff Loiselle > You have to follow convention if you want Cake to play with you > > Try this: > > CREATE VIEW users_profile_view AS > SELECT > User.id as UserProfileView.id, > User.username as UserProfileView.username, > DATE( User.last_login ) as "UserProfileView.last_login", > User.city as "UserProfileView.city", > > > etc. > > If that doesn't work let me know. Usually if you alias everything it > should work perfectly. If not, you can use the raw dbo methods for > query and retrieval. > Good advice, thanks, will try. Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
On 1/29/07, Bernard Grosperrin <[EMAIL PROTECTED]> wrote: > > Chris > > You're probably right that > > 9+ years of exposure to MySQL, Postgres and some Oracle mixed in there > > as well gives me no real sql/database background. > > > Exposure? Sorry, what do that mean? I have been exposed to the sun, > quite a bit, that did not give me any specific insider informations > about how it works... > Never used views, he? How many databases have you DESIGNED, from > scratch? How many times have you been chief of a project, responsible > entirely, from A to Z, for data integrity, security, as well as defining > stored procedures, triggers, etc, etc > > If I was looking for a job as DBA, I would avoid to put on my resume > that I have no ideas what views are made for > > Bernard > Um, I never said I was a DBA or looking to work as a DBA. I've never been discounted from a position as a developer because I didn't know what a view was or how to use it. And on top of it, you continue to be incredibly rude towards me. Your little joke about exposure to the sun is a perfect example of that. Do all DBA's have this type of attitude towards developers? Wow. Oddly enough, the other DBA that I have worked with displayed the same level of disdain for developers and shock that not everyone understood database systems the way he did. He wasn't even that good at his job either. If I was doing some massive project, for sure I'd try to bring on a DBA. But not one with the kind of attitude you've displayed in these emails. I have no problem working with people smarter than me, I just prefer the types who are humble and not insulting towards their co-workers. Lack of English as a mother tongue is not an excuse to rip on people who ask simple questions. So...I suggest that you offer up your suggestions on how CakePHP can better implement views, or keep the insulting emails private. -- Chris Hartjes My motto for 2007: "Just build it, damnit!" rallyhat.com - digitial photo scavenger hunt @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Larry E. Masters aka PhpNut wrote > Get this thread back on topic or I will close it OK, sorry. Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Larry E. Masters aka PhpNut wrote: > No one will be banned from the list unless I do it, and that happens > only when I feel someone has pushed me to do it. > Thanks you. Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
> Exposure? Sorry, what do that mean? I have been exposed to the sun, > quite a bit, that did not give me any specific insider informations > about how it works... > Never used views, he? How many databases have you DESIGNED, from > scratch? How many times have you been chief of a project, responsible > entirely, from A to Z, for data integrity, security, as well as defining > stored procedures, triggers, etc, etc > > If I was looking for a job as DBA, I would avoid to put on my resume > that I have no ideas what views are made for Get this thread back on topic or I will close it -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @access public */ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
AD7six wrote: > How about just using the method rawQuery (or whichever is the lowest > common-denominator model query method)? Don't know, I am not a specialist in Cake, but so far I have been unable to create a controller on a view (backend view, I mean). And I have not tried either to have one working on a stored procedure returning a dataset, 2 very common ways to develop an application working with a relational database. (Some stored procedures are just a view with a parameter) Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
AD7six wrote: >> That's a pretty typical (and kinda sad) answer from someone with no real >> sql/ database background, and happy with MySQL... >> > > BTW Please keep it friendly ;). > > Sorry it came out too strong. English is not my mother tongue, even if i had a good "exposure" to it (pun very much intended!), and from the reactions I can see I should have started that on a lighter tone. Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
> You can ban me from this list, I have no problem with that. But about > arrogance, check yourself in a mirror. No one will be banned from the list unless I do it, and that happens only when I feel someone has pushed me to do it. -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @access public */ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Chris > You're probably right that > 9+ years of exposure to MySQL, Postgres and some Oracle mixed in there > as well gives me no real sql/database background. > Exposure? Sorry, what do that mean? I have been exposed to the sun, quite a bit, that did not give me any specific insider informations about how it works... Never used views, he? How many databases have you DESIGNED, from scratch? How many times have you been chief of a project, responsible entirely, from A to Z, for data integrity, security, as well as defining stored procedures, triggers, etc, etc If I was looking for a job as DBA, I would avoid to put on my resume that I have no ideas what views are made for Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
nate > No more MySQL-bashing or Postgres arrogance. Arrogance? Which one? Comparing apples and oranges has never been a fair comparison. If you want pure raw speed, the old Btrieve files have no real match. You request in Postgresql is slow? Are you sure it's used properly? You can ban me from this list, I have no problem with that. But about arrogance, check yourself in a mirror. Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
On 1/28/07, Bernard Grosperrin <[EMAIL PROTECTED]> wrote: > > That's a pretty typical (and kinda sad) answer from someone with no real > sql/ database background, and happy with MySQL, which just recently, > (version 5) realised that Views, stored procedures, triggers, etc are > MANDATORY in any serious database engine.( I use Postgresql exclusively > with Cake, and am increasingly frustrated by the numerous limitations of > cake versus a REAL database) > Ouch. I hope you weren't trying to hurt my feelings there, Bernard. You know almost NOTHING about my background, so you're making a huge number of assumptions. I encourage you to go to my programming blog, where all my ignorance is revealed. My point was that I have never used views and wanted to know of circumstances when they were appropriate. You're probably right that 9+ years of exposure to MySQL, Postgres and some Oracle mixed in there as well gives me no real sql/database background. Perhaps you can help us lowly mortals understand views. It's probably just ignorance on my part, as I'm just a lowly developer not a sooperdooper DBA like yourself. As for feeling "constrained by the Framework", well, maybe I'm an idiot, but it seems to me that when you use a framework you are accepting a bunch of rules on how to build you application. It's called "convention over configuration" and many, many people smarter than you (yes, I'm as shocked as you that those people do exist) seem to do just fine with the constraints of a framework and create well-designed applications. Best of luck with Cake. -- Chris Hartjes My motto for 2007: "Just build it, damnit!" rallyhat.com - digitial photo scavenger hunt @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Kaste > when you dont need the modelling-features of a framework because it > duplicates your fine SQL-code and you only see a need for the VC of the > MVC probably switch to CodeIgniter and query your views and execute your > procedures and do the validation in the controller. > I have been overlooking CodeIgniter. Will look deeper at it. I am not a "cake" in PHP (pun intended!), but am pretty good at SQL, and use it daily to solve business problems. so it's very natural for me to want to code on that side, and want the web pages to do the display, and that's about it. And I want a framework to not have to reinvent the wheel when I need users to login, for example. But I don't want to be constrained by the Framework, on the contrary Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
> That's a pretty typical (and kinda sad) answer from someone with no real > sql/ database background, and happy with MySQL, which just recently, > (version 5) realised that Views, stored procedures, triggers, etc are > MANDATORY in any serious database engine.( I use Postgresql exclusively > with Cake, and am increasingly frustrated by the numerous limitations of > cake versus a REAL database) remember the main-demo of rails or cake is creating a blog and getting some pictures out of flickr. you dont do a backend in rails that serves any views outside the webworld. you do the model in php or ruby because it doesnt have to be independent of this app. = rapid development of web2.0 apps, nothing more. simple. at least, that is the _focus_ on these frameworks IMHO. when you dont need the modelling-features of a framework because it duplicates your fine SQL-code and you only see a need for the VC of the MVC probably switch to CodeIgniter and query your views and execute your procedures and do the validation in the controller. beside that cake sucks because..anyway --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: [professionel] Re: Cake is breaking database views. This looks like a bug.
Chris > I have never used an SQL view and would love to see a real-world > example of when a view should be used over, say, the CakePHP model > combined with associations. > > That's a pretty typical (and kinda sad) answer from someone with no real sql/ database background, and happy with MySQL, which just recently, (version 5) realised that Views, stored procedures, triggers, etc are MANDATORY in any serious database engine.( I use Postgresql exclusively with Cake, and am increasingly frustrated by the numerous limitations of cake versus a REAL database) Let's see some REAL WORLD reasons to use views instead of (or beside) associations in cake: (1) The request is compiled in the DB engine instead of being interpreted each time. So optimization is done once and for all, hence faster, and results can be cached. So the first reason is performances. (2) Security, at different levels. Guest use can access views, or some views, and none of the underlaying tables. (3) Technicals reasons. The association have no ideas on how to handle a recursive relation. Example: SELECT a.suppliesactivityid, a.suppliesid, a.pending, a.date, a.qtyin, a.qtyout, a.productid, ( SELECT sum((sua.qtyin - sua.qtyout)) AS sum FROM sua WHERE ((sua.suppliesactivityid <= a.suppliesactivityid) AND ((sua.suppliesid)::text = (( SELECT suaview_id.suppliesid FROM suaview_id WHERE (suaview_id.id = 1) ))::text)) ) AS qtyonhand, a.setasbeginningbalance, a.tagged, a.seqno FROM sua a WHERE ((a.suppliesid)::text = (( SELECT suaview_id.suppliesid FROM suaview_id WHERE (suaview_id.id = 1) ))::text) ORDER BY a.pending, a.date, a.suppliesactivityid; It's a running total, very classical SQL. There are no other ways than a query in Cake. But it's a typically slow query. Using a view for this is THE way to do it. Justifying limitations in a product by doubting the usefulness of very standard SQL features is not giving confidence in the futures ameliorations to said product. In other words, I don't like this answer, it makes me doubt of my sanity in spending time with cake. Bernard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---