Sponsored Content
Full Discussion: Two small queries
Top Forums UNIX for Advanced & Expert Users Two small queries Post 302125462 by kamitsin on Thursday 5th of July 2007 11:32:38 AM
Old 07-05-2007
Quote:
Query 1 : How to check if a directory already exists? If doesn't exist then create a new one.
Code:
if [[ ! -d ${DIR_NAME} ]]
then
     mkdir -p ${DIR_NAME}
fi

kamitsin
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Some queries...

Guys need some advice on how to check some of the questions below? i'm running on an open VMS platform... which i am an idiot to... appreciate if anyone can give some hints or source on how to check on.. a script that is running on cron job... but doesn't run as the login user name.. 1. why... (6 Replies)
Discussion started by: 12yearold
6 Replies

2. Shell Programming and Scripting

my queries

hi guys Well, i need to have a report generation script or any script which will show me all the content/information of a file when i run that script. Please help me on this isssue at the earliest.As i am little bit aware of scripting.Thanks in advance! regards ash (4 Replies)
Discussion started by: whizkidash
4 Replies

3. Homework & Coursework Questions

Queries

Any help on like where to get started on this? I'm just confused. 1. The problem statement, all variables and given/known data: Enter text here.Queries to satisfy these two report requests (use your CCI database): Retrieve all rows of active inventory where current on hands is less than... (0 Replies)
Discussion started by: lakers34kb
0 Replies

4. Solaris

Installation queries

Dear All, Please clarify my queries My 1st doubt is as you know solaris have default 8 slices out of 8 slices in which slice the OS is stored. Like in windows if you select C drive the Program files are stored in C drive like that in solaris in which slice the OS is stored. My 2nd doubt is... (2 Replies)
Discussion started by: suneelieg
2 Replies

5. Shell Programming and Scripting

Few queries regarding awk...

One of the command output is as below. -rw-r--r--+ 1 root root 75G Nov 21 16:43 /var/ovs/mount/86BXXX/running_pool/Machine1/System-sda.img -rw-r--r--+ 1 root root 75G Nov 21 16:36 /var/ovs/mount/86BXXX/running_pool/Machine2/System.img -rw-r--r--+ 1 root root 150G Sep 23 19:13... (2 Replies)
Discussion started by: pinga123
2 Replies

6. UNIX for Dummies Questions & Answers

FTP Queries

Hi, 1) How to get exact permissions, group names for files while transferring with FTP 2) Is there any command to transfer entire directory and sub directories. Thanks (1 Reply)
Discussion started by: nag_sathi
1 Replies

7. Red Hat

NFS Queries

Hi, I would like to know on one server how many mouting can be done? wheather there is limitation on number of mounting? wheather it is possible to increase NFS Performance? if yes then which parameters needs to given while mounting? (3 Replies)
Discussion started by: manoj.solaris
3 Replies

8. Debian

GRUB Queries ?!

Hello, I am posting the following questions here because I need them answered by people who have actually done a lot of work in GRUB. DO NOT GIVE ME GUESS ANSWERS PLEASE. Feel free to redirect me if this is not the right place to ask these questions. Can I download GRUB separately from... (6 Replies)
Discussion started by: sreyan32
6 Replies

9. IP Networking

RDNS Queries

Hey everyone, I have a question, I've been playing around with tcpdump, and noticed my machine making numerous rdns look ups. They are displayed like: 10.80.80.141.51234 > 10.80.80.1.domain: 9950+ PTR? 223.114.55.65.in-addr.arpa. (44) My question is, if dns works based on numerical... (0 Replies)
Discussion started by: Lost in Cyberia
0 Replies
CUBRID_QUERY(3) 							 1							   CUBRID_QUERY(3)

cubrid_query - Send a CUBRID query

SYNOPSIS
resource cubrid_query (string $query, [resource $conn_identifier]) DESCRIPTION
cubrid_query(3) sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified $conn_identifier. PARAMETERS
o $query - An SQL query Data inside the query should be properly escaped. o $conn_identifier - The CUBRID connection. If the connection identifier is not specified, the last connection opened by cubrid_connect(3) is assumed. RETURN VALUES
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, cubrid_query(3) returns a resource on success, or FALSE on error. For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, cubrid_query(3) returns TRUE on success or FALSE on error. The returned result resource should be passed to cubrid_fetch_array(3), and other functions for dealing with result tables, to access the returned data. Use cubrid_num_rows(3) to find out how many rows were returned for a SELECT statement or cubrid_affected_rows(3) to find out how many rows were affected by a DELETE, INSERT, REPLACE, or UPDATE statement. cubrid_query(3) will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query. EXAMPLES
Example #1 Invalid Query The following query is syntactically invalid, so cubrid_query(3) fails and returns FALSE. <?php $conn = cubrid_connect('localhost', 33000, 'demodb'); $result = cubrid_query('SELECT * WHERE 1=1'); if (!$result) { die('Invalid query: ' . cubrid_error()); } ?> Example #2 Valid Query The following query is valid, so cubrid_query(3) returns a resource. <?php // This could be supplied by a user, for example $firstname = 'fred'; $lastname = 'fox'; $conn = cubrid_connect('localhost', 33000, 'demodb'); cubrid_execute($conn,"DROP TABLE if exists friends"); cubrid_execute($conn,"create table friends(firstname varchar,lastname varchar,address char(24),age int)"); cubrid_execute($conn,"insert into friends values('fred','fox','home-1','20')"); cubrid_execute($conn,"insert into friends values('blue','cat','home-2','21')"); // Formulate Query // This is the best way to perform an SQL query // For more examples, see cubrid_real_escape_string() $query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'", cubrid_real_escape_string($firstname), cubrid_real_escape_string($lastname)); // Perform Query $result = cubrid_query($query); // Check result // This shows the actual query sent to CUBRID, and the error. Useful for debugging. if (!$result) { $message = 'Invalid query: ' . cubrid_error() . " "; $message .= 'Whole query: ' . $query; die($message); } // Use result // Attempting to print $result won't allow access to information in the resource // One of the cubrid result functions must be used // See also cubrid_result(), cubrid_fetch_array(), cubrid_fetch_row(), etc. while ($row = cubrid_fetch_assoc($result)) { echo $row['firstname']; echo $row['lastname']; echo $row['address']; echo $row['age']; } // Free the resources associated with the result set // This is done automatically at the end of the script cubrid_free_result($result); ?> SEE ALSO
cubrid_connect(3), cubrid_error(3), cubrid_real_escape_string(3), cubrid_result(3), cubrid_fetch_assoc(3), cubrid_unbuffered_query(3). PHP Documentation Group CUBRID_QUERY(3)
All times are GMT -4. The time now is 09:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy