[wp-hackers] PostgreSQL port status?

Jacob wordpress at santosj.name
Mon Oct 1 03:22:07 GMT 2007


Oops, the answer was already there. Change:

if ( !wp_select_db($dbh, $db) )

to:

if( !$this->wp_select_db($dbh, $db) )

Jacob Santos

Jacob wrote:
> Is this function in the class? I'm not sure from the missing other 140 
> lines before it. If I had the other 140 lines or answer my first 
> question.
>
> Jacob Santos
>
> Computer Guru wrote:
>> I'm trying to do just that right now, but I'm getting the weirdest 
>> PHP error I've ever seen :S
>>
>>
>>     function wp_select_db($dbname, $connection_id)
>>     {
>>         global $server;
>>         $conn =  @pg_connect("host={$server->host} 
>> user={$server->user} password={$server->pass} dbname=$dbname"); 
>>         $server->user = '';
>>         $server->pass = '';
>>         $server->host = '';
>>         return $conn;
>>     }
>>
>>     // 
>> ==================================================================
>>     //    Select a DB (if another one needs to be selected)
>>
>>     function select($db, &$dbh) {
>>         if ( !wp_select_db($dbh, $db) ) {
>>         $this->bail("error message");
>>         }
>>     }
>>
>>
>> It *INSISTS* that wp_select_db does not exist....
>> Fatal error: Call to undefined function wp_select_db() in 
>> c:\Inetpub\wwwroot\blog\wp-content\db.php on line 140
>>
>> I've tried renaming the function and moving the definition, but it is 
>> adamantly refusing to see the function I defined /just/ above it..
>> Any ideas?
>>
>> Computer Guru
>> NeoSmart Technologies
>> http://neosmart.net/
>>
>>
>>  
>>> -----Original Message-----
>>> From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-
>>> bounces at lists.automattic.com] On Behalf Of Jacob
>>> Sent: Monday, October 01, 2007 5:02 AM
>>> To: wp-hackers at lists.automattic.com
>>> Subject: Re: [wp-hackers] PostgreSQL port status?
>>>
>>> Ah, not bad, if you replace the global $wpdb with your class and
>>> provide
>>> the same methods and properties, that would work.
>>>
>>> However, my previous post is an possible implementation that wouldn't
>>> require this step.
>>>
>>> Jacob Santos
>>>
>>> DD32 wrote:
>>>    
>>>> On Mon, 01 Oct 2007 11:22:48 +1000, Jacob <wordpress at santosj.name>
>>>>       
>>> wrote:
>>>    
>>>>> My thoughts was having all of the queries as filters specific to the
>>>>> function and query. You would end up with about several hundred
>>>>>         
>>> filters,
>>>    
>>>>> but it would allow for the easiest transition. It wouldn't be as
>>>>>         
>>> hard or
>>>    
>>>>> difficult as porting and can be just a plugin. It would also allow
>>>>>         
>>> for
>>>    
>>>>> removing upgrading conflicts.
>>>>>
>>>>>         
>>>> That'd be rather pointless IMO, If your wanting to replace the
>>>>       
>>> database, then you use your own db class file anyway, All queries will
>>> be passed directly to the class, Your code would handle the query
>>> before its made.
>>>    
>>>> It would probably be easier if all of WP used the prepare()
>>>>       
>>> functionality that 2.3 has introduced, AFAIK that means it'll be using
>>> something like "SELECT `id` FROM `table` WHERE `name` = '%s' ORDER BY
>>> %s" with parameters passed in, It would make it a lot easier for the
>>> database class to replace 'dodgy' queries with something more friendly
>>> for that database.
>>>    
>>>> D
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>
>>>>       
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>     
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>   
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list