From: John D. <jo...@we...> - 2001-07-05 19:48:42
|
Just to be clear, metabase is a separate project that binarycloud is embedding. From it's website (http://phpclasses.upperdesign.com/browse.html/package/20): Description: Package of classes that provide DBMS independent access and management of databases. Features: o Set of functions that call the selected DBMS driver objects functions supporting when possible: * Database connection setup * Operation error handling * Query constant data conversion * Direct queries * Prepared queries * Query result rows random access * Retrieve a limit range of rows of a SELECT query. * Transactions * Database object creation (tables, indexes, sequences) * DBMS driver supported feature query etc.. metabase is not what is responsible for actually generating your queries. The only place (that I'm familiar with) where queries are generated at run-time are in the EntityManager (and even then, only when we _can't_ use a compile-time generated query), which hasn't actually made its way into binarycloud at this point. But, generating queries requires a context. In the EntityManager, your context is your entities. A predefined set of queries can be generated (mostly at compile time, there's no reason to do them at run-time) for adding, deleting, updating, and fetching, based on the fields which you have designated as being the fields you want to be exposed to the world. You wouldn't in most cases, want to run mysql_fetch_field() at run-time and just interate over everything you find, as that would run contradictory to defining your entities at development time, and cause a lot of lost functionality. That's not to say, however, that there shouldn't be something that you could run on a particular table to generate an entity definition, which you can then edit/fine-tune. On the other hand, maybe it would be more correct to generate the SQL to make the tables based on the entity definitions, instead of the other way around. That could allow for some pretty cool shit, such as automatic schema migrations, true database independance, etc.. As to your question about the case control structure, see: www.php.net/switch John On Thu, 5 Jul 2001, Alby Lash wrote: > Whilst waiting for bc2 to be ready for production - I'm doing some > restructuring of my current project and I'm trying to isolate all of my sql > commands into a few dynamic functions. For the most part, I'll be doing a > lot of updating, inserting, and querying - big surprise I know. > > At any rate, I was thinking of building some tables that contain information > about the _real_ db structure, so that when I do an insert on a variable > driven table definition, I would be able to cycle through the field titles > and build my sql call that way. However, I thought, why not just grab the > table structure from the tables themselves using the mysql_fetch_field > command. So, when I was thinking about this - bringing the db structure out > in pieces to a simple dynamic sql query builder - I felt it sounded very > much like what I thought the BC metabase to be. However, I did some poking > around in the db "metabase" code and I couldn't find that much that made > sense from that perspective. > > Anyone want to try to explain to me what the metabase portion on BC is up > to, and if there is anything like what I am describing in BC2? Also, I came > across this often used function "case" that I couldn't find in the php > manual. Anyone know what this does? It seems to have something to do with > the data type thats in the table field. > > Thanks, > > Albert Lash > al...@th... > > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev > > -- John Donagher Application Engineer Intacct Corp. - Powerful Accounting on the Web 408-395-0989 720 University Ave. Los Gatos CA 95032 www.intacct.com Public key available off http://www.keyserver.net Key fingerprint = 4024 DF50 56EE 19A3 258A D628 22DE AD56 EEBE 8DDD |