Browscap can not import php_browscap.ini to Postgresql

iktaka - August 27, 2008 - 15:03
Project:Browscap
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

Browscap use "REPLACE INTO" to import php_browscap.ini. The "REPLACE INTO" is MySQL specific SQL, and not work with postgresql.
The attached patch make SELECT and INSERT or UPDATE to import php_browscap.ini whenever DB is postgresql.
Also fix another SELECT error on postgresql.

AttachmentSize
browscap.module.diff1.51 KB

#1

Rob Loach - September 12, 2008 - 18:10
Status:needs review» needs work

This patch has quite a lot of tabs and coding standard typos.

#2

cedarm - October 21, 2008 - 07:19
Status:needs work» needs review

Here's the same patch cleaned up, and split into the two fixes.

Also, it looks like CVS code has moved on, so I'm mainly posting this for the benefit of those trying to use PostgreSQL with browscap-6.x-1.0.

AttachmentSize
browscap-300627-2-pgsql.patch 1.04 KB
browscap-300627-2-sqlsyntax.patch 617 bytes

#3

veriKami - December 13, 2008 - 08:59

subscribing :-) I have just started this module on postgres and have lots of errors, eg.:

warning: pg_query() [function.pg-query]: Query failed: ERROR: column "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWeb" does not exist in /.../database.pgsql.inc on line 139.

user warning: query: SELECT useragent FROM dru_browscap WHERE useragent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" LIMIT 1 OFFSET 0 in /.../browscap.module on line 204.

[...]

...propably this could help...

...after 'quick patchwork' it seems it does :-)

#4

veriKami - December 13, 2008 - 12:59

...but when trying to import Browscap data I have msg.:

warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid byte sequence for encoding "UTF8": 0xe26e63 in /.../database.pgsql.inc on line 139.

user warning: in /.../browscap.module on line 342.
warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid byte sequence for encoding "UTF8": 0xa3 in /.../database.pgsql.inc on line 139.

user warning: in /.../browscap.module on line 340.
warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid byte sequence for encoding "UTF8": 0xa3 in /.../database.pgsql.inc on line 139.

however imported data are in db, displaying: 'New version of browscap imported: 4409'

#5

Darren Oh - May 29, 2009 - 19:28

Simplified patch.

AttachmentSize
browscap.module-300627-5.patch 1.37 KB

#6

Rob Loach - May 29, 2009 - 19:56
Status:needs review» reviewed & tested by the community

Although I haven't tested wiht Postres, it does use DELETE and INSERT instead of REPLACE properly. If anyone comes along and says it works on Postgres, I'd be happy to commit it.

#7

Darren Oh - June 1, 2009 - 13:59

PostgreSQL is what I use this on. I still get the error in comment #4, but it's not related. It results from the encoding not being converted to UTF8 before data is passed to the database.

#8

henmue - June 8, 2009 - 11:02

Hi there! I'm using PostgreSQL, too. The "REPLACE INTO" part is still in the development snapshot. Will it be replaced by compatible commands?

Best regards
Henry

#9

Rob Loach - June 8, 2009 - 11:39
Status:reviewed & tested by the community» fixed

Thanks for reminding me.... http://drupal.org/cvs?commit=222442

#10

henmue - June 8, 2009 - 14:27

Yeah, Rob! That was a fast one, thank you.

I reinstalled Browsecap and also got the "invalid byte sequence for encoding "UTF8": 0xe26e63" error mentioned earlier. But it doesn't seem to have any effect on the module (up to now :-).

Regards
Henry

#11

System Message - June 22, 2009 - 14:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.