Hello
I am wondering how I could make a site so that I am not depended on some specific table names/structure, that is that the columns don't neccisarily have to be called something specific and I can easily adjust my site to differant table/column names.
I do run all querys throught an object so I am not depended on some specific database and I wanted to take it a step further.
I was just wondering what is the best way to do this?
I had thought of doing querys like this:
replacing table1/col1 etc with some convinient names that are saved in my system, then I store what the actual field name is and do preg_replace through all my querys to place the appropriate names, still, this method must be a little bit slow with all those preg_replace calls, or what ?PHP Code:$q =& $db->query('SELECT {table1.col1} as name1, {table2.col2} as name2 FROM {table1}, {table2}');
If anyone is doing/knows how to something like this please share it, I would appreciate it very much!
Thanks in advance!
edit: isn't it independed ? I don't know what is wrong with me today ; )









Bookmarks