Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

SqlBuilder Class

edited January 2007 in Vanilla 1.0 Help
Could someone explain to me how the sql builder class works. As i understand what it does $db->SetMainTable('Table1', 't'); $db->AddSelect( array('Row1', 'Row2'), 't'); $db->AddJoin('Table2', 'u', 'Row1', 't', 'Row1', 'join'); $db->AddSelect('LRow2', 'u', 'UserName'); $db->AddWhere('Row2', 'Something', '', 'null', 'is', 'or', '', 0); $db->EndWhereGroup(); return $db; Kinda thing however i would like to use a similar setup on some of my own scripts but i dont understand the inner workings of the sqlbuilder class. If someone could "document" it further so i may understand it i would be grateful or if someone has a similar more simple sqlbuilder that is less reliant on previous code. I would be forever grateful. Thanks

Comments

  • You realise you can just rip the sqlbuilder function out of the framework? I'm not aware that it's reliant on other parts of vanilla?
  • oh can i? Ill give it a shot then. Or if i can't i will try and make something slightly simpler. If you wish to help me rip it out as you know alot about vanilla i would be most grateful.
  • edited December 2006
    Well, first things first, lift the Framework.Class.SQLBuilder.php file out of the library/framework folder, drop it into your app, try using it, and see what happens :D
  • actually would it help i use vanillas mysql class aswell?..
  • That i cant tell you. Probably though.
  • lol ok, thanks for your help anyway. If marks has time and wants to offer up and of his super, awesome, out of this world knowledge it might make more sense
  • sql builder class seems pretty wedged into the rest of the framework. I may have to start writing my own based upon Marks.
  • $s->SetMainTable('UserWall', 'w'); well what does the letter 'w' do here?
  • edited January 2007
    The 'w' is the table alias (or name, or codename - if you like) that you'll use in future methods (i.e. AddWhere) to distinguish the table you want the method to use. Its used so that you can set and manipulate more than one main table at the same time. For instance, if you take a look at the first post, you'll see that he sets the main table with an alias of "t" and then uses that alias in all of his method calls. (Until he Joins another table with the alias of "u").
  • Now i need a way of ripping out the sql class and making it still work. Im guessing ill have tos tart with the whole framework as a whole and then remove peices till it is as small as i can get it without it breaking.
This discussion has been closed.