From 61c85ff417a2e86cddcd1491fd76b617f9f0a708 Mon Sep 17 00:00:00 2001 From: Egon Schmid Date: Mon, 24 Jan 2000 21:43:09 +0000 Subject: [PATCH] Some cosmetic changes. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@18807 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/dbase.xml | 270 ++++++++++++++++++++++++++------------------ 1 file changed, 158 insertions(+), 112 deletions(-) diff --git a/functions/dbase.xml b/functions/dbase.xml index c919ba2491..d7183974c3 100644 --- a/functions/dbase.xml +++ b/functions/dbase.xml @@ -5,11 +5,13 @@ These functions allow you to access records stored in dBase-format - (dbf) databases. + (dbf) databases. + - There is no support for indexes or memo fields. There is no support - for locking, too. Two concurrent webserver processes modifying the - same dBase file will very likely ruin your database. + There is no support for indexes or memo fields. There is no + support for locking, too. Two concurrent webserver processes + modifying the same dBase file will very likely ruin your database. + Unlike SQL databases, dBase "databases" cannot change the database definition afterwards. Once the file is created, the database @@ -17,21 +19,23 @@ otherwise organize your data. dBase files are simple sequential files of fixed length records. Records are appended to the end of the file and delete records are kept until you call - dbase_pack(). + dbase_pack(). + We recommend that you do not use dBase files as your production database. Choose any real SQL server instead; MySQL or Postgres - are common choices with PHP. dBase support is here to allow you - to import and export data to and from your web database, since the - file format is commonly understood with Windows spreadsheets - and organizers. Import and export of data is about all that - dBase support is good for. + are common choices with PHP. dBase support is here to allow you to + import and export data to and from your web database, since the + file format is commonly understood with Windows spreadsheets and + organizers. Import and export of data is about all that dBase + support is good for. + dbase_create - creates a dBase database + Creates a dBase database Description @@ -41,49 +45,65 @@ array fields - The fields parameter is an array of - arrays, each array describing the format of one field in the - database. Each field consists of a name, a character - indicating the field type, a length, and a precision. - - The types of fields available are: - - - L - - Boolean. These do not have a length or precision. - - - M - - Memo. (Note that these aren't supported by PHP.) - These do not have a length or precision. - - - D - - Date (stored as YYYYMMDD). These do not have a length - or precision. - - - N - - Number. These have both a length and a precision (the - number of digits after the decimal point). - - - C - - String. - - - - If the database is successfully created, a dbase_identifier - is returned, otherwise false is returned. - + The fields parameter is an array of + arrays, each array describing the format of one field in the + database. Each field consists of a name, a character indicating + the field type, a length, and a precision. + + + The types of fields available are: + + + L + + + Boolean. These do not have a length or precision. + + + + + M + + + Memo. (Note that these aren't supported by PHP.) These do + not have a length or precision. + + + + + D + + + Date (stored as YYYYMMDD). These do not have a length or + precision. + + + + + N + + + Number. These have both a length and a precision (the number + of digits after the decimal point). + + + + + C + + + String. + + + + + + + If the database is successfully created, a dbase_identifier is + returned, otherwise false is returned. Creating a dBase database file - + // "database" name $dbname = "/tmp/test.dbf"; @@ -100,16 +120,16 @@ $def = // creation if (!dbase_create($dbname, $def)) print "<strong>Error!</strong>"; - - - + + + dbase_open - opens a dBase database + Opens a dBase database Description @@ -119,19 +139,21 @@ if (!dbase_create($dbname, $def)) int flags - The flags correspond to those for the open() system call. - (Typically 0 means read-only, 1 means write-only, and 2 - means read and write.) - - Returns a dbase_identifier for the opened database, or - false if the database couldn't be opened. + The flags correspond to those for the open() system call. + (Typically 0 means read-only, 1 means write-only, and 2 means + read and write.) + + + Returns a dbase_identifier for the opened database, or false if + the database couldn't be opened. + dbase_close - close a dBase database + Close a dBase database Description @@ -140,14 +162,16 @@ if (!dbase_create($dbname, $def)) int dbase_identifier - Closes the database associated with dbase_identifier. + Closes the database associated with + dbase_identifier. + dbase_pack - packs a dBase database + Packs a dBase database Description @@ -156,15 +180,17 @@ if (!dbase_create($dbname, $def)) int dbase_identifier - Packs the specified database (permanently deleting all records - marked for deletion using dbase_delete_record. + Packs the specified database (permanently deleting all records + marked for deletion using + dbase_delete_record. + dbase_add_record - add a record to a dBase database + Add a record to a dBase database Description @@ -174,17 +200,18 @@ if (!dbase_create($dbname, $def)) array record - Adds the data in the record to the - database. If the number of items in the supplied record isn't - equal to the number of fields in the database, the operation - will fail and false will be returned. + Adds the data in the record to the + database. If the number of items in the supplied record isn't + equal to the number of fields in the database, the operation will + fail and false will be returned. + dbase_replace_record - replace a record in a dBase database + Replace a record in a dBase database Description @@ -197,21 +224,23 @@ if (!dbase_create($dbname, $def)) Replaces the data associated with the record record_number with the data in the - record in the database. If the number of items in - the supplied record is not equal to the number of fields in the database, - the operation will fail and false will be returned. - + record in the database. If the number of + items in the supplied record is not equal to the number of fields + in the database, the operation will fail and false will be + returned. + - dbase_record_number is an integer which spans from - 1 to the number of records in the database (as returned by - dbase_numrecords). + dbase_record_number is an integer which + spans from 1 to the number of records in the database (as + returned by dbase_numrecords). + dbase_delete_record - deletes a record from a dBase database + Deletes a record from a dBase database Description @@ -221,16 +250,17 @@ if (!dbase_create($dbname, $def)) int record - Marks record to be deleted from the database. - To actually remove the record from the database, you must - also call dbase_pack. + Marks record to be deleted from the + database. To actually remove the record from the database, you + must also call dbase_pack. + dbase_get_record - gets a record from a dBase database + Gets a record from a dBase database Description @@ -240,43 +270,54 @@ if (!dbase_create($dbname, $def)) int record - Returns the data from record in an array. The - array is indexed starting at 0, and includes an associative - member named 'deleted' which is set to 1 if the record has - been marked for deletion (see dbase_delete_record. + Returns the data from record in an + array. The array is indexed starting at 0, and includes an + associative member named 'deleted' which is set to 1 if the + record has been marked for deletion (see + dbase_delete_record. + - Each field is converted to the appropriate PHP type. (Dates - are left as strings.) + Each field is converted to the appropriate PHP type. (Dates are + left as strings.) + dbase_get_record_with_names - gets a record from a dBase database as an associative array + + Gets a record from a dBase database as an associative array + Description - array dbase_get_record_with_names + array + dbase_get_record_with_names + int dbase_identifier int record - Returns the data from record in an - associative array. The array also includes an associative member - named 'deleted' which is set to 1 if the record has been marked - for deletion (see dbase_delete_record. + Returns the data from record in an + associative array. The array also includes an associative member + named 'deleted' which is set to 1 if the record has been marked + for deletion (see dbase_delete_record. + - Each field is converted to the appropriate PHP type. (Dates - are left as strings.) + Each field is converted to the appropriate PHP type. (Dates are + left as strings.) + dbase_numfields - find out how many fields are in a dBase database + + Find out how many fields are in a dBase database + Description @@ -285,25 +326,29 @@ if (!dbase_create($dbname, $def)) int dbase_identifier - Returns the number of fields (columns) in the specified - database. Field numbers are between 0 and dbase_numfields($db)-1, - while record numbers are between 1 and dbase_numrecords($db). - - Using <function>dbase_numfields</function> - + Returns the number of fields (columns) in the specified + database. Field numbers are between 0 and dbase_numfields($db)-1, + while record numbers are between 1 and dbase_numrecords($db). + + Using <function>dbase_numfields</function> + $rec = dbase_get_record($db, $recno); $nf = dbase_numfields($db); for ($i=0; $i < $nf; $i++) { print $rec[$i]."<br>\n"; } - + + + dbase_numrecords - find out how many records are in a dBase database + + Find out how many records are in a dBase database + Description @@ -312,9 +357,10 @@ for ($i=0; $i < $nf; $i++) { int dbase_identifier - Returns the number of records (rows) in the specified - database. Record numbers are between 1 and dbase_numrecords($db), - while field numbers are between 0 and dbase_numfields($db)-1. + Returns the number of records (rows) in the specified + database. Record numbers are between 1 and dbase_numrecords($db), + while field numbers are between 0 and dbase_numfields($db)-1. + @@ -330,7 +376,7 @@ sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil -sgml-default-dtd-file:"../manual.ced" +sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil