RecordSet functionality
If i assume right, obtaining a ResultSet from an Statement execution will get all the records from database, throught the driver. So, all the data is transfered into JVM at the time that the Statement.executeQuery() was called.
Is there any way to fetch the records from the database only when you call ResultSet .getXXX() method?
Or maybe other solution, not necessary with ResultSet object?
I believe the ResultSet stores the meta data and a pointer to the database implicit cursor. Any call to getXXX will return the data from the database.
If you want another way then maybe consider writing your own driver if you fancy it!!
Ted.
Similar Messages
-
I have created a simple photo gallery page and I'm having
trouble creating the dynamic navigation. I have a page that
contains thumbnails of all of the images using the following code:
<cfquery datasource="#datasource2#" name="getphotos">
SELECT *
FROM w_photos
WHERE event = '#url.e#'
ORDER BY ID
</cfquery>
<table>
<cfset startRow=#StartRow_getphotos#>
<cfset j = Ceiling(#getphotos.recordcount#/3)>
<cfloop index="LoopCount" from="1" to="#j#">
<tr>
<cfoutput query="getphotos" startRow="#StartRow#"
maxRows="#MaxRows_getphotos#"><td align="center"><a
href="displayimage.cfm?f=#getphotos.filename#&i=#getphotos.id#"
class="text"><img
src="/ac/images/galleryimages/thumbs/#getphotos.filename#"
align="middle"></a></td></cfoutput>
</tr>
<cfset startrow=(#StartRow#+3)>
</cfloop>
</table>
So on my displayimage.cfm page I would like to be able to
provide next and previous navigation links that allow the user to
move forward or back through the full size images based on the
order that the thumbnails were displayed on the previous page. I
originally thought that I could use the id field and add orsubtract
1 value but that will not work as the next or previous id may be
more than one unit away. Is there any function that will let me
call the next or previous record in the recordset? Thanks in
advance for any help.Thanks for the help with this. Here is what I ended up doing
based on your suggestion.
In the image display page I am doing the following:
<cfset currentrow = #url.r#>
<cfif #currentrow# LTE 1>
<cfset previousimage='index.cfm'>
<cfset previousrow=0>
<cfset nextimage = #getallphotos.filename[(#currentrow# +
1)]#>
<cfset nextrow = (#currentrow# + 1)>
<cfelse>
<cfif #currentrow# GTE #getallphotos.recordcount#>
<cfset nextimage = 'index.cfm'>
<cfset nextrow = (#currentrow#+1)>
<cfset previousimage =
#getallphotos.filename[(#currentrow# - 1)]#>
<cfset previousrow =(#currentrow# - 1)>
<cfelse>
<cfset previousrow =(#currentrow# - 1)>
<cfset nextrow = (#currentrow# + 1)>
<cfset previousimage =
#getallphotos.filename[(#currentrow# - 1)]#>
<cfset nextimage = #getallphotos.filename[(#currentrow# +
1)]#>
</cfif>
</cfif>
And then this to make the links:
<cfoutput>
<a
href="displayimage.cfm?f=#previousimage#&r=#previousrow#">PREVIOUS</a><a
href="displaythumbs.cfm">THUMBNAILS</a><a
href="displayimage.cfm?f=#nextimage#&r=#nextrow#">NEXT</a><br
/>
<br />
<img src="/images/#getphotos.filename#">
</cfoutput>
So far it is working out. Thanks for getting me
started. -
SBO B1 2005 SP 01 Patch 11 - Issues with recordsets.
Hi,
We are using recordset for Query all over our application. I have performance problems when I upgraded to SP01 Patch 11. Recordset retrieves the data fast but takes very very long time when I do movenext() or eof() or movefirst().
Here is a sample code:
Dim rs As SAPbobsCOM.Recordset = Query (sqlStmt)
' If no record is fetched, returns false which indicates the finding failed
rs.MoveFirst()
If rs.EoF() Then Return False
' Caches the object columns
CacheColumns(rs)
' Releases the referenced object
rs = Nothing
The whole process takes long time. So I debugged the code. The delay is at MoveFirst() and eof() stage. If I comment these 2 steps, it is faster. But I have to use the recordset functions.
IT WAS VERY QUICK IN SBO 2005 before upgrading the sp01 patch 11. Am I missing something? Is something changed in SP01? I am using Recordset to query on user tables only.
Please somebody help me out.
Regards,
PrakashDoes this bug also affect the GetByKey method? Because I am developing an addon, and all of a sudden it starts to hang. I did upgrade to PL11 during the development. I have been going insane trying to figure out what made my program stop working, and I even back-tracked numerous revisions. In the end, it is the following code that made the difference:
oDocs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
strSQL = "Select DocEntry from ORDR where DocNum = '" + strDocNum + "'"
oRecs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRecs.DoQuery(strSQL)
strDocEntry = oRecs.Fields.Item("DocEntry").Value
If oDocs.GetByKey(strDocEntry) Then
oDocs.UserFields.Fields.Item("U_MyField").Value = strValue
end if
If I comment out the last if statement with GetByKey, it seems to be fine. If I leave it in, it hangs when I click the "Update" button on the Sales Order form. The database I'm working on has thousands of order records. Could it be caused by the bug since it's a large volume of records to go through? We also use record sets all over the place. It also doesn't make sense to me that in other areas it seems to work ok. -
ANN: Updated extensions for DW 8.0.2
Adobe released the Dreamweaver 8.0.2 updater about a month
ago, and since
that time I have been working furiously on getting my
incompatible
extensions updated to work around the bugs introduced by the
updater. In
short, the Dreamweaver recordset functionality for previewing
recordsets and
showing in the Bindings panel is broken with any kind of
dynamic SQL code
(such as dynamic sorting or dynamic SQL). Thanks to the good
folks at
Interakt (www.interaktonline.com), who provided me with some
alternate
Recordset functionality, I was able to make the extensions
compatible. The
DW 8.0.2 updater fixes some SQL injection problems and should
be applied to
your copy of Dreamweaver 8. The DW 8.0.2 updater can be found
at the Adobe
web site:
http://www.adobe.com/support/dreamweaver/downloads_updaters.html
The affected extensions that have been updated are the
following:
Dynamic Search Suite for ColdFusion
Dynamic Search Suite for PHP
Dynamic Search Suite for ASP/VB
Sort Repeat Region (ASP/VB, ColdFusion, and PHP versions)
If you have purchased any of these extensions in the past and
have your
download information, you can download the free updates by
logging in at
http://www.tom-muck.com/extensions/customers/login.cfm
and downloading the
latest versions. Please note that if you do not have the
Dreamweaver 8.0.2
updater, no extension updates are necessary. The new updated
extensions will
work in Dreamweaver 6, 7, and 8.
The extensions NOT updated in this round of fixes are the
following:
Dynamic Search Suite for ASP/JS
Sort Repeat Region (JSP and ASP/JS versions.)
Other extensions available at
http://www.tom-muck.com/extensions/
are not
affected by the updater. If you run into any problems using
any of my
extensions, drop me a line using my contact form.
Tom Muck
co-author Dreamweaver MX 2004: The Complete Reference
http://www.tom-muck.com/
Cartweaver Development Team
http://www.cartweaver.com
Extending Knowledge Daily
http://www.communitymx.com/Adobe released the Dreamweaver 8.0.2 updater about a month
ago, and since
that time I have been working furiously on getting my
incompatible
extensions updated to work around the bugs introduced by the
updater. In
short, the Dreamweaver recordset functionality for previewing
recordsets and
showing in the Bindings panel is broken with any kind of
dynamic SQL code
(such as dynamic sorting or dynamic SQL). Thanks to the good
folks at
Interakt (www.interaktonline.com), who provided me with some
alternate
Recordset functionality, I was able to make the extensions
compatible. The
DW 8.0.2 updater fixes some SQL injection problems and should
be applied to
your copy of Dreamweaver 8. The DW 8.0.2 updater can be found
at the Adobe
web site:
http://www.adobe.com/support/dreamweaver/downloads_updaters.html
The affected extensions that have been updated are the
following:
Dynamic Search Suite for ColdFusion
Dynamic Search Suite for PHP
Dynamic Search Suite for ASP/VB
Sort Repeat Region (ASP/VB, ColdFusion, and PHP versions)
If you have purchased any of these extensions in the past and
have your
download information, you can download the free updates by
logging in at
http://www.tom-muck.com/extensions/customers/login.cfm
and downloading the
latest versions. Please note that if you do not have the
Dreamweaver 8.0.2
updater, no extension updates are necessary. The new updated
extensions will
work in Dreamweaver 6, 7, and 8.
The extensions NOT updated in this round of fixes are the
following:
Dynamic Search Suite for ASP/JS
Sort Repeat Region (JSP and ASP/JS versions.)
Other extensions available at
http://www.tom-muck.com/extensions/
are not
affected by the updater. If you run into any problems using
any of my
extensions, drop me a line using my contact form.
Tom Muck
co-author Dreamweaver MX 2004: The Complete Reference
http://www.tom-muck.com/
Cartweaver Development Team
http://www.cartweaver.com
Extending Knowledge Daily
http://www.communitymx.com/ -
GRRR! 8.0.2 Causing Me Grief
I've been fighting the 8.0.2 upgrade for a day now and
finally figured out what the problem is. I have ASP pages that hits
a SQL Server database to display dynamic information. In my queries
I have a request.querystring that grabs the month (numeric
representation), and a default value set to get todays date minus
seven days, and use only the month (i.e. June would be 6). The
actual value for "default value" is
datepart(month,(GETDATE()-7)), which today would be 6. It
worked in 8.0.1, but is broken in 8.0.2. The error message
displayed is:
Error Type:
ADODB.Command (0x800A0D5D)
Application uses a value of the wrong type for the current
operation.
/server1/dev/test/Reports/DW_TEST.asp, line 19
If I manually type this, "?mon=6", at the end of my url
string in IE it works.
Please help if you can.
Thanks!"oraLinque" <[email protected]> wrote in
message
news:e6pcq8$594$[email protected]..
> I've been fighting the 8.0.2 upgrade for a day now and
finally figured out
> what
> the problem is. I have ASP pages that hits a SQL Server
database to
> display
> dynamic information. In my queries I have a
request.querystring that grabs
> the
> month (numeric representation), and a default value set
to get todays date
> minus seven days, and use only the month (i.e. June
would be 6). The
> actual
> value for "default value" is
datepart(month,(GETDATE()-7)), which
> today
> would be 6. It worked in 8.0.1, but is broken in 8.0.2.
The error message
> displayed is:
Can you post the code? The 8.0.2 broke most recordset
functionality that is
not the basic cookie-cutter SELECT statement.
Tom Muck
co-author Dreamweaver MX 2004: The Complete Reference
http://www.tom-muck.com/
Cartweaver Development Team
http://www.cartweaver.com
Extending Knowledge Daily
http://www.communitymx.com/ -
Hi
please help me
How to read and write data from file in j2mehello, u are looking to write some persistant data to a file on the mobile phone? Its the next step for me aswell. You can use the recordset function.
I'm looking at this site: http://www-128.ibm.com/developerworks/library/wi-rms/
It seems every time you use the function you must use try catch blocks. I hope this is what you are looking for. -
Hi,
I'm using LabSql to connect to a Ms Access database. I successful created the database and i was able to connect to the database. i was able to insert, delete and select from the database. My problem is i want to be able to move to the next data in my database using the movenext in my recordset functions. This is how i tried it below but it gives me errors. how do i go about this?
Thanks!
Attachments:
movenext.png 14 KBHi,
Thank you for your reply. I tried to substitute the movenext recordset function above with the movefirst recordset function and i got the error shown below.
Attachments:
movefirst.PNG 6 KB -
Uninstall 8.0.2 to 8.0.1
How can I uninstall the 8.0.2 update? Because I wish back to
8.0.1 version. Why? Because the new Type var field in the recordset
function is my nigthmare.
Then, there is not way of disabling this function so
bothersome?
Because I have some places made with the previous version,
and everything fails when trying to make some change with the new
one.
Then I want to uninstall this update.Completely uninstall DW. You can leave the extensions, most
likely.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"armopet" <[email protected]> wrote in
message
news:f03qq6$sdj$[email protected]..
> Do I should completely unistall DW? and before that I do
owe unistall the
> extensions?
>
> Thanks -
IHi there:
Hi there:
I am trying to build an XML file from a string and I am getting a Expected Statement Error. I am not sure what
is wrong that would cause this error with a simple loop for a bar graph. Any ideas?
Thanks in advance! Brett
<%@ Language=VBScript %>
<%
Dim oConn, rs
Dim strConnQuery
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Mode = 1
'Create the path to database
oConn.open session("DSN")
%>
<%
'This page generates the XML data for the Chart contained in
'Default.asp.
'Database Objects - Initialization
Dim oRs, oRs2, strQuery
'strXML will be used to store the entire XML document generated
Dim strXML
'Create the recordset to retrieve data
Set oRs = Server.CreateObject("ADODB.Recordset")
Function getTotals()
'Initialize database objects
Dim oRs, strSQL
'Variable to store XML Data
Dim strXML
'To store categories
Dim strCat
'To store amount Dataset & quantity dataset
Dim strAmtDS, strQtyDS
strCat = "select * from fusion_category"
strSQL = "select * from claim_table where reference_num =" & session("globalrefno")
Set oRs = Server.CreateObject("ADODB.Recordset")
oRs.Open strSQL, oConn
'Initialize <categories> element
strCat = "<categories>"
'Response.Write(strCat)
'Initialize datasets
strIncDS = "<dataset seriesname='Incurred'>"
strPdDS = "<dataset seriesName='Paid' parentYAxis='P'>"
'Variable to store link
Dim strLink
'Iterate through each data row
Do While not oRs.EOF
strCat = strCat & "<category label='" & oRs("Category") & "'/>"
strIncDS = strIncDS & "<set value='" & oRs("Incurred") & "'/>"
strPdDS = strPdDS & "<set value='" & oRs("Paid") & "'/>"
'oRs.EOF
'Closing elements
strCat = strCat & "</categories>"
strIncDS = strIncDS & "</dataset>"
strPdDS = strPdDS & "</dataset>"
'Entire XML - concatenation
strXML = strCat & strIncDS & strPdDS
oRs.Close()
Set oRs = nothing
getTotals = strXML
End Function
strXML = "<chart caption='Incurred vs Paid" & getTotals() & "' xAxisName='Year' palette='" & "' numberPrefix='$' formatNumberScale='0'>"
'Get the data
strXML = strXML & "<set label='Incurred' value='" & getTotals() & "' />"
strXML = strXML & "<set label='Paid' value='" & getTotals() & "' />"
strXML = strXML & "</chart>"
'Output it
Response.ContentType = "text/xml"
Response.Write(strXML)
%>Hi there:
I am trying to build an XML file from a string and I am getting a Expected Statement Error. I am not sure what
is wrong that would cause this error with a simple loop for a bar graph. Any ideas?
Thanks in advance! Brett
<%@ Language=VBScript %>
<%
Dim oConn, rs
Dim strConnQuery
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Mode = 1
'Create the path to database
oConn.open session("DSN")
%>
<%
'This page generates the XML data for the Chart contained in
'Default.asp.
'Database Objects - Initialization
Dim oRs, oRs2, strQuery
'strXML will be used to store the entire XML document generated
Dim strXML
'Create the recordset to retrieve data
Set oRs = Server.CreateObject("ADODB.Recordset")
Function getTotals()
'Initialize database objects
Dim oRs, strSQL
'Variable to store XML Data
Dim strXML
'To store categories
Dim strCat
'To store amount Dataset & quantity dataset
Dim strAmtDS, strQtyDS
strCat = "select * from fusion_category"
strSQL = "select * from claim_table where reference_num =" & session("globalrefno")
Set oRs = Server.CreateObject("ADODB.Recordset")
oRs.Open strSQL, oConn
'Initialize <categories> element
strCat = "<categories>"
'Response.Write(strCat)
'Initialize datasets
strIncDS = "<dataset seriesname='Incurred'>"
strPdDS = "<dataset seriesName='Paid' parentYAxis='P'>"
'Variable to store link
Dim strLink
'Iterate through each data row
Do While not oRs.EOF
strCat = strCat & "<category label='" & oRs("Category") & "'/>"
strIncDS = strIncDS & "<set value='" & oRs("Incurred") & "'/>"
strPdDS = strPdDS & "<set value='" & oRs("Paid") & "'/>"
'oRs.EOF
'Closing elements
strCat = strCat & "</categories>"
strIncDS = strIncDS & "</dataset>"
strPdDS = strPdDS & "</dataset>"
'Entire XML - concatenation
strXML = strCat & strIncDS & strPdDS
oRs.Close()
Set oRs = nothing
getTotals = strXML
End Function
strXML = "<chart caption='Incurred vs Paid" & getTotals() & "' xAxisName='Year' palette='" & "' numberPrefix='$' formatNumberScale='0'>"
'Get the data
strXML = strXML & "<set label='Incurred' value='" & getTotals() & "' />"
strXML = strXML & "<set label='Paid' value='" & getTotals() & "' />"
strXML = strXML & "</chart>"
'Output it
Response.ContentType = "text/xml"
Response.Write(strXML)
%> -
A Newbie HD Podcast Download Question ... Help Request
I have an 80GB video iPod. I've successfully subscribed to a number of video podcasts and can download/play them without difficulty. However, I'm interested in subscribing to an HD podcast (a London, England landscape podcast that is only published in HD format). For some reason, I keep receiving an error message that indicates that I can't play this on my iPod ... so it doesn't download. Am I doing something wrong or are these simply not compatible with my iPod? Thanks for any help you can offer up!
While I'm a stout supporter of DW, it's recordset functions are sorely lacking and you will do yourself a huge favor by learning how to write the query yourself. In this scenario you need to run a query with the WHERE statement of "WHERE {id user selects} = AlbumID". That result will return many results, I assume. The way the SQL query works is it returns the value into an array. The following is a tutorial going over the basics of a while loop with SQL queries:
http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php
If you have any issues or questions trying to implement that loop feel free to post back. But having that understanding will help in trying to explain anything in further detail if you run into issues. -
I want to call Stored Procedure that return records and output parameter, from CVI
I can get output parrameter but when I want to get records stream I recieve following wrror:
function return value == -10. Native error code -2146824584 ADOBD.Recordset: Operation is not allowed when object is closedin Stored procedure I create table variable and and insert into string values
when I remove usage of table variable the error desappear -
Create price range search function in php recordset
Hi,
On a continuation from a previous thread, I am finding that the expertise of the web designers on these forums is proving much more educational and beneficial than the vast numbers of books I have bought to setup a website for my property company. (Without sounding too sycophantic!).
I have managed to create a working website where the properties in my database and their related images are pulled into a recordset on the live webpage and everything is working perfectly. I do however want to add some simple filters on the search page to narrow down the results from the database.
I am finding that given one push or piece of coding I can work out the rest myself. Therefore, all I would like to do is create a price range drop down, where clients can select properties from the database in one of 3 categories: under £1m, £1m-£2m, and over £2m.
As I understand it, I need two pages to do this, one html form page where the clients will input their search criteria with coding similar to:
<form action="search_results.php" method="post" name="search" id="search" >
Price Range:
<select name="prop_price" id="select8">
<option value="<1000000"> >£1,000,000 </option>
<option value="1000000-2000000"> £1,000,000 - £2,000,000</option>
<option value=">2000000"> >£2,000,000 </option>
</select>
<input name="search" type="submit" id="search" value="search">
</form>
(apologies for my messy coding - I am still new and not sure if certain fields arent required yet!).
Then, I would need to create the search_results.php page which would give the results of properties in the database depending on the price range submitted. I have tried various different methods put online through the forums, but cannot seem to get anything post 2006, nor anything that has actually worked. I am using Dreamweaver CS5 and MySQL for my db.
How do I incorporate the above search criteria into a dynamic php doc? The only way I have managed to get something working is to create a new page for each of the price variables -something which is incredibly inefficient, and hardly something that can be developed easily going forward.
The php code I currently have that is retrieving all the properties from my database is as follows (connection name is test, recordset name is getDetails):
<?php require_once('Connections/test.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$maxRows_getDetails = 20;
$pageNum_getDetails = 0;
if (isset($_GET['pageNum_getDetails'])) {
$pageNum_getDetails = $_GET['pageNum_getDetails'];
$startRow_getDetails = $pageNum_getDetails * $maxRows_getDetails;
mysql_select_db($database_test, $test);
$query_getDetails = "SELECT id, prop_name, prop_price, country, post_code, short_desc, image FROM images order by prop_price DESC";
$query_limit_getDetails = sprintf("%s LIMIT %d, %d", $query_getDetails, $startRow_getDetails, $maxRows_getDetails);
$getDetails = mysql_query($query_limit_getDetails, $test) or die(mysql_error());
$row_getDetails = mysql_fetch_assoc($getDetails);
if (isset($_GET['totalRows_getDetails'])) {
$totalRows_getDetails = $_GET['totalRows_getDetails'];
} else {
$all_getDetails = mysql_query($query_getDetails);
$totalRows_getDetails = mysql_num_rows($all_getDetails);
$totalPages_getDetails = ceil($totalRows_getDetails/$maxRows_getDetails)-1;
?>
<table width="990" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
</tr>
<?php do { ?>
<tr>
<td><img src="show_image.php?id=<?php echo $row_getDetails['id']; ?>"></td>
<td><?php echo $row_getDetails['prop_name']; ?></td>
<td><?php echo $row_getDetails['prop_price']; ?></td>
<td><?php echo $row_getDetails['short_desc']; ?></td>
</tr>
<?php } while ($row_getDetails = mysql_fetch_assoc($getDetails)); ?>
</table>
<?php
mysql_free_result($getDetails);
?>
Essentially, I need to incorporate the WHERE function into my sql query, but how do I do this so that it is dependent on the clients submission on the search page.......?
Sorry if this is incredibly easy, but I am at a complete loss now and cant try any more techniques from the various forums out there! I even downloaded the entire Zen cart framework just to see if I could find something in the vast numbers of php pages that came with it!
Hope someone can help -
Thanks
JackHi Gunter,
Thanks for your quick response. I thought I had it but not quite yet. I uploaded these pages into live browser but am only getting the following on the search results page:
This is the case for all three parameters. As I have not yet uploaded all the properties into mysql, there are only 2 live ones in there, one is prop_price at 600,000 (int) and the other prop_price 2300000 (int). For the query to work, should this field in mysql be a different format?
For your reference, the new show_results.php code is:
<?php require_once('Connections/test.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$maxRows_getDetails = 20;
$pageNum_getDetails = 0;
if (isset($_GET['pageNum_getDetails'])) {
$pageNum_getDetails = $_GET['pageNum_getDetails'];
$startRow_getDetails = $pageNum_getDetails * $maxRows_getDetails;
if(isset($_POST['prop_price']))
switch($_POST['prop_price'])
case ("a"):
$price_whereclause = ' WHERE prop_price < 1000000 ';
break;
case ("b"):
$price_whereclause = ' WHERE prop_price BETWEEN 100000 AND 200000 ';
break;
case ("c"):
$price_whereclause = ' WHERE prop_price < 2000000 ';
break;
else {
$price_whereclause = '';
mysql_select_db($database_test, $test);
$query_getDetails = "SELECT id, prop_name, prop_price, country, post_code, short_desc, image FROM images ".$price_whereclause." order by prop_price DESC";
$query_limit_getDetails = sprintf("%s LIMIT %d, %d", $query_getDetails, $startRow_getDetails, $maxRows_getDetails);
$getDetails = mysql_query($query_limit_getDetails, $test) or die(mysql_error());
$row_getDetails = mysql_fetch_assoc($getDetails);
if (isset($_GET['totalRows_getDetails'])) {
$totalRows_getDetails = $_GET['totalRows_getDetails'];
} else {
$all_getDetails = mysql_query($query_getDetails);
$totalRows_getDetails = mysql_num_rows($all_getDetails);
$totalPages_getDetails = ceil($totalRows_getDetails/$maxRows_getDetails)-1;
?>
<table width="990" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
</tr>
<?php do { ?>
<tr>
<td><img src="show_image.php?id=<?php echo $row_getDetails['id']; ?>"></td>
<td><?php echo $row_getDetails['prop_name']; ?></td>
<td><?php echo $row_getDetails['prop_price']; ?></td>
<td><?php echo $row_getDetails['short_desc']; ?></td>
</tr>
<?php } while ($row_getDetails = mysql_fetch_assoc($getDetails)); ?>
</table>
<?php
mysql_free_result($getDetails);
?>
I know its very cheeky, but assuming you can help with fixing this, where in the coding would I insert a "No properties returned. Please try another query" response should the db not have anything in the set parameters (instead of the symbol currently being displayed).
Again thanks so much for all your help.
Jack -
Returning Recordsets from Functions
Pardon my ignorance; there is probably a simple answer to this one, but I'm trying to make the leap to Oracle Stored Procedures and I have a basic question:
I have created a Function in Oracle 8.1.7 EMP_SEL_ALL, based on the following SQL Statement:
CREATE OR REPLACE FUNCTION "SCOTT"."EMP_SEL_ALL" (
enuma IN NUMBER)
RETURN SCOTT.emp%ROWTYPE IS
emp_row SCOTT.emp%ROWTYPE;
BEGIN
SELECT * into emp_row FROM SCOTT.emp
WHERE empno = enuma;
RETURN emp_row;
END;
The function compiles with no problems.
I have written a Java call to execute the Function, which reads as follows. Because I am attempting to return an entire row, I assume that will equate to a ResultSet:
sqlCallStmt = con.prepareCall("{ call SCOTT.EMP_SEL_ALL ? ) }");
sqlCallStmt.setInt(1, 7369);
result = sqlCallStmt.executeQuery();
The error returned is as follows:
java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'EMP_SEL_ALL' is not a procedure or is undefined
Looking in DBA Studio, the Function is shown in the SCOTT schema, and I am logged in as that user. I am therefore inclined to think that, rather than a permissions issue, I have a syntax error somewhere, or I have left out a step.
For anyone who has been down this road before, please advise. Is there a better way to do this via Stored Procedure? I have no problem querying the table and data in a standard SQL statement. Many thanks in advance.First, when you call a function I think you have to use the syntax {call ? = function_name} (notice where the ? goes.
However, I still don't think you will be able to get this to work becuase a Java client cannot interpret a PL/SQL record (or rowtype, in your case).
If you want to return the results as a recordset, you will have to move the function into package and declare a REF CURSOR for the return type. It appears your code only returns one row, however, so a recordset will create unnecessary overhead.
It would probably be best to make your function a procedure that returns OUT parameters, one for each column selected. -
How can I pass Recordsets as input parameter to a Function ?
Hi Gurus,
I want to create a function that receive recordsets as input parameter also returns recordsets as output.
I have a requirement to do stock taking for all order items of one Order number in one single query execution (to avoid row by row basis).
From the post in the forum I know that a function can return recordsets / query result using REF CURSOR or pipelined table function.
My question is : how to pass the recordsets as input parameter to that function ?
(because I could have 75 rows item in one order number)
Below is the DDL and the query :
create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
insert into stocks values('P001', 'WH001', '01-dec-2006', 30)
insert into stocks values('P001', 'WH002', '01-dec-2006', 50)
insert into stocks values('P001', 'WH002', '01-jan-2007', 50 )
insert into stocks values('P001', 'WH001', '01-Mar-2007', 150)
insert into stocks values('P002', 'WH003', '01-dec-2006', 25)
insert into stocks values('P002', 'WH003', '15-Jan-2007', 50)
insert into stocks values('P002', 'WH003', '01-Mar-2007', 75)
insert into stocks values('P003', 'WH001', '01-dec-2006', 30)
insert into stocks values('P003', 'WH002', '15-Jan-2007', 40)
insert into stocks values('P003', 'WH003', '01-Mar-2007', 50)
CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
The query for stock taking :
select product,warehouse,expireddate, least(qty_available-(sm - qty_ord),qty_available) qty
from ( select product,warehouse,expireddate,qty_available,qty_ord, sum(qty_available) over(partition by product order by s.product,expireddate,decode(warehouse,priority_wh,0,1),warehouse ) sm
from stocks s,order_detail o
where s.product = o.product_ord order by s.product,expireddate,decode(warehouse,priority_wh,0,1) )
where (sm - qty_ord) < qty_availableHi,
This my requirement :
I have (simplified)Order_Detail as below :
CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
Then I want to do stock taking from my STOCK table (described on my first post on this thread)
create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
The rule is : The stok taking is on First In First Out basis, on expireddate.
And I want to do it in single query.
I want to make this a Function / Stored Procedure so that other transaction can also make use of this query.
That is why I need to pass the 3 rows oy mr Order_Detail above, do the query, and return the result.
Then INSERT the result into ORDER_DETAIL_PER_EXPIRED_DATE table.
I hope this clear my requirement, is this possible ?
Thank you,
xtanto -
Using LIMIT function in PHP/MySQL Dreamweaver RecordSet
I want to have a record set that skips the first record, and shows the next three. I've found several suggestions online to use the LIMIT function, but I keep getting "error in SQL syntax." What am I missing?
mysql_select_db($database_adventcms, $adventcms);
$query_rsSideNews = "SELECT * FROM tb_news LIMIT 1, 3 WHERE status = 'Live' ORDER BY `date` DESC";
$rsSideNews = mysql_query($query_rsSideNews, $adventcms) or die(mysql_error());
$row_rsSideNews = mysql_fetch_assoc($rsSideNews);
$totalRows_rsSideNews = mysql_num_rows($rsSideNews);And there we go. That's the reason I need to go through PHP/MySQL training rather than relying on google searches!
Maybe you are looking for
-
How to Stop or remove perlinnoise?
...so that I can add the next image. and use a tween alpha to show it. If you test this, (just rename any images by the image names I use and export to as3 from library). You can see that the perlinnoise is continually existing in the background. For
-
Excel security for locked documents
I develop many forms and templates for clients. I just discovered that I can take a fully locked document from Excel (any version), bring it into open office and unlock it with NO PASSWORD. How is this possible? Is there anything I can do to prevent
-
Date is outside factory calendar range
HI Experts, I have an issue with date variables. When ever i try to click on browse button, beside the variable selection i keep getting the # symbol. I need to see the calendar popup instead of this # symbol. I did some research and found some threa
-
CLAF - How to just change the color-scheme of default laf of Oracle EBiz
How to change the color scheme of the default oracle ebusiness suites laf? When we tried the CLAF UI, there is no option to extend the oracle-desktop.xss. It gives only the base-desktop (which is different from the default Oracle Ebusiness laf). Have
-
What are collections in oracle plsql, and Transpose concepts.
Hi OTN, what are the collections available in Oracle Plsql, what are concepts of collection. How to Transpose a Table from rows to columns or columns into rows. DDL and DML concepts. What is the concepts of statistics in Oracle Plsql. Thanks Edited b