Sql API Reference

 Backup tables, check if the table exixts, and handle Blob.

TableExists($dataSrc ,$tableName);

 Check if $table exists or not.

This function is often used before execute DROP TABLE and CREATE TABLE SQL sentence in order to avoid error.

backup($dataSrc, $tableName, $fileName);

 Backup table into the file with filename $fileName. The backuped file is a CSV formatted file with a header. The header is name of the column. The "SQL.loadCsv()" function uses this header, therefore do not edit this header line.

loadCsv($dataSrc, $tableName, $fileName);

 Load the csv file stored with Sql.backup().

This function load the CSV file, and after that, make a templete of INSERT INTO SQL. By making this SQL, it uses the first line of the CSV file, which is the CSV header.

storeBlob($dataSrc, $tableName, $key, $keyValue, $blobColumn, $fileName);

 Store blob into table having blob columns.$key is primary key's column name and $keyValue is the value.
$blobColumn is column to sotre blob.$fileName is the file which has data to be stored.

This function is used to handle big binary data. If the size of the data is within the available length of the SQL, you can use Base64 encoding and UPDATE or INSERT INTO SQL instead of this function.

loadBlob($dataSrc, $tableName, $key, $keyValue, $blobColumn, $fileName);

 Loading blob into file.

 


Go to Top