cvs: presentations /slides/mysql-limits counting.xml schemas.xml

From: Date: Wed, 09 Nov 2005 13:08:19 +0000
Subject: cvs: presentations /slides/mysql-limits counting.xml schemas.xml
Groups: php.pres 
Request: Send a blank email to pres+get-1218@lists.php.net to get a copy of this message
dbs Wed Nov 9 08:08:19 2005 EDT Modified files: /presentations/slides/mysql-limits counting.xml schemas.xml Log: Clean up thinkos. http://cvs.php.net/diff.php/presentations/slides/mysql-limits/counting.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/mysql-limits/counting.xml diff -u presentations/slides/mysql-limits/counting.xml:1.1 presentations/slides/mysql-limits/counting.xml:1.2 --- presentations/slides/mysql-limits/counting.xml:1.1 Mon Sep 19 13:26:29 2005 +++ presentations/slides/mysql-limits/counting.xml Wed Nov 9 08:08:17 2005 @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="iso-8859-1"?> <slide> <title>Counting results of SELECT statement</title> -<blurb>A very popular MySQL idiom is to use the return value of %mysql_query()% to -reflect the number of rows that will be returned by the SELECT statement that was +<blurb>A very popular MySQL idiom is to use the return value of %mysql_num_rows()% to +reflect the number of rows that will be returned by the last SELECT statement that was issued.</blurb> <list> -<bullet>But in most database APIs, the return value from executing a SELECT statement is simply true or false reflecting success or failure.</bullet> +<bullet>But in most database APIs, the number of rows *affected* by executing a SELECT statement is zero -- and that's what %xx_num_rows()% will return.</bullet> <bullet>If your database supports scrollable cursors, and you request a scrollable cursor when you issue your SELECT statement, you *will* get an accurate count of the number of rows in the result set.</bullet> <bullet>Most times, however, you can either issue a separate SELECT COUNT(*) if you actually want the number of rows, or just try fetching the first row from the result set.</bullet> http://cvs.php.net/diff.php/presentations/slides/mysql-limits/schemas.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/mysql-limits/schemas.xml diff -u presentations/slides/mysql-limits/schemas.xml:1.1 presentations/slides/mysql-limits/schemas.xml:1.2 --- presentations/slides/mysql-limits/schemas.xml:1.1 Mon Sep 19 13:26:29 2005 +++ presentations/slides/mysql-limits/schemas.xml Wed Nov 9 08:08:17 2005 @@ -54,14 +54,10 @@ </bullet> <bullet effect="hide">TINYINT (an integer accepting values from 0-255 or -128 to 128) can be mapped best to either a plain old INTEGER or a NUMERIC(3,0). -In other cases in the DDL, the TINYINT column is defined with a maximum of 1 or 3 --- this simply reduces the portability of the schema to other databases. -I would say that a more portable -approach would be to define a CHECK CONSTRAINT for a plain INTEGER column to -ensure that the value is less than a defined value -- however, MySQL in turn -does not support that. Of course, MySQL (until version 5, with STRICT MODE turned on) -would simply convert a value outside of the defined maximum to the maximum -value. +In other cases in the DDL, the TINYINT column is defined with a (1) or (3) +-- this affects the display of the value by left-padding the integer type +with zeros, which simply reduces the portability of the schema to other + databases and the flexibility of the data in the column. </bullet> <bullet effect="hide">The "special" table name prefix %#__% is a way of avoiding table name clashes with other applications stored in the same database. Apache Derby, like most database servers, supports the use of ~schemas~ to provide a namespace for tables. For example, application %dboy%'s tables could be created in the %dboy% schema and accessible as %dboy.table1%, %dboy.table2% without conflicting with %dgirl.table1%, %dgirl.table2% existing in the same database.</bullet> </list>

« previous php.pres (#1218) next »