Restricting rights to modify only some rows
Hi,
I just discovered HTML DB and played around with it on myhtmldb.com because htmldb.oracle.com is down for some reason.
Is there a way to restrict write access to some rows of a table for each user? For example everybody can see the whole table but you can only add/delete/modify the rows where your id/company name/.. is present in one column.
Cheers
Mathias
Hi,
I just discovered HTML DB and played around with it
on myhtmldb.com because htmldb.oracle.com is down for
some reason.
Is there a way to restrict write access to some rows
of a table for each user? For example everybody can
see the whole table but you can only
add/delete/modify the rows where your id/company
name/.. is present in one column.
Cheers
Mathias
Similar Messages
-
How to edit only some rows in ALV
Hi Experts,
I have editable ALV. I need to allow edit only for some rows, not generaly all of them.
Do you have any idea how to do it?
I use ALV through FM module REUSE_ALV_GRID_DISPLAY.
Thenks®ards,
JirkaHi,
You need to use events. Sample code from sdn.
TYPE-POOLS:SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA:IT_EVENTS TYPE SLIS_T_EVENT.
data: begin of it_chg occurs 0,
index type sy-tabix,
end of it_chg.
DATA: X_EVENTS TYPE SLIS_ALV_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
NAME(10) TYPE C,
ZTERM TYPE C,
END OF ITAB.
PERFORM FILL_TABLE.
loop at itab where zterm = 'A'.
it_chg-index = sy-tabix + 3.
" addition 3 IS FOR FIELD LABELS
append it_chg.
clear it_chg.
endloop.
DATA:L_POS TYPE I VALUE 1.
CLEAR: L_POS.
L_POS = L_POS + 1.
**fieldcatalog
X_FIELDCAT-FIELDNAME = 'NAME'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '10'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-FIELDNAME = 'ZTERM'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '10'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
**events
REFRESH:IT_EVENTS.
CLEAR:X_EVENTS,IT_EVENTS.
X_EVENTS-NAME = SLIS_EV_END_OF_LIST.
X_EVENTS-FORM = 'MODIFY_LIST'.
APPEND X_EVENTS TO IT_EVENTS.
CLEAR X_EVENTS.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form FILL_TABLE
text
FORM FILL_TABLE.
ITAB-NAME = 'vijay'.
ITAB-ZTERM = 'A'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'ABC'.
ITAB-ZTERM = 'B'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'TEST'.
ITAB-ZTERM = 'C'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'DILIP'.
ITAB-ZTERM = 'D'.
APPEND ITAB.
clear itab.
ITAB-NAME = '123'.
ITAB-ZTERM = 'E'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'GEN'.
ITAB-ZTERM = 'A'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'ALV'.
ITAB-ZTERM = 'F'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'ALVTEST'.
ITAB-ZTERM = 'A'.
APPEND ITAB.
clear itab.
ENDFORM. "FILL_TABLE
*& Form MODIFY_LIST
text
FORM MODIFY_LIST.
data: l_lines type i.
describe table itab lines l_lines.
L_LINES = L_LINES + 3.
"because we have 3 lines extra occupied by lables.
"if we have header,i mean top of page add the no.of lines
"how many ever top of page have + 3 for labels.
DO L_LINES TIMES.
read table it_chg with key INDEX = sy-index.
if sy-subrc = 0.
**This code is for reading the out put line
**and modify accordinlg to our requiremnet.
**don't chnage this.
READ LINE SY-INDEX INDEX SY-LSIND.
IF SY-SUBRC = 0.
MODIFY LINE SY-INDEX INDEX SY-LSIND
FIELD FORMAT ITAB-NAME INPUT.
ENDIF.
ENDIF.
ENDDO.
ENDFORM. "MODIFY_LIST -
Download link for only some rows
Hi,
I have 2 tables. One contains records for products, and the other contains images for only some of the products. The images have been uploaded through the application and therefore are in a 'upload_data' table.
The tables are linked by product_id.
I would like to display a report that shows all the column from the products table and a download link for only those products that have an image.
So far the query only returns those rows that have an image.
Thanks
Edited by: user12970007 on 20-Apr-2010 17:59What does this query look like?
-
Hi,
I wonder if anybody could help me in my problem?
I made a table and would like only some of the rows to be selectable. Is this possible?
The best solution would be to hide those squares on the left of the rows.
Thanks in advance for your help.
Piotrek
Edited by: Piotr Kondratowicz on Feb 10, 2009 4:29 PMHi Piotr,
Create a value attribute of type boolean(Ex: ed) and assign it to all editable fields of the table.
Based on a condition enable(ed=true)/disable(ed=false) the row fields as read only.Which will fulfill your requirement.
Thanks & Regards,
Jhansi Miryala -
Counting only some rows without where or subqueries?
Is it possible with oracle to count only some of the rows? I mean without excluding the rows in where or using sub queries.
This does not work but I think it illustrates what I want:
SELECT count(flags), count(flags like '%P%'), count(flags like '%F%') FROM table WHERE some_column = 2;
Where the first would return the number of flags rows, while the second contet the numbers that have P in them and the third counted the number with F.
Table would be
Flags Some_column
'AFP' 2
'A* 1
'PF' 1
'P' 2
And so on.
In postgres you can do: count(substring(flags from 'R')), to achieve the above mentioned idea. Does oracle have a way of doing the same?Your requirement is not clear. But.. Is this what you are trying to achieve?
SQL> with t
2 as
3 (select 'AFP' st from dual
4 union all
5 select 'A*' from dual
6 union all
7 select 'PF' from dual
8 union all
9 select 'P' from dual
10 )
11 select sum(1) sum1,
12 sum(case when st like '%P%' then 1 else 0 end) sum2,
13 sum(case when st like '%F%' then 1 else 0 end) sum3
14 from t
15 /
SUM1 SUM2 SUM3
4 3 2 -
ALV - how to make selectable only some rows on an ALV?
Hi my problem is:
I have an ALV GRID as output of a report.
I have to make selectable only few rows based on the contents of a field (showed in a column in the ALV).
Is it possible?
Best Regards, VincenzoI did understand, but as i told you there is nothing like that, neither an option nor an event to capture.
Here is the documentation: http://help.sap.com/saphelp_erp2005vp/helpdata/EN/bf/3bd1369f2d280ee10000009b38f889/frameset.htm
Read it and choose what you need and what is in existance. -
Hotspot click for only some rows in ALV grid for a particular column ?
Hi there,
In ALV grid, we can make Hotspot enable for all rows in a specified column
by specifying in the fieldcatalog with Hotspot attribute set as true.
But I want to enable Hotspot only for certain rows in the particular column. I tried with MC_STYLE4_LINK , but I didnt got the required result.
So , how could I achieve that in ALV grid.
Points would be rewarded for helpful answers.
Regards,
Anil .Hi,
You can do it for a column. Please refer to the code snippet below,
DATA : it_fcat TYPE lvc_t_fcat,
wa_fcat LIKE LINE OF it_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'SMMW_ALERTS_ICON_S'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = it_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
LOOP AT it_fcat INTO wa_fcat.
IF wa_fcat-fieldname = 'STATUS'.
wa_fcat-hotspot = 'X'.
MODIFY it_fcat FROM wa_fcat.
CLEAR wa_fcat.
ENDIF.
ENDLOOP.
CALL METHOD l_obj_alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SMMW_ALERTS_ICON_S'
CHANGING
it_outtab = lt_alerts_st
it_fieldcatalog = it_fcat.
In the above replace the structure 'SMMW_ALERTS_ICON_S' with your structure and column 'STATUS' with your desired column.
Hope this helps,
Regards,
Vinodh -
Display item renderer in only some rows of a datagrid
I need to display a combobox item renderer in my datagrid
only in the first of every 5 rows. With the remaining 4 rows in
this particular column empty. Then the pattern will repeat again.
This is how I am currently creating the columns however with
this approach the combobox itemrenderer is appearing in all rows
<mx:columns>
<mx:DataGridColumn headerText="No."
dataField="assCriteriaNum" width="60" />
<mx:DataGridColumn headerText="Assessment Criteria"
dataField="assCriteria" width="210"/>
<mx:DataGridColumn headerText="Mark Range"
dataField="markRange" width="50" />
<mx:DataGridColumn headerText="Mark" dataField="mark"
width="70" >
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox>
<mx:dataProvider>
<mx:ArrayCollection>
<mx:String>0</mx:String>
<mx:String>1</mx:String>
<mx:String>2</mx:String>
<mx:String>3</mx:String>
<mx:String>4</mx:String>
<mx:String>5</mx:String>
<mx:String>6</mx:String>
<mx:String>7</mx:String>
<mx:String>8</mx:String>
<mx:String>9</mx:String>
<mx:String>10</mx:String>
</mx:ArrayCollection>
</mx:dataProvider>
</mx:ComboBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>Here is my data provider hard coded
<mx:dataProvider>
<mx:ArrayCollection>
<mx:Array>
<mx:Object assCriteria="A01 Manage." />
<mx:Object assCriteriaNum="1" assCriteria="Brief project
plan, with little evidence of monitoring progress of project work
against the project plan." markRange="(1-3)" />
<mx:Object assCriteriaNum="2" assCriteria="Limited
identification of the topic to be investigated/ researched and
limited evidence of appropriate aims and objectives, and proposed
project title." markRange="(1-3)" />
<mx:Object assCriteriaNum="3" assCriteria="Project plan,
with some evidence of monitoring progress of project work against
the project plan." markRange="(4-6)" />
<mx:Object assCriteriaNum="4" assCriteria="Some
identification of the topic to be investigated/ researched and some
evidence of appropriate aims complete the work and objectives, and
proposed project title." markRange="(4-6)" />
<mx:Object assCriteriaNum="5" assCriteria="Detailed
project plan, with clear evidence of monitoring progress of project
work against the project plan." markRange="(7-10)" />
<mx:Object assCriteriaNum="6" assCriteria="Clear
identification of the topic to be investigated/ researched and
clear evidence of appropriate aims identify the topic and
objectives, and proposed project title." markRange="(7-10)" />
<mx:Object assCriteriaNum="7" assCriteria="No relevant
response." markRange="(0)" />
<mx:Object assCriteria="A02 Use resources/research."
/>
<mx:Object assCriteriaNum="8" assCriteria="Little or no
analysis and application of the research, with few links made to
appropriate theories and concepts." markRange="(1-5)" />
<mx:Object assCriteriaNum="9" assCriteria="Evidence of
limited research involving limited selection and evaluation of
sources." markRange="(1-5)" />
<mx:Object assCriteriaNum="10" assCriteria="Some analysis
and application of the research, with links made to appropriate
theories and concepts." markRange="(4-6)" />
<mx:Object assCriteriaNum="11" assCriteria="Evidence of
some research involving the selection analyse data and evaluation
of a range of relevant sources." markRange="(4-6)" />
<mx:Object assCriteriaNum="12" assCriteria="Critical
analysis and application of the research, with obtain and select
clear links made to appropriate theories and information from a
concepts. variety of sources." markRange="(7-10)" />
<mx:Object assCriteriaNum="13" assCriteria="Evidence of
detailed research involving the selection and evaluation of a wide
range of relevant sources." markRange="(7-10)" />
<mx:Object assCriteriaNum="14" assCriteria="No relevant
response." markRange="(0)" />
</mx:Array>
</mx:ArrayCollection>
</mx:dataProvider> -
Hi all,
I've a query with more than 500 rows as result. I'm only interested to show the first 50 rows. Did you know any way to prepare the select sentence to do it? I prefer avoid use cursors to do that.
Regards,
dbajugHitesh Nirkhey wrote:
hi
use ROWNUM keyword for fetching first 50 rows
simplest example
select * from emp
where rownum < 5 ;
regards
HiteshROWNUM applies to the rows after they are collected into a result set. Thus, it may, or may not, fulfill the OP's requirements. He still needs to define what he means by "first 5 rows".
http://psoug.org/reference/pseudocols.html
Also see description of ROWNUM in the fine SQL Reference manual -
Make only some rows in a report as links
Hi friends,
I am trying to make some of the rows in a report(The report is using union to take data from multiple tables) as links. For example i am trying to make a row corresponding to "emp" as a link. For this i am trying to use the below code
select dname "c1" from dept where dname='dept5'
union all
select
'<a href=*"javascript:popUp2('
|| '''f?p=&APP_ID.:4:&SESSION.::&DEBUG.::'
|| 'P3_EXAMPLE:'
|| ename
|| ''', 700, 500);'
|| '" >'
|| ename*
|| '</a>'
"c1" from emp where Empno=7839
--remove the '*' from the codeBut i a getting the result as
dept5
<*a href="javascript:popUp2('f?p=19669:4:1768622885363834::NO::P3_EXAMPLE:KING', 700, 500);" >KING</a*>
--remove the '*'
What i need to use to make this row a link.
Thanks,
JeevEnsure that the Display As Column Attribute for the report column is Standard Report Column.
-
Restricting class access to only some classes.
Hi Guys,
I want my classes to be accessed by only my defined classes. Is it possible?
Say I have public class defined test. I want that this class should be accessed by only the classes I want not by any other class by any mean. If somebody tries to access the class it should result in SecurityException. How can I do that???
Thanks,
Rajanmaybe a package private class will do it, ie package the classes in the same package. define the particular class as protected, it will be visible to other classes in the package, the other classes maybe public.
otherwise maybe it is an protected abstract class that the others extend?
otherwise have this particular class take as arguments the other classes in overloaded methods?
otherwise maybe a strategy pattern and default is a do nothing class (ie throws)?
... -
How can I modify this script to return only certain rows of my mySQL table?
Hi there,
I have a php script that accesses a mySQL database and it was generated out of the Flex Builder wizard automatically. The script works great and there are no problems with it. It allows me to perform CRUD on a table by calling it from my Flex app. and it retrieves all the data and puts it into a nice MXML format.
My question, currently when I call "findAll" to retrieve all the data in the table, well, it retrieves ALL the rows in the table. That's fine, but my table is starting to grow really large with thousands of rows.
I want to modify this script so that I can pass a variable into it from Flex so that it only retrieves the rows that match the "$subscriber_id" variable that I pass. In this way the results are not the entire table's data, only the rows that match 'subscriber_id'.
I know how to pass a variable from Flex into php and the code on the php side to pick it up would look like this:
$subscriberID = $_POST['subscriberID'];
Can anyone shed light as to the proper code modification in "findAll" which will take my $subscriberID variable and compare it to the 'subscriber_id' field and then only return those rows that match? I think it has something to do with lines 98 to 101.
Any help is appreciated.
<?php
require_once(dirname(__FILE__) . "/2257safeDBconn.php");
require_once(dirname(__FILE__) . "/functions.inc.php");
require_once(dirname(__FILE__) . "/XmlSerializer.class.php");
* This is the main PHP file that process the HTTP parameters,
* performs the basic db operations (FIND, INSERT, UPDATE, DELETE)
* and then serialize the response in an XML format.
* XmlSerializer uses a PEAR xml parser to generate an xml response.
* this takes a php array and generates an xml according to the following rules:
* - the root tag name is called "response"
* - if the current value is a hash, generate a tagname with the key value, recurse inside
* - if the current value is an array, generated tags with the default value "row"
* for example, we have the following array:
* $arr = array(
* "data" => array(
* array("id_pol" => 1, "name_pol" => "name 1"),
* array("id_pol" => 2, "name_pol" => "name 2")
* "metadata" => array(
* "pageNum" => 1,
* "totalRows" => 345
* we will get an xml of the following form
* <?xml version="1.0" encoding="ISO-8859-1"?>
* <response>
* <data>
* <row>
* <id_pol>1</id_pol>
* <name_pol>name 1</name_pol>
* </row>
* <row>
* <id_pol>2</id_pol>
* <name_pol>name 2</name_pol>
* </row>
* </data>
* <metadata>
* <totalRows>345</totalRows>
* <pageNum>1</pageNum>
* </metadata>
* </response>
* Please notice that the generated server side code does not have any
* specific authentication mechanism in place.
* The filter field. This is the only field that we will do filtering after.
$filter_field = "subscriber_id";
* we need to escape the value, so we need to know what it is
* possible values: text, long, int, double, date, defined
$filter_type = "text";
* constructs and executes a sql select query against the selected database
* can take the following parameters:
* $_REQUEST["orderField"] - the field by which we do the ordering. MUST appear inside $fields.
* $_REQUEST["orderValue"] - ASC or DESC. If neither, the default value is ASC
* $_REQUEST["filter"] - the filter value
* $_REQUEST["pageNum"] - the page index
* $_REQUEST["pageSize"] - the page size (number of rows to return)
* if neither pageNum and pageSize appear, we do a full select, no limit
* returns : an array of the form
* array (
* data => array(
* array('field1' => "value1", "field2" => "value2")
* metadata => array(
* "pageNum" => page_index,
* "totalRows" => number_of_rows
function findAll() {
global $conn, $filter_field, $filter_type;
* the list of fields in the table. We need this to check that the sent value for the ordering is indeed correct.
$fields = array('id','subscriber_id','lastName','firstName','birthdate','gender');
$where = "";
if (@$_REQUEST['filter'] != "") {
$where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);
$order = "";
if (@$_REQUEST["orderField"] != "" && in_array(@$_REQUEST["orderField"], $fields)) {
$order = "ORDER BY " . @$_REQUEST["orderField"] . " " . (in_array(@$_REQUEST["orderDirection"], array("ASC", "DESC")) ? @$_REQUEST["orderDirection"] : "ASC");
//calculate the number of rows in this table
$rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
$row_rscount = mysql_fetch_assoc($rscount);
$totalrows = (int) $row_rscount["cnt"];
//get the page number, and the page size
$pageNum = (int)@$_REQUEST["pageNum"];
$pageSize = (int)@$_REQUEST["pageSize"];
//calculate the start row for the limit clause
$start = $pageNum * $pageSize;
//construct the query, using the where and order condition
$query_recordset = "SELECT id,subscriber_id,lastName,firstName,birthdate,gender FROM `modelName` $where $order";
//if we use pagination, add the limit clause
if ($pageNum >= 0 && $pageSize > 0) {
$query_recordset = sprintf("%s LIMIT %d, %d", $query_recordset, $start, $pageSize);
$recordset = mysql_query($query_recordset, $conn);
//if we have rows in the table, loop through them and fill the array
$toret = array();
while ($row_recordset = mysql_fetch_assoc($recordset)) {
array_push($toret, $row_recordset);
//create the standard response structure
$toret = array(
"data" => $toret,
"metadata" => array (
"totalRows" => $totalrows,
"pageNum" => $pageNum
return $toret;
* constructs and executes a sql count query against the selected database
* can take the following parameters:
* $_REQUEST["filter"] - the filter value
* returns : an array of the form
* array (
* data => number_of_rows,
* metadata => array()
function rowCount() {
global $conn, $filter_field, $filter_type;
$where = "";
if (@$_REQUEST['filter'] != "") {
$where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);
//calculate the number of rows in this table
$rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
$row_rscount = mysql_fetch_assoc($rscount);
$totalrows = (int) $row_rscount["cnt"];
//create the standard response structure
$toret = array(
"data" => $totalrows,
"metadata" => array()
return $toret;Hi there,
I have a php script that accesses a mySQL database and it was generated out of the Flex Builder wizard automatically. The script works great and there are no problems with it. It allows me to perform CRUD on a table by calling it from my Flex app. and it retrieves all the data and puts it into a nice MXML format.
My question, currently when I call "findAll" to retrieve all the data in the table, well, it retrieves ALL the rows in the table. That's fine, but my table is starting to grow really large with thousands of rows.
I want to modify this script so that I can pass a variable into it from Flex so that it only retrieves the rows that match the "$subscriber_id" variable that I pass. In this way the results are not the entire table's data, only the rows that match 'subscriber_id'.
I know how to pass a variable from Flex into php and the code on the php side to pick it up would look like this:
$subscriberID = $_POST['subscriberID'];
Can anyone shed light as to the proper code modification in "findAll" which will take my $subscriberID variable and compare it to the 'subscriber_id' field and then only return those rows that match? I think it has something to do with lines 98 to 101.
Any help is appreciated.
<?php
require_once(dirname(__FILE__) . "/2257safeDBconn.php");
require_once(dirname(__FILE__) . "/functions.inc.php");
require_once(dirname(__FILE__) . "/XmlSerializer.class.php");
* This is the main PHP file that process the HTTP parameters,
* performs the basic db operations (FIND, INSERT, UPDATE, DELETE)
* and then serialize the response in an XML format.
* XmlSerializer uses a PEAR xml parser to generate an xml response.
* this takes a php array and generates an xml according to the following rules:
* - the root tag name is called "response"
* - if the current value is a hash, generate a tagname with the key value, recurse inside
* - if the current value is an array, generated tags with the default value "row"
* for example, we have the following array:
* $arr = array(
* "data" => array(
* array("id_pol" => 1, "name_pol" => "name 1"),
* array("id_pol" => 2, "name_pol" => "name 2")
* "metadata" => array(
* "pageNum" => 1,
* "totalRows" => 345
* we will get an xml of the following form
* <?xml version="1.0" encoding="ISO-8859-1"?>
* <response>
* <data>
* <row>
* <id_pol>1</id_pol>
* <name_pol>name 1</name_pol>
* </row>
* <row>
* <id_pol>2</id_pol>
* <name_pol>name 2</name_pol>
* </row>
* </data>
* <metadata>
* <totalRows>345</totalRows>
* <pageNum>1</pageNum>
* </metadata>
* </response>
* Please notice that the generated server side code does not have any
* specific authentication mechanism in place.
* The filter field. This is the only field that we will do filtering after.
$filter_field = "subscriber_id";
* we need to escape the value, so we need to know what it is
* possible values: text, long, int, double, date, defined
$filter_type = "text";
* constructs and executes a sql select query against the selected database
* can take the following parameters:
* $_REQUEST["orderField"] - the field by which we do the ordering. MUST appear inside $fields.
* $_REQUEST["orderValue"] - ASC or DESC. If neither, the default value is ASC
* $_REQUEST["filter"] - the filter value
* $_REQUEST["pageNum"] - the page index
* $_REQUEST["pageSize"] - the page size (number of rows to return)
* if neither pageNum and pageSize appear, we do a full select, no limit
* returns : an array of the form
* array (
* data => array(
* array('field1' => "value1", "field2" => "value2")
* metadata => array(
* "pageNum" => page_index,
* "totalRows" => number_of_rows
function findAll() {
global $conn, $filter_field, $filter_type;
* the list of fields in the table. We need this to check that the sent value for the ordering is indeed correct.
$fields = array('id','subscriber_id','lastName','firstName','birthdate','gender');
$where = "";
if (@$_REQUEST['filter'] != "") {
$where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);
$order = "";
if (@$_REQUEST["orderField"] != "" && in_array(@$_REQUEST["orderField"], $fields)) {
$order = "ORDER BY " . @$_REQUEST["orderField"] . " " . (in_array(@$_REQUEST["orderDirection"], array("ASC", "DESC")) ? @$_REQUEST["orderDirection"] : "ASC");
//calculate the number of rows in this table
$rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
$row_rscount = mysql_fetch_assoc($rscount);
$totalrows = (int) $row_rscount["cnt"];
//get the page number, and the page size
$pageNum = (int)@$_REQUEST["pageNum"];
$pageSize = (int)@$_REQUEST["pageSize"];
//calculate the start row for the limit clause
$start = $pageNum * $pageSize;
//construct the query, using the where and order condition
$query_recordset = "SELECT id,subscriber_id,lastName,firstName,birthdate,gender FROM `modelName` $where $order";
//if we use pagination, add the limit clause
if ($pageNum >= 0 && $pageSize > 0) {
$query_recordset = sprintf("%s LIMIT %d, %d", $query_recordset, $start, $pageSize);
$recordset = mysql_query($query_recordset, $conn);
//if we have rows in the table, loop through them and fill the array
$toret = array();
while ($row_recordset = mysql_fetch_assoc($recordset)) {
array_push($toret, $row_recordset);
//create the standard response structure
$toret = array(
"data" => $toret,
"metadata" => array (
"totalRows" => $totalrows,
"pageNum" => $pageNum
return $toret;
* constructs and executes a sql count query against the selected database
* can take the following parameters:
* $_REQUEST["filter"] - the filter value
* returns : an array of the form
* array (
* data => number_of_rows,
* metadata => array()
function rowCount() {
global $conn, $filter_field, $filter_type;
$where = "";
if (@$_REQUEST['filter'] != "") {
$where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);
//calculate the number of rows in this table
$rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
$row_rscount = mysql_fetch_assoc($rscount);
$totalrows = (int) $row_rscount["cnt"];
//create the standard response structure
$toret = array(
"data" => $totalrows,
"metadata" => array()
return $toret; -
How to restrict only one row in Table ??.
Hi all,
i want to restrict no. of rows to one,
that is not more that one row should be there in the table.
Following trigger works well in all conditions
except:
insert into myTab select 'x' from emp;
inserts 14 rows.
Create or replace trigger one_row_myTab
before insert on myTab
for each row
declare
cnt number;
pragma AUTONOMOUS_TRANSACTION;
Begin
select count(*) into cnt from mydual;
if cnt=1 then
raise_application_error(-20001,'MyDual Can have only one Row');
end if;
end;
i think with trigger it w't be possible because,
same transaction triggers c't query the table (Mutating Table),
Autonomus trans ca't identify uncommited changes.
pls add your suggestions.
Thanks for Reading the Post.
Rajashekhar Ganga,
mail : [email protected]nice try Mulder ! it doesn't work everywhere...
SQL> connect scott/tiger@lsc69
Connected to:
Oracle7 Server Release 7.3.4.5.0 - Production
With the distributed and parallel query options
PL/SQL Release 2.3.4.5.0 - Production
SQL> create table d as select * from dual;
Table created.
SQL> create index i on d(1);
create index i on d(1)
ERROR at line 1:
ORA-00904: invalid column name
SQL> connect scott/tiger@lsc65
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production
JServer Release 8.1.7.4.0 - 64bit Production
SQL> create table d as select * from dual;
Table created.
SQL> create index i on d(1);
Index created.
SQL> connect scott/tiger@lsc68
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production
With the Partitioning and Data Mining options
SQL> create table d as select * from dual
Table created.
SQL> CREATE UNIQUE INDEX i on d(1);
CREATE UNIQUE INDEX i on d(1)
ERROR at line 1:
ORA-03113: end-of-file on communication channel -
Display commandButton in some rows only
In my handler, I created a dynamic datatable. How can I add a command button in some rows only ? I tried to use setRendered but it doesn't work...
HtmlDataTable _dataTable = new HtmlDataTable();
_dataTable.setId("table1");
_dataTable.setVar("table1");
_dataTable.setValueBinding("value", application.createValueBinding(#{lpHandler.shpModel}));
UIColumn _addColumn = new UIColumn();
HtmlCommandExButton _addCommand = new HtmlCommandExButton();
String _addAction = "#{hksHandler.editLPOutcome}";
MethodBinding _addActionBinding = application.createMethodBinding(_addAction,null);
_addCommand.setAction(_addActionBinding);
_addCommand.setRendered(_dataTable.getRowIndex() > 0);
_addColumn.getChildren().add(_addCommand);
_dataTable.getChildren().add(_addColumn);
Thanks in AdvanceTo expand on this a little more, when you have a data table the components inside the data table only occur once. That is, there is one instance of the command button you have created. During the render process, the subcomponents of the data table are rendered many times, once for each row. What you have done is set the value of the rendered property for the command button once, to whatever static value (_dataTable.getRowIndex() > 0) has at the time you invoke it. So the value for rendered is the same for each row, so you either always get the button or never get the button. In order to make the rendered value dependent on the row, use must set the rendered using a value expression, in the same way you did with the value property for the data table.
-
How to copy only some coulums and rows from excel files to a Oracle Table
Dear all,
I have the following problems:
How to copy only some wanted coulums ( I.e DATETIME(format:17/09/2007 00:00:01 ) and TIME (format: 00:00:01 ) from excel files to oracle table.
HOPE TO GET HELP FROM YOU GUYS!
SINCERELY,
MONOJSHARMALUITELHow about Heterogeneous Services so that the Excel sheet is an external database:
1- Go to Control Panel>Administrative Tools>Data Sources (ODBC)>System DSN and create a data source with appropriate driver. Name it EXCL.
2- In %ORACLE_HOME%\Network\Admin\Tnsnames.ora fie add entry:
EXCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.0.24)(PORT = 1521))
(CONNECT_DATA =
(SID = EXCL)
(HS = OK)
Here SID is the name of data source that you have just created.
3- In %ORACLE_HOME%\Network\Admin\Listener.ora file add:
(SID_DESC =
(PROGRAM = hsodbc)
(SID_NAME = <hs_sid>)
(ORACLE_HOME = <oracle home>)
under SID_LIST_LISTENER like:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = d:\ORA9DB)
(PROGRAM = extproc)
(SID_DESC =
(GLOBAL_DBNAME = ORA9DB)
(ORACLE_HOME = d:\ORA9DB)
(SID_NAME = ORA9DB)
(SID_DESC =
(PROGRAM = hsodbc)
(SID_NAME = EXCL)
(ORACLE_HOME = D:\ora9db)
Dont forget to reload the listener
c:\> lsnrctl reload
4- In %ORACLE_HOME%\hs\admin create init<HS_SID>.ora. For our sid EXCL we create file initexcl.ora.
In this file set following two parameters:
HS_FDS_CONNECT_INFO = excl
HS_FDS_TRACE_LEVEL = 0
5- Now connect to Oracle database and create database link with following command:
SQL> CREATE DATABASE LINK excl
2 USING 'excl'
3 /
Database link created.
Now you can perform query against this database like you would for any remote database.
SQL> SELECT table_name FROM all_tables@excl;
TABLE_NAME
DEPT
EMP
Maybe you are looking for
-
Purchase your BlackBerry Z10 with the new BlackBerry 10 operating system today at Best Buy! The BlackBerry Z10 features a gorgeous 4.2” display (1208x768 resolution) 356 ppi. An 8MP rear camera with capability to shoot 1080p video. A 1.5GHz dual-core
-
FTP_R3_TO_SERVER gives error " FTP SubCommand Local Error"
Hi I have an issue with the transfer of data from SAP internal table to FTP server I am using the function module FTP_R3_TO_SERVER. Using this function module I am able to transfer data only some times. Most of the time it gives the error messa
-
Cisco ISE deployment with HP Swithes
Is there any compatibility matrix of cisco ISE with HP access swithes or there is any features restriction on HP access layer. The HP switches do support 802.1x. Thanks Qasim
-
How many number of input/output arguments allowed in Stored procedure
Please let me know how may input and output arguments are allowed in Oracle stored procedure. I wan't to writer one generic SP and for that I need to know the limitation on the number of arguments. I am using Oracle 8.0.5.
-
Can you transfer files in Adobe Premiere Pro CS5 from a Mac computer to a PC that also has Adobe
I am looking into buying Adobe Premiere Pro CS5 for my iMac computer, because the guy that I am going to help out is in another state, using Adobe Premiere Pro CS5 on his PC, we will both be editing video to be featured on the Pursuit channel. My qu