* Re: Updated eudcb-mab.el
2015-02-17 14:52 ` Thomas Fitzsimmons
@ 2015-02-18 19:56 ` Danie Roux
2015-02-20 2:52 ` Thomas Fitzsimmons
0 siblings, 1 reply; 6+ messages in thread
From: Danie Roux @ 2015-02-18 19:56 UTC (permalink / raw)
To: Thomas Fitzsimmons; +Cc: John Wiegley, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1889 bytes --]
Hi Thomas,
Please find attached a new version and a sql file.
Thomas Fitzsimmons <fitzsim@fitzsim.org> writes:
> Danie Roux <lists@danieroux.com> writes:
>> I've updated eudcb-mab.el to directly query the contacts database,
>> instead of using an external application.
>
> It looks like you're still relying on an external application, sqlite3,
> instead of "contacts", right?
Yes, thank you for picking that up. By external I meant "no additional
software".
> It probably makes sense to change eudcb-mab in the way you're
> suggesting rather than providing a new backend eudcb-mab-sqlite,
> right?
Yes.
> Is this patch backward compatible with the "contacts" format? If not,
> do you have a sense for how common the "contacts" format is these
> days? Would it make sense to obsolete the contacts format and support
> only the sqlite3 format in Emacs 25?
That would be my suggestion. I have no feel for how many people use the
"contacts" external application. This should be a seamless change
because it was never possible to set the location or the format to the
"contacts" application
>> Please find the changed version attached.
>
> Are you able to provide a test database file with example data and a
> test procedure for using it for completion? That would be a useful
> addition. I haven't been able to test the MAB backend myself because I
> don't have access to a Mac OS or GNUstep system.
Please find attached an anonymized and stripped contacts.sql file to be
used:
$ sqlite3 /tmp/test-contacts.db < contacts.sql
And:
(setq eudc-contacts-file "/tmp/test-contacts.db")
(eudc-set-server "dummy" 'mab t)
In a scratch buffer: (eudc-mab-sqlite3-dump-mac-addressbook)
Searching for "Richard" or "Anton" should be interesting:
(eudc-query-form)
> Do you have a copyright assignment on file?
No. I'm not in the US. Do I just email copyright-clerk@ ?
--
Danie Roux
[-- Attachment #2: eudcb-mab.el --]
[-- Type: application/emacs-lisp, Size: 5199 bytes --]
[-- Attachment #3: contacts.sql --]
[-- Type: application/octet-stream, Size: 10820 bytes --]
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE ZABCDRECORD ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZCREATIONDATEYEAR INTEGER, ZDISPLAYFLAGS INTEGER, ZMODIFICATIONDATEYEAR INTEGER, ZADDRESSBOOKSOURCE INTEGER, ZISALL INTEGER, ZINFO INTEGER, ZME INTEGER, Z21_ME INTEGER, ZBIRTHDAYYEAR INTEGER, ZPREFERREDFORLINKNAME INTEGER, ZPREFERREDFORLINKPHOTO INTEGER, ZPRIVACYFLAGS INTEGER, ZADDRESSBOOKSOURCE1 INTEGER, ZCONTACTINDEX INTEGER, ZLUNARBIRTHDAYCOMPONENTS INTEGER, ZNOTE INTEGER, ZSOURCEWHERECONTACTISME INTEGER, ZASSISTANTSYNCANCHOR INTEGER, ZSHARECOUNT INTEGER, ZSYNCCOUNT INTEGER, ZVERSION INTEGER, ZADDRESSBOOKSOURCE2 INTEGER, ZCREATIONDATE TIMESTAMP, ZCREATIONDATEYEARLESS FLOAT, ZMODIFICATIONDATE TIMESTAMP, ZMODIFICATIONDATEYEARLESS FLOAT, ZBIRTHDAY TIMESTAMP, ZBIRTHDAYYEARLESS FLOAT, ZUNIQUEID VARCHAR, ZNAME VARCHAR, ZNAMENORMALIZED VARCHAR, ZTMPREMOTELOCATION VARCHAR, ZNAME1 VARCHAR, ZREMOTELOCATION VARCHAR, ZSERIALNUMBER VARCHAR, ZDEPARTMENT VARCHAR, ZFIRSTNAME VARCHAR, ZIDENTITYUNIQUEID VARCHAR, ZIMAGEREFERENCE VARCHAR, ZJOBTITLE VARCHAR, ZLASTNAME VARCHAR, ZLINKID VARCHAR, ZMAIDENNAME VARCHAR, ZMIDDLENAME VARCHAR, ZNICKNAME VARCHAR, ZORGANIZATION VARCHAR, ZPHONEMEDATA VARCHAR, ZPHONETICFIRSTNAME VARCHAR, ZPHONETICLASTNAME VARCHAR, ZPHONETICMIDDLENAME VARCHAR, ZSORTINGFIRSTNAME VARCHAR, ZSORTINGLASTNAME VARCHAR, ZSUFFIX VARCHAR, ZTITLE VARCHAR, ZTMPHOMEPAGE VARCHAR, ZASSISTANTVALIDITY VARCHAR, ZCREATEDVERSION VARCHAR, ZLASTDOTMACACCOUNT VARCHAR, ZLASTSAVEDVERSION VARCHAR, ZSYNCANCHOR VARCHAR, ZMODIFIEDUNIQUEIDSDATA BLOB, ZSEARCHELEMENTDATA BLOB );
INSERT INTO ZABCDRECORD VALUES(1,21,36,2011,0,2013,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,1,NULL,NULL,3,NULL,NULL,NULL,NULL,NULL,345373485.904313,29840685.904313,406059020.315689,27367820.315689,NULL,NULL,'00000000-0000-0000-0000-000000000000:ABPerson',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Danie',NULL,NULL,NULL,'Roux',00000000-0000-0000-0000-000000000000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO ZABCDRECORD VALUES(20,21,4,2011,0,2013,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,428,NULL,30,NULL,NULL,NULL,NULL,NULL,NULL,345415361.631351,29882561.631351,406059026.557472,27367826.557472,NULL,NULL,'00000000-0000-0000-0000-000000000000:ABPerson',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Cheryl',NULL,NULL,NULL,'van der Merwe',00000000-0000-0000-0000-000000000000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO ZABCDRECORD VALUES(21,21,6,2011,0,2013,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,197,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,345415361.633945,29882561.633945,406059017.105404,27367817.105404,NULL,NULL,'00000000-0000-0000-0000-000000000000:ABPerson',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Anton',NULL,NULL,'CTO','Smit',00000000-0000-0000-0000-000000000000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO ZABCDRECORD VALUES(32,21,8,2011,0,2013,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,473,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,345415361.666141,29882561.666141,406059026.557472,27367826.557472,NULL,NULL,'00000000-0000-0000-0000-000000000000:ABPerson',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Richard',NULL,NULL,'Founding Member','Loots',00000000-0000-0000-0000-000000000000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO ZABCDRECORD VALUES(42,21,13,2011,0,2013,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,175,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,345415361.692974,29882561.692974,406059026.557472,27367826.557472,NULL,NULL,'00000000-0000-0000-0000-000000000000:ABPerson',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Nicole',NULL,NULL,NULL,'Kidman',00000000-0000-0000-0000-000000000000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO ZABCDRECORD VALUES(43,21,6,2011,0,2013,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,446,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,345415361.69717,29882561.69717,406059015.318355,27367815.318355,NULL,NULL,'00000000-0000-0000-0000-000000000000:ABPerson',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Rudi',NULL,NULL,'Owner','Brisco',00000000-0000-0000-0000-000000000000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO ZABCDRECORD VALUES(100,21,10,2011,0,2013,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,122,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,345415361.849586,29882561.849586,406059015.318355,27367815.318355,NULL,NULL,'00000000-0000-0000-0000-000000000000:ABPerson',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Marius',NULL,NULL,NULL,'Ludikke',00000000-0000-0000-0000-000000000000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO ZABCDRECORD VALUES(102,21,4,2011,0,2013,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,513,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,345415361.854852,29882561.854852,406059017.105404,27367817.105404,NULL,NULL,'00000000-0000-0000-0000-000000000000:ABPerson',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Martin',NULL,NULL,NULL,'Nel',00000000-0000-0000-0000-000000000000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
CREATE TABLE ZABCDEMAILADDRESS ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZISPRIMARY INTEGER, ZISPRIVATE INTEGER, ZORDERINGINDEX INTEGER, ZOWNER INTEGER, Z21_OWNER INTEGER, ZADDRESS VARCHAR, ZADDRESSNORMALIZED VARCHAR, ZLABEL VARCHAR, ZUNIQUEID VARCHAR );
INSERT INTO ZABCDEMAILADDRESS VALUES(735,10,1,1,NULL,0,42,21,'nicole.kidman@example.com','nicole.kidman@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(755,10,1,1,NULL,0,43,21,'rudi@example.com','rudi@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(858,10,1,0,NULL,1,43,21,'rudi.brisco@example.com','rudi.brisco@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(972,10,1,0,NULL,2,43,21,'rudi@example.net','rudi@example.net','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1004,10,1,1,NULL,0,32,21,'richard@example.com','richard@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1021,10,1,1,NULL,0,20,21,'cheryl@example.com','cheryl@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1057,10,1,0,NULL,1,102,21,'mn@example.com','mn@example.com','_$!<Home>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1155,10,1,1,NULL,0,102,21,'martin@example.com','martin@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1369,10,1,1,NULL,0,100,21,'marius@example.com','marius@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1379,10,1,0,NULL,2,1,21,'danie@example.net','danie@example.net','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1381,10,1,0,NULL,1,1,21,'accounts+gnu@example.com','accounts+gnu@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1382,10,1,0,NULL,3,1,21,'accounts+savannah@example.com','accounts+savannah@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1383,10,1,1,NULL,0,1,21,'danie@example.com','danie@example.com','_$!<Home>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1545,10,1,0,NULL,2,21,21,'anton@example.com','anton@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1547,10,1,1,NULL,0,21,21,'as@example.net','as@example.net','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1548,10,1,0,NULL,3,21,21,'anton.smit@example.com','anton.smit@example.com','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDEMAILADDRESS VALUES(1560,10,1,0,NULL,1,21,21,'anton@example.net','anton@example.net','_$!<Other>!$_',00000000-0000-0000-0000-000000000000);
CREATE TABLE ZABCDPHONENUMBER ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZISPRIMARY INTEGER, ZISPRIVATE INTEGER, ZORDERINGINDEX INTEGER, ZOWNER INTEGER, Z21_OWNER INTEGER, ZAREACODE VARCHAR, ZCOUNTRYCODE VARCHAR, ZEXTENSION VARCHAR, ZFULLNUMBER VARCHAR, ZLABEL VARCHAR, ZLOCALNUMBER VARCHAR, ZUNIQUEID VARCHAR );
INSERT INTO ZABCDPHONENUMBER VALUES(525,13,1,0,NULL,1,20,21,NULL,NULL,NULL,'011 123 4560','_$!<Mobile>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(543,13,1,1,NULL,0,20,21,NULL,NULL,NULL,'011 123 4561','_$!<Home>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(552,13,1,1,NULL,0,21,21,NULL,NULL,NULL,'011 321 9876','_$!<Mobile>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(560,13,1,0,NULL,1,1,21,NULL,NULL,NULL,'011 123 4562','_$!<Mobile>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(567,13,1,1,NULL,0,100,21,NULL,NULL,NULL,'011 123 4563','_$!<Mobile>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(593,13,1,1,NULL,0,43,21,NULL,NULL,NULL,'011 123 4564','_$!<Mobile>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(594,13,1,0,NULL,2,20,21,NULL,NULL,NULL,'011 123 4565','_$!<HomeFAX>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(604,13,1,1,NULL,0,1,21,NULL,NULL,NULL,'011 123 4566','_$!<Home>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(613,13,1,1,NULL,0,42,21,NULL,NULL,NULL,'011 123 4567','_$!<Mobile>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(619,13,1,0,NULL,1,102,21,NULL,NULL,NULL,'011 123 4568','_$!<Work>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(643,13,1,1,NULL,0,32,21,NULL,NULL,NULL,'011 123 4569','_$!<Mobile>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(745,13,1,1,NULL,0,102,21,NULL,NULL,NULL,'011 123 4570','_$!<Mobile>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(761,13,1,0,NULL,1,42,21,NULL,NULL,NULL,'011 123 4571','_$!<Work>!$_',NULL,00000000-0000-0000-0000-000000000000);
INSERT INTO ZABCDPHONENUMBER VALUES(964,13,1,NULL,NULL,2,1,21,NULL,NULL,NULL,'011 123 4572','_$!<HomeFAX>!$_',NULL,00000000-0000-0000-0000-000000000000);
COMMIT;
^ permalink raw reply [flat|nested] 6+ messages in thread