$query_log
$query_log : string
Used to store statistics about what queries have been run depending on the debug level
This abstract class defines the interface through which the seek_quarry program communicates with a database and the filesystem.
connect(string $db_host = \seekquarry\yioop\configs\DB_HOST, string $db_user = \seekquarry\yioop\configs\DB_USER, string $db_password = \seekquarry\yioop\configs\DB_PASSWORD, string $db_name = \seekquarry\yioop\configs\DB_NAME) : mixed
Connects to a database on a DBMS using data provided or from config.php
string | $db_host | the hostname of where the database is located (not used in all dbms's) |
string | $db_user | the user to connect as |
string | $db_password | the password of the user to connect as |
string | $db_name | the name of the database on host we are connecting to |
return false if not successful and some kind of connection object/identifier otherwise
exec(string $sql, array $params = array()) : mixed
Hook Method for execute(). Executes the sql command on the database
This method operates on either query or data manipulation statements
string | $sql | SQL statement to execute |
array | $params | bind_name => value values to interpolate into the $sql to be executes |
false if query fails, resource or true otherwise
execute(string $sql, array $params = array()) : mixed
Executes the supplied sql command on the database, depending on debug levels computes query statistics
This method operates either query or data manipulation statements
string | $sql | SQL statement to execute |
array | $params | bind_name => value values to interpolate into the $sql to be executes |
false if query fails, resource or true otherwise
fileInfoRecursive(string $dir, boolean $rootToo = true) : array
Returns arrays of filesizes and file modifcations times of files in a directory
string | $dir | directory to get filesizes for |
boolean | $rootToo | whether to have an entry for the whole directory too |
of fileinfo information for each file in the folder in question
copyRecursive(string $source_dir, string $destination_dir)
Recursively copies a source directory to a destination directory
It would have been cool to use traverseDirectory to implement this, but it was a little bit too much of a stretch to shoehorn the code to match
string | $source_dir | the name of the source directory |
string | $destination_dir | the name of the destination directory |
traverseDirectory(string $dir, \seekquarry\yioop\models\datasources\function $callback, boolean $rootToo = true) : array
Recursively traverse a directory structure and call a callback function
string | $dir | Directory name |
\seekquarry\yioop\models\datasources\function | $callback | Function to call as traverse structure |
boolean | $rootToo | whether to have an apply the callback to the whole directory as well |
results computed by performing the traversal
autoIncrement(array $dbinfo) : string
Returns string for given DBMS CREATE TABLE equivalent to auto_increment (at least as far as Yioop requires).
array | $dbinfo | contains strings DBMS, DB_HOST, DB_USER, DB_PASSWORD |
to achieve auto_increment function for the given DBMS
serialType(array $dbinfo) : string
Used to return the database column type for a column that can be used to do autoincrementing. Usually this will just be INTEGER, however, for Postgres is SERIAL.
array | $dbinfo | containing fields for the current DBMS (pdo for Postgres) and DB_HOST (DSN connection string to database) |
what to use for serial data type
integerType(array $dbinfo) : string
Used when creating databases to set what an integer is If the DBMS is sqlite, there is not BIGINT type, only INTEGER which can be 8 bytes
array | $dbinfo | containing fields for the current DBMS |
to use for column type corresponding to an 64bit int
insertIgnore( $sql, array $dbinfo) : string
Used to convert a sql string that does an insert statement into a sql string where a duplicate insert is ignored
$sql | ||
array | $dbinfo | containing fields for the current DBMS (pdo for Postgres) and DB_HOST (DSN connection string to database) |
what to use for insert ignore expression
limitOffset(integer $start, integer $num = -1, array $dbinfo = null) : string
How a daabase can perform LIMIT OFFSET queries is not standardized between DBMS's. This method take a $start, a $num, and a $dbinfo and returns the string that would restrict a query to show $num many rows starting at $start. In the case that $num is not provided then it returns the string represent returning the first $start many rows. In the case that $dbinfo is not provided the current Yioop default database is used.
integer | $start | starting row to return from if ($num == -1, i.e., not supplied in the call) then this is is the number of rows desired |
integer | $num | number of rows to return |
array | $dbinfo | containing fields for how to connect to a database |
what to use for for LIMIT OFFSET query with input $limit and $num for the DBMS in question
copyTable(string $from_table, resource $from_dbm, resource $to_table, resource $to_dbm)
Copies the contents of from_table in the first database into the to a to_table of suitable schema in a second database. It assumes the table exists in both databases, both have the same number of columns, etc.
string | $from_table | name of the table to be copied from |
resource | $from_dbm | database resource for the from table |
resource | $to_table | name of the table to be copied to |
resource | $to_dbm | database resource for the to table |