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

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Recently uploaded (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

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