Jaggi Posted February 26, 2007 Share Posted February 26, 2007 I know your gonna say no straight away but hear me out first... :PI want support for calling tables using ipb db class system with the ability to use no prefix. At the moment i have to cheat using $this->ipsclass->DB->query("SELECT * FROM table"); Now although this system works my discussion with digi on ipsbeyond outlined a few things that lays fault to it such as inability to support other db systems and i've had some initial problems with things too. Now to answer you reason why your gonna shout no at me, not all mods can use the ibf_ prefix even tho i try to where ever possible its just always possible with various things. An example is a current mod i'm working which ties ipb into a WoW server, i can't change the name of the wow tables because they are accessed by the wow server which is lovely coded in c++ and half of it is encrypted up the wazoo. I've got various examples of where this causes issues. I know it would be only used by a few people in extreme cases but feel that the option at least should be made available. Link to comment Share on other sites More sharing options...
Digi Posted February 26, 2007 Share Posted February 26, 2007 The only place I can see needing more functionality is given your circumstance here where you needed to do a table with join. However, did you actually try setting the prefix to '' and manually type out the IPB prefix for ipb related tables? Here is an example of what I mean (shortened for simplicity).$ipb_prefix = $db->obj['sql_prefix']; $db->obj['sql_prefix'] = ''; $example = $db->build_and_exec_query( array( 'select' => 'wow.*,ipb.*', 'from' => array( $ipb_prefix.'members' => 'ipb' ), 'add_join' => array( 0 => array( 'type' => 'left', 'from' => array( 'somewowtable' => 'wow' ), 'where' => 'ipb.member_id=wow.wow_id', ) ), ) ); /** lets not forget to reassign **/ $db->obj['sql_prefix'] = $ipb_prefix;I haven't tested this, but it should work in theory. I think it might prove more difficult to increase functionality in the manner you want than it would be to do this. Not saying that this is a bad request, just providing additional methods :) Link to comment Share on other sites More sharing options...
Jaggi Posted February 26, 2007 Share Posted February 26, 2007 yea thats actually a good method, also in theory it should work if not a little long winded and potentially fatal if you forget to reassign the prefix although the 100 or so errors you'll pretty much means you'll notice straight away :P. I've no real idea how to implement the addition i want as when mixing with ipb tables it can get complex in the way of needing a prefix as well as not needing one. Just throwing the idea open to debate at the moment to see what people here think and suggest. Link to comment Share on other sites More sharing options...
bfarber Posted February 26, 2007 Share Posted February 26, 2007 Just set this before your query$this->ipsclass->DB->no_prefix_convert = 1;And reset it afterwards. The following will have the same effect$this->ipsclass->DB->prefix_changed = 1;So, all the support for using custom prefixes is already there, and I don't see any reason to make any changes. Link to comment Share on other sites More sharing options...
Digi Posted February 26, 2007 Share Posted February 26, 2007 According to this post That doesn't always work and why I had to offer the other solutions. Link to comment Share on other sites More sharing options...
bfarber Posted February 26, 2007 Share Posted February 26, 2007 Depends upon what you are doing I suppose. I know that do_update and do_insert will add the prefix anyways (from those functions before query function is called). Link to comment Share on other sites More sharing options...
Digi Posted February 26, 2007 Share Posted February 26, 2007 And that is the problem. Because those function force the prefix to be added, it makes them unusable in the situation at hand. Link to comment Share on other sites More sharing options...
bfarber Posted February 26, 2007 Share Posted February 26, 2007 Yes, looking into this further the build_* etc functions do add the prefix - the other parameters will only affect the "query" function itself.Will have a think about whether we should invest time in changing this or not. It doesn't really affect us, but I could see how those integrating with IP.Board could benefit from being able to override the prefix even in our own library. Link to comment Share on other sites More sharing options...
Jaggi Posted February 27, 2007 Share Posted February 27, 2007 i'll look into the methods you mentioned bfarber but proper support would be a welcome change, seeing as it'll probably arrive in 3.0 and your rewriting most things for that i'm sure it won't be too much hassle :P. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.