Sponsored Content
Top Forums Shell Programming and Scripting Need help with array substitution Post 303000286 by RudiC on Saturday 8th of July 2017 06:33:06 AM
Old 07-08-2017
Need to memorize that...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Array help (variable substitution).

I am using an array (clmlist01). I have 61 of these and have 4 or more references to each one in a block of code that I do not want to have to hardcode. With that being said, I am creating a varible and going through a for loop to create the actually name of each array. The arrays would end up... (3 Replies)
Discussion started by: dsimpg1
3 Replies

2. Programming

Creating an array to hold posix thread ids: Only dynamic array works

I am facing a strange error while creating posix threads: Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output. Snippet 1 This works: -------------- int *threadids; threadids = (int *) malloc (num_threads * sizeof(int)); ... (4 Replies)
Discussion started by: kmehta
4 Replies

3. Shell Programming and Scripting

Tricky array substitution in functions

Hello, Please tell me if there is a better way to get the number of elements from an array that is passed to a function. This is what works on Solaris 8 (ksh) but it looks odd: loop_array() { array_name=$2 b1='\${\#' b2='}' nr_elements=`eval echo... (6 Replies)
Discussion started by: majormark
6 Replies

4. Shell Programming and Scripting

Difference between "Command substitution" and "Process substitution"

Hi, What is the actual difference between these two? Why the following code works for process substitution and fails for command substitution? while IFS= read -r line; do echo $line; done < <(cat file)executes successfully and display the contents of the file But, while IFS='\n' read -r... (3 Replies)
Discussion started by: royalibrahim
3 Replies

5. Shell Programming and Scripting

Array reference - bad substitution

I've created a series of arrays named as follows: row1 row2 row3 . . . row10 Each has 4 elements. I'm trying to echo the array elements out in a for loop. Here's what I have: for ((i=1;i<=10;i++)) do for ((j=1;j<=4;j++)) do eval out=${row`echo $i`} echo -n $out (3 Replies)
Discussion started by: swankgd
3 Replies

6. Shell Programming and Scripting

Substitution in a file dont work with an Array in filename

Hi. I´ve a script that should substitude the 8th line in a file called xxx.num6. The "xxx" is set by an array filled with this command: j=0 for Par in *.sys ; do Par=`echo $Par | sed 's/\(.*\).sys/\1/'` ; Par2="$Par" ; echo "${Par2}" j=$((j + 1)); done Now i try... (0 Replies)
Discussion started by: Lock3
0 Replies

7. Shell Programming and Scripting

PERL : Read an array and write to another array with intial string pattern checks

I have an array and two variables as below, I need to check if $datevar is present in $filename. If so, i need to replace $filename with the values in the array. I need the output inside an ARRAY How can this be done. Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies

8. Shell Programming and Scripting

Bash 3.2 - Array / Regex - IF 3rd member in array ends in 5 digits then do somthing...

Trying to do some control flow parsing based on the index postion of an array member. Here is the pseudo code I am trying to write in (preferably in pure bash) where possible. I am thinking regex with do the trick, but need a little help. pesudo code if == ENDSINFIVEINTS ]]; then do... (4 Replies)
Discussion started by: briandanielz
4 Replies

9. Shell Programming and Scripting

Variable substitution in array printing

Hi folks, A really dumb question as I've wasted far too long trying to get this to work.... (on RH bash) I have an array: m0='<hello>' m0='<there>' m0='<fred>' v0='<goodbye>' v0='<again>' v0='<john>' in my code I calculate the value of the variable to output and if I echo it, I... (2 Replies)
Discussion started by: say170
2 Replies

10. Shell Programming and Scripting

Bash arrays: rebin/interpolate smaller array to large array

hello, i need a bit of help on how to do this effectively in bash without a lot of extra looping or massive switch/case i have a long array of M elements and a short array of N elements, so M > N always. M is not a multiple of N. for case 1, I want to stretch N to fit M arrayHuge H = (... (2 Replies)
Discussion started by: f77hack
2 Replies
SQL::Statement::Roadmap(3pm)				User Contributed Perl Documentation			      SQL::Statement::Roadmap(3pm)

NAME
SQL::Statement::Roadmap - Planned Enhancements for SQL::Statement and SQL::Parser Jens Rehsack - June 2010 SYNOPSIS
This document gives a high level overview of the future of SQL::Statement, SQL::Parser and its impact. The planned enhancements cover testing, performance, reliability, extensibility and more. CHANGES AND ENHANCEMENTS
Enhancements in SQL::Statement 1.xx SQL::Statement 1.xx will not receive big changes, but a few enhancements may help us to design SQL::Statement 2.xx much better. CREATE and DROP of FUNCTION, KEYWORD, OPERATOR, TYPE SQL::Statement is missing some functions, types, operators etc. It's supported to add missing functionality - but the implementation wasn't picked up during the modernizing of column evaluation. See RT#52397 for some more information. This should be done before SQL::Statement 1.xx reaches the end of its road. Parser improvements The SQL::Parser is implemented based on a lot of regular expressions and some manually developed logic. This creates some issues like RT#53416 or RT#55190. Further, trailing ";" causes SQL::Parser to croak. We need to decide what can be fixed without internal design changes and what has to wait. Performance There is no intention to work on performance improvements in SQL::Statement 1.xx. The performance is good as it is and improvement requires design changes. Reliability Bugs will be fixed - where possible. SQL::Statement 1.28 is much more reliable than SQL::Statement 1.15. Even if a bug cannot be fixed all issues are gratefully received as they will be considered in the design process for SQL::Statement 2.xx better. Extensibility SQL::Statement 1.xx is highly extensible, even if a more object oriented design would improve that. The 1.xx branch will not be redesigned for greater extensibility on a coding level. Enhancements in SQL::Statement 2.xx Concerning the procedural design of SQL::Statement 1.xx a rewrite of the basic components is required. SQL::Parser rewrite The SQL::Parser needs to be modified to be able to use a http://en.wikipedia.org/wiki/Backus_Naur_Form. This would allow users and developers to rely on many different SQL dialects. This will allow better extensibility from a feature point of view without losing ANSI SQL compatibility. SQL::Statement rewrite SQL::Statement should be reduced to a simple coordinating engine. The executing tasks should be organized into separated commands. This will reduce side effects and will open the door for higher level optimizations, reliability improvements or sub-selects (or other calculated tables). Features There is a large list of missing features but not all table backends will be able to support each new feature. The most popular requested features need additional discussion and everyone is welcome to do it on the mailto:dbi-dev@perl.org. LOCK TABLE Locking table within SQL scripts to manually control table consistence over several operations. The current locking support is restricted to one statement. Transaction support Executing statements on a temporary copy of the table data. The easiest way to implement this would be to create a SQL::Statement::RAM on "BEGIN TRANSACTION" and write the entire table back on "COMMIT" or discard on "ROLLBACK". Better performance could be acheived when the implementation allows to memorize the single modification and apply them at "COMMIT". This needs more discussion. ALTER TABLE Adding, removing or modifying columns is not supported for created tables. A generic "ALTER TABLE" seems to rely on the implementation of the transaction support - until better ideas are provided. Indices Currently some table backends have implicit support to access specified rows quicker than fetching each row and evaluating the where clause against the row data. An interface would be required to configure fetching to return only rows matching a restricted where clause. Another (probably better) way to support indices would be to fetch index entries at first and have an interface to the table fetching lines based on an index key. Sub-Selects In most cases queries can be re-expressed without using sub-selects. But in any case, there are circumstances where sub-selects are required. The first implementation will do the sub-select before the primary statement is executed without any further optimization. Hopefully a later version will provide better Performance with some optimization. Query based variables Currently the only variable I can imagine is "ROWNUM". More suggestions are very welcome. Better SQL Script support In SQL::Statement 1.xx the function "RUN ()" provides SQL script execution. This function may have limitations and side effects (at least when the executed SQL touched the same tables as the primary statement). I plan to improve the SQL script support to remove the side effects on the one hand and have a more flexible and easier way to execute them. Finally it should be possible to execute a script via: $dbh->do( join( ";", @script ) ); Trigger support Most important when doing complicated things is having callback functions for several events. While real triggers will not be possible for SQL::Statement and underlying pseudo-databases, callbacks could be provided via triggers. Performance There are several performance optimizations required for SQL::Statement 2.xx. The first one should be done on a very high level (query optimization) by implementing algebraic evaluation of queries and clean implementation of typical database algorithms. With respect to the basic optimization rule premature optimization is the root of all evil, it is primarily targeted to have an adequately fast, reliable implementation of many algorithms (e.g. early incomplete evaluation to reduce amount of rows, transpose where clause to evaluate constants first) and a clever controller choosing the right algorithm for a specific query. The second optimization goal means: implementing most expensive methods in XS. This requires a good performance test suite as well as some real world useage cases. Reliability This is one of the primary goals of SQL::Statement. I hope to reach it using test driven development and I hope I get some more todo's from the users for this. Extensibility The currently high level of extensibility should be increased on a coding level. This will be done by redesigning the entire parser and execution engine using object oriented techniques and design patterns. Testing Many tests in SQL::Statement are not well organized. The tests should be reorganized into several parts: Basic API This part should test the entire basic API of SQL::Statement, SQL::Parser and probably the entire engine command classes. DBI / Table API This part should test if the API to DBI drivers work (maybe an empty test driver will be needed for that). Functionality This part should test the functionality of the SQL::Parser and the SQL::Statement engine. Performance This part should be used to implement full useage cases (ideally from real world projects) to allow for testing optimizations. PRIORITIES
Our priorities are localized to our current issues and proof of concept fixes for upcoming SQL::Statement 2.xx. Any additional priorities (as missing features, the SQL::Statement rewrite) will come later and can be modified by (paying) users. RESOURCES AND CONTRIBUTIONS
See <http://dbi.perl.org/contributing> for how you can help. If your company has benefited from the DBI or SQL::Statement, please consider if it could make a donation to The Perl Foundation "DBI Development" or "SQL::Statement Development" fund at <http://dbi.perl.org/donate> to secure future development. Alternatively, if your company would benefit from a specific new DBI or SQL::Statement feature, please consider sponsoring its development through the options listed in the section "Commercial Support from the Author" on <http://dbi.perl.org/support/>. Using such targeted financing allows you to contribute to DBI development (including SQL::Statement and PurePerl DBI drivers) and rapidly get something specific and directly valuable to you in return. Thank you. perl v5.10.1 2010-07-12 SQL::Statement::Roadmap(3pm)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy