⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbd::gofer.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "DBD::Gofer 3".TH DBD::Gofer 3 "2007-10-21" "perl v5.10.0" "User Contributed Perl Documentation".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"DBD::Gofer \- A stateless\-proxy driver for communicating with a remote DBI.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 1\&  use DBI;\&\&  $original_dsn = "dbi:..."; # your original DBI Data Source Name\&\&  $dbh = DBI\->connect("dbi:Gofer:transport=$transport;...;dsn=$original_dsn",\&                      $user, $passwd, \e%attributes);\&\&  ... use $dbh as if it was connected to $original_dsn ....Ve.PPThe \f(CW\*(C`transport=$transport\*(C'\fR part specifies the name of the module to use totransport the requests to the remote \s-1DBI\s0. If \f(CW$transport\fR doesn't contain anydouble colons then it's prefixed with \f(CW\*(C`DBD::Gofer::Transport::\*(C'\fR..PPThe \f(CW\*(C`dsn=$original_dsn\*(C'\fR part \fImust be the last element\fR of the \s-1DSN\s0 becauseeverything after \f(CW\*(C`dsn=\*(C'\fR is assumed to be the \s-1DSN\s0 that the remote \s-1DBI\s0 shoulduse..PPThe \f(CW\*(C`...\*(C'\fR represents attributes that influence the operation of the Goferdriver or transport. These are described below or in the documentation of thetransport module being used..SH "DESCRIPTION".IX Header "DESCRIPTION"DBD::Gofer is a \s-1DBI\s0 database driver that forwards requests to another \s-1DBI\s0driver, usually in a seperate process, often on a separate machine. It tries tobe as transparent as possible so it appears that you are using the remotedriver directly..PPDBD::Gofer is very similar to DBD::Proxy. The major difference is that withDBD::Gofer no state is maintained on the remote end. That means everyrequest contains all the information needed to create the required state. (So,for example, every request includes the \s-1DSN\s0 to connect to.) Each request can besent to any available server. The server executes the request and returns asingle response that includes all the data..PPThis is very similar to the way http works as a stateless protocol for the web.Each request from your web browser can be handled by a different web server process..Sh "Use Cases".IX Subsection "Use Cases"This may seem like pointless overhead but there are situations where this is avery good thing. Let's consider a specific case..PPImagine using DBD::Gofer with an http transport. Your application calls\&\fIconnect()\fR, prepare(\*(L"select * from table where foo=?\*(R"), \fIbind_param()\fR, and \fIexecute()\fR.At this point DBD::Gofer builds a request containing all the informationabout the method calls. It then uses the httpd transport to send that requestto an apache web server..PPThis 'dbi execute' web server executes the request (using DBI::Gofer::Executeand related modules) and builds a response that contains all the rows of data,if the statement returned any, along with all the attributes that describe theresults, such as \f(CW$sth\fR\->{\s-1NAME\s0}. This response is sent back to DBD::Gofer whichunpacks it and presents it to the application as if it had executed thestatement itself..Sh "Advantages".IX Subsection "Advantages"Okay, but you still don't see the point? Well let's consider what we've gained:.PP\fIConnection Pooling and Throttling\fR.IX Subsection "Connection Pooling and Throttling".PPThe 'dbi execute' web server leverages all the functionality of webinfrastructure in terms of load balancing, high-availability, firewalls, accessmanagement, proxying, caching..PPAt its most basic level you get a configurable pool of persistent database connections..PP\fISimple Scaling\fR.IX Subsection "Simple Scaling".PPGot thousands of processes all trying to connect to the database? You can useDBD::Gofer to connect them to your smaller pool of 'dbi execute' web servers instead..PP\fICaching\fR.IX Subsection "Caching".PPClient-side caching is as simple as adding "\f(CW\*(C`cache=1\*(C'\fR" to the \s-1DSN\s0.This feature alone can be worth using DBD::Gofer for..PP\fIFewer Network Round-trips\fR.IX Subsection "Fewer Network Round-trips".PPDBD::Gofer sends as few requests as possible (dependent on the policy being used)..PP\fIThin Clients / Unsupported Platforms\fR.IX Subsection "Thin Clients / Unsupported Platforms".PPYou no longer need drivers for your database on every system.  DBD::Gofer is pure perl..SH "CONSTRAINTS".IX Header "CONSTRAINTS"There are some natural constraints imposed by the DBD::Gofer 'stateless' approach.But not many:.Sh "You can't change database handle attributes after \fIconnect()\fP".IX Subsection "You can't change database handle attributes after connect()"You can't change database handle attributes after you've connected.Use the \fIconnect()\fR call to specify all the attribute settings you want..PPThis is because it's critical that when a request is complete the databasehandle is left in the same state it was when first connected..PPAn exception is made for attributes with names starting "\f(CW\*(C`private_\*(C'\fR":They can be set after \fIconnect()\fR but the change is only applied locally..Sh "You can't change statement handle attributes after \fIprepare()\fP".IX Subsection "You can't change statement handle attributes after prepare()"You can't change statment handle attributes after prepare..PPAn exception is made for attributes with names starting "\f(CW\*(C`private_\*(C'\fR":They can be set after \fIprepare()\fR but the change is only applied locally..Sh "You can't use transactions".IX Subsection "You can't use transactions"AutoCommit only. Transactions aren't supported..PP(In theory transactions could be supported when using a transport thatmaintains a connection, like \f(CW\*(C`stream\*(C'\fR does. If you're interested in thisplease get in touch via dbi\-dev@perl.org).Sh "You can't call driver-private sth methods".IX Subsection "You can't call driver-private sth methods"But that's rarely needed anyway..SH "GENERAL CAVEATS".IX Header "GENERAL CAVEATS"A few important things to keep in mind when using DBD::Gofer:.Sh "Temporary tables, locks, and other per-connection persistent state".IX Subsection "Temporary tables, locks, and other per-connection persistent state"You shouldn't expect any per-session state to persist between requests.This includes locks and temporary tables..PPBecause the server-side may execute your requests via a differentdatabase connections, you can't rely on any per-connection persistent state,such as temporary tables, being available from one request to the next..PPThis is an easy trap to fall into. A good way to check for this is to test yourcode with a Gofer policy package that sets the \f(CW\*(C`connect_method\*(C'\fR policy to\&'connect' to force a new connection for each request. The \f(CW\*(C`pedantic\*(C'\fR policy does this..Sh "Driver-private Database Handle Attributes".IX Subsection "Driver-private Database Handle Attributes"Some driver-private dbh attributes may not be available if the driver has notimplemented the \fIprivate_attribute_info()\fR method (added in \s-1DBI\s0 1.54)..Sh "Driver-private Statement Handle Attributes".IX Subsection "Driver-private Statement Handle Attributes"Driver-private sth attributes can be set in the \fIprepare()\fR call. \s-1TODO\s0.PPSome driver-private dbh attributes may not be available if the driver has notimplemented the \fIprivate_attribute_info()\fR method (added in \s-1DBI\s0 1.54)..Sh "Multiple Resultsets".IX Subsection "Multiple Resultsets"Multiple resultsets are supported only if the driver supports the \fImore_results()\fR method(an exception is made for DBD::Sybase)..Sh "Statement activity that also updates dbh attributes".IX Subsection "Statement activity that also updates dbh attributes"Some drivers may update one or more dbh attributes after performing activity ona child sth.  For example, DBD::mysql provides \f(CW$dbh\fR\->{mysql_insertid} in addition to\&\f(CW$sth\fR\->{mysql_insertid}. Currently mysql_insertid is supported via a hack but amore general mechanism is needed for other drivers to use..Sh "Methods that report an error always return undef".IX Subsection "Methods that report an error always return undef"With DBD::Gofer, a method that sets an error always return an undef or empty list.That shouldn't be a problem in practice because the \s-1DBI\s0 doesn't define anymethods that return meaningful values while also reporting an error..Sh "Subclassing only applies to client-side".IX Subsection "Subclassing only applies to client-side"The RootClass and DbTypeSubclass attributes are not passed to the Gofer server..SH "CAVEATS FOR SPECIFIC METHODS".IX Header "CAVEATS FOR SPECIFIC METHODS".Sh "last_insert_id".IX Subsection "last_insert_id"To enable use of last_insert_id you need to indicate to DBD::Gofer that you'd

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -