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.
| Attachment | Size |
|---|---|
| browscap.module.diff | 1.51 KB |

#1
This patch has quite a lot of tabs and coding standard typos.
#2
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.
#3
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
...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
Simplified patch.
#6
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
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
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
Thanks for reminding me.... http://drupal.org/cvs?commit=222442
#10
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
Automatically closed -- issue fixed for 2 weeks with no activity.