FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Adding MSSQL support to a MySQL/Postgres script
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Adding MSSQL support to a MySQL/Postgres script [message #170133 is a reply to message #170132] Mon, 11 October 2010 22:31 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 10/11/2010 5:39 PM, DiamondEagle wrote:
> On Oct 11, 2:25 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>>
>> So, what do you actually have in $table?
>>
>
> Thanks Jerry.
>
> The only reference to $table is in the "while ($table =
> mssql_fetch_assoc($query))" loop in the case statement. I think I
> fixed the script by copying the Postgres SQL into the MSSQL case and
> modifying it to use the MSSQL functions. The switch statement in
> mergeuser_get_userid_columns() function now has:
>
> case 'mssql_n':
> $query = mssql_query("
> SELECT column_name
> FROM information_schema.columns
> WHERE table_name = '$tablename'
> AND ( (column_name LIKE 'userid')
> OR (column_name LIKE 'user_id')
> OR (column_name LIKE 'id_user')
> )
> ");
>
> if (mssql_num_rows($query)> 0) {
> while ($column = mssql_fetch_assoc($query)) {
> if (!empty($column['column_name'])) {
> $columns[] = trim($column['column_name']);
> }
> }
> }
> break;
>
>
> And the switch statement in mergeuser_get_tables() function has:
>
> case 'mssql_n':
> $query = mssql_query("SELECT * FROM information_schema.tables");
> if (mssql_num_rows($query)> 0) {
> while ($table = mssql_fetch_assoc($query)) {
> $tablename = trim($table['TABLE_NAME']);
> if (!empty($tablename)) {
> $tables[] = $tablename;
> }
> }
> }
> break;
>
> It seems to be working now. Thanks.

Glad to hear it's working. But an easier way to handle this would be to
use inheritance - define an abstract class 'Database' and derive your
other classes from it. Then just use the appropriate class - function
names would be the same in all classes.

Much simpler and easier to maintain and troubleshoot.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Cursor to 1st fllable field?
Next Topic: php://memory and php://temp
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 11:07:15 GMT 2024

Total time taken to generate the page: 0.04656 seconds