diff --git a/functions/fbsql.xml b/functions/fbsql.xml new file mode 100644 index 0000000000..aaac13b370 --- /dev/null +++ b/functions/fbsql.xml @@ -0,0 +1,1755 @@ + + FrontBase functions + FrontBase + + + These functions allow you to access FrontBase database servers. In + order to have these functions available, you must compile php + with fbsql support by using the + option. If you + use this option without specifying the path to fbsql, php will + search for the fbsql client libraries in the default instalation + location for the platform. Users who installed FrontBase in + a non standard directory should always specify the path to fbsql: + . + This will force php to use the client libraries installed by + FrontBase, avoiding any conflicts. + + + More information about FrontBase can be found at &url.fbsql;. + + + Documentation for FrontBase can be found at &url.fbsql.docs;. + + + + + + + fbsql_affected_rows + Get number of affected rows in previous FrontBase + operation + + + Description + + + int fbsql_affected_rows + int + + link_identifier + + + + + + fbsql_affected_rows returns the number + of rows affected by the last INSERT, UPDATE or DELETE query + associated with link_identifier. If the + link identifier isn't specified, the last link opened by + fbsql_connect is assumed. + + + + If you are using transactions, you need to call + fbsql_affected_rows after your INSERT, + UPDATE, or DELETE query, not after the commit. + + + + If the last query was a DELETE query with no WHERE clause, all + of the records will have been deleted from the table but this + function will return zero. + + + + When using UPDATE, FrontBase will not update columns where the new + value is the same as the old value. This creates the possiblity + that fbsql_affected_rows may not actually + equal the number of rows matched, only the number of rows that + were literally affected by the query. + + + + If the last query failed, this function will return -1. + + + See also: fbsql_num_rows. + + + + + + + fbsql_autocommit + Enable or disable autocommit. + + + Description + + + bool fbsql_autocommit + int + link_identifier + + bool + + OnOff + + + + + + fbsql_autocommit returns the current + autocommit status. if the optional OnOff parameter is + given the auto commit status will be changed. + + + + + + fbsql_change_user + + Change logged in user of the active connection + + + + Description + + + int fbsql_change_user + string user + string password + string + + database + + + int + + link_identifier + + + + + + fbsql_change_user changes the logged in user + of the current active connection, or the connection given by the + optional parameter link_identifier. If a database is + specified, this will default or current database after the user + has been changed. If the new user and password authorization fails, + the current connected user stays active. + + + + + + fbsql_close + Close FrontBase connection + + + Description + + + int fbsql_close + int + + link_identifier + + + + + + Returns: true on success, false on error. + + fbsql_close closes the connection to + the FrontBase server that's associated with the specified link + identifier. If link_identifier isn't + specified, the last opened link is used. + + + Using fbsql_close isn't usually necessary, + as non-persistent open links are automatically closed at the end + of the script's execution. + + + + + FrontBase close example + +<?php + $link = fbsql_connect ("localhost", "_SYSTEM", "secret") + or die ("Could not connect"); + print ("Connected successfully"); + fbsql_close ($link); +?> + + + + See also: fbsql_connect, and + fbsql_pconnect. + + + + + + + fbsql_connect + Open a connection to a FrontBase Server + + + Description + + + int fbsql_connect + string + + hostname + + + + string + + username + + + string + + password + + + + + + Returns a positive FrontBase link identifier on success, or an error + message on failure. + + + fbsql_connect establishes a connection + to a FrontBase server. The following defaults are assumed for + missing optional parameters: hostname = + 'NULL', username = '_SYSTEM' and + password = empty password. + + + If a second call is made to fbsql_connect + with the same arguments, no new link will be established, but + instead, the link identifier of the already opened link will be + returned. + + + The link to the server will be closed as soon as the execution of + the script ends, unless it's closed earlier by explicitly calling + fbsql_close. + + + FrontBase connect example + +<?php + + $link = fbsql_connect ("localhost", "_SYSTEM", "secret") + or die ("Could not connect"); + print ("Connected successfully"); + fbsql_close ($link); + +?> + + + See also + fbsql_pconnect, and + fbsql_close. + + + + + + + fbsql_create_db + Create a FrontBase database + + + Description + + + int fbsql_create_db + string database name + int + + link_identifier + + + + + + fbsql_create_db attempts to create a new + database on the server associated with the specified link + identifier. + + + FrontBase create database example + +<?php + $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") + or die ("Could not connect"); + if (fbsql_create_db ("my_db")) { + print ("Database created successfully\n"); + } else { + printf ("Error creating database: %s\n", fbsql_error ()); + } +?> + + + + See also: fbsql_drop_db. + + + + + + + fbsql_data_seek + Move internal result pointer + + + Description + + + int fbsql_data_seek + int result_identifier + int row_number + + + + Returns: true on success, false on failure. + + + fbsql_data_seek moves the internal row + pointer of the FrontBase result associated with the specified result + identifier to point to the specified row number. The next call + to fbsql_fetch_row would return that row. + + + Row_number starts at 0. + + + + FrontBase data seek example + +<?php + $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") + or die ("Could not connect"); + + fbsql_select_db ("samp_db") + or die ("Could not select database"); + + $query = "SELECT last_name, first_name FROM friends"; + $result = fbsql_query ($query) + or die ("Query failed"); + + # fetch rows in reverse order + + for ($i = fbsql_num_rows ($result) - 1; $i >=0; $i--) { + if (!fbsql_data_seek ($result, $i)) { + printf ("Cannot seek to row %d\n", $i); + continue; + } + + if(!($row = fbsql_fetch_object ($result))) + continue; + + printf ("%s %s<BR>\n", $row->last_name, $row->first_name); + } + + fbsql_free_result ($result); +?> + + + + + + + + fbsql_db_query + Send a FrontBase query + + + Description + + + int fbsql_db_query + string database + string query + int + + link_identifier + + + + + + Returns: A positive FrontBase result identifier to the query result, + or false on error. + + + fbsql_db_query selects a database and + executes a query on it. If the optional link identifier isn't + specified, the function will try to find an open link to the + FrontBase server and if no such link is found it'll try to create one + as if fbsql_connect was called with no + arguments + + + See also fbsql_connect. + + + + + + + fbsql_drop_db + Drop (delete) a FrontBase database + + + Description + + + int fbsql_drop_db + string database_name + int + + link_identifier + + + + + + Returns: true on success, false on failure. + + + fbsql_drop_db attempts to drop (remove) an + entire database from the server associated with the specified + link identifier. + + + + + + + fbsql_errno + Returns the numerical value of the error message from previous + FrontBase operation + + + Description + + + int fbsql_errno + int + + link_identifier + + + + + + Returns the error number from the last fbsql function, or + 0 (zero) if no error occurred. + + + Errors coming back from the fbsql database backend dont + issue warnings. Instead, use fbsql_errno to + retrieve the error code. Note that this function only returns the + error code from the most recently executed fbsql function (not + including fbsql_error and + fbsql_errno), so if you want to use it, + make sure you check the value before calling another fbsql + function. + + +<?php +fbsql_connect("marliesle"); +echo fbsql_errno().": ".fbsql_error()."<BR>"; +fbsql_select_db("nonexistentdb"); +echo fbsql_errno().": ".fbsql_error()."<BR>"; +$conn = fbsql_query("SELECT * FROM nonexistenttable"); +echo fbsql_errno().": ".fbsql_error()."<BR>"; +?> + + + + + See also: fbsql_error, + fbsql_warnings + + + + + + + fbsql_error + Returns the text of the error message from previous + FrontBase operation + + + Description + + + string fbsql_error + int + + link_identifier + + + + + + Returns the error text from the last fbsql function, or + '' (the empty string) if no error occurred. + + + Errors coming back from the fbsql database backend dont + issue warnings. Instead, use fbsql_error to + retrieve the error text. Note that this function only returns the + error text from the most recently executed fbsql function (not + including fbsql_error and + fbsql_errno), so if you want to use it, make + sure you check the value before calling another fbsql function. + + +<?php +fbsql_connect("marliesle"); +echo fbsql_errno().": ".fbsql_error()."<BR>"; +fbsql_select_db("nonexistentdb"); +echo fbsql_errno().": ".fbsql_error()."<BR>"; +$conn = fbsql_query("SELECT * FROM nonexistenttable"); +echo fbsql_errno().": ".fbsql_error()."<BR>"; +?> + + + + + See also: fbsql_errno, + fbsql_warnings + + + + + + + fbsql_fetch_array + + Fetch a result row as an associative array, a numeric array, or both. + + + + Description + + + array fbsql_fetch_array + int result + int + + result_type + + + + + + Returns an array that corresponds to the fetched row, or false + if there are no more rows. + + fbsql_fetch_array is an extended version of + fbsql_fetch_row. In addition to storing the + data in the numeric indices of the result array, it also stores + the data in associative indices, using the field names as keys. + + + If two or more columns of the result have the same field names, + the last column will take precedence. To access the other column(s) + of the same name, you must the numeric index of the column or + make an alias for the column. + + +select t1.f1 as foo t2.f1 as bar from t1, t2 + + + + + An important thing to note is that using + fbsql_fetch_array is NOT significantly + slower than using fbsql_fetch_row, while it + provides a significant added value. + + + The optional second argument result_type + in fbsql_fetch_array is a constant and can + take the following values: FBSQL_ASSOC, FBSQL_NUM, and + FBSQL_BOTH. + + + For further details, see also + fbsql_fetch_row and fbsql_fetch_assoc. + + + <function>fbsql_fetch_array</function> + +<?php +fbsql_connect ($host, $user, $password); +$result = fbsql_db_query ("database","select user_id, fullname from table"); +while ($row = fbsql_fetch_array ($result)) { + echo "user_id: ".$row["user_id"]."<br>\n"; + echo "user_id: ".$row[0]."<br>\n"; + echo "fullname: ".$row["fullname"]."<br>\n"; + echo "fullname: ".$row[1]."<br>\n"; +} +fbsql_free_result ($result); +?> + + + + + + + + fbsql_fetch_assoc + + Fetch a result row as an associative array + + + + Description + + + array fbsql_fetch_assoc + int result + + + + Returns an associative array that corresponds to the fetched row, + or false if there are no more rows. + + fbsql_fetch_assoc is equivalent to calling + fbsql_fetch_array with FBSQL_ASSOC for the + optional second parameter. It only returns an associative array. + This is the way fbsql_fetch_array originally + worked. If you need the numeric indices as well as the + associative, use fbsql_fetch_array. + + + If two or more columns of the result have the same field names, + the last column will take precedence. To access the other column(s) + of the same name, you must use fbsql_fetch_array and + have it return the numeric indices as well. + + + An important thing to note is that using + fbsql_fetch_assoc is NOT significantly + slower than using fbsql_fetch_row, while it + provides a significant added value. + + + For further details, see also + fbsql_fetch_row and fbsql_fetch_array. + + + <function>fbsql_fetch_assoc</function> + +<?php +fbsql_connect ($host, $user, $password); +$result = fbsql_db_query ("database","select * from table"); +while ($row = fbsql_fetch_assoc ($result)) { + echo $row["user_id"]; + echo $row["fullname"]; +} +fbsql_free_result ($result); +?> + + + + + + + + fbsql_fetch_field + + Get column information from a result and return as an object + + + + Description + + + object fbsql_fetch_field + int result + int + + field_offset + + + + + + Returns an object containing field information. + + + fbsql_fetch_field can be used in order to + obtain information about fields in a certain query result. If + the field offset isn't specified, the next field that wasn't yet + retrieved by fbsql_fetch_field is retrieved. + + + The properties of the object are: + + + + name - column name + + + + + table - name of the table the column belongs to + + + + + max_length - maximum length of the column + + + + + not_null - 1 if the column cannot be null + + + + + type - the type of the column + + + + + + <function>fbsql_fetch_field</function> + +<?php +fbsql_connect ($host, $user, $password) + or die ("Could not connect"); +$result = fbsql_db_query ("database", "select * from table") + or die ("Query failed"); +# get column metadata +$i = 0; +while ($i < fbsql_num_fields ($result)) { + echo "Information for column $i:<BR>\n"; + $meta = fbsql_fetch_field ($result); + if (!$meta) { + echo "No information available<BR>\n"; + } + echo "<PRE> +max_length: $meta->max_length +name: $meta->name +not_null: $meta->not_null +table: $meta->table +type: $meta->type +</PRE>"; + $i++; +} +fbsql_free_result ($result); +?> + + + + See also fbsql_field_seek. + + + + + + + fbsql_fetch_lengths + + Get the length of each output in a result + + + + Description + + + array fbsql_fetch_lengths + int + + result + + + + + Returns: An array that corresponds to the lengths of each field + in the last row fetched by fbsql_fetch_row, + or false on error. + + + fbsql_fetch_lengths stores the lengths of + each result column in the last row returned by + fbsql_fetch_row, + fbsql_fetch_array, and + fbsql_fetch_object in an array, starting at + offset 0. + + + See also: fbsql_fetch_row. + + + + + + + fbsql_fetch_object + Fetch a result row as an object + + + Description + + + object fbsql_fetch_object + int result + int + + result_type + + + + + + Returns an object with properties that correspond to the fetched + row, or false if there are no more rows. + + + fbsql_fetch_object is similar to + fbsql_fetch_array, with one difference - an + object is returned, instead of an array. Indirectly, that means + that you can only access the data by the field names, and not by + their offsets (numbers are illegal property names). + + + The optional argument result_type is a + constant and can take the following values: FBSQL_ASSOC, + FBSQL_NUM, and FBSQL_BOTH. + + + Speed-wise, the function is identical to + fbsql_fetch_array, and almost as quick as + fbsql_fetch_row (the difference is + insignificant). + + <function>fbsql_fetch_object</function> example + +<?php +fbsql_connect ($host, $user, $password); +$result = fbsql_db_query ("database", "select * from table"); +while ($row = fbsql_fetch_object ($result)) { + echo $row->user_id; + echo $row->fullname; +} +fbsql_free_result ($result); +?> + + + + + See also: fbsql_fetch_array and + fbsql_fetch_row. + + + + + + + fbsql_fetch_row + Get a result row as an enumerated array + + + Description + + + array fbsql_fetch_row + int result + + + + Returns: An array that corresponds to the fetched row, or false + if there are no more rows. + + + fbsql_fetch_row fetches one row of data from + the result associated with the specified result identifier. The + row is returned as an array. Each result column is stored in an + array offset, starting at offset 0. + + + Subsequent call to fbsql_fetch_row would + return the next row in the result set, or false if there are no + more rows. + + + See also: fbsql_fetch_array, + fbsql_fetch_object, + fbsql_data_seek, + fbsql_fetch_lengths, and + fbsql_result. + + + + + + + fbsql_field_flags + + Get the flags associated with the specified field in a result + + + + Description + + + string fbsql_field_flags + int result + int field_offset + + + + fbsql_field_flags returns the field flags of + the specified field. The flags are reported as a single word + per flag separated by a single space, so that you can split the + returned value using explode. + + + + + + + fbsql_field_name + + Get the name of the specified field in a result + + + + Description + + + string fbsql_field_name + int result + int field_index + + + + fbsql_field_name returns the name of the + specified field index. result must be a + valid result identifier and field_index is + the numerical offset of the field. + + + + field_index starts at 0. + + + e.g. The index of the third field would actually be 2, the index + of the fourth field would be 3 and so on. + + + + + <function>fbsql_field_name</function> example + +// The users table consists of three fields: +// user_id +// username +// password. + +$res = fbsql_db_query("users", "select * from users", $link); + +echo fbsql_field_name($res, 0) . "\n"; +echo fbsql_field_name($res, 2); + + + + + The above example would produce the following output: + + +user_id +password + + + + + + + + + fbsql_field_len + + Returns the length of the specified field + + + + Description + + + int fbsql_field_len + int result + int field_offset + + + + fbsql_field_len returns the length of the + specified field. + + + + + + + fbsql_field_seek + + Set result pointer to a specified field offset + + + + Description + + + int fbsql_field_seek + int result + int field_offset + + + + Seeks to the specified field offset. If the next call to + fbsql_fetch_field doesn't include a field + offset, the field offset specified in + fbsql_field_seek will be returned. + + + See also: fbsql_fetch_field. + + + + + + + fbsql_field_table + + Get name of the table the specified field is in + + + + Description + + + string fbsql_field_table + int result + int field_offset + + + + Returns the name of the table that the specifed field is + in. + + + + + + + fbsql_field_type + + Get the type of the specified field in a result + + + + Description + + + string fbsql_field_type + int result + int field_offset + + + + fbsql_field_type is similar to the + fbsql_field_name function. The arguments are + identical, but the field type is returned instead. The field type + will be one of "int", "real", "string", "blob", and others as + detailed in the FrontBase + documentation. + + fbsql field types + +<?php + +fbsql_connect ("localhost:3306"); +fbsql_select_db ("wisconsin"); +$result = fbsql_query ("SELECT * FROM onek"); +$fields = fbsql_num_fields ($result); +$rows = fbsql_num_rows ($result); +$i = 0; +$table = fbsql_field_table ($result, $i); +echo "Your '".$table."' table has ".$fields." fields and ".$rows." records <BR>"; +echo "The table has the following fields <BR>"; +while ($i < $fields) { + $type = fbsql_field_type ($result, $i); + $name = fbsql_field_name ($result, $i); + $len = fbsql_field_len ($result, $i); + $flags = fbsql_field_flags ($result, $i); + echo $type." ".$name." ".$len." ".$flags."<BR>"; + $i++; +} +fbsql_close(); + +?> + + + + + + + + + fbsql_free_result + Free result memory + + + Description + + + int fbsql_free_result + int result + + + + fbsql_free_result will free all memory + associated with the result identifier result. + + + fbsql_free_result only needs to be called if + you are concerned about how much memory is being used for queries + that return large result sets. All associated result memory is + automatically freed at the end of the script's execution. + + + + + + + fbsql_insert_id + + Get the id generated from the previous INSERT operation + + + + Description + + + int fbsql_insert_id + int + + link_identifier + + + + + + fbsql_insert_id returns the ID generated for + an AUTO_INCREMENT column by the previous INSERT query using the + given link_identifier. If + link_identifier isn't specified, the last + opened link is assumed. + + + fbsql_insert_id returns 0 if the previous + query does not generate an AUTO_INCREMENT value. If you need to + save the value for later, be sure to call fbsql_insert_id() + immediately after the query that generates the value. + + + + The value of the FrontBase SQL function + LAST_INSERT_ID() always contains the most + recently generated AUTO_INCREMENT value, and is not reset + between queries. + + + + + fbsql_insert_id converts the return type of + the native FrontBase C API function + fbsql_insert_id() to a type of + long. If your AUTO_INCREMENT column has + a column type of BIGINT, the value returned by + fbsql_insert_id will be incorrect. + Instead, use the internal FrontBase SQL function + LAST_INSERT_ID(). + + + + + + + + fbsql_list_dbs + + List databases available on a FrontBase server + + + + Description + + + int fbsql_list_dbs + int + + link_identifier + + + + + + fbsql_list_dbs will return a result pointer + containing the databases available from the current fbsql + daemon. Use the fbsql_tablename function to + traverse this result pointer. + + + + <function>fbsql_list_dbs</function> example + +$link = fbsql_connect('localhost', 'myname', 'secret'); +$db_list = fbsql_list_dbs($link); + +while ($row = fbsql_fetch_object($db_list)) { + echo $row->Database . "\n"; +} + + + + + The above example would produce the following output: + + +database1 +database2 +database3 +... + + + + + + The above code would just as easily work with + fbsql_fetch_row or other similar functions. + + + + + + + + fbsql_list_fields + List FrontBase result fields + + + Description + + + int fbsql_list_fields + string database_name + string table_name + int + + link_identifier + + + + + + fbsql_list_fields retrieves information + about the given tablename. Arguments are the database name and + the table name. A result pointer is returned which can be used + with fbsql_field_flags, + fbsql_field_len, + fbsql_field_name, and + fbsql_field_type. + + + A result identifier is a positive integer. The function returns + -1 if a error occurs. A string describing the error will be + placed in $phperrmsg, and unless the function + was called as @fbsql() then this error string + will also be printed out. + + + + <function>fbsql_list_fields</function> example + +$link = fbsql_connect('localhost', 'myname', 'secret'); + +$fields = fbsql_list_fields("database1", "table1", $link); +$columns = fbsql_num_fields($fields); + +for ($i = 0; $i < $columns; $i++) { + echo fbsql_field_name($fields, $i) . "\n";; +} + + + + + The above example would produce the following output: + + +field1 +field2 +field3 +... + + + + + + + + + fbsql_list_tables + List tables in a FrontBase database + + + Description + + + int fbsql_list_tables + string database + int + + link_identifier + + + + + + fbsql_list_tables takes a database name and + returns a result pointer much like the + fbsql_db_query function. The + fbsql_tablename function should be used to + extract the actual table names from the result pointer. + + + + + + + fbsql_num_fields + Get number of fields in result + + + Description + + + int fbsql_num_fields + int result + + + + fbsql_num_fields returns the number of + fields in a result set. + + + See also: + fbsql_db_query, + fbsql_query, + fbsql_fetch_field, + fbsql_num_rows. + + + + + + fbsql_num_rows + Get number of rows in result + + + Description + + + int fbsql_num_rows + int result + + + + fbsql_num_rows returns the number of rows in + a result set. This command is only valid for SELECT statements. + To retrieve the number of rows returned from a INSERT, UPDATE or + DELETE query, use fbsql_affected_rows. + + <function>fbsql_num_rows</function> example + +<?php + +$link = fbsql_connect("localhost", "username", "password"); +fbsql_select_db("database", $link); + +$result = fbsql_query("SELECT * FROM table1", $link); +$num_rows = fbsql_num_rows($result); + +echo "$num_rows Rows\n"; + +?> + + + + + See also: + fbsql_affected_rows, + fbsql_connect, + fbsql_select_db and + fbsql_query. + + + + + + + fbsql_pconnect + + Open a persistent connection to a FrontBase Server + + + + Description + + + int fbsql_pconnect + string + + hostname + :port + :/path/to/socket + + + + string + username + + string + password + + + + + Returns: A positive FrontBase persistent link identifier on success, + or false on error. + + + fbsql_pconnect establishes a connection + to a FrontBase server. The following defaults are assumed for + missing optional parameters: host:port = + 'localhost:3306', username = name of the + user that owns the server process and + password = empty password. + + + The hostname string can also include a port + number. eg. "hostname:port" or a path to a socket + eg. ":/path/to/socket" for the localhost. + + + fbsql_pconnect acts very much like + fbsql_connect with two major differences. + + + First, when connecting, the function would first try to find a + (persistent) link that's already open with the same host, + username and password. If one is found, an identifier for it + will be returned instead of opening a new connection. + + + Second, the connection to the SQL server will not be closed when + the execution of the script ends. Instead, the link will remain + open for future use. + + + This type of links is therefore called 'persistent'. + + + + + + + fbsql_query + Send a FrontBase query + + + Description + + + int fbsql_query + string query + int + link_identifier + + + + + fbsql_query sends a query to the currently + active database on the server that's associated with the + specified link identifier. If + link_identifier isn't specified, the last + opened link is assumed. If no link is open, the function tries + to establish a link as if fbsql_connect was + called with no arguments, and use it. + + + + The query string should not end with a semicolon. + + + + fbsql_query returns TRUE (non-zero) or FALSE + to indicate whether or not the query succeeded. A return value + of TRUE means that the query was legal and could be executed by + the server. It does not indicate anything about the number of + rows affected or returned. It is perfectly possible for a query + to succeed but affect no rows or return no rows. + + + The following query is syntactically invalid, so + fbsql_query fails and returns FALSE: + + <function>fbsql_query</function> + +<?php +$result = fbsql_query ("SELECT * WHERE 1=1") + or die ("Invalid query"); +?> + + + + + The following query is semantically invalid if + my_col is not a column in the table + my_tbl, so fbsql_query + fails and returns FALSE: + + <function>fbsql_query</function> + +<?php +$result = fbsql_query ("SELECT my_col FROM my_tbl") + or die ("Invalid query"); +?> + + + + + fbsql_query will also fail and return FALSE + if you don't have permission to access the table(s) referenced by + the query. + + + Assuming the query succeeds, you can call + fbsql_num_rows to find out how many rows + were returned for a SELECT statment or + fbsql_affected_rows to find out how many + rows were affected by a DELETE, INSERT, REPLACE, or UPDATE + statement. + + + For SELECT statements, fbsql_query returns a + new result identifier that you can pass to + fbsql_result. When you are done with the + result set, you can free the resources associated with it by + calling fbsql_free_result. Although, the + memory will automatically be freed at the end of the script's + execution. + + + See also: fbsql_affected_rows, + fbsql_db_query, + fbsql_free_result, + fbsql_result, + fbsql_select_db, and + fbsql_connect. + + + + + + + fbsql_result + Get result data + + + Description + + + mixed fbsql_result + int result + int row + mixed + + field + + + + + + fbsql_result returns the contents of one + cell from a FrontBase result set. The field argument can be the + field's offset, or the field's name, or the field's table dot + field's name (tabledname.fieldname). If the column name has been + aliased ('select foo as bar from...'), use the alias instead of + the column name. + + + When working on large result sets, you should consider using one + of the functions that fetch an entire row (specified below). As + these functions return the contents of multiple cells in one + function call, they're MUCH quicker than + fbsql_result. Also, note that specifying a + numeric offset for the field argument is much quicker than + specifying a fieldname or tablename.fieldname argument. + + + Calls to fbsql_result should not be mixed + with calls to other functions that deal with the result set. + + + Recommended high-performance alternatives: + fbsql_fetch_row, + fbsql_fetch_array, and + fbsql_fetch_object. + + + + + + + fbsql_select_db + Select a FrontBase database + + + Description + + + int fbsql_select_db + string database_name + int + + link_identifier + + + + + + Returns: true on success, false on error. + + + fbsql_select_db sets the current active + database on the server that's associated with the specified link + identifier. If no link identifier is specified, the last opened + link is assumed. If no link is open, the function will try to + establish a link as if fbsql_connect was + called, and use it. + + + Every subsequent call to fbsql_query will be + made on the active database. + + See also: + fbsql_connect, + fbsql_pconnect, and + fbsql_query. + + + + + + + fbsql_tablename + Get table name of field + + + Description + + + string fbsql_tablename + int result + int i + + + + fbsql_tablename takes a result pointer + returned by the fbsql_list_tables function + as well as an integer index and returns the name of a table. The + fbsql_num_rows function may be used to + determine the number of tables in the result pointer. + + <function>fbsql_tablename</function> Example + +<?php +fbsql_connect ("localhost:3306"); +$result = fbsql_list_tables ("wisconsin"); +$i = 0; +while ($i < fbsql_num_rows ($result)) { + $tb_names[$i] = fbsql_tablename ($result, $i); + echo $tb_names[$i] . "<BR>"; + $i++; +} +?> + + + + + + + + + fbsql_warnings + Enable or disable FrontBase warnings + + + Description + + + bool fbsql_warnings + bool + + OnOff + + + + + + Returns: true if warnings is turned on otherwise false. + + + fbsql_warnings enables or disables FrontBase + warnings. + + + + + + +