author | mickeyl <mickeyl> | 2004-02-24 12:46:23 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-24 12:46:23 (UTC) |
commit | 911473db35a9fce5f3589f03c27210456faaba86 (patch) (unidiff) | |
tree | 7d55b6117b24de6ab18747b00a4641d38001c0ed /libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | |
parent | a2ead23c3614fe581261455cb4c3f31cee2098f3 (diff) | |
download | opie-911473db35a9fce5f3589f03c27210456faaba86.zip opie-911473db35a9fce5f3589f03c27210456faaba86.tar.gz opie-911473db35a9fce5f3589f03c27210456faaba86.tar.bz2 |
*phew* here is the class and file rename patch. not converted yet: backend,
but that will be not visible to application classes so we can change it later.
Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp index d0c8052..f121cc2 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp | |||
@@ -41,4 +41,4 @@ | |||
41 | 41 | ||
42 | #include <opie2/ocontactfields.h> | 42 | #include <opie2/opimcontactfields.h> |
43 | #include <opie2/oconversion.h> | 43 | #include <opie2/opimdateconversion.h> |
44 | #include <opie2/osqldriver.h> | 44 | #include <opie2/osqldriver.h> |
@@ -107,3 +107,3 @@ namespace Opie { | |||
107 | /** | 107 | /** |
108 | * inserts/adds a OContact to the table | 108 | * inserts/adds a OPimContact to the table |
109 | */ | 109 | */ |
@@ -111,3 +111,3 @@ namespace Opie { | |||
111 | public: | 111 | public: |
112 | InsertQuery(const OContact& ); | 112 | InsertQuery(const OPimContact& ); |
113 | ~InsertQuery(); | 113 | ~InsertQuery(); |
@@ -115,3 +115,3 @@ namespace Opie { | |||
115 | private: | 115 | private: |
116 | OContact m_contact; | 116 | OPimContact m_contact; |
117 | }; | 117 | }; |
@@ -178,3 +178,3 @@ namespace Opie { | |||
178 | 178 | ||
179 | QStringList fieldList = OContactFields::untrfields( false ); | 179 | QStringList fieldList = OPimContactFields::untrfields( false ); |
180 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ | 180 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ |
@@ -225,3 +225,3 @@ namespace Opie { | |||
225 | 225 | ||
226 | InsertQuery::InsertQuery( const OContact& contact ) | 226 | InsertQuery::InsertQuery( const OPimContact& contact ) |
227 | : OSQLQuery(), m_contact( contact ) { | 227 | : OSQLQuery(), m_contact( contact ) { |
@@ -233,3 +233,3 @@ namespace Opie { | |||
233 | /* | 233 | /* |
234 | * converts from a OContact to a query | 234 | * converts from a OPimContact to a query |
235 | */ | 235 | */ |
@@ -246,4 +246,4 @@ namespace Opie { | |||
246 | 246 | ||
247 | QStringList fieldList = OContactFields::untrfields( false ); | 247 | QStringList fieldList = OPimContactFields::untrfields( false ); |
248 | QMap<QString, int> translate = OContactFields::untrFieldsToId(); | 248 | QMap<QString, int> translate = OPimContactFields::untrFieldsToId(); |
249 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ | 249 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ |
@@ -297,3 +297,3 @@ namespace Opie { | |||
297 | // Get the translation from the ID to the String | 297 | // Get the translation from the ID to the String |
298 | QMap<int, QString> transMap = OContactFields::idToUntrFields(); | 298 | QMap<int, QString> transMap = OPimContactFields::idToUntrFields(); |
299 | 299 | ||
@@ -461,7 +461,7 @@ namespace Opie { | |||
461 | 461 | ||
462 | OContactAccessBackend_SQL::OContactAccessBackend_SQL ( const QString& /* appname */, | 462 | OPimContactAccessBackend_SQL::OPimContactAccessBackend_SQL ( const QString& /* appname */, |
463 | const QString& filename ): | 463 | const QString& filename ): |
464 | OContactAccessBackend(), m_changed(false), m_driver( NULL ) | 464 | OPimContactAccessBackend(), m_changed(false), m_driver( NULL ) |
465 | { | 465 | { |
466 | qWarning("C'tor OContactAccessBackend_SQL starts"); | 466 | qWarning("C'tor OPimContactAccessBackend_SQL starts"); |
467 | QTime t; | 467 | QTime t; |
@@ -482,6 +482,6 @@ OContactAccessBackend_SQL::OContactAccessBackend_SQL ( const QString& /* appname | |||
482 | 482 | ||
483 | qWarning("C'tor OContactAccessBackend_SQL ends: %d ms", t.elapsed() ); | 483 | qWarning("C'tor OPimContactAccessBackend_SQL ends: %d ms", t.elapsed() ); |
484 | } | 484 | } |
485 | 485 | ||
486 | OContactAccessBackend_SQL::~OContactAccessBackend_SQL () | 486 | OPimContactAccessBackend_SQL::~OPimContactAccessBackend_SQL () |
487 | { | 487 | { |
@@ -491,3 +491,3 @@ OContactAccessBackend_SQL::~OContactAccessBackend_SQL () | |||
491 | 491 | ||
492 | bool OContactAccessBackend_SQL::load () | 492 | bool OPimContactAccessBackend_SQL::load () |
493 | { | 493 | { |
@@ -508,3 +508,3 @@ bool OContactAccessBackend_SQL::load () | |||
508 | 508 | ||
509 | bool OContactAccessBackend_SQL::reload() | 509 | bool OPimContactAccessBackend_SQL::reload() |
510 | { | 510 | { |
@@ -513,3 +513,3 @@ bool OContactAccessBackend_SQL::reload() | |||
513 | 513 | ||
514 | bool OContactAccessBackend_SQL::save() | 514 | bool OPimContactAccessBackend_SQL::save() |
515 | { | 515 | { |
@@ -519,3 +519,3 @@ bool OContactAccessBackend_SQL::save() | |||
519 | 519 | ||
520 | void OContactAccessBackend_SQL::clear () | 520 | void OPimContactAccessBackend_SQL::clear () |
521 | { | 521 | { |
@@ -527,3 +527,3 @@ void OContactAccessBackend_SQL::clear () | |||
527 | 527 | ||
528 | bool OContactAccessBackend_SQL::wasChangedExternally() | 528 | bool OPimContactAccessBackend_SQL::wasChangedExternally() |
529 | { | 529 | { |
@@ -532,3 +532,3 @@ bool OContactAccessBackend_SQL::wasChangedExternally() | |||
532 | 532 | ||
533 | QArray<int> OContactAccessBackend_SQL::allRecords() const | 533 | QArray<int> OPimContactAccessBackend_SQL::allRecords() const |
534 | { | 534 | { |
@@ -538,3 +538,3 @@ QArray<int> OContactAccessBackend_SQL::allRecords() const | |||
538 | if ( m_changed ) | 538 | if ( m_changed ) |
539 | ((OContactAccessBackend_SQL*)this)->update(); | 539 | ((OPimContactAccessBackend_SQL*)this)->update(); |
540 | 540 | ||
@@ -543,3 +543,3 @@ QArray<int> OContactAccessBackend_SQL::allRecords() const | |||
543 | 543 | ||
544 | bool OContactAccessBackend_SQL::add ( const OContact &newcontact ) | 544 | bool OPimContactAccessBackend_SQL::add ( const OPimContact &newcontact ) |
545 | { | 545 | { |
@@ -559,3 +559,3 @@ bool OContactAccessBackend_SQL::add ( const OContact &newcontact ) | |||
559 | 559 | ||
560 | bool OContactAccessBackend_SQL::remove ( int uid ) | 560 | bool OPimContactAccessBackend_SQL::remove ( int uid ) |
561 | { | 561 | { |
@@ -572,3 +572,3 @@ bool OContactAccessBackend_SQL::remove ( int uid ) | |||
572 | 572 | ||
573 | bool OContactAccessBackend_SQL::replace ( const OContact &contact ) | 573 | bool OPimContactAccessBackend_SQL::replace ( const OPimContact &contact ) |
574 | { | 574 | { |
@@ -581,5 +581,5 @@ bool OContactAccessBackend_SQL::replace ( const OContact &contact ) | |||
581 | 581 | ||
582 | OContact OContactAccessBackend_SQL::find ( int uid ) const | 582 | OPimContact OPimContactAccessBackend_SQL::find ( int uid ) const |
583 | { | 583 | { |
584 | qWarning("OContactAccessBackend_SQL::find()"); | 584 | qWarning("OPimContactAccessBackend_SQL::find()"); |
585 | QTime t; | 585 | QTime t; |
@@ -587,6 +587,6 @@ OContact OContactAccessBackend_SQL::find ( int uid ) const | |||
587 | 587 | ||
588 | OContact retContact( requestNonCustom( uid ) ); | 588 | OPimContact retContact( requestNonCustom( uid ) ); |
589 | retContact.setExtraMap( requestCustom( uid ) ); | 589 | retContact.setExtraMap( requestCustom( uid ) ); |
590 | 590 | ||
591 | qWarning("OContactAccessBackend_SQL::find() needed: %d ms", t.elapsed() ); | 591 | qWarning("OPimContactAccessBackend_SQL::find() needed: %d ms", t.elapsed() ); |
592 | return retContact; | 592 | return retContact; |
@@ -596,3 +596,3 @@ OContact OContactAccessBackend_SQL::find ( int uid ) const | |||
596 | 596 | ||
597 | QArray<int> OContactAccessBackend_SQL::queryByExample ( const OContact &query, int settings, const QDateTime& d = QDateTime() ) | 597 | QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &query, int settings, const QDateTime& d = QDateTime() ) |
598 | { | 598 | { |
@@ -601,4 +601,4 @@ QArray<int> OContactAccessBackend_SQL::queryByExample ( const OContact &query, i | |||
601 | QMap<int, QString> queryFields = query.toMap(); | 601 | QMap<int, QString> queryFields = query.toMap(); |
602 | QStringList fieldList = OContactFields::untrfields( false ); | 602 | QStringList fieldList = OPimContactFields::untrfields( false ); |
603 | QMap<QString, int> translate = OContactFields::untrFieldsToId(); | 603 | QMap<QString, int> translate = OPimContactFields::untrFieldsToId(); |
604 | 604 | ||
@@ -616,3 +616,3 @@ QArray<int> OContactAccessBackend_SQL::queryByExample ( const OContact &query, i | |||
616 | // Do exist a better solution to switch this ? | 616 | // Do exist a better solution to switch this ? |
617 | if ( settings & OContactAccess::IgnoreCase ) | 617 | if ( settings & OPimContactAccess::IgnoreCase ) |
618 | qu += "(\"" + *it + "\"" + " LIKE " + "'" | 618 | qu += "(\"" + *it + "\"" + " LIKE " + "'" |
@@ -645,3 +645,3 @@ QArray<int> OContactAccessBackend_SQL::queryByExample ( const OContact &query, i | |||
645 | 645 | ||
646 | QArray<int> OContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const | 646 | QArray<int> OPimContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const |
647 | { | 647 | { |
@@ -651,11 +651,11 @@ QArray<int> OContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const | |||
651 | 651 | ||
652 | const uint OContactAccessBackend_SQL::querySettings() | 652 | const uint OPimContactAccessBackend_SQL::querySettings() |
653 | { | 653 | { |
654 | return OContactAccess::IgnoreCase | 654 | return OPimContactAccess::IgnoreCase |
655 | || OContactAccess::WildCards; | 655 | || OPimContactAccess::WildCards; |
656 | } | 656 | } |
657 | 657 | ||
658 | bool OContactAccessBackend_SQL::hasQuerySettings (uint querySettings) const | 658 | bool OPimContactAccessBackend_SQL::hasQuerySettings (uint querySettings) const |
659 | { | 659 | { |
660 | /* OContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay | 660 | /* OPimContactAccess::IgnoreCase, DateDiff, DateYear, DateMonth, DateDay |
661 | * may be added with any of the other settings. IgnoreCase should never used alone. | 661 | * may be added with any of the other settings. IgnoreCase should never used alone. |
@@ -666,10 +666,10 @@ bool OContactAccessBackend_SQL::hasQuerySettings (uint querySettings) const | |||
666 | if ( ( querySettings & ( | 666 | if ( ( querySettings & ( |
667 | OContactAccess::IgnoreCase | 667 | OPimContactAccess::IgnoreCase |
668 | | OContactAccess::WildCards | 668 | | OPimContactAccess::WildCards |
669 | // | OContactAccess::DateDiff | 669 | // | OPimContactAccess::DateDiff |
670 | // | OContactAccess::DateYear | 670 | // | OPimContactAccess::DateYear |
671 | // | OContactAccess::DateMonth | 671 | // | OPimContactAccess::DateMonth |
672 | // | OContactAccess::DateDay | 672 | // | OPimContactAccess::DateDay |
673 | // | OContactAccess::RegExp | 673 | // | OPimContactAccess::RegExp |
674 | // | OContactAccess::ExactMatch | 674 | // | OPimContactAccess::ExactMatch |
675 | ) ) != querySettings ) | 675 | ) ) != querySettings ) |
@@ -680,3 +680,3 @@ bool OContactAccessBackend_SQL::hasQuerySettings (uint querySettings) const | |||
680 | // IngoreCase alone is invalid | 680 | // IngoreCase alone is invalid |
681 | if ( querySettings == OContactAccess::IgnoreCase ) | 681 | if ( querySettings == OPimContactAccess::IgnoreCase ) |
682 | return false; | 682 | return false; |
@@ -684,14 +684,14 @@ bool OContactAccessBackend_SQL::hasQuerySettings (uint querySettings) const | |||
684 | // WildCards, RegExp and ExactMatch should never used at the same time | 684 | // WildCards, RegExp and ExactMatch should never used at the same time |
685 | switch ( querySettings & ~( OContactAccess::IgnoreCase | 685 | switch ( querySettings & ~( OPimContactAccess::IgnoreCase |
686 | | OContactAccess::DateDiff | 686 | | OPimContactAccess::DateDiff |
687 | | OContactAccess::DateYear | 687 | | OPimContactAccess::DateYear |
688 | | OContactAccess::DateMonth | 688 | | OPimContactAccess::DateMonth |
689 | | OContactAccess::DateDay | 689 | | OPimContactAccess::DateDay |
690 | ) | 690 | ) |
691 | ){ | 691 | ){ |
692 | case OContactAccess::RegExp: | 692 | case OPimContactAccess::RegExp: |
693 | return ( true ); | 693 | return ( true ); |
694 | case OContactAccess::WildCards: | 694 | case OPimContactAccess::WildCards: |
695 | return ( true ); | 695 | return ( true ); |
696 | case OContactAccess::ExactMatch: | 696 | case OPimContactAccess::ExactMatch: |
697 | return ( true ); | 697 | return ( true ); |
@@ -705,3 +705,3 @@ bool OContactAccessBackend_SQL::hasQuerySettings (uint querySettings) const | |||
705 | 705 | ||
706 | QArray<int> OContactAccessBackend_SQL::sorted( bool asc, int , int , int ) | 706 | QArray<int> OPimContactAccessBackend_SQL::sorted( bool asc, int , int , int ) |
707 | { | 707 | { |
@@ -737,3 +737,3 @@ QArray<int> OContactAccessBackend_SQL::sorted( bool asc, int , int , int ) | |||
737 | 737 | ||
738 | void OContactAccessBackend_SQL::update() | 738 | void OPimContactAccessBackend_SQL::update() |
739 | { | 739 | { |
@@ -758,3 +758,3 @@ void OContactAccessBackend_SQL::update() | |||
758 | 758 | ||
759 | QArray<int> OContactAccessBackend_SQL::extractUids( OSQLResult& res ) const | 759 | QArray<int> OPimContactAccessBackend_SQL::extractUids( OSQLResult& res ) const |
760 | { | 760 | { |
@@ -780,3 +780,3 @@ QArray<int> OContactAccessBackend_SQL::extractUids( OSQLResult& res ) const | |||
780 | #ifdef __STORE_HORIZONTAL_ | 780 | #ifdef __STORE_HORIZONTAL_ |
781 | QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | 781 | QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) const |
782 | { | 782 | { |
@@ -800,4 +800,4 @@ QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | |||
800 | // Now loop through all columns | 800 | // Now loop through all columns |
801 | QStringList fieldList = OContactFields::untrfields( false ); | 801 | QStringList fieldList = OPimContactFields::untrfields( false ); |
802 | QMap<QString, int> translate = OContactFields::untrFieldsToId(); | 802 | QMap<QString, int> translate = OPimContactFields::untrFieldsToId(); |
803 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ | 803 | for ( QStringList::Iterator it = ++fieldList.begin(); it != fieldList.end(); ++it ){ |
@@ -822,3 +822,3 @@ QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | |||
822 | QDate date( year, month, day ); | 822 | QDate date( year, month, day ); |
823 | nonCustomMap.insert( id, OConversion::dateToString( date ) ); | 823 | nonCustomMap.insert( id, OPimDateConversion::dateToString( date ) ); |
824 | } | 824 | } |
@@ -845,3 +845,3 @@ QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | |||
845 | 845 | ||
846 | QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | 846 | QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) const |
847 | { | 847 | { |
@@ -868,3 +868,3 @@ QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | |||
868 | t3.start(); | 868 | t3.start(); |
869 | QMap<QString, int> translateMap = OContactFields::untrFieldsToId(); | 869 | QMap<QString, int> translateMap = OPimContactFields::untrFieldsToId(); |
870 | 870 | ||
@@ -889,3 +889,3 @@ QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | |||
889 | QDate date( year, month, day ); | 889 | QDate date( year, month, day ); |
890 | nonCustomMap.insert( typeId, OConversion::dateToString( date ) ); | 890 | nonCustomMap.insert( typeId, OPimDateConversion::dateToString( date ) ); |
891 | } | 891 | } |
@@ -908,3 +908,3 @@ QMap<int, QString> OContactAccessBackend_SQL::requestNonCustom( int uid ) const | |||
908 | 908 | ||
909 | QMap<QString, QString> OContactAccessBackend_SQL::requestCustom( int uid ) const | 909 | QMap<QString, QString> OPimContactAccessBackend_SQL::requestCustom( int uid ) const |
910 | { | 910 | { |