Liquid Fire Posted March 9, 2008 Share Posted March 9, 2008 I have been building a framework for the pass 3-4 months and it is coming along pretty well. I have a database class and this the functionality i currently have for it: get_row() : return first row from passed query get_one() : return first variable from passed query get_column() : return first variable from all return as an array get_all() : returns all data from all rows from passed query insert() : field=>values array delete() : delete records with the pass where statement update() : field=>value array and where statement table_exists() : searches for passed table name row_exists() : searches for number of rows on a table with a where statement table_information() : resturn DESCRIBE STATEMENT(MySQL) information primary_key() : return field name of primary key transaction() : query to run with transactions commit_transactions() : commits transactions rollback_transactions() : rollback transactions get_indexes() : return all indexes for a table of database get_relationships() : returns all foreign/primary key relationship for a table or database get_tables() : return all table name for a database truncate() : delete all record for passed table name process query() : runs the query passed add_index() : adds an index to a field add_relationship() : add a relation to a table is there any other functionality that i have not done that you think would be useful? Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/ Share on other sites More sharing options...
Daniel0 Posted March 9, 2008 Share Posted March 9, 2008 I like how you can do $select = $db->select() ->from(array('u' => 'users')) ->join(array('m' => 'messages'), 'u.user_id = m.user_id') ->where('u.user_id = ?', $userId) ->limit(5) ->order('m.message_created_at DESC'); if (!$ignoreDeleted) { $select->where('is_deleted = 0'); } $messages = $db->fetchAll($select); with Zend_Db. The above example could be for fetching the latest 5 messages of a user in whatever system you might have. You could do something like that. Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-488075 Share on other sites More sharing options...
cunoodle2 Posted March 22, 2008 Share Posted March 22, 2008 Care you share your code with us? It would be of great help to many noobie and myself as well =). I always wanted to have a core of usable files that we could just pull form. I.E a rock solid login page, a display table page, etc... Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-498072 Share on other sites More sharing options...
Liquid Fire Posted March 23, 2008 Author Share Posted March 23, 2008 do you mean the framework or the database class? Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-498511 Share on other sites More sharing options...
cunoodle2 Posted March 24, 2008 Share Posted March 24, 2008 Both would be great. It might help someone in the future learn something. Or at the very least anything you feel like putting up here =) Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-499139 Share on other sites More sharing options...
dbo Posted March 24, 2008 Share Posted March 24, 2008 to cunoodle: What are you looking for exactly? Are you just wanting to see some barebones code that helps demonstrate the MVC design pattern? Something that is not as bloated as Cake/CI, etc and that you would be able to tinker with yourself? Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-499583 Share on other sites More sharing options...
Acs Posted March 25, 2008 Share Posted March 25, 2008 I would like to see something like that dbo! I am trying to implement MVC but I just don't really know how to start. I have read in a few places that say that frameworks like cake and symphony break the mvc pattern. (don't ask me exactly how the break it, I just read they did) Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-500496 Share on other sites More sharing options...
dbo Posted March 25, 2008 Share Posted March 25, 2008 I just started writing a bare bones example the other day. I've got a few more things I need to implement but I'll throw the code up somewhere, when I get done, so you've got something to play with. Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-500606 Share on other sites More sharing options...
Acs Posted March 25, 2008 Share Posted March 25, 2008 Well say something in this post if you can! I have notify on Thanks Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-500791 Share on other sites More sharing options...
dbo Posted March 26, 2008 Share Posted March 26, 2008 The code is coming together pretty well. I haven't added in all the bells and whistles yet, but its basically functioning. Let me get some documentation together and then I'll throw the code up. Known requirements ------------------------------------------------------- PHP5 PDO Support mod_rewrite Right now it basically includes this: MVC Design Pattern URL Segments/Smart URLS/SEO Friendly URLS... whatever you want to call them Templating/Caching Generic DB Abstraction I'm planning on adding in some input validation, session management, and CRUD generation capability next. Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-500950 Share on other sites More sharing options...
dbo Posted March 28, 2008 Share Posted March 28, 2008 I've uploaded my generic framework. Anyone who was interested in seeing it can send me a PM and I'll send a you a link. I also appreciate any bug fixes or new features. Quote Link to comment https://forums.phpfreaks.com/topic/95289-database-class-functionality/#findComment-503332 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.