SlideShare a Scribd company logo
1 of 16
Download to read offline
Drupal 7
Database API

 Andriy Podanenko
  a.podanenko@simbioz.com.ua
Gold Sponsor of
DrupalCamp Kyiv 2011
Silver Sponsors of
DrupalCamp Kyiv 2011
Server configuration

PHP 5.0+ (5.3+ recommended)
php5-pdo
php5-pdo_mysql
php5-pdo_pgsql
php5-pdo_sqlite
mysql, postgres…
Apache1.3+ (or php cgi enabled web server)
The start…

php.net/pdo
<?php
abstract class DatabaseConnection extends
PDO
…

// Drupal fun…
// Because the other methods don't seem to work right.
$driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
Class Hierarhy
    abstract class DatabaseConnection extends PDO…




DatabaseConnection
DatabaseConnection::select db_select   (SelectQuery)
DatabaseConnection::delete db_delete   (DeleteQuery)
DatabaseConnection::update db_update   (UpdateQuery)
DatabaseConnection::query db_query     (DatabaseStatementInterface)
DatabaseConnection::insert db_insert   (InsertQuery)
DatabaseConnection::merge db_merge     (MergeQuery)
…
DatabaseStatementInterface




•
  execute ($args=array(), $options=array())
•
  fetchAllAssoc ($key, $fetch=NULL)
•
  fetchAllKeyed ($key_index=0, $value_index=1)
•
  fetchAssoc ()
•
  fetchCol ($index=0)
•
  fetchField ($index=0)
•
  getQueryString ()
•
  rowCount ()     (UPDATE, DELETE, INSERT only)
Query interface hierarchy
db_select
SELECT name,description FROM taxonomy_term_data AS ttd
WHERE tid LIKE 79
<?php //Drupal
$result = db_select('taxonomy_term_data', 'ttd');
//returned SelectQuery
$ret = $result -> fields('ttd', array('name', 'description'));
//returned SelectQueryInterface
$ret = $result -> condition('tid', 79, 'like');
// returned QueryConditionInterface
$ret = $result -> execute(); // returned SelectQuery object
$data = $ret -> fetchAll(); // fetched data as object from database
Other database (target)

$result = db_select('taxonomy_term_data', 'ttd',
array('target' => 'slave'));
// adding other database at runtime
Database::addConnectionInfo('default', 'slave',
array(
 'database' => ‘other_db',
 'username' => ‘name', 'password' => 'pass',
 'host' => 'localhost', 'port' => '5432',
 'driver' => 'pgsql'));
DatabaseTransaction
            (innodb,pgsql)
<?php
function demo_transaction()
$temp = db_transaction();
db_update… // charging account1 +100$
db_update… // charging account2 -100$
db_insert… // creating log entry for that
return TRUE; // automatically commit (no $temp)
} //
$error->handle  try{} catch{}

<?php
function demo_transaction()
$temp = db_transaction();
try {
db_insert… // some ugly code here…
return TRUE; }
catch(Exception $e) { $temp->rollback();
watchdog(‘demo error', print_r($e, TRUE)}
logging -> DatabaseLog

$demo_log = new DatabaseLog;
$demo_log->start(‘some_key’);
db_update…
db_select…
// Calling functions or any…
$demo_log->end(‘some_key’);
print_r($demo_log->get(‘some_key’), TRUE);
// printed indexed array for all queries…
Drupal 6 – dbtng module (backport)

                         drupal.org/project/dbtng
     dbtng_* (full functions list in dbtng.module)
                                       dbtng_query
                                  dbtng_set_active
                                          db_select
                       •
                        good for support old sites
   •
     multi database setup possibility for Drupal 6
                     •
                      preparing code for upgrade
Useful links

•
 api.drupal.org/api/drupal/7
•
 drupal.org/developing/api/database
•
 upgrade.boombatower.com/tools/sql/inline
•
 drupal.org/project/coder
•
 php.net/pdo
•
 drupal.org/project/dbtng
•
 drupal.org/node/310069
Drupal DB api->executed();

           
            twitter.com/podarok
           
            facebook.com/podarok
           
            vkontakte.ru/podarokua
           
               a.podanenko@simbioz.com.ua
           
            drupal.org/user/116002
           
            drupal.ua/user/23




                        http://simbioz.ua

More Related Content

What's hot

Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8Théodore Biadala
 
Large Scale Crawling with Apache Nutch and Friends
Large Scale Crawling with Apache Nutch and FriendsLarge Scale Crawling with Apache Nutch and Friends
Large Scale Crawling with Apache Nutch and Friendslucenerevolution
 
Web scraping with nutch solr part 2
Web scraping with nutch solr part 2Web scraping with nutch solr part 2
Web scraping with nutch solr part 2Mike Frampton
 
Exported resources design patterns
Exported resources design patternsExported resources design patterns
Exported resources design patternsYevgeny Trachtinov
 
Building data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemyBuilding data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemyRoger Barnes
 
Hawq Hcatalog Integration
Hawq Hcatalog IntegrationHawq Hcatalog Integration
Hawq Hcatalog IntegrationShivram Mani
 
HCatalog Hadoop Summit 2011
HCatalog Hadoop Summit 2011HCatalog Hadoop Summit 2011
HCatalog Hadoop Summit 2011Hortonworks
 
Friends of Solr - Nutch & HDFS
Friends of Solr - Nutch & HDFSFriends of Solr - Nutch & HDFS
Friends of Solr - Nutch & HDFSSaumitra Srivastav
 
8b. Column Oriented Databases Lab
8b. Column Oriented Databases Lab8b. Column Oriented Databases Lab
8b. Column Oriented Databases LabFabio Fumarola
 
Introduction to apache nutch
Introduction to apache nutchIntroduction to apache nutch
Introduction to apache nutchSigmoid
 
8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker8a. How To Setup HBase with Docker
8a. How To Setup HBase with DockerFabio Fumarola
 
Geodaten & Drupal 7
Geodaten & Drupal 7Geodaten & Drupal 7
Geodaten & Drupal 7Michael Milz
 
Boosting MongoDB performance
Boosting MongoDB performanceBoosting MongoDB performance
Boosting MongoDB performanceAlexei Panin
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDBDavid Coallier
 

What's hot (20)

Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8Upgrade your javascript to drupal 8
Upgrade your javascript to drupal 8
 
Postgresql Federation
Postgresql FederationPostgresql Federation
Postgresql Federation
 
Large Scale Crawling with Apache Nutch and Friends
Large Scale Crawling with Apache Nutch and FriendsLarge Scale Crawling with Apache Nutch and Friends
Large Scale Crawling with Apache Nutch and Friends
 
Web scraping with nutch solr part 2
Web scraping with nutch solr part 2Web scraping with nutch solr part 2
Web scraping with nutch solr part 2
 
Exported resources design patterns
Exported resources design patternsExported resources design patterns
Exported resources design patterns
 
Building data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemyBuilding data flows with Celery and SQLAlchemy
Building data flows with Celery and SQLAlchemy
 
Hawq Hcatalog Integration
Hawq Hcatalog IntegrationHawq Hcatalog Integration
Hawq Hcatalog Integration
 
HCatalog Hadoop Summit 2011
HCatalog Hadoop Summit 2011HCatalog Hadoop Summit 2011
HCatalog Hadoop Summit 2011
 
Hive
HiveHive
Hive
 
Friends of Solr - Nutch & HDFS
Friends of Solr - Nutch & HDFSFriends of Solr - Nutch & HDFS
Friends of Solr - Nutch & HDFS
 
8b. Column Oriented Databases Lab
8b. Column Oriented Databases Lab8b. Column Oriented Databases Lab
8b. Column Oriented Databases Lab
 
Introduction to apache nutch
Introduction to apache nutchIntroduction to apache nutch
Introduction to apache nutch
 
MongoDB & PHP
MongoDB & PHPMongoDB & PHP
MongoDB & PHP
 
8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker
 
Geodaten & Drupal 7
Geodaten & Drupal 7Geodaten & Drupal 7
Geodaten & Drupal 7
 
Boosting MongoDB performance
Boosting MongoDB performanceBoosting MongoDB performance
Boosting MongoDB performance
 
Hbase
HbaseHbase
Hbase
 
Hive hcatalog
Hive hcatalogHive hcatalog
Hive hcatalog
 
May 2013 HUG: HCatalog/Hive Data Out
May 2013 HUG: HCatalog/Hive Data OutMay 2013 HUG: HCatalog/Hive Data Out
May 2013 HUG: HCatalog/Hive Data Out
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDB
 

Viewers also liked

Ubercart7 views catalog ru
Ubercart7 views catalog ruUbercart7 views catalog ru
Ubercart7 views catalog ruAndrii Podanenko
 
Drupal 8 configuration development flow
Drupal 8 configuration development flowDrupal 8 configuration development flow
Drupal 8 configuration development flowAndrii Podanenko
 
Drupal codesprint kyiv drupal cafe 07.02.2013
Drupal codesprint   kyiv drupal cafe 07.02.2013Drupal codesprint   kyiv drupal cafe 07.02.2013
Drupal codesprint kyiv drupal cafe 07.02.2013Andrii Podanenko
 
Docker SQL Continuous Integration Flow
Docker SQL Continuous Integration FlowDocker SQL Continuous Integration Flow
Docker SQL Continuous Integration FlowAndrii Podanenko
 
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011camp_drupal_ua
 
Drupal 8 what to wait from
Drupal 8   what to wait fromDrupal 8   what to wait from
Drupal 8 what to wait fromAndrii Podanenko
 
Do + ldo for developers(full)
Do + ldo for developers(full)Do + ldo for developers(full)
Do + ldo for developers(full)Andrii Podanenko
 
Getting started with Ansible. Be efficient.
Getting started with Ansible. Be efficient.Getting started with Ansible. Be efficient.
Getting started with Ansible. Be efficient.Alex S
 
Getting Started with DrupalGap
Getting Started with DrupalGapGetting Started with DrupalGap
Getting Started with DrupalGapAlex S
 
Drupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systemsDrupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systemsAlex S
 
Drupal contrib module maintaining
Drupal contrib module maintainingDrupal contrib module maintaining
Drupal contrib module maintainingAndrii Podanenko
 
Live deployment, ci, drupal
Live deployment, ci, drupalLive deployment, ci, drupal
Live deployment, ci, drupalAndrii Podanenko
 
Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...Alex S
 
Drupal Continuous Integration Workflow
Drupal Continuous Integration WorkflowDrupal Continuous Integration Workflow
Drupal Continuous Integration WorkflowAndrii Podanenko
 
природна і економна дорожня карта для переходу команди розробки на тест центр...
природна і економна дорожня карта для переходу команди розробки на тест центр...природна і економна дорожня карта для переходу команди розробки на тест центр...
природна і економна дорожня карта для переходу команди розробки на тест центр...Andrii Podanenko
 
Історія, теорія та використання CMS Drupal
Історія, теорія та використання CMS DrupalІсторія, теорія та використання CMS Drupal
Історія, теорія та використання CMS DrupalIgor Bronovskyy
 
Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.Andrii Podanenko
 

Viewers also liked (20)

Ubercart7 views catalog ru
Ubercart7 views catalog ruUbercart7 views catalog ru
Ubercart7 views catalog ru
 
Feeds drupal cafe
Feeds drupal cafeFeeds drupal cafe
Feeds drupal cafe
 
Drupal Optimization
Drupal OptimizationDrupal Optimization
Drupal Optimization
 
Drupal 8 configuration development flow
Drupal 8 configuration development flowDrupal 8 configuration development flow
Drupal 8 configuration development flow
 
Drupal codesprint kyiv drupal cafe 07.02.2013
Drupal codesprint   kyiv drupal cafe 07.02.2013Drupal codesprint   kyiv drupal cafe 07.02.2013
Drupal codesprint kyiv drupal cafe 07.02.2013
 
Docker SQL Continuous Integration Flow
Docker SQL Continuous Integration FlowDocker SQL Continuous Integration Flow
Docker SQL Continuous Integration Flow
 
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
 
Drupal 8 what to wait from
Drupal 8   what to wait fromDrupal 8   what to wait from
Drupal 8 what to wait from
 
Do + ldo for developers(full)
Do + ldo for developers(full)Do + ldo for developers(full)
Do + ldo for developers(full)
 
Getting started with Ansible. Be efficient.
Getting started with Ansible. Be efficient.Getting started with Ansible. Be efficient.
Getting started with Ansible. Be efficient.
 
Getting Started with DrupalGap
Getting Started with DrupalGapGetting Started with DrupalGap
Getting Started with DrupalGap
 
Drupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systemsDrupal and diversity of Single sign-on systems
Drupal and diversity of Single sign-on systems
 
Drupal contrib module maintaining
Drupal contrib module maintainingDrupal contrib module maintaining
Drupal contrib module maintaining
 
Live deployment, ci, drupal
Live deployment, ci, drupalLive deployment, ci, drupal
Live deployment, ci, drupal
 
Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...
 
Start using vagrant now!
Start using vagrant now!Start using vagrant now!
Start using vagrant now!
 
Drupal Continuous Integration Workflow
Drupal Continuous Integration WorkflowDrupal Continuous Integration Workflow
Drupal Continuous Integration Workflow
 
природна і економна дорожня карта для переходу команди розробки на тест центр...
природна і економна дорожня карта для переходу команди розробки на тест центр...природна і економна дорожня карта для переходу команди розробки на тест центр...
природна і економна дорожня карта для переходу команди розробки на тест центр...
 
Історія, теорія та використання CMS Drupal
Історія, теорія та використання CMS DrupalІсторія, теорія та використання CMS Drupal
Історія, теорія та використання CMS Drupal
 
Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.
 

Similar to Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011

What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?Alexandru Badiu
 
Convert modules from 6.x to 7.x
Convert modules from 6.x to 7.xConvert modules from 6.x to 7.x
Convert modules from 6.x to 7.xJoão Ventura
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS DrupalMumbai
 
Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes ramakesavan
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Siva Epari
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Developmentipsitamishra
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsLuís Carneiro
 
Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)jimyhuang
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolGordon Forsythe
 
Intro to drupal_7_architecture
Intro to drupal_7_architectureIntro to drupal_7_architecture
Intro to drupal_7_architectureHai Vo Hoang
 
Tools and Tips for Moodle Developers - #mootus16
 Tools and Tips for Moodle Developers - #mootus16 Tools and Tips for Moodle Developers - #mootus16
Tools and Tips for Moodle Developers - #mootus16Dan Poltawski
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesShabir Ahmad
 
Automating Drupal Migrations
Automating Drupal MigrationsAutomating Drupal Migrations
Automating Drupal MigrationslittleMAS
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practicesmanugoel2003
 
Introducing PHP Data Objects
Introducing PHP Data ObjectsIntroducing PHP Data Objects
Introducing PHP Data Objectswebhostingguy
 
Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011Ryan Price
 

Similar to Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011 (20)

Drupal 7 database api
Drupal 7 database api Drupal 7 database api
Drupal 7 database api
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?
 
Convert modules from 6.x to 7.x
Convert modules from 6.x to 7.xConvert modules from 6.x to 7.x
Convert modules from 6.x to 7.x
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS
 
Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Development
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
 
Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)
 
Migrate in Drupal 8
Migrate in Drupal 8Migrate in Drupal 8
Migrate in Drupal 8
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 
Intro to drupal_7_architecture
Intro to drupal_7_architectureIntro to drupal_7_architecture
Intro to drupal_7_architecture
 
Tools and Tips for Moodle Developers - #mootus16
 Tools and Tips for Moodle Developers - #mootus16 Tools and Tips for Moodle Developers - #mootus16
Tools and Tips for Moodle Developers - #mootus16
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API Changes
 
Automating Drupal Migrations
Automating Drupal MigrationsAutomating Drupal Migrations
Automating Drupal Migrations
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Introducing PHP Data Objects
Introducing PHP Data ObjectsIntroducing PHP Data Objects
Introducing PHP Data Objects
 
Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011
 

More from camp_drupal_ua

Peter Lozovitsky.Money under your feet or why you have not already training i...
Peter Lozovitsky.Money under your feet or why you have not already training i...Peter Lozovitsky.Money under your feet or why you have not already training i...
Peter Lozovitsky.Money under your feet or why you have not already training i...camp_drupal_ua
 
Alexandr Shvets.Trends in drupal.DrupalCamp Kyiv 2011
Alexandr Shvets.Trends in drupal.DrupalCamp Kyiv 2011Alexandr Shvets.Trends in drupal.DrupalCamp Kyiv 2011
Alexandr Shvets.Trends in drupal.DrupalCamp Kyiv 2011camp_drupal_ua
 
Dmitry Kostyuk.Cloud hosting for drupal.DrupalCamp Kyiv 2011
Dmitry Kostyuk.Cloud hosting for drupal.DrupalCamp Kyiv 2011Dmitry Kostyuk.Cloud hosting for drupal.DrupalCamp Kyiv 2011
Dmitry Kostyuk.Cloud hosting for drupal.DrupalCamp Kyiv 2011camp_drupal_ua
 
Pavel Makhrinsky.Field API.DrupalCamp Kyiv 2011
Pavel Makhrinsky.Field API.DrupalCamp Kyiv 2011Pavel Makhrinsky.Field API.DrupalCamp Kyiv 2011
Pavel Makhrinsky.Field API.DrupalCamp Kyiv 2011camp_drupal_ua
 
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...camp_drupal_ua
 
Sergey Korzh.CCK 3 presentation.DrupalCamp Kyiv 2011
Sergey Korzh.CCK 3 presentation.DrupalCamp Kyiv 2011Sergey Korzh.CCK 3 presentation.DrupalCamp Kyiv 2011
Sergey Korzh.CCK 3 presentation.DrupalCamp Kyiv 2011camp_drupal_ua
 
Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011
Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011
Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011camp_drupal_ua
 
Artem Pankov.Eclipse.DrupalCamp Kyiv 2011
Artem Pankov.Eclipse.DrupalCamp Kyiv 2011Artem Pankov.Eclipse.DrupalCamp Kyiv 2011
Artem Pankov.Eclipse.DrupalCamp Kyiv 2011camp_drupal_ua
 
Vasily Yaremchuk.Single page website.DrupalCamp Kiev 2011
Vasily Yaremchuk.Single page website.DrupalCamp Kiev 2011Vasily Yaremchuk.Single page website.DrupalCamp Kiev 2011
Vasily Yaremchuk.Single page website.DrupalCamp Kiev 2011camp_drupal_ua
 
Anton Paschenko.Geolocation with Apach Solr using search API.DrupalCamp Kyiv ...
Anton Paschenko.Geolocation with Apach Solr using search API.DrupalCamp Kyiv ...Anton Paschenko.Geolocation with Apach Solr using search API.DrupalCamp Kyiv ...
Anton Paschenko.Geolocation with Apach Solr using search API.DrupalCamp Kyiv ...camp_drupal_ua
 
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011camp_drupal_ua
 
Pavel Prischepa.node load without-restrictions.DrupalCamp Kiev 2011
Pavel Prischepa.node load without-restrictions.DrupalCamp Kiev 2011Pavel Prischepa.node load without-restrictions.DrupalCamp Kiev 2011
Pavel Prischepa.node load without-restrictions.DrupalCamp Kiev 2011camp_drupal_ua
 
Eugene Poltorakov.HTML 5 and drupal.DrupalCamp Kiev 2011
Eugene Poltorakov.HTML 5 and drupal.DrupalCamp Kiev 2011Eugene Poltorakov.HTML 5 and drupal.DrupalCamp Kiev 2011
Eugene Poltorakov.HTML 5 and drupal.DrupalCamp Kiev 2011camp_drupal_ua
 
Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011
Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011
Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011camp_drupal_ua
 
Viktor Levandovsky.Why drupal.DrupalCamp Kyiv 2011
Viktor Levandovsky.Why drupal.DrupalCamp Kyiv 2011Viktor Levandovsky.Why drupal.DrupalCamp Kyiv 2011
Viktor Levandovsky.Why drupal.DrupalCamp Kyiv 2011camp_drupal_ua
 
Petrov Olexandr.Varnish and drupal.DrupalCamp Kyiv 2011
Petrov Olexandr.Varnish and drupal.DrupalCamp Kyiv 2011Petrov Olexandr.Varnish and drupal.DrupalCamp Kyiv 2011
Petrov Olexandr.Varnish and drupal.DrupalCamp Kyiv 2011camp_drupal_ua
 
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011camp_drupal_ua
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011camp_drupal_ua
 
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011camp_drupal_ua
 
Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011
Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011
Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011camp_drupal_ua
 

More from camp_drupal_ua (20)

Peter Lozovitsky.Money under your feet or why you have not already training i...
Peter Lozovitsky.Money under your feet or why you have not already training i...Peter Lozovitsky.Money under your feet or why you have not already training i...
Peter Lozovitsky.Money under your feet or why you have not already training i...
 
Alexandr Shvets.Trends in drupal.DrupalCamp Kyiv 2011
Alexandr Shvets.Trends in drupal.DrupalCamp Kyiv 2011Alexandr Shvets.Trends in drupal.DrupalCamp Kyiv 2011
Alexandr Shvets.Trends in drupal.DrupalCamp Kyiv 2011
 
Dmitry Kostyuk.Cloud hosting for drupal.DrupalCamp Kyiv 2011
Dmitry Kostyuk.Cloud hosting for drupal.DrupalCamp Kyiv 2011Dmitry Kostyuk.Cloud hosting for drupal.DrupalCamp Kyiv 2011
Dmitry Kostyuk.Cloud hosting for drupal.DrupalCamp Kyiv 2011
 
Pavel Makhrinsky.Field API.DrupalCamp Kyiv 2011
Pavel Makhrinsky.Field API.DrupalCamp Kyiv 2011Pavel Makhrinsky.Field API.DrupalCamp Kyiv 2011
Pavel Makhrinsky.Field API.DrupalCamp Kyiv 2011
 
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
Vadim Mirgorod.Best practices for cross browser compatibility of drupal websi...
 
Sergey Korzh.CCK 3 presentation.DrupalCamp Kyiv 2011
Sergey Korzh.CCK 3 presentation.DrupalCamp Kyiv 2011Sergey Korzh.CCK 3 presentation.DrupalCamp Kyiv 2011
Sergey Korzh.CCK 3 presentation.DrupalCamp Kyiv 2011
 
Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011
Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011
Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011
 
Artem Pankov.Eclipse.DrupalCamp Kyiv 2011
Artem Pankov.Eclipse.DrupalCamp Kyiv 2011Artem Pankov.Eclipse.DrupalCamp Kyiv 2011
Artem Pankov.Eclipse.DrupalCamp Kyiv 2011
 
Vasily Yaremchuk.Single page website.DrupalCamp Kiev 2011
Vasily Yaremchuk.Single page website.DrupalCamp Kiev 2011Vasily Yaremchuk.Single page website.DrupalCamp Kiev 2011
Vasily Yaremchuk.Single page website.DrupalCamp Kiev 2011
 
Anton Paschenko.Geolocation with Apach Solr using search API.DrupalCamp Kyiv ...
Anton Paschenko.Geolocation with Apach Solr using search API.DrupalCamp Kyiv ...Anton Paschenko.Geolocation with Apach Solr using search API.DrupalCamp Kyiv ...
Anton Paschenko.Geolocation with Apach Solr using search API.DrupalCamp Kyiv ...
 
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
 
Pavel Prischepa.node load without-restrictions.DrupalCamp Kiev 2011
Pavel Prischepa.node load without-restrictions.DrupalCamp Kiev 2011Pavel Prischepa.node load without-restrictions.DrupalCamp Kiev 2011
Pavel Prischepa.node load without-restrictions.DrupalCamp Kiev 2011
 
Eugene Poltorakov.HTML 5 and drupal.DrupalCamp Kiev 2011
Eugene Poltorakov.HTML 5 and drupal.DrupalCamp Kiev 2011Eugene Poltorakov.HTML 5 and drupal.DrupalCamp Kiev 2011
Eugene Poltorakov.HTML 5 and drupal.DrupalCamp Kiev 2011
 
Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011
Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011
Anna Fedoruk.Theworkflow.DrupalCamp Kyiv 2011
 
Viktor Levandovsky.Why drupal.DrupalCamp Kyiv 2011
Viktor Levandovsky.Why drupal.DrupalCamp Kyiv 2011Viktor Levandovsky.Why drupal.DrupalCamp Kyiv 2011
Viktor Levandovsky.Why drupal.DrupalCamp Kyiv 2011
 
Petrov Olexandr.Varnish and drupal.DrupalCamp Kyiv 2011
Petrov Olexandr.Varnish and drupal.DrupalCamp Kyiv 2011Petrov Olexandr.Varnish and drupal.DrupalCamp Kyiv 2011
Petrov Olexandr.Varnish and drupal.DrupalCamp Kyiv 2011
 
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
 
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
Pankov Artem.Improving drupal performance www.hr portal.ru.DrupalCamp Kyiv 2011
 
Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011
Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011
Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011
 

Recently uploaded

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011

  • 1. Drupal 7 Database API Andriy Podanenko a.podanenko@simbioz.com.ua
  • 4. Server configuration PHP 5.0+ (5.3+ recommended) php5-pdo php5-pdo_mysql php5-pdo_pgsql php5-pdo_sqlite mysql, postgres… Apache1.3+ (or php cgi enabled web server)
  • 5. The start… php.net/pdo <?php abstract class DatabaseConnection extends PDO … // Drupal fun… // Because the other methods don't seem to work right. $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
  • 6. Class Hierarhy abstract class DatabaseConnection extends PDO… DatabaseConnection DatabaseConnection::select db_select (SelectQuery) DatabaseConnection::delete db_delete (DeleteQuery) DatabaseConnection::update db_update (UpdateQuery) DatabaseConnection::query db_query (DatabaseStatementInterface) DatabaseConnection::insert db_insert (InsertQuery) DatabaseConnection::merge db_merge (MergeQuery) …
  • 7. DatabaseStatementInterface • execute ($args=array(), $options=array()) • fetchAllAssoc ($key, $fetch=NULL) • fetchAllKeyed ($key_index=0, $value_index=1) • fetchAssoc () • fetchCol ($index=0) • fetchField ($index=0) • getQueryString () • rowCount () (UPDATE, DELETE, INSERT only)
  • 9. db_select SELECT name,description FROM taxonomy_term_data AS ttd WHERE tid LIKE 79 <?php //Drupal $result = db_select('taxonomy_term_data', 'ttd'); //returned SelectQuery $ret = $result -> fields('ttd', array('name', 'description')); //returned SelectQueryInterface $ret = $result -> condition('tid', 79, 'like'); // returned QueryConditionInterface $ret = $result -> execute(); // returned SelectQuery object $data = $ret -> fetchAll(); // fetched data as object from database
  • 10. Other database (target) $result = db_select('taxonomy_term_data', 'ttd', array('target' => 'slave')); // adding other database at runtime Database::addConnectionInfo('default', 'slave', array( 'database' => ‘other_db', 'username' => ‘name', 'password' => 'pass', 'host' => 'localhost', 'port' => '5432', 'driver' => 'pgsql'));
  • 11. DatabaseTransaction (innodb,pgsql) <?php function demo_transaction() $temp = db_transaction(); db_update… // charging account1 +100$ db_update… // charging account2 -100$ db_insert… // creating log entry for that return TRUE; // automatically commit (no $temp) } //
  • 12. $error->handle  try{} catch{} <?php function demo_transaction() $temp = db_transaction(); try { db_insert… // some ugly code here… return TRUE; } catch(Exception $e) { $temp->rollback(); watchdog(‘demo error', print_r($e, TRUE)}
  • 13. logging -> DatabaseLog $demo_log = new DatabaseLog; $demo_log->start(‘some_key’); db_update… db_select… // Calling functions or any… $demo_log->end(‘some_key’); print_r($demo_log->get(‘some_key’), TRUE); // printed indexed array for all queries…
  • 14. Drupal 6 – dbtng module (backport) drupal.org/project/dbtng dbtng_* (full functions list in dbtng.module) dbtng_query dbtng_set_active db_select • good for support old sites • multi database setup possibility for Drupal 6 • preparing code for upgrade
  • 15. Useful links • api.drupal.org/api/drupal/7 • drupal.org/developing/api/database • upgrade.boombatower.com/tools/sql/inline • drupal.org/project/coder • php.net/pdo • drupal.org/project/dbtng • drupal.org/node/310069
  • 16. Drupal DB api->executed();  twitter.com/podarok  facebook.com/podarok  vkontakte.ru/podarokua  a.podanenko@simbioz.com.ua  drupal.org/user/116002  drupal.ua/user/23 http://simbioz.ua