stargeek
PHP news website logo.
home    PHP scripts    articles    seo tools    links    search    contact    shop    realtors


Using ext/mysqli Part 1







Using ext/mysqli Part 1

Using ext/mysqli Part 1 04/09/2004 04:05 PM

Extension for PHP5 that will support new features in MySQL Version 4.1 and higher




This is a GrokNews Entry: (what is grok?)





Similar Items

Using ext/mysqli Part 1

Grok Headline matches for Using ext/mysqli Part 1

Zend: Using ext/mysqli (Part 2) -
Extending mysqli


Zend: Using ext/mysqli (Part 2) -
Extending mysqli
05/31/2004 09:59 AM
Zend has a new article posted today as a follow up to their previous "Using ext/mysqli" piece - Using ext/mysqli: Part II - Extending mysqli

John Lautner's Chemosphere: part
Jetsons, part Bond and vintage L.A.
Modern.


John Lautner's Chemosphere: part
Jetsons, part Bond and vintage L.A.
Modern.
04/07/2005 12:53 PM
The most modern home built in the world. "From the outside it looks like a spaceship you cannot enter. But if you go inside, it feels very cozy… very Zen and calming. Maybe because you are floating above the city, in the sky". John Lautner's Chemosphere residence is the product of a fortuitous union of architect, client, time and place. Leonard Malin was a young aerospace engineer in late-1950s L.A. whose father-in-law had just given him a plot north of Mulholland Drive, near Laurel Canyon. The only catch: at roughly 45 degrees, the slope was all but unbuildable. Lautner sketched a bold vertical line, a cross, and a curve above it. "Draw it up," he told his assistant. Now publisher Benedik t Taschen owns Chemosphere (NSFW), and after 20 years of neglect the house has been beautifully restored (.pdf) by Frank Escher.

New Form of Internet Fiction is Part
Story, Part Game


New Form of Internet Fiction is Part
Story, Part Game
06/05/2005 10:52 PM
Internet startup City of IF today launched a web site dedicated to “storygaming” – a new form of storytelling over the Web. Storygaming is a unique combination of storytelling and computer games in which players cooperatively play characters in a story guided by a human author. [PRWEB Jun 2, 2005]

Part Butler and Part Buddy, Aide Keeps
Kerry Running


Part Butler and Part Buddy, Aide Keeps
Kerry Running
04/28/2004 12:17 AM
Marvin Nicholson Jr. is the man literally behind Senator John Kerry, ready with an uncapped bottle of water whenever Mr. Kerry's throat runs dry.

Into the Itanium, Part 2
http://www.devhardware.com/c/a/Computer-
Processors/Into-the-Itanium-Part-2/ In
our la


Into the Itanium, Part 2
http://www.devhardware.com/c/a/Computer-
Processors/Into-the-Itanium-Part-2/ In
our la
12/27/2004 01:08 PM
DevHardware Dec 27 2004 4:25PM GMT

Ask EA Part 4


Ask EA Part 4 07/11/2004 06:34 AM

shacknews.com/onearticle.x/32582
track this site | 3 links


Grr, part II


Grr, part II 12/30/2003 06:26 PM
Ha! Two more victories today! Five wins out of six games... One more win and I might get a prize!

And by the way - if it's dangerous to go into a DVD sale in Anttila, it is twice as much dangerous to go to a DVD sale in Tower Records in London... I was seriously tempted to buy the entire Fawlty Towers, but managed to resist the tempation after picking up some interesting bargain stuff like both Tetsuos and Holy Grail (and what do you mean by "odd combination"?)


Grr, part III


Grr, part III 12/31/2003 06:11 PM
Whee! Seven wins out of eight games - I even beat a dan-grade player. I got a certificate and a prize and everything :).

This was a good way to end the year. See you in 2004.

(And yeah, it's really 2003 as I'm writing this. Timezone differences schmisserences)


"37 CFR Part 201"


"37 CFR Part 201" 10/30/2003 03:49 PM

You are who you know: Part 2


You are who you know: Part 2 06/16/2004 12:23 AM
Salon Jun 16 2004 4:11AM GMT

"Part 1"


"Part 1" 02/14/2004 03:42 AM

part one


part one 09/24/2004 03:06 AM

goldsteinhowe.com/blog/files/VFPart1.pdf
track this site | 3 links


Do your part


Do your part 12/02/2003 01:09 AM
Fight AIDS @home is a valuable resource for your "wasted" computer cycles. Instead of search the universe for extraterrestrial life, shouldn't we be searching our world for cures to our own diseases?

Doing More With XML Schemas (part 1)


Doing More With XML Schemas (part 1) 01/08/2003 07:11 PM
Get into the more advanced aspects of XML Schema design with a discussion of simple and complex datatypes, and learn to apply the basic OOP concepts of extensibility and inheritance to your schemas.

Normalizing XML, Part 2


Normalizing XML, Part 2 12/04/2002 08:22 PM
In this second and final look at applying relational normalization techniques to W3C XML Schema data modeling, Will Provost discusses when not to normalize, the scope of uniqueness and the fourth and fifth normal forms.

Til Dignity Do Us Part


Til Dignity Do Us Part 01/18/2004 10:26 AM
The yuppie panhandling site Pay for Cynthia's Wedding seeks $25,000 to fund a couple's dream nuptials. "Our life is the Fine Living Channel," explains Cynthia Wachtel. (01-17)

Zap Annoyances on the Web, Part II


Zap Annoyances on the Web, Part II 04/30/2004 05:05 AM
Using AdZapper to block many ads and Web bugs.

Why is there a part of a cookie here?


Why is there a part of a cookie here? 01/16/2004 01:00 PM
Made one mitten, mitten too small...damn it. Back to the drawing board for that one. Wendy's scarf has been...completed! (said...

Notes From All Over Part V


Notes From All Over Part V 07/23/2004 02:52 PM

Thoughts on the Odeon debacle and developer workarounds for bad sites, Internet Explorer news, and a few random links to start the weekend.


Vi for programmers, part 1


Vi for programmers, part 1 07/26/2004 05:37 AM
CNET Jul 26 2004 10:26AM GMT

Doing More With XML Schemas (part 3)


Doing More With XML Schemas (part 3) 01/30/2003 02:34 PM
This article introduces you to the concept of uniqueness in the XML Schema world, showing you how to use built-in schema constructs to enforce uniqueness within your XML document instances.

Vi for programmers, part 2


Vi for programmers, part 2 07/26/2004 05:37 AM
CNET Jul 26 2004 10:27AM GMT

Doing More With XML Schemas (part 2)


Doing More With XML Schemas (part 2) 01/23/2003 08:07 PM
In this second part, find out how to derive new element types by constraining existing ones, control access to your schema definitions, and redefine externally-provided schemas in place.

Beyond Megapixels - Part II


Beyond Megapixels - Part II 05/01/2004 07:51 AM

Help: I Got Hacked. Now What Do I Do?
Part II


Help: I Got Hacked. Now What Do I Do?
Part II
08/01/2004 12:27 AM

Direct and Related Links for 'Help: I Got Hacked. Now What Do I Do? Part II'

If you missed part 1 of this series, I strongly suggest that you read it here. “On This Page: There Is More to Information Security Than Viruses Salvaging Data in the Absence of Backups Recovering After an Attack – What Tools Will Help? Conclusion”…

CSS Crash Course - Part 3


CSS Crash Course - Part 3 02/14/2003 08:26 AM
In this edition: How to apply colors to page elements, Applying background colors to elements, Using background images, and Shorthand notation for background properties

Beyond Megapixels - Part III


Beyond Megapixels - Part III 06/16/2004 07:10 AM

XML canonicalization, part 2 (XML.com)


XML canonicalization, part 2 (XML.com) 10/11/2002 07:55 AM

XML canonicalization, part 2 (XML.com)


XML canonicalization, part 2 (XML.com) 10/11/2002 07:56 AM

Implementing CSS (Part 1)


Implementing CSS (Part 1) 06/05/2005 11:17 PM

One of the most interesting problems (to me at least) in browser layout engines is how to implement a style system that can determine the style information for elements on a page efficiently. I worked on this extensively in the Gecko layout engine during my time at AOL and I've also done a lot of work on it for WebCore at Apple. My ideal implementation would actually be a hybrid of the two systems, since some of the optimizations I've done exist only in one engine or the other.

When dealing with style information like font size or text color, you have both the concept of back end information, what was specified in the style rule, and the concept of front end information, the computed result that you'll actually use when rendering. The interesting problem is how to compute this front end information for a given element efficiently.

Back end information can be specified in two different ways. It can either be specified using CSS syntax, whether in a stylesheet or in an inline style attribute on the element itself, or it is implicitly present because another attribute on the element specified presentational information. An example of such an attribute would be the color attribute on the font tag. Both WebCore and Gecko use the term mapped attribute to describe an attribute whose value (or even mere presence) maps to some implicit style declaration.

A rule in CSS consists of two pieces. There is the selector, that bit of information that says under what conditions the rule should match a given element, and there is the declaration, a list of property/value pairs that should be applied to the element should the selector be matched.

All back end information can ultimately be thought of as supplying a declaration. A normal rule in a stylesheet that is matched has the declaration specified as part of the rule. An inline style attribute on an element has no selector and is simply a declaration that always applies to that element. Similarly each individual mapped attribute (like the color and face attributes on the font tag) can be thought of as supplying a declaration as well.

Therefore the process of computing the style information for an element can be broken down into two phases. The first phase is to determine what set of declarations apply to an element. Once that back end information has been determined, the second phase is to take that back end information and quickly determine the information that should be used when rendering.

WebCore (in upcoming Safari releases) has a really cool optimization that I came up with to avoid even having to compute the set of declarations that apply to an element. This optimization in practice results in not even having to match style for about 60% of the elements on your page.

The idea behind the optimization is to recognize when two elements in a page are going to have the same style through DOM (and other state) inspection and to simply share the front end style information between those two elements whenever possible.

There are a number of conditions that must be met in order for this sharing to be possible:
(1) The elements must be in the same mouse state (e.g., one can't be in :hover while the other isn't)
(2) Neither element should have an id
(3) The tag names should match
(4) The class attributes should match
(5) The set of mapped attributes must be identical
(6) The link states must match
(7) The focus states must match
(8) Neither element should be affected by attribute selectors, where affected is defined as having any selector match that uses an attribute selector in any position within the selector at all
(9) There must be no inline style attribute on the elements
(10) There must be no sibling selectors in use at all. WebCore simply throws a global switch when any sibling selector is encountered and disables style sharing for the entire document when they are present. This includes the + selector and selectors like :first-child and :last-child.

The algorithm to locate a shared style then goes something like this. You walk through your previous siblings and for each one see if the above 10 conditions are met. If you find a match, then simply share your style information with the other element. Such a system obviously assumes a reference counting model for your front end style information.

Where this optimization kicks into high gear, however, is that it doesn't have to give up if no siblings can be located. Because the detection of identical style contexts is essentially O(1), nothing more than a straight pointer comparison, you can easily look for cousins of your element and still share style with those elements.

The way this works is that if you can't locate a sibling, you can go up to a parent element and attempt to find a sibling or cousin of the parent element that has the same style pointer. If you find such an element, you can then drill back down into its children and attempt to find a match.

This means that for HTML like the following:

<table>
<tr class='row'>
<td class='cell' width=300 nowrap>Cell One</td>
</tr>
<tr class='row'>
<td class='cell' width=300 nowrap>Cell Two</td>
</tr>

In the above example, not only do the two rows share the same style information, but the two cells do as well. This optimization works extremely well for both old-school HTML (in which many deprecated presentational tags are used) and newer HTML (in which class attributes might figure more prominently).

Once the engine determines that a style can't be shared, i.e., that no pre-existing front end style pointer is available, then it's time to figure out the set of declarations that match a given element. It is obvious that for inline style attributes and mapped attributes that you can find the corresponding declaration quickly. The inline style declaration can be owned by the element, and the mapped attributes can be kept in a document-level hash. WebCore has a bit of an edge over Gecko here in that it treats each individual mapped attribute on an element as a separate declaration, whereas Gecko hashes all of the mapped attributes on an element as a single "rule." This means that Gecko will not be able to share the mapped attribute declaration for the following two elements:

<img width=300 border=0>
<img width=500 border=0>

WebCore creates three unique declarations and hashes them, one for a width of 300, one for a width of 500, and one for a border of 0. Gecko creates two different "rules," one for (width=300,border=0) and another for (width=500,border=0). As you can see in such a system, you will frequently not be able to treat the identical border attributes as the same.

Aside from this difference in mapped attribute handling, the two engines employ a similar optimization for quickly determining matching stylesheet rules called rule filtering. All rules that are potentially matchable by any element (i.e., that have the correct media type) are hashed based on the contents of the rightmost simple selector in the rule.

A selector in CSS can be either simple (meaning that all of the contents of that selector apply only to a single element) or compound (meaning that you may examine multiple elements like parents or siblings of that element). A compound selector is essentially a chain of simple selectors, so the following rule:

tr > td { color: blue }

has two simple selectors, tr and td. The rightmost simple selector in the rule is the one that we will use for the rule filtering optimization.

The rightmost simple selector falls into four categories.

(1) The selector uses an ID. (Example: #foo)
(2) The selector doesn't have an ID but uses a class. (Example: .foo)
(3) The selector has no class or ID but specifies a tag name. (Example: div)
(4) The selector specifies none of these things. (Example: *[disabled])

The rule is placed into one of four hashtables depending on which category it falls into. The idea behind these categorizations is to always filter out more specific information first. For example, if an element has a specific ID, then obviously any rules whose rightmost selector uses a different ID cannot match. Technically the last category can just be a list and not a hashtable, since those rules must always be examined by all elements.

Each hashtable, therefore, consists of a mapping from a given atomic string to a set of rules that match. The class attribute is exceptional in that you must put the rule into the hashtable multiple times if multiple class attributes are used.

When determining the set of rules that match a given element, you only examine rules that correspond to the correct hash entry based off your ID, classes and tag name. This optimization basically eliminates 95+% of the rules up front so that they need not even be considered during the matching process.

Each rule is then examined in detail, with all selectors being checked, to determine if it is a match, and the set of matches is collected. The set of matches can then be sorted by priority and specificity such that all the declarations are in the proper application order.

This brings us to the final phase of the style computation, which is taking the set of matches and quickly computing the appropriate front end style information. It is here that Gecko really shines. What I implemented in Gecko was a data structure called the rule tree for efficient storing of cached style information that can be shared *even when* two elements are not necessarily the same.

The idea behind the rule tree is as follows. You can think of the universe of possible rules in your document as an alphabet and the set of rules that are matched by an element as a given input word. For example, imagine that you had 26 rules in a stylesheet and you labeled them A-Z. One element might match three rules in the sheet, thus forming the input word "C-A-T" or another might form the input word "D-O-G."

There are several important observations one can make once you formulate the problem this way. The first is that words that are prefixes of a larger word will end up applying the same set of rules. All additional letters in the word do is result in the application of more declarations. Thus the rule tree is effectively a lexicographic tree of nodes, with each node in a tree being created lazily as you walk the tree spelling out a given word.

This system allows you to cache style information at each node in the tree. This means that once you've looked up the word "C-A-T-E-R-W-A-U-L", and cached information at all of the nodes, then looking up the word "C-A-T" becomes more efficient.

In order to make the caching efficient, properties can be grouped into categories, with the primary criterion for categorization being whether the property inherits by default. It's also important to group properties together that would logically be specified together, so that when a fault occurs and you have to make a copy of a given struct, you do so knowing that the other values in the struct were probably going to be different anyway.

Once you have the properties grouped into categories like the border struct or the background struct, then you can either store these structs in the rule tree or as part of a style tree that more or less matches the structure of the document. Inheritance has to apply down the style tree and tends to force a fault, whereas non-inherited properties can usually be cached in the rule tree for easy access.

WebCore doesn't contain a rule tree, but it is smart enough to refcount the structs and share them as long as no properties have been set in the struct. In practice this works pretty well but is not as ideal as the rule tree solution.


The Best of 2004: Part 1


The Best of 2004: Part 1 01/04/2005 01:08 PM
TechTree Jan 4 2005 5:07PM GMT

ZPT Basics (part 4)


ZPT Basics (part 4) 10/31/2002 06:32 PM
In this concluding article, get up close and personal with METAL, the macro language that allows you to add reusability to your Zope templates.

OLAP and DW (Part 4)


OLAP and DW (Part 4) 01/06/2005 11:36 AM

Zap Annoyances on the Web, Part I


Zap Annoyances on the Web, Part I 04/29/2004 06:32 AM
Get rid of annoying Web marketing and protect your privacy, using both the browser and a proxy server.

Mac OS X For The Traveler, Part 2


Mac OS X For The Traveler, Part 2 09/03/2004 08:02 PM
Theft is a primary source of information leaks and other hassles when you travel. By Francois Joseph de Kermadec, O'Reilly Network (via MyAppleMenu)

Normalizing XML, Part 1


Normalizing XML, Part 1 11/13/2002 08:10 PM
Will Provost's XML Schema Clinic series takes a look at the relational features of W3C XML Schema, applying the concepts of relational normalization to schema design.

Normalizing XML, part 1 (XML.com)


Normalizing XML, part 1 (XML.com) 11/18/2002 11:57 AM

Bluetooth and YOU: Part 1


Bluetooth and YOU: Part 1 06/16/2004 06:18 PM
macteens Jun 16 2004 10:25PM GMT

*back, Part V


*back, Part V 11/20/2002 12:42 PM
Installing PostgreSQL on my web hosting account was simple enough. Lost time getting PHP's Postgre extension to work, turned out...
Grok Description matches for Using ext/mysqli Part 1
GrokA matches for Using ext/mysqli Part 1

Using ext/mysqli Part 1

The following phrases have been identified by the grok system as matching this entry: ext/mysqli zak greant

















Also check out:


Grok

Ipod Porn on the
Rise

Brief Abstract of
Wikipedia's
Mesothelioma Cancer
page

Get first aid
instructions in your
cell phone

IE is crap
JSPWiki gains
podcasting support

PHP Class 'MySQL
Optimizer' released

YahooFinance: MySQL,
Zend Join Forces to
Strengthen Open
Source Web
Development

D.Net CMS Beta
Released

ADTmag: Open-Source
MySQL DBMS Adds
Clustering Tech

PHP Class 'Form
Classic' released

qpopper-mysql 0.13
released

Adding & Changing
Data in MySQL

Content Architect/IT
Analyst

Perl Application
Developer

Perl IS developer
Intermediate
Developer for an
online market
research company

Senior Perl
Developer wanted in
MN!!

OO CGI/mod_perl
developer

Immediate
Opportunities for
E-Commerce &
Transaction
Processing Co.

Perl / Mason
Application
Architect

PHP and Apache 2.0
PHP Class 'My Query
Report' released

PHP Class 'Email
Sender' released

PHP Class 'MySQL
Operations' released

Implement Bayesian
inference using PHP,
Part 1

PHP Class 'Browse
Edit' released

PHP Class 'Image to
PHP' released

PHP Class 'reGlobal'
released

PHP Class 'gonxtabs'
released

PHP Class 'PHP
Figlet' released

PHP Class 'MySQL
Backup Pro' released

Aqsis Renderer
release 0.9.1
Source, Windows
binary, RPM

PHP Class 'ADSI
Access' released

Switches look to
security to
recapture lost
luster

Tech group urges
action on health
care mandates

Sun kills UltraSparc
V, Gemini chips

Microsoft reins in
Longhorn for 2006
launch

Accounting questions
delay Salesforce IPO

Lindows to Change
Name

BugMeNot.com
Speed Sensing
Traffic Light

Smooth As Silk on
Square Wheels

Happy Birthday,
Internet!

The Exploratorium
System/360 Turns 40
Real Life X-Files
Early Usenet Posts
See the Ether
To the Moon!
Electronic Data
Coverage Insurance

The Endless Mountain
Life With Fedora
Field
FrooglePEG
I'm paying for what
now?

what is grok?