Change to studlyCaps convention

# Hopefully discussed enough this time
This commit is contained in:
Marcus Boerger 2004-03-26 21:16:50 +00:00
parent 26b75f56c6
commit f956b50f65
22 changed files with 85 additions and 84 deletions

1
NEWS
View File

@ -1,6 +1,7 @@
PHP NEWS PHP NEWS
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ????? 2004, PHP 5 Release Candidate 2 ?? ????? 2004, PHP 5 Release Candidate 2
- Changed sqlite to use studlyCaps convention for its OO API. (Marcus)
- Force destructors to have empty signatures. (Marcus) - Force destructors to have empty signatures. (Marcus)
- Stopped file uploads from throwing E_WARNINGs and E_NOTICEs which can not be - Stopped file uploads from throwing E_WARNINGs and E_NOTICEs which can not be
hidden from within scripts (and a result value in the $_FILES global can be hidden from within scripts (and a result value in the $_FILES global can be

View File

@ -189,32 +189,32 @@ function_entry sqlite_functions[] = {
}; };
function_entry sqlite_funcs_db[] = { function_entry sqlite_funcs_db[] = {
PHP_ME_MAPPING(sqlite_db, sqlite_open, NULL) PHP_ME_MAPPING(__construct, sqlite_open, NULL)
/* PHP_ME_MAPPING(close, sqlite_close, NULL)*/ /* PHP_ME_MAPPING(close, sqlite_close, NULL)*/
PHP_ME_MAPPING(query, sqlite_query, NULL) PHP_ME_MAPPING(query, sqlite_query, NULL)
PHP_ME_MAPPING(array_query, sqlite_array_query, NULL) PHP_ME_MAPPING(arrayQuery, sqlite_array_query, NULL)
PHP_ME_MAPPING(single_query, sqlite_single_query, NULL) PHP_ME_MAPPING(singleQuery, sqlite_single_query, NULL)
PHP_ME_MAPPING(unbuffered_query, sqlite_unbuffered_query, NULL) PHP_ME_MAPPING(unbufferedQuery, sqlite_unbuffered_query, NULL)
PHP_ME_MAPPING(last_insert_rowid, sqlite_last_insert_rowid, NULL) PHP_ME_MAPPING(lastInsertRowid, sqlite_last_insert_rowid, NULL)
PHP_ME_MAPPING(changes, sqlite_changes, NULL) PHP_ME_MAPPING(changes, sqlite_changes, NULL)
PHP_ME_MAPPING(create_aggregate, sqlite_create_aggregate, NULL) PHP_ME_MAPPING(createAggregate, sqlite_create_aggregate, NULL)
PHP_ME_MAPPING(create_function, sqlite_create_function, NULL) PHP_ME_MAPPING(createFunction, sqlite_create_function, NULL)
PHP_ME_MAPPING(busy_timeout, sqlite_busy_timeout, NULL) PHP_ME_MAPPING(busyTimeout, sqlite_busy_timeout, NULL)
PHP_ME_MAPPING(last_error, sqlite_last_error, NULL) PHP_ME_MAPPING(lastError, sqlite_last_error, NULL)
PHP_ME_MAPPING(fetch_column_types, sqlite_fetch_column_types, NULL) PHP_ME_MAPPING(fetchColumnTypes, sqlite_fetch_column_types, NULL)
/* PHP_ME_MAPPING(error_string, sqlite_error_string, NULL) static */ /* PHP_ME_MAPPING(error_string, sqlite_error_string, NULL) static */
/* PHP_ME_MAPPING(escape_string, sqlite_escape_string, NULL) static */ /* PHP_ME_MAPPING(escape_string, sqlite_escape_string, NULL) static */
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
function_entry sqlite_funcs_query[] = { function_entry sqlite_funcs_query[] = {
PHP_ME_MAPPING(fetch_array, sqlite_fetch_array, NULL) PHP_ME_MAPPING(fetch, sqlite_fetch_array, NULL)
PHP_ME_MAPPING(fetch_object, sqlite_fetch_object, NULL) PHP_ME_MAPPING(fetchObject, sqlite_fetch_object, NULL)
PHP_ME_MAPPING(fetch_single, sqlite_fetch_single, NULL) PHP_ME_MAPPING(fetchSingle, sqlite_fetch_single, NULL)
PHP_ME_MAPPING(fetch_all, sqlite_fetch_all, NULL) PHP_ME_MAPPING(fetchAll, sqlite_fetch_all, NULL)
PHP_ME_MAPPING(column, sqlite_column, NULL) PHP_ME_MAPPING(column, sqlite_column, NULL)
PHP_ME_MAPPING(num_fields, sqlite_num_fields, NULL) PHP_ME_MAPPING(numFields, sqlite_num_fields, NULL)
PHP_ME_MAPPING(field_name, sqlite_field_name, NULL) PHP_ME_MAPPING(fieldName, sqlite_field_name, NULL)
/* spl_forward */ /* spl_forward */
PHP_ME_MAPPING(current, sqlite_current, NULL) PHP_ME_MAPPING(current, sqlite_current, NULL)
PHP_ME_MAPPING(next, sqlite_next, NULL) PHP_ME_MAPPING(next, sqlite_next, NULL)
@ -223,20 +223,20 @@ function_entry sqlite_funcs_query[] = {
PHP_ME_MAPPING(rewind, sqlite_rewind, NULL) PHP_ME_MAPPING(rewind, sqlite_rewind, NULL)
/* additional */ /* additional */
PHP_ME_MAPPING(prev, sqlite_prev, NULL) PHP_ME_MAPPING(prev, sqlite_prev, NULL)
PHP_ME_MAPPING(hasprev, sqlite_has_prev, NULL) PHP_ME_MAPPING(hasPrev, sqlite_has_prev, NULL)
PHP_ME_MAPPING(num_rows, sqlite_num_rows, NULL) PHP_ME_MAPPING(numRows, sqlite_num_rows, NULL)
PHP_ME_MAPPING(seek, sqlite_seek, NULL) PHP_ME_MAPPING(seek, sqlite_seek, NULL)
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
function_entry sqlite_funcs_ub_query[] = { function_entry sqlite_funcs_ub_query[] = {
PHP_ME_MAPPING(fetch_array, sqlite_fetch_array, NULL) PHP_ME_MAPPING(fetch, sqlite_fetch_array, NULL)
PHP_ME_MAPPING(fetch_object, sqlite_fetch_object, NULL) PHP_ME_MAPPING(fetchObject, sqlite_fetch_object, NULL)
PHP_ME_MAPPING(fetch_single, sqlite_fetch_single, NULL) PHP_ME_MAPPING(fetchSingle, sqlite_fetch_single, NULL)
PHP_ME_MAPPING(fetch_all, sqlite_fetch_all, NULL) PHP_ME_MAPPING(fetchAll, sqlite_fetch_all, NULL)
PHP_ME_MAPPING(column, sqlite_column, NULL) PHP_ME_MAPPING(column, sqlite_column, NULL)
PHP_ME_MAPPING(num_fields, sqlite_num_fields, NULL) PHP_ME_MAPPING(numFields, sqlite_num_fields, NULL)
PHP_ME_MAPPING(field_name, sqlite_field_name, NULL) PHP_ME_MAPPING(fieldName, sqlite_field_name, NULL)
/* spl_forward */ /* spl_forward */
PHP_ME_MAPPING(current, sqlite_current, NULL) PHP_ME_MAPPING(current, sqlite_current, NULL)
PHP_ME_MAPPING(next, sqlite_next, NULL) PHP_ME_MAPPING(next, sqlite_next, NULL)

View File

@ -14,7 +14,7 @@ var_dump($db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))"));
var_dump($db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)")); var_dump($db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)"));
$r = $db->query("SELECT * from foo"); $r = $db->query("SELECT * from foo");
var_dump($r); var_dump($r);
var_dump($r->fetch_array()); var_dump($r->fetch());
?> ?>
--EXPECTF-- --EXPECTF--
object(sqlite_db)#%d (0) { object(sqlite_db)#%d (0) {

View File

@ -12,11 +12,11 @@ include "blankdb_oo.inc";
$db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))"); $db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))");
$db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)"); $db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)");
$r = $db->query("SELECT * from foo"); $r = $db->query("SELECT * from foo");
var_dump($r->fetch_array(SQLITE_BOTH)); var_dump($r->fetch(SQLITE_BOTH));
$r = $db->query("SELECT * from foo"); $r = $db->query("SELECT * from foo");
var_dump($r->fetch_array(SQLITE_NUM)); var_dump($r->fetch(SQLITE_NUM));
$r = $db->query("SELECT * from foo"); $r = $db->query("SELECT * from foo");
var_dump($r->fetch_array(SQLITE_ASSOC)); var_dump($r->fetch(SQLITE_ASSOC));
?> ?>
--EXPECT-- --EXPECT--
array(6) { array(6) {

View File

@ -22,7 +22,7 @@ foreach ($data as $str) {
} }
$r = $db->query("SELECT a from strings"); $r = $db->query("SELECT a from strings");
while ($row = $r->fetch_array(SQLITE_NUM)) { while ($row = $r->fetch(SQLITE_NUM)) {
var_dump($row); var_dump($row);
} }
echo "DONE!\n"; echo "DONE!\n";

View File

@ -21,8 +21,8 @@ foreach ($data as $str) {
$db->query("INSERT INTO strings VALUES('$str')"); $db->query("INSERT INTO strings VALUES('$str')");
} }
$r = $db->unbuffered_query("SELECT a from strings"); $r = $db->unbufferedQuery("SELECT a from strings");
while ($row = $r->fetch_array(SQLITE_NUM)) { while ($row = $r->fetch(SQLITE_NUM)) {
var_dump($row); var_dump($row);
} }
echo "DONE!\n"; echo "DONE!\n";

View File

@ -21,7 +21,7 @@ foreach ($data as $str) {
$db->query("INSERT INTO strings VALUES('$str')"); $db->query("INSERT INTO strings VALUES('$str')");
} }
$r = $db->unbuffered_query("SELECT a from strings", SQLITE_NUM); $r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
while ($row = $r->valid()) { while ($row = $r->valid()) {
var_dump($r->current()); var_dump($r->current());
$r->next(); $r->next();

View File

@ -14,7 +14,7 @@ $db->query("CREATE TABLE bar (c1 char, c2 char, c3 char)");
$db->query("INSERT INTO foo VALUES ('1', '2', '3')"); $db->query("INSERT INTO foo VALUES ('1', '2', '3')");
$db->query("INSERT INTO bar VALUES ('4', '5', '6')"); $db->query("INSERT INTO bar VALUES ('4', '5', '6')");
$r = $db->query("SELECT * from foo, bar", SQLITE_ASSOC); $r = $db->query("SELECT * from foo, bar", SQLITE_ASSOC);
var_dump($r->fetch_array()); var_dump($r->fetch());
?> ?>
--EXPECT-- --EXPECT--
array(6) { array(6) {

View File

@ -13,13 +13,13 @@ $db->query("CREATE TABLE strings(foo VARCHAR, bar VARCHAR, baz VARCHAR)");
echo "Buffered\n"; echo "Buffered\n";
$r = $db->query("SELECT * from strings"); $r = $db->query("SELECT * from strings");
for($i=0; $i<$r->num_fields(); $i++) { for($i=0; $i<$r->numFields(); $i++) {
var_dump($r->field_name($i)); var_dump($r->fieldName($i));
} }
echo "Unbuffered\n"; echo "Unbuffered\n";
$r = $db->unbuffered_query("SELECT * from strings"); $r = $db->unbufferedQuery("SELECT * from strings");
for($i=0; $i<$r->num_fields(); $i++) { for($i=0; $i<$r->numFields(); $i++) {
var_dump($r->field_name($i)); var_dump($r->fieldName($i));
} }
echo "DONE!\n"; echo "DONE!\n";
?> ?>

View File

@ -31,7 +31,7 @@ while ($r->valid()) {
$r->next(); $r->next();
} }
echo "====UNBUFFERED====\n"; echo "====UNBUFFERED====\n";
$r = $db->unbuffered_query("SELECT a, b from strings"); $r = $db->unbufferedQuery("SELECT a, b from strings");
while ($r->valid()) { while ($r->valid()) {
var_dump($r->column(0)); var_dump($r->column(0));
var_dump($r->column('b')); var_dump($r->column('b'));

View File

@ -22,20 +22,20 @@ foreach ($data as $str) {
} }
echo "unbuffered twice\n"; echo "unbuffered twice\n";
$r = $db->unbuffered_query("SELECT a from strings", SQLITE_NUM); $r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
var_dump($r->fetch_all()); var_dump($r->fetchAll());
var_dump($r->fetch_all()); var_dump($r->fetchAll());
echo "unbuffered with fetch_array\n"; echo "unbuffered with fetch_array\n";
$r = $db->unbuffered_query("SELECT a from strings", SQLITE_NUM); $r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
var_dump($r->fetch_array()); var_dump($r->fetch());
var_dump($r->fetch_all()); var_dump($r->fetchAll());
echo "buffered\n"; echo "buffered\n";
$r = $db->query("SELECT a from strings", SQLITE_NUM); $r = $db->query("SELECT a from strings", SQLITE_NUM);
var_dump($r->fetch_all()); var_dump($r->fetchAll());
var_dump($r->fetch_array()); var_dump($r->fetch());
var_dump($r->fetch_all()); var_dump($r->fetchAll());
echo "DONE!\n"; echo "DONE!\n";
?> ?>
@ -59,7 +59,7 @@ array(3) {
} }
} }
Notice: sqlite_ub_query::fetch_all(): One or more rowsets were already returned in %ssqlite_oo_014.php on line %d Notice: sqlite_ub_query::fetchAll(): One or more rowsets were already returned in %ssqlite_oo_014.php on line %d
array(0) { array(0) {
} }
unbuffered with fetch_array unbuffered with fetch_array

View File

@ -21,7 +21,7 @@ foreach ($data as $str) {
$db->query("INSERT INTO strings VALUES('$str')"); $db->query("INSERT INTO strings VALUES('$str')");
} }
$res = $db->array_query("SELECT a from strings", SQLITE_NUM); $res = $db->arrayQuery("SELECT a from strings", SQLITE_NUM);
var_dump($res); var_dump($res);
echo "DONE!\n"; echo "DONE!\n";

View File

@ -23,12 +23,12 @@ foreach ($data as $str) {
echo "====BUFFERED====\n"; echo "====BUFFERED====\n";
$r = $db->query("SELECT a, b from strings"); $r = $db->query("SELECT a, b from strings");
while ($r->valid()) { while ($r->valid()) {
var_dump($r->fetch_single()); var_dump($r->fetchSingle());
} }
echo "====UNBUFFERED====\n"; echo "====UNBUFFERED====\n";
$r = $db->unbuffered_query("SELECT a, b from strings"); $r = $db->unbufferedQuery("SELECT a, b from strings");
while ($r->valid()) { while ($r->valid()) {
var_dump($r->fetch_single()); var_dump($r->fetchSingle());
} }
echo "DONE!\n"; echo "DONE!\n";
?> ?>

View File

@ -39,7 +39,7 @@ foreach ($data as $str) {
$db->query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')"); $db->query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')");
} }
$r = $db->unbuffered_query("SELECT a, b from strings"); $r = $db->unbufferedQuery("SELECT a, b from strings");
while ($r->valid()) { while ($r->valid()) {
var_dump($r->current(SQLITE_NUM)); var_dump($r->current(SQLITE_NUM));
$r->next(); $r->next();

View File

@ -13,13 +13,13 @@ for ($i = 0; $i < 10; $i++) {
} }
$db->query("INSERT INTO test_db (data) VALUES(NULL)"); $db->query("INSERT INTO test_db (data) VALUES(NULL)");
var_dump($db->single_query("SELECT id FROM test_db WHERE id=5")); var_dump($db->singleQuery("SELECT id FROM test_db WHERE id=5"));
var_dump($db->single_query("SELECT * FROM test_db WHERE id=4")); var_dump($db->singleQuery("SELECT * FROM test_db WHERE id=4"));
var_dump($db->single_query("SELECT data FROM test_db WHERE id=6")); var_dump($db->singleQuery("SELECT data FROM test_db WHERE id=6"));
var_dump($db->single_query("SELECT * FROM test_db WHERE id < 5")); var_dump($db->singleQuery("SELECT * FROM test_db WHERE id < 5"));
var_dump($db->single_query("SELECT * FROM test db WHERE id < 4")); var_dump($db->singleQuery("SELECT * FROM test db WHERE id < 4"));
var_dump($db->single_query("SELECT * FROM test_db WHERE id=999999")); var_dump($db->singleQuery("SELECT * FROM test_db WHERE id=999999"));
var_dump($db->single_query("SELECT id FROM test_db WHERE id=5", FALSE)); var_dump($db->singleQuery("SELECT id FROM test_db WHERE id=5", FALSE));
echo "DONE!\n"; echo "DONE!\n";
?> ?>
@ -38,7 +38,7 @@ array(4) {
string(1) "4" string(1) "4"
} }
Warning: sqlite_db::single_query(): no such table: test in %s on line %d Warning: sqlite_db::singleQuery(): no such table: test in %s on line %d
bool(false) bool(false)
NULL NULL
array(1) { array(1) {

View File

@ -30,13 +30,13 @@ foreach ($data as $str) {
echo "====class24====\n"; echo "====class24====\n";
$res = $db->query("SELECT a FROM strings", SQLITE_ASSOC); $res = $db->query("SELECT a FROM strings", SQLITE_ASSOC);
while ($res->valid()) { while ($res->valid()) {
var_dump($res->fetch_object('class24')); var_dump($res->fetchObject('class24'));
} }
echo "====stdclass====\n"; echo "====stdclass====\n";
$res = $db->query("SELECT a FROM strings", SQLITE_ASSOC); $res = $db->query("SELECT a FROM strings", SQLITE_ASSOC);
while ($res->valid()) { while ($res->valid()) {
var_dump($res->fetch_object()); var_dump($res->fetchObject());
} }
echo "====DONE!====\n"; echo "====DONE!====\n";

View File

@ -23,7 +23,7 @@ foreach ($data as $str) {
} }
echo "====UNBUFFERED====\n"; echo "====UNBUFFERED====\n";
$r = $db->unbuffered_query("SELECT a from strings", SQLITE_NUM); $r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
//var_dump(class_implements($r)); //var_dump(class_implements($r));
foreach($r as $row) { foreach($r as $row) {
var_dump($row); var_dump($row);
@ -33,7 +33,7 @@ foreach($r as $row) {
var_dump($row); var_dump($row);
} }
echo "====DIRECT====\n"; echo "====DIRECT====\n";
foreach($db->unbuffered_query("SELECT a from strings", SQLITE_NUM) as $row) { foreach($db->unbufferedQuery("SELECT a from strings", SQLITE_NUM) as $row) {
var_dump($row); var_dump($row);
} }
echo "====BUFFERED====\n"; echo "====BUFFERED====\n";

View File

@ -23,13 +23,13 @@ foreach ($data as $str) {
} }
echo "====FOREACH====\n"; echo "====FOREACH====\n";
$r = $db->unbuffered_query("SELECT a from strings", SQLITE_NUM); $r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
foreach($r as $idx => $row) { foreach($r as $idx => $row) {
var_dump($row[0]); var_dump($row[0]);
var_dump($row[0]); var_dump($row[0]);
} }
echo "====FOR====\n"; echo "====FOR====\n";
$r = $db->unbuffered_query("SELECT a from strings", SQLITE_NUM); $r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
for(;$r->valid(); $r->next()) { for(;$r->valid(); $r->next()) {
$v = $r->column(0); $v = $r->column(0);
var_dump($v); var_dump($v);

View File

@ -10,7 +10,7 @@ include "blankdb_oo.inc";
$db->query("CREATE TABLE strings(a, b INTEGER, c VARCHAR(10), d)"); $db->query("CREATE TABLE strings(a, b INTEGER, c VARCHAR(10), d)");
$db->query("INSERT INTO strings VALUES('1', '2', '3', 'abc')"); $db->query("INSERT INTO strings VALUES('1', '2', '3', 'abc')");
var_dump($db->fetch_column_types("strings")); var_dump($db->fetchColumnTypes("strings"));
?> ?>
--EXPECT-- --EXPECT--
array(4) { array(4) {

View File

@ -13,14 +13,14 @@ $db->query("INSERT INTO strings VALUES('foo', 'foo')");
class sqlite_help class sqlite_help
{ {
function sqlite_help($db){ function __construct($db){
$this->db = $db; $this->db = $db;
$this->db->create_function('link_keywords', array(&$this, 'linkers'), 1); $this->db->createFunction('link_keywords', array(&$this, 'linkers'), 1);
} }
function get_single($key) function getSingle($key)
{ {
return $this->db->single_query('SELECT link_keywords(var) FROM strings WHERE key=\''.$key.'\'', 1); return $this->db->singleQuery('SELECT link_keywords(var) FROM strings WHERE key=\''.$key.'\'', 1);
} }
function linkers($str) function linkers($str)
@ -41,7 +41,7 @@ class sqlite_help
} }
$obj = new sqlite_help($db); $obj = new sqlite_help($db);
echo $obj->get_single('foo')."\n"; echo $obj->getSingle('foo')."\n";
$obj->free(); $obj->free();
unset($obj); unset($obj);

View File

@ -21,13 +21,13 @@ function baz($param = NULL) {
return $param; return $param;
} }
var_dump($db->single_query("select php('baz')", 1)); var_dump($db->singleQuery("select php('baz')", 1));
var_dump($db->single_query("select php('baz', 1)", 1)); var_dump($db->singleQuery("select php('baz', 1)", 1));
var_dump($db->single_query("select php('baz', \"PHP\")", 1)); var_dump($db->singleQuery("select php('baz', \"PHP\")", 1));
var_dump($db->single_query("select php('foo::bar')", 1)); var_dump($db->singleQuery("select php('foo::bar')", 1));
var_dump($db->single_query("select php('foo::bar', 1)", 1)); var_dump($db->singleQuery("select php('foo::bar', 1)", 1));
var_dump($db->single_query("select php('foo::bar', \"PHP\")", 1)); var_dump($db->singleQuery("select php('foo::bar', \"PHP\")", 1));
var_dump($db->single_query("select php('foo::bar(\"PHP\")')", 1)); var_dump($db->singleQuery("select php('foo::bar(\"PHP\")')", 1));
?> ?>
===DONE=== ===DONE===

View File

@ -60,7 +60,7 @@ class SqliteNestedset implements RecursiveIterator
{ {
$this->db = $db; $this->db = $db;
$this->id_l = $id_l; $this->id_l = $id_l;
$this->id_r = $this->db->single_query('SELECT id_r FROM menu WHERE id_l='.$id_l, 1); $this->id_r = $this->db->singleQuery('SELECT id_r FROM menu WHERE id_l='.$id_l, 1);
$this->id = $id_l; $this->id = $id_l;
} }
@ -93,8 +93,8 @@ class SqliteNestedset implements RecursiveIterator
protected function fetch() protected function fetch()
{ {
$res = $this->db->unbuffered_query('SELECT * FROM menu WHERE id_l='.$this->id); $res = $this->db->unbufferedQuery('SELECT * FROM menu WHERE id_l='.$this->id);
$this->entry = $res->fetch_object('SqliteNestedsetElement', array(&$this->db)); $this->entry = $res->fetchObject('SqliteNestedsetElement', array(&$this->db));
unset($res); unset($res);
} }