So-net無料ブログ作成

PostgreSQL や Firebird で自動採番された主キーの値を INSERT 時に知る [RDBMS]

・SQLite3 で id INTEGER PRIMARY KEY
・MySQLで id AUTO_INCRIMENT PRIMARY KEY
としておくと、cursor.execute() の後の cursor.lastrowid で、id の値が取ってこれる(Python的に)。
http://www.randynetwork.com/blog/46
それは知ってた。

んでもって、PostgreSQL(psycopg2) でも lastrowid って、とってこれるんだけど、それって oid で、主キーの値でないんだよねぇ、と思っていたら、PostgreSQL 8.2 から INSERT文 にRETURNING 句というのを付けると好きな値を取ってこれるらしい。
http://lists.initd.org/pipermail/psycopg/2008-July/006112.html

そして、Firebird でも 2.0 から使えるようになっていて、しかも FAQ。
http://www.firebirdfaq.org/faq243/
ちょっと試してみたところ、 kinterbasdb でも値が取得できる。

うーん、知らんかった。

ちなみに、Firebird 2.0 以降では、トリガーを使わなくてもシーケンス番号を設定することができるようになったので、これと組み合わせればシーケンス番号の追加のためだけのトリガーを作成しなくてもよくなる。
http://nakagami.blog.so-net.ne.jp/2006-04-01

nice!(0)  コメント(20)  トラックバック(0) 
共通テーマ:パソコン・インターネット

nice! 0

コメント 20

CarlosNum

1000000+ unique high-ranking visitors from the US, AU, CA, UK per month to your site
Hello.
If you need to have so much quality traffic without only a few body movements, you can find the funniness here: http://make[dot - ultimate-link-building[dot - info/
([dot - replaced by .)
by CarlosNum (2018-05-01 10:24) 

Thomasnoits

Hello. And Bye. Vghrufwiodjowifuegijefqolw
by Thomasnoits (2018-10-14 00:27) 

RaymondUnfag

harvard essay writing <a href=http://www.abcagency.se/uyessayonline39021>purdue owl essay writing</a>
writing the persuasive essay <a href=http://www.vkvi.net/uyessayonline20069>how to write a critical evaluation essay</a>
writing analytical essays <a href=http://goto.iamaws.com/uyessayonline54379>how to write a intro paragraph for an essay</a>
latest topics for essay writing <a href=http://www.vkvi.net/uyessayonline20069>how to write a critical evaluation essay</a>
how to write a university application essay <a href=http://stwnsh.com/writemyessayonline63370>writing essays services</a>
writing essays services <a href=http://corta.co/essaywritersonline42992>writing essay services</a>
how to write a convincing essay <a href=http://84030.ml/uyessayonline96735>essay writing my family</a>
best essay writing sites <a href=http://gaei.tk/howtowriteanessays77185>how to write a movie essay</a>
example of writing an essay <a href=http://www.1lnk.net//writemyessays22504>how to write a good essay introduction</a>
by RaymondUnfag (2018-10-15 05:55) 

Patrickfible

write an essay on <a href=https://aaa.moda/writeareflectionessay69570>writing descriptive essay</a>
essay writing tools <a href=http://ralive.de/autoessaywriter88754>writing a quote in an essay</a>
how to start writing an essay examples <a href=http://999.sh/howtowriteadbqessay69686>help with college essay writing</a>
writing the body of an essay <a href=http://rih.co/uyessayonline33626>writing the introduction of an essay</a>
good movies to write an essay on <a href=http://www.1lnk.net//uyessayonline67022>help writing college essay</a>
writing a cause and effect essay examples <a href=http://84028.ml/essaywritingservicesreviews16890>write an essay about</a>
write analysis essay <a href=https://crwl.it/uyessayonline18580>writing college essays for money</a>
writing a comparison and contrast essay <a href=http://motz.tk/writinganarrativeessay86158>tips for essay writing in english</a>
how to write a professional essay <a href=http://xn--n1af6d.net/Buyessayonline12088>buy custom essays online</a>
by Patrickfible (2018-10-15 05:55) 

AlbertPew

how to write a critique essay <a href=http://rih.co/uyessayonline29808>how to write college application essays</a>
how to write an art critique essay <a href=http://l776.us/howtowriteananalysisessay78418>essay writer</a>
the proper way to write an essay <a href=http://84028.ml/uyessayonline11231>how to improve my essay writing</a>
german essay writing <a href=http://perkele.ovh/essaywritings81978>how to write an essay for graduate school</a>
essay writing for english tests <a href=https://dziku.ovh/Buyessayonline99029>how to write mba essays</a>
how to write a self assessment essay <a href=http://www.short4free.us/Buyessayonline97381>excellent essay writings</a>
essay writing pdf <a href=http://www.abcagency.se/uyessayonline99791>buy essay online safe</a>
essay to write <a href=http://999.sh/uyessayonline90100>writing a history essay</a>
teel essay writing <a href=http://yourls.site/topessaywritingservices61257>write a comparison essay</a>
by AlbertPew (2018-10-15 05:55) 

DavidAvave

writing a literature essay <a href=http://www.nomore.cards/howtowriteasummaryessay24671>essay writing about my best friend</a>
writing and essay <a href=http://stwnsh.com/Buyessayonline24875>teaching essay writing high school</a>
how to write an art critique essay <a href=http://stwnsh.com/howtowritesynthesisessay20661>buy law essay</a>
how to write a thematic essay <a href=http://www.link.netsons.org/uyessayonline27695>rules for essay writing competition</a>
how to write the college essay <a href=http://motz.tk/howtowriteacollegeapplicationessay61974>how to write a proper essay</a>
buy pre written essays <a href=http://stras.me/howtowritearhetoricalanalysisessay30579>self reflective essay on writing</a>
how to write argument essay <a href=https://dziku.ovh/howtowriteessayfast84161>writing an autobiography essay</a>
a level essay writing <a href=http://y.saudhosting.com/uyessayonline50203>my best friend essay writing</a>
essay writing review <a href=https://ameo.link/thesite>writing academic essays</a>
by DavidAvave (2018-10-15 05:55) 

JamesClief

how to write a university essay <a href=http://www.lookweb.it/helpwritinganessay90426>guided essay writing</a>
how to write a essay in english <a href=http://84028.ml/howtowritearesearchessay47152>essay writing phrases</a>
writing critical essays <a href=https://crwl.it/writingcollegeessays30946>youtube essay writing</a>
how to write an admission essay for graduate school <a href=https://tinyurl.com/Buyessayonline60105>writing a critical analysis essay</a>
essay writing images <a href=http://84028.ml/uyessayonline67466>how to write dialogue in an essay</a>
write custom essays <a href=http://corta.co/Buyessayonline12949>how to write a thesis statement for a research essay</a>
owl essay writing <a href=http://recorta.es/writingascholarshipessay42764>how to write a reflective essay</a>
writing an essay powerpoint <a href=https://dziku.ovh/howtowritecollegeessays67866>buy custom essay</a>
essay writing tips for ielts <a href=http://xn--n1af6d.net/Buyessayonline12696>where can i buy essays online</a>
by JamesClief (2018-10-15 05:56) 

Bobbyvieni

Free Dating Site for AU Singles: https://crwl.it/adultdatingonline45389
The Best Free Dating Site: https://is.gd/adultdatingonline33798
Girls for sex in your town: http://www.lookweb.it/adultdatingonline92035
Free Dating Site for UK Singles: http://ralive.de/adultdatingonline33644




dating sites free to lookfree dating site for mobilehalf life and radioisotope dating worksheet answersdating analogysoulmate online datingexample personal dating adssahuarita datingmarine corps dating sitesdating protocol first datesfree dating ukrainian siteshook up two monitorshook up mcallen txpixel gun 3d online datingsinopsis marriage not dating ep 7 part 2dating second cousinjapanese simulation dating games onlinedating websites for hard of hearingthe idea of dating scares meolder dating online safree christian dating chat roomszim sa online datingfree dating uk no sign upinternet dating for 11 year oldsdating site shirtlessdating ads newspaperatlanta speed dating meetupbest vegetarian dating websitesfree dating sites south africa cape towntrusted dating sites australiacarbon dating mt saint helensentp and infp datingare dating sites a good ideayoona and donghae datinglusaka dating sitesknow if your dating psychopath
by Bobbyvieni (2018-10-23 01:43) 

Charlesinimi

how earn money online by typing:
<a href=http://www.youtube.com/watch?v=xlDwDtCqPD0>game to earn money online</a>
<a href=http://www.youtube.com/watch?v=DvSyHUcHh3o>learn earn money online</a>
<a href=http://www.youtube.com/watch?v=HrjYoU23r1E>earn money online youtube views</a>
<a href=http://www.youtube.com/watch?v=cttAwrzpIjY>earn money online 2017 india</a>
<a href=http://www.youtube.com/watch?v=y2amZtfwuTk>earn money online job from home</a>

Popular Tags: earn extra money online surveyslegitimate ways to earn money onlinehow to make money with playing online gameshow to make money by selling books onlinethe best online money making sitesmaking money online in chinamaking money online as a teachertop sites to make money onlineblack desert online how to make money fishingwhat can i do right now to make money onlinehow to make money online in usways to make money online quoragraphic design make money onlineare money making apps legalhow to make money online pdfearn money online telugu 2018how to earn money with mobile onlinetop money earning apps 2018 in telugumake money on ios appsearn money online legitmake money online fast no scamshow to make money online with emaileve online beginner's guide to making iskhow to earn money online from appsmake money online and get paid by cheque
by Charlesinimi (2018-11-23 22:57) 

AnthonyHanny

best money making apps for ios:
<a href=http://www.youtube.com/watch?v=YBsTXMt3zPI>earn money online to paypal</a>
<a href=http://www.youtube.com/watch?v=WD48OAImUwM>earn money online legitimately</a>
<a href=http://www.youtube.com/watch?v=aOec_05J35I>make money online 6 figures</a>
<a href=http://www.youtube.com/watch?v=BDXPGqN8um0>earn money online on pc</a>
<a href=http://www.youtube.com/watch?v=fiualfv_gDc>make money online yoonla</a>

Popular Tags: can you earn money from surveys onlinegetting paid for online surveys ukhow to make money on betting exchangesto make real money onlinehow to earn money online with drawingsways to earn extra income onlinemake money with an online storehow to make money online under 18 ukhow to make money with mechanical turkhow to make money of online surveyshow to earn money online through governmentmaking money writing articles onlineeasy ways to make money from home onlineplay chess earn money onlinemoney for online surveys ukmake money online fbhow much money can you make on amazon mturkmake money online web chat ukbest way to earn money online apponline money making in americaearn money watching videos apphow to get money by online businesshow to make money online with android mobilemake money easy onlineearn money online with paypal
by AnthonyHanny (2018-11-25 13:54) 

lightroomciz

"https://adobe.com/" - Adobe Lightroom is the most famous epitome editing software because the gain photographers, with hundreds of thousands of effects and presets within reach on the internet.

You can download Lightroom from Adobe’s website.

"https://en.wikipedia.org/wiki/Adobe_Lightroom" - Adobe Lightroom presets help you to redact your photos in register time by means of doing a lot of the position suitable you. You can plainly crack old-fashioned a pre-defined capacity, while keeping your original aspect and reverting recoil from to it at anytime.

You can use:
Lightroom Presets for Wedding Photography
Lightroom Presets for Baby and Family Photography
Lightroom Presets for Headshots
Lightroom Presets for Senior Portraits
Lightroom Presets for Landscape
Lightroom Presets for Nature Photography
Lightroom Presets for Food Photography
Lightroom Presets for Car Photography
Lightroom Presets for Real Estate
Lightroom Presets for Product and Fashion Photography

And a "https://mrlightroom.com/shop/lightroom-presets/orange-theme-lightroom-desktop-and-mobile-presets/" - Orange Theme Lightroom Desktop and Mobile Presets
for everyday shooting.


by lightroomciz (2019-04-23 00:13) 

Auststeend

Comprar Viagra Con Mastercard Priligy 30mg Tablets <a href=http://buyoxys.com>buy levitra overnight</a> Dapoxetine Prix
by Auststeend (2019-04-30 18:34) 

Auststeend

Precio Cialis 5 Mg 28 Comprimidos En Farmacias <a href=http://buyciali.com>cialis cheapest online prices</a> Levitra Comprare Viagra Zurich Levitra Preiswert
by Auststeend (2019-05-30 19:20) 

Ellemossy

Finasteride Avidart Propecia Viagra Generika Gefahrlich <a href=http://ciali5mg.com>cialis 5mg best price</a> Where To Buy Cialis 20mg In Uk Prix Cialis France Pharmacie
by Ellemossy (2019-06-03 06:30) 

FranSkige

Isotretinoin acutane Amoxicillin Abnormal Dreams Kamagra Fast London <a href=http://cialionline.com>cialis 5mg best price</a> Kamagra Vente Libre Kamagra Online Prescription Secure Ordering Real Bentyl Price Best Website
by FranSkige (2019-06-03 10:23) 

Ellemossy

Cialis Canada Generic <a href=http://adrugo.com>online cialis</a> Cytotec En Gynecologie Cialis Generit Acheter Vrai Viagra En Ligne
by Ellemossy (2019-06-19 09:22) 

Auststeend

Lisinopril For Sale Progesterone Australia Anastrozole Benefits For Men <a href=http://lapizmoon.com>generic cialis overnight delivery</a> Can You Safely Take Expired Amoxicillin Cialis Generique Prezzo Cialis Italia
by Auststeend (2019-07-01 09:37) 

FranSkige

Cephalexin Antibiotic Cialis Kaufen Erfahrungsbericht Glucotrol Antibiotics Without A Script <a href=http://buycialonline.com>generic 5mg cialis best price</a> Doxycycline 10mg Overseas Low Price
by FranSkige (2019-07-05 06:11) 

FranSkige

Side Effecrs Of Amoxicillin <a href=http://cialgeneri.com>canadian cialis</a> Cytotec Online Purchase In Singapore
by FranSkige (2019-07-12 07:37) 

Ellemossy

Priligy Sample Canadian Discount Pharmacies <a href=http://aaost.com>canadian pharmacy cialis</a> Propecia Comparativa Kamagra Oral Jelly Where To Buy
by Ellemossy (2019-07-20 00:18) 

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

Facebook コメント

トラックバック 0