RC4PHP (Raul's Classes for PHP) quick reference =========================================================== CONNECTION CLASSES classes: RC4PHP_DB_MSSQL, RC4PHP_DB_MySQL, RC4PHP_DB_PostgreSQL, RC4PHP_DB_SQLite GET PROPERTIES --------------------------------------------------------------------------- (Note: get properties marked with [], can also be accessed as array keys.) --------------------------------------------------------------------------- type = object's type: 'SQL' [] version = server version [] database = database's name [] server = server's name [] user = user's name [] password = user's password [] connection = sql connection resource databases = databases from server (array) tables = database's tables (array) views = current database's views (array) SET PROPERTIES --------------------------------------------------------------------------- (Note: set properties marked with [], can also be accessed as array keys.) --------------------------------------------------------------------------- database = database's name [] server = server's name [] user = user's name [] password = user's password [] PUBLIC METHODS --------------------------------------------------------------------------- escapeString($string); -> returns escaped string of $string. &escapeBinaryString(&$binaryString); -> returns escaped string for binary data. &unescapeSQLBinaryString(&$binaryString); -> returns binary string from SQL server. isConnected(); -> returns state of connection: boolean true for connected else it returns false. connect(); -> try to connects to SQL server. disconnect(); -> disconnect from SQL server. query($sql); -> send a query to the SQL server; it returns an SQL Result object. getDatabases(); -> get array of databases getTables($database=''); -> get array of tables from $database; if $database is empty then it will use current database. getViews($database=''); -> get array of views from $database; if $database is empty then it will use current database. DATE2MIDAS($date); -> convert date into MIDAS date. MIDAS2DATE($MIDASdate); -> convert MIDAS date into date. RESULT CLASSES classes: RC4PHP_DB_MSSQL_Result, RC4PHP_DB_MySQL_Result, RC4PHP_DB_PostgreSQL_Result, RC4PHP_DB_SQLite_Result ------------------------------------------------------------------------------ (Note: the result's rows and columns can also be accessed as array elements Example: $result[0][0] -> first columnn from 1st row $result[1]['Foo'] -> column 'Foo' from 2nd row) ------------------------------------------------------------------------------ GET PROPERTIES ------------------------------------------------------------- type = object's type: 'SQL' maxPageSize = limit maximum page size pageSize = number of rows for page pages = number of pages page = current page number (starting from 1) row = current row number (from current page, if pageSize is set) (starting from 0) rows = number of rows from current page or total number of rows if pagination is not used totalRows = total number of rows, no matter pagination is set or not fields = number of fields affectedRows = number of affected rows lastInsertedID = last inserted ID executionTime = execution time for the SQL query in msec SET PROPERTIES ------------------------------------------------------------- maxPageSize = limit maximum page size pageSize = number of rows for page page = current page number (starting from 1) row = current row number (from current page, if pageSize is set) (starting from 0) PUBLIC METHODS ------------------------------------------------------------- execute(); -> execute the sql querry. fetchField($fieldOffset=NULL); fetchRow(); -> fetch row from current row position as an array. each result column is stored in an array offset, starting at offset 0. fetchRowAssociative(); -> fetch row from current row position as an associative array of column's names. fetchRowArray(); -> fetch row from current row position as an array. the array offsets can be colum's name or column's number (starting from 0). fetchObject(); -> fetch row from current row position as an object with properties that correspond to the fetched row. fetchAllRows(); -> fetch all rows from current row position as a bidimensional array. first dimension is row number (starting from 0) and the 2nd dimension is column (starting from 0). fetchAllRowsAssociative(); -> fetch all rows from current row position as a bidimensional array. first dimension is row number (starting from 0) and the 2nd dimension is column's name. fetchAllRowsArray(); -> fetch all rows from current row position as a bidimensional array. first dimension is row number (starting from 0) and the 2nd dimension can be colum's name or column's number (starting from 0). fetchAllObjectsArray(); -> fetch all rows from current row position as an array of objects. the array offsets are row numbers (starting from 0). nextResult(); freeResult(); -> free all memory associated with the result. printPageSelect($selectName='page',$otherSelectParameters='',$ReturnAsStringInsteadOfPrint=false); -> prints/returns as a string page select control