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.

Comments

Status:Needs review» Needs work

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

Status:Needs work» Needs review
StatusFileSize
new617 bytes
new1.04 KB

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.

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 :-)

...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'

StatusFileSize
new1.37 KB

Simplified patch.

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.

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.

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

Status:Reviewed & tested by the community» Fixed

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

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

Status:Fixed» Closed (fixed)

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