From 4ac70c6821545e824a78dd9341d8c66240b63583 Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Mon, 8 Apr 2002 01:37:38 +0000 Subject: Added pg_metadate(), pg_convert(), pg_insert(), pg_select(), pg_update() and pg_delete(). @ Added pg_metadate(), pg_convert(), pg_insert(), pg_select(), pg_update() @ and pg_delete(). (Yasuo) --- ext/pgsql/tests/10pg_convert.phpt | 17 +++++++++++ ext/pgsql/tests/11pg_metadata.phpt | 51 +++++++++++++++++++++++++++++++++ ext/pgsql/tests/12pg_insert.phpt | 10 +++++++ ext/pgsql/tests/13pg_select.phpt | 21 ++++++++++++++ ext/pgsql/tests/14pg_update.phpt | 10 +++++++ ext/pgsql/tests/15pg_delete.phpt | 10 +++++++ ext/pgsql/tests/16pg_result_status.phpt | 11 +++++++ ext/pgsql/tests/informational.inc | 47 ++++++++++++++++++++++++++++++ ext/pgsql/tests/pg_convert.inc | 14 +++++++++ ext/pgsql/tests/pg_delete.inc | 17 +++++++++++ ext/pgsql/tests/pg_insert.inc | 16 +++++++++++ ext/pgsql/tests/pg_metadata.inc | 13 +++++++++ ext/pgsql/tests/pg_result_status.inc | 13 +++++++++ ext/pgsql/tests/pg_select.inc | 18 ++++++++++++ ext/pgsql/tests/pg_update.inc | 17 +++++++++++ 15 files changed, 285 insertions(+) create mode 100644 ext/pgsql/tests/10pg_convert.phpt create mode 100644 ext/pgsql/tests/11pg_metadata.phpt create mode 100644 ext/pgsql/tests/12pg_insert.phpt create mode 100644 ext/pgsql/tests/13pg_select.phpt create mode 100644 ext/pgsql/tests/14pg_update.phpt create mode 100644 ext/pgsql/tests/15pg_delete.phpt create mode 100644 ext/pgsql/tests/16pg_result_status.phpt create mode 100644 ext/pgsql/tests/informational.inc create mode 100644 ext/pgsql/tests/pg_convert.inc create mode 100644 ext/pgsql/tests/pg_delete.inc create mode 100644 ext/pgsql/tests/pg_insert.inc create mode 100644 ext/pgsql/tests/pg_metadata.inc create mode 100644 ext/pgsql/tests/pg_result_status.inc create mode 100644 ext/pgsql/tests/pg_select.inc create mode 100644 ext/pgsql/tests/pg_update.inc (limited to 'ext/pgsql/tests') diff --git a/ext/pgsql/tests/10pg_convert.phpt b/ext/pgsql/tests/10pg_convert.phpt new file mode 100644 index 0000000000..ca54fdd50d --- /dev/null +++ b/ext/pgsql/tests/10pg_convert.phpt @@ -0,0 +1,17 @@ +--TEST-- +PostgreSQL pg_convert() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +array(3) { + ["num"]=> + int(1234) + ["str"]=> + string(5) "'AAA'" + ["bin"]=> + string(5) "'BBB'" +} diff --git a/ext/pgsql/tests/11pg_metadata.phpt b/ext/pgsql/tests/11pg_metadata.phpt new file mode 100644 index 0000000000..08aab03a77 --- /dev/null +++ b/ext/pgsql/tests/11pg_metadata.phpt @@ -0,0 +1,51 @@ +--TEST-- +PostgreSQL pg_metadata() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +array(3) { + ["num"]=> + array(5) { + ["num"]=> + int(1) + ["type"]=> + string(4) "int4" + ["len"]=> + int(4) + ["not null"]=> + bool(false) + ["default"]=> + bool(false) + } + ["str"]=> + array(5) { + ["num"]=> + int(2) + ["type"]=> + string(4) "text" + ["len"]=> + int(-1) + ["not null"]=> + bool(false) + ["default"]=> + bool(false) + } + ["bin"]=> + array(5) { + ["num"]=> + int(3) + ["type"]=> + string(5) "bytea" + ["len"]=> + int(-1) + ["not null"]=> + bool(false) + ["default"]=> + bool(false) + } +} + diff --git a/ext/pgsql/tests/12pg_insert.phpt b/ext/pgsql/tests/12pg_insert.phpt new file mode 100644 index 0000000000..8070df1539 --- /dev/null +++ b/ext/pgsql/tests/12pg_insert.phpt @@ -0,0 +1,10 @@ +--TEST-- +PostgreSQL pg_insert() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Ok diff --git a/ext/pgsql/tests/13pg_select.phpt b/ext/pgsql/tests/13pg_select.phpt new file mode 100644 index 0000000000..7c61436089 --- /dev/null +++ b/ext/pgsql/tests/13pg_select.phpt @@ -0,0 +1,21 @@ +--TEST-- +PostgreSQL pg_select() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + array(3) { + ["num"]=> + string(4) "1234" + ["str"]=> + string(3) "AAA" + ["bin"]=> + string(3) "BBB" + } +} +Ok diff --git a/ext/pgsql/tests/14pg_update.phpt b/ext/pgsql/tests/14pg_update.phpt new file mode 100644 index 0000000000..da78eeac92 --- /dev/null +++ b/ext/pgsql/tests/14pg_update.phpt @@ -0,0 +1,10 @@ +--TEST-- +PostgreSQL pg_update() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Ok diff --git a/ext/pgsql/tests/15pg_delete.phpt b/ext/pgsql/tests/15pg_delete.phpt new file mode 100644 index 0000000000..331e898383 --- /dev/null +++ b/ext/pgsql/tests/15pg_delete.phpt @@ -0,0 +1,10 @@ +--TEST-- +PostgreSQL pg_delete() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Ok diff --git a/ext/pgsql/tests/16pg_result_status.phpt b/ext/pgsql/tests/16pg_result_status.phpt new file mode 100644 index 0000000000..6faf849e7f --- /dev/null +++ b/ext/pgsql/tests/16pg_result_status.phpt @@ -0,0 +1,11 @@ +--TEST-- +PostgreSQL pg_result_status() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +1 +COMMIT diff --git a/ext/pgsql/tests/informational.inc b/ext/pgsql/tests/informational.inc new file mode 100644 index 0000000000..120c61335b --- /dev/null +++ b/ext/pgsql/tests/informational.inc @@ -0,0 +1,47 @@ + \ No newline at end of file diff --git a/ext/pgsql/tests/pg_convert.inc b/ext/pgsql/tests/pg_convert.inc new file mode 100644 index 0000000000..ab6e95ff65 --- /dev/null +++ b/ext/pgsql/tests/pg_convert.inc @@ -0,0 +1,14 @@ +'1234', 'str'=>'AAA', 'bin'=>'BBB'); +$converted = pg_convert($db, $table_name, $fields); + +var_dump($converted); + + +?> diff --git a/ext/pgsql/tests/pg_delete.inc b/ext/pgsql/tests/pg_delete.inc new file mode 100644 index 0000000000..33e001081b --- /dev/null +++ b/ext/pgsql/tests/pg_delete.inc @@ -0,0 +1,17 @@ +'1234', 'str'=>'XXX', 'bin'=>'YYY'); +$ids = array('num'=>'1234'); +if (!pg_delete($db, $table_name, $ids, 1)) { + echo "Error\n"; +} +else { + echo "Ok\n"; +} + +?> \ No newline at end of file diff --git a/ext/pgsql/tests/pg_insert.inc b/ext/pgsql/tests/pg_insert.inc new file mode 100644 index 0000000000..bfb2e90e83 --- /dev/null +++ b/ext/pgsql/tests/pg_insert.inc @@ -0,0 +1,16 @@ +'1234', 'str'=>'AAA', 'bin'=>'BBB'); +if (!pg_insert($db, $table_name, $fields, 1, 0)) { + echo "Error\n"; +} +else { + echo "Ok\n"; +} + +?> diff --git a/ext/pgsql/tests/pg_metadata.inc b/ext/pgsql/tests/pg_metadata.inc new file mode 100644 index 0000000000..16a2577e36 --- /dev/null +++ b/ext/pgsql/tests/pg_metadata.inc @@ -0,0 +1,13 @@ + diff --git a/ext/pgsql/tests/pg_result_status.inc b/ext/pgsql/tests/pg_result_status.inc new file mode 100644 index 0000000000..2c03e8966a --- /dev/null +++ b/ext/pgsql/tests/pg_result_status.inc @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/ext/pgsql/tests/pg_select.inc b/ext/pgsql/tests/pg_select.inc new file mode 100644 index 0000000000..04ca501deb --- /dev/null +++ b/ext/pgsql/tests/pg_select.inc @@ -0,0 +1,18 @@ +'1234', 'str'=>'XXX', 'bin'=>'YYY'); +$ids = array('num'=>'1234'); +if (!($res = pg_select($db, $table_name, $ids, 1))) { + echo "Error\n"; +} +else { + var_dump($res); + echo "Ok\n"; +} + +?> \ No newline at end of file diff --git a/ext/pgsql/tests/pg_update.inc b/ext/pgsql/tests/pg_update.inc new file mode 100644 index 0000000000..6501c09af5 --- /dev/null +++ b/ext/pgsql/tests/pg_update.inc @@ -0,0 +1,17 @@ +'1234', 'str'=>'XXX', 'bin'=>'YYY'); +$ids = array('num'=>'1234'); +if (!pg_update($db, $table_name, $fields, $ids, 1, 0)) { + echo "Error\n"; +} +else { + echo "Ok\n"; +} + +?> -- cgit v1.2.1