siddham chesina prakatana

database management systems (dbms) loe, tayaaru chesina statement, paramiti prakatana ledhaa paramiti prasna anedi database ess. kyuu. ell kodnu mundhe sankalanam chesi, phalitaalanu nilva chesi, dayta nundi vaeru chese lakshanam. tayaaruchesina prakatanala yokka prayojanaaluh
tayaaruchesina prakatana mundugaa sankalanam chesina template roopaanni teesukuntundi, dheenilo prati amalu samayamlo sthiramaina viluvalu pratyaamnaayam cheyabadataayi mariyu saadhaaranamgaa choppinchadam, enchukovadam ledhaa naveekarinchadam vanti SQL DML statementlanu upayogistundi.
siddham chesina prakatanalaku oka saadhaarana pani pravaham emitante
siddham chesina prakatanaku pratyaamnaayam code mariyu daetaanu militam chese vidhamgaa application soars code nundi neerugaa SQL nii coll cheyadam. paina perkonna udaaharanaku pratyaksha samaanamainadih
utpattulu (paeru, dhara) viluvalu ("bike", "10900") loki choppinchandi;
rendu kaaranaala valla statement template sankalanam cheyabadina samayamlo anni optimisations nirvahinchalemuhu uttama pranaalika paaraamitula yokka nirdishta viluvalapai aadharapadi undavacchu, mariyu pattikalu mariyu suuchikalu kalakramena maarutunnanduna uttama pranaalika maaravacchu.
marovaipu, oka prasna okasari matrame amalu cheyabadithe, sarvarku adanapu round-trip kaaranamgaa sarvar-side tayaaru chesina statementlu nemmadigaa untaayi. amalu parimitulu paniteeru jarimaanaalaku kooda daariteeyavachchu; udaaharanaku, mysql yokka konni samskaranalu siddham chesina prasnala phalitaalanu kaash cheyaledu. 
nilva cheyabadina vidhanam, idhi mundugaane sankalanam cheyabadi, taruvaata amalu kosam sarvarlo nilva cheyabadutundi, ilanti prayojanaalanu kaligi untundi. nilva chesina vidhaanaaniki bhinnamgaa, tayaaru chesina prakatana saadhaaranamgaa vidhaanaparamaina bhaashalo vraayabadadu mariyu asthiraalanu upayoginchadu ledhaa savarinchadu ledhaa niyantrana pravaaha nirmaanaalanu upayoginchadu, badulugaa declarative database prasna bhashapai aadharapadi untundi. vaati saralata mariyu client-side anukarana kaaranamgaa, tayaaruchesina prakatanalu vikretalalo marinta portable gaa untaayi.
software maddatu.
squalite, mysql, orakil, ibm ibm, microsoft sql sarvar mariyu postgreskwile vanti pradhana dbms luu tayaaru chesina statementlaku maddatu istayi. tayaaru chesina prakatanalu saadhaaranamgaa SQL injection nundi saamarthyam mariyu rakshana kosam naan-SQL binary protocol dwara amalu cheyabadataayi, ayithe myskwal tayaaru chesina prakatanalu vanti konni dbms thoo debugging prayojanaala kosam SQL vaakyanirmanaanni upayoginchi kooda andubaatulo untaayi. 
aneka prograaming bhashalu vaari praamaanika grandhalayalalo tayaaru chesina prakatanalaku maddatu istayi mariyu jaava yokka jdbc, perl yokka dbi, php yokka pdo mariyu paithan yokka db-apiaitho sahaa antarleena dbmlu maddatu ivvakapoyina client vaipu vaatini anukaristaayi. sarvarku round tripla sankhyanu tagginchadam dwara okasari matrame amalu cheyabade prasnalaku client-side emulation vaegamgaa untundi, conny saadhaaranamgaa chalasarlu amalu cheyabadina prasnalaku nemmadigaa untundi. idhi SQL injection daadulanu samanamga samarthavantamgaa nirodhistundi.
aksharaalanu nilipiveyadam" dwara aneka rakaala SQL injection daadulanu tolaginchavacchu, samarthavantamgaa tayaaru chesina prakatanala upayogam avasaram; H2 matrame eee lakshanaaniki maddatu istundi.
udaaharanalu.
jaava jdbc.
eee udaaharana jaava mariyu jdbcni upayogistundih
digumati com.mysql.jdbc.jdbc2.optional.myscledatasource;
javanu digumati chesukondi.SQL.anusandhanam;
javanu digumati chesukondi.SQL.driver manager;
javanu digumati chesukondi.SQL.siddham prakatana;
javanu digumati chesukondi.SQL.phalitaalanu;
javanu digumati chesukondi.SQL.squelexeption;
javanu digumati chesukondi.SQL.prakatana;
public class pradhana {
 public static woyd maine (string [] orgs) squelexeption visurutundi {
 mysqualdatasores ds = nyuu mysqualdatasores ();
 ds.settatabacenem ("mysql");
 ds.setuser ("ruut");
 prayatninchandi (connection cohn = ds.connection pondandi ()) {
 prayatninchandi (statement STMT = cohn.create statement ()) {
 ess. tii. emm. tii.amalu thedhee ("utpattulu lekapothe pattikanu srushtinchandi (varchar (40), dhara inta)");
 prayatninchandi (prepaired statement STMT = cohn.tayari prakatana ("utpattula viluvalalo choppinchandi (?,?)) {
 ess. tii. emm. tii.sett string (1, "bike");
 ess. tii. emm. tii.settint (2,9900);
 ess. tii. emm. tii.amalu thedhee ();
 ess. tii. emm. tii.sett string (1, "bootlu");
 ess. tii. emm. tii.settint (2,7400);
 ess. tii. emm. tii.amalu thedhee ();
 ess. tii. emm. tii.sett string (1, "phone");
 ess. tii. emm. tii.settint (2,29500);
 ess. tii. emm. tii.amalu thedhee ();
 prayatninchandi (prepaired statement STMT = cohn.tayari prakatana ("paeru = ekkada undho utpattula nundi * enchukondi?") {
 ess. tii. emm. tii.sett string (1, "bootlu");
 phalitaanni rs = STMT gaa sett cheyandi.amalu ();
 ruu.tadupari ();
 vyavastha.bayataki.println (rs.gattint (2));
jaava kokvij _ 1 "settarlu" (kokvij _ 2 modalainavi) andistundi.) anni pradhana antarnirmita dayta rakaala kosam.
PHP pdo.
eee udaaharana PHP mariyu PDO nii upayogistundih
<?php
prayatninchandi {
 //"ruut" anae sankethapadamtho "mys ql" anae databaseku connect cheyandi."
 $connection = kotta pdo ('mys ql dbname = mys ql', 'ruut');
 //connectionpy oka abhyardhananu amalu cheyandi, adhi srushtistundi
 //rendu niluvu varusalatho kuudina pattika "utpattulu", "paeru" mariyu "dhara"
 $connection-> execute ('utpattulu lekapothe pattikanu srushtinchandi (varchar (40), dhara inta)');
 //pattikalo bahula utpattulanu choppinchadaaniki oka prasnanu siddham cheyandi
 $statement = $connection-> siddham cheyandi ('utpattula viluvalalo choppinchandi (?,?));
 $utpattulu = [
 ['bike', 10900],
 ['bootlu', 7400],
 ['phone', 29500],
 //"utpattulu" shreniloni utpattula dwara punaraavrutam cheyandi, mariyu
 //prati utpattiki siddham chesina prakatnanu amalu cheyandi
 forch ($utpattulu $utpattigaa) {
 $statement-> amalu cheyandi ($utpatti);
 //perunna paraamititoe kotta prakatnanu siddham cheyandi
 $statement = $connection-> siddham cheyandi ('paeru =: paeru' unna utpattula nundi * enchukondi);
 $statement-> amalu cheyandi ([
 ': paeru' => 'bootlu',
 //utpatti paeru mariyu daani dharanu ketaayinchadaaniki shrenini naasanam cheyadaaniki upayoginchandi
 //sambandhita chararaasulaku
 [$utpatti, $dhara] = $prakatana-> pondandi ();
 //phalitaanni viniyogadaaruku pradarsinchandi
 pratidhvani "utpatti yokka dhara {$utpatti}\${$dhara}.";
 //karsarnu moosiveyandi, tadwara 'fetch' nuu chivariki mallee upayoginchavacchu
 $statement-> klojkarsar ();
} catch (\exception $e) {
 pratidhvani 'oka dosham sambhavinchindihi'. $e-> getmessage ();
purl dbi.
eee udaaharana perl mariyu dbini upayogistundih
kathinamgaa upayoginchandi;
dbini upayoginchandi;
naa ($db _ name, $db _ user, $db _ password) = ('mye _ database', 'moyi', 'password');
naa $dbh = dbi-> anusandhanam ("dbi: MySql: database = $db _ name", $db _ user, $db _ password,
 {raijar error => 1, auto kamit => 1})
 ledhaa databaseku $db _ name "kuu anusandhaaninchetappudu" lopam (pradhaanamainadih dbi-> connect) ".
 $dbi:: errstr. "\n";
$dbh-> cheyandi ('utpattulu lekapothe pattikanu srushtinchandi (varchar (40), dhara inta)');
naa $sth = $dbh-> siddham cheyandi ('utpattula viluvalalo choppinchandi (?,?));
$STH-> amalu cheyandi (@$_) forch ['bike', 10900], ['bootlu', 7400], ['phone', 29500];
$STH = $dbh-> siddham cheyandi ("paeru = ekkada undho utpattula nundi * enchukondi?");
$estihetch-> amalu cheyandi ('bootlu');
$$_ [1] \n" nuu mudrinchandi $sth-> fetchro _ arreref;
$st-> mugimpu;
$dbh-> disconnect;
sii #adoo.nett.
eee udaaharana sii #mariyu adoni upayogistundi.nett
(sqlcommand command = connection) upayoginchadam.command () srushtinchandi
 aadesam.command text = "viniyogadaaru paeru = @username mariyu gadhi = @room unna viniyogadaarula nundi * enchukondi";
 aadesam.paaraamitulu.viluvanu jodinchandi ("@username", viniyogadaaru paeru);
 aadesam.paaraamitulu.viluvanu jodinchandi ("@room", gadhi);
 (sqldatareader datarider = command.karyanirvahaka nayakudu ())
 //...
adoo.nikara kokwais _ 3 kokwais _ 5 yokka kokwais _ 4 paramiti kosam yea rakamainanaina angeekaristundi, mariyu rakam marpidi svayamchaalakamgaa jarugutundi. perunna paaraamitulu" (i.ii. coque _ 6) badulugaa coque _ 7-idhi prasna aadesam vachanamlo oka paraamitini aneka saarlu mariyu yea ekapaksha kramamlo upayoginchadaaniki mimmalni anumatistundi.
ayithe, varchar mariyu envarture vanti chara podavaina dayta rakaalato yaad-vith-value paddhatini upayoginchakudadu. dheeniki kaaranam.pratibimbam dwara database nundi vaastava podavunu pondadam kante, paramiti yokka podavunu icchina viluva yokka podavugaa nikara bhaavistundi. dheeni paryavasanamga, prati ververu podavu kosam ververu prasna pranaalika sankalanam cheyabadutundi mariyu nilva cheyabadutundi. saadhaaranamgaa, "nakilee" pranaalikala garishta sankhya database loe perkonna vidhamgaa chara podavaina niluvu varusala podavula yokka utpatti. eee kaaranamgaa, variable podavu niluvu varusala kosam praamaanika jodimpu paddhatini upayoginchadam mukhyam.
, ikkada database loe perkonna vidhamgaa parama podavu anedi podavu.
variable podavu dayta rakaala kosam praamaanika jodimpu paddhatini upayoginchaalsina avasaram unnanduna, anni paramiti rakalaku dheenini upayoginchadam manchi alavaatu.
paithan db-epi.
eee udaaharana paithan mariyu db-apini upayogistundih
mysqlnu digumati cheyandi.connector
mysql thoo.connector.connect cheyandi (database = "mysql", user = "ruut"):
 cohn thoo.karsarga karsar (tayaaru = nijam):
 karsar.amalu cheyandi ("utpattulu lekapothe pattikanu srushtinchandi (varchar (40), dhara inta)")
 params = [("bike", 10900),
 ("bootlu", 7400),
 ("phone", 29500)]
 karsar.executamony ("utpattula viluvalalo choppinchandi (% s,% s)", paaraamlu)
 params = ("bootlu",)
 karsar.amalu cheyandi ("paeru =% s, paaraamlu unna utpattula nundi * enchukondi")
 print (karsar.fechal () [0] [1])
magic direct SQL.
eee udaaharana naalugo taram bhasha ayina edavalapar, unipaslu mariyu magic software samsthala nundi magic xpa nundi pratyaksha ess. kyuu. ell. nuu upayogistundi.
 virtual viniyogadaaru paeru alfa 20 init: 'sodari'
 virtual sanketapadam alfa 20 init: 'pasupu'
 SQL aadesamh viniyogadaaru paeru =: 1 mariyu sanketapadam =: 2 unna viniyogadaarula nundi * enchukondi
 input vaadanalu 
 1: viniyogadaaru paeru
 2: sanketapadam
swachchamaina praathamika.
pure basic (v5.40 lts nundi) eee krindi aadeshaalatho 7 rakaala linklanu nirvahinchagaladu
 settatabaseblab, settatabaseduble, settatabasefloat, settatabaselang, settatabasenul, settatabesquad, settatabastring
database rakanni batti 2 ververu paddhatulu unnaayi.
sclite, oo. dii. bii. sii, mariadb/mysql upayogam kosamh? 
 settatabastering (#database, 0, "pareeksha") 
 database prasna (#database ", udyogi nundi * enchukondi, ekkada ID =?") 
 endiff
postgresscle upayogam kosamh $1, $2, $3,...
 settatabastering (#database, 0, "smith");-> $1 
 settabatabastring (#database, 1, "avunu");-> $2
 settatabaselong (#database, 2,250);-> $3
 database prasna unte (#database, "udyogi nundi * nuu enchukondi, ikkada ID = $1 mariyu kriyaaseela = $2 mariyu samvatsaraalu> $3") 
 endiff

