12-04-2010
A bunch of pdf can for example be found
here
10 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
Hi all,
Have two SCO 5.0.5 systems and one Slackware(joy?) system.
I've been asked to backup all three systems onto a newly acquired AIT Tape drive that we've installed on one of the SCO boxes.
Using the existing cpio backup script on the one SCO works a treat and is really fast (which is... (2 Replies)
Discussion started by: Cameron
2 Replies
2. UNIX for Advanced & Expert Users
We run WebSphere and by default it wants to install everything under /usr. While I can understand the default (everyone has a /usr) I would like to move this over to a dedicated volume group called apps and then setup my lv's and fs's here. Our WebSphere Admin doesn't like this because apparently... (1 Reply)
Discussion started by: scottsl
1 Replies
3. Shell Programming and Scripting
Hi-
I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment...
I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies
4. UNIX for Dummies Questions & Answers
Hi guys,
I am new on here, I have a function in oracle that returns a specific value:
create or replace
PACKAGE BODY "CTC_ASDGET_SCHED" AS
FUNCTION FN_ASDSCHEDULE_GET
RETURN VARCHAR2
AS
BEGIN
DECLARE
ASDSchedule varchar2(6);
ASDComplete... (1 Reply)
Discussion started by: reptile
1 Replies
5. UNIX for Advanced & Expert Users
Hello there....i am a final year comp science student.......i am thinking of doing my project on unix platform......which one do u suggest?thanx in advance... (3 Replies)
Discussion started by: theprasad1990
3 Replies
6. Shell Programming and Scripting
Hi!
I would like to do a single connection to sqlplus and execute some querys.
Actually I do for every query one connection to database
i.e
echo 'select STATUS from v$instance;
exit' > $SQL_FILE
sqlplus user/pass@sid @$SQL_FILE > $SELECT_RESULT
echo 'select VERSION from v$instance;... (6 Replies)
Discussion started by: guif
6 Replies
7. AIX
Hello,
Am fresher to AIX domain but trained in RHEL 5.
I want to go for AIX certifications in future and very much eager to learn AIX from basics.Kindly provide me the guides or the links or the books for study.
What are the recent IBM AIX certifications in the market as of today and their... (3 Replies)
Discussion started by: zaheerbk
3 Replies
8. UNIX for Advanced & Expert Users
Hi Experts:
I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies
9. UNIX for Dummies Questions & Answers
Hi guys, i'm undergoing a traning in solaris administration and i request if any one have an idea on the interview questions on solaris.
thank you. (3 Replies)
Discussion started by: 038karthik
3 Replies
10. Shell Programming and Scripting
Hi All,
I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
LEARN ABOUT PHP
sqlite_create_function
SQLITE_CREATE_FUNCTION(3) SQLITE_CREATE_FUNCTION(3)
sqlite_create_function - Registers a "regular" User Defined Function for use in SQL statements
SYNOPSIS
void sqlite_create_function (resource $dbhandle, string $function_name, callable $callback, [int $num_args = -1])
DESCRIPTION
Object oriented style (method): void SQLiteDatabase::createFunction (string $function_name, callable $callback, [int $num_args = -1])
sqlite_create_function(3) allows you to register a PHP function with SQLite as an UDF (User Defined Function), so that it can be called
from within your SQL statements.
The UDF can be used in any SQL statement that can call functions, such as SELECT and UPDATE statements and also in triggers.
PARAMETERS
o $dbhandle
- The SQLite Database resource; returned from sqlite_open(3) when used procedurally. This parameter is not required when using the
object-oriented method.
o $function_name
- The name of the function used in SQL statements.
o $callback
- Callback function to handle the defined SQL function.
Note
Callback functions should return a type understood by SQLite (i.e. scalar type).
o $num_args
- Hint to the SQLite parser if the callback function accepts a predetermined number of arguments.
Note
Two alternative syntaxes are supported for compatibility with other database extensions (such as MySQL). The preferred form is the
first, where the $dbhandle parameter is the first parameter to the function.
RETURN VALUES
No value is returned.
EXAMPLES
Example #1
sqlite_create_function(3) example
<?php
function md5_and_reverse($string)
{
return strrev(md5($string));
}
if ($dbhandle = sqlite_open('mysqlitedb', 0666, $sqliteerror)) {
sqlite_create_function($dbhandle, 'md5rev', 'md5_and_reverse', 1);
$sql = 'SELECT md5rev(filename) FROM files';
$rows = sqlite_array_query($dbhandle, $sql);
} else {
echo 'Error opening sqlite db: ' . $sqliteerror;
exit;
}
?>
In this example, we have a function that calculates the md5 sum of a string, and then reverses it. When the SQL statement executes, it
returns the value of the filename transformed by our function. The data returned in $rows contains the processed result.
The beauty of this technique is that you do not need to process the result using a foreach loop after you have queried for the data.
PHP registers a special function named php when the database is first opened. The php function can be used to call any PHP function with-
out having to register it first.
Example #2
Example of using the PHP function
<?php
$rows = sqlite_array_query($dbhandle, "SELECT php('md5', filename) from files");
?>
This example will call the md5(3) on each filename column in the database and return the result into $rows
Note
For performance reasons, PHP will not automatically encode/decode binary data passed to and from your UDF's. You need to manually
encode/decode the parameters and return values if you need to process binary data in this way. Take a look at
sqlite_udf_encode_binary(3) and sqlite_udf_decode_binary(3) for more details.
Tip
It is not recommended to use UDF's to handle processing of binary data, unless high performance is not a key requirement of your
application.
Tip
You can use sqlite_create_function(3) and sqlite_create_aggregate(3) to override SQLite native SQL functions.
SEE ALSO
sqlite_create_aggregate(3).
PHP Documentation Group SQLITE_CREATE_FUNCTION(3)