Linux Running MariaDB Database

Hi

I have MariaDB running on Linux. I have created a stored procedu

DELIMITER //
CREATE DEFINER=`root`@`%` PROCEDURE `UpdatePeriodLocaltime`(IN `startUtcTime` datetime, IN `tableName` VARCHAR(50))
BEGIN
DECLARE period, localperiod, startrange, endrange datetime;
declare _offset time;
declare endtime datetime;
declare _dstStart, _dstEnd date;
declare statement varchar(256);


SET period = startUtcTime;

set endtime = addtime(startUtcTime,'1 00:15:00');

select offset, dstStart, dstEnd from timezone into _offset, _dstStart, _dstEnd;

if (startUtcTime >= _dstStart and startUtcTime < _dstEnd) then
set _offset = addtime(_offset, '01:00:00');
end if;


periods_loop : LOOP

IF period >= endtime

THEN leave periods_loop;

END IF;

set localperiod = addtime(period, _offset);
set startrange = addtime(period, '-00:07:30');
set endrange = addtime(period,'00:07:30');


UPDATE updperiod SET timest = period;

set @sql = concat('update ', tableName, ' set periodlocaltime = "', localperiod, '" where starttime > "', startrange, '" and starttime <= "', endrange, '"');

#UPDATE pre_mib2 SET periodlocaltime = addtime(period, _offset) WHERE starttime > (addtime(period, '-00:07:30')) AND starttime <= (addtime(period,'00:07:30'));

prepare stmt1 from @sql;
execute stmt1;
deallocate prepare stmt1;



set period = addtime(period, '00:15:00');


END loop;


END//
DELIMITER ;

But when I try to call the procedure I get the following error:

mysql> call UpdatePeriodLocaltime("2015-04-02","table_name");
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1


I have created another procedure with only one IN parameter and that works just fine...

What am I missing here?

P


Similar Content



What Is A Good Linux Script For Changing An IP Address Statically In Ubuntu?

I have a shell script that currently changes the mac address of eth0 repeatedly. However, it does not change the public IP address, confirmed by wget -qO- ipinfo.io/ip .

PERIOD=10

while [ 1 ]
do
echo "Changing mac address..."
let lastup=`date +%s`
macchanger -A eth0
let diff=`date +%s`-$lastup
if [ "$diff" -lt "$PERIOD" ]
then
sleep $(($PERIOD-$diff))
echo "Changed mac address successfully."
echo
elif [ "$diff" -gt "$PERIOD" ]
then
echo "Command took longer than iteration period of $PERIOD seconds!"
fi
done

The script needs to change the IP Address statically.

Also, ultimately, what I am trying to accomplish, for security reasons, is to frequently and automatically change a computer's public IP address and mac address. This way, my office's computers, when using the Internet, has an additional form of protection.

Problem W/.bash Script... Need Help

I'm trying to loop through a query in SQLDeveloper by passing the query a different Period and I'm having a problem getting the syntax correct.

Individually the following works correctly on its own:

Code:
#!/bin/bash
 for i in `seq -f "%02g" 1 5`;
    do
    echo $i
 done

$ ./test.sh
1
2
3
4
5

the following also executes correctly:

Quote:
sqlplus table1/$userpass@Mytable <<EOF
@./sqlcode.sql $i
EOF
but when I try to wrap the loop around my sqlplus command

Code:
#! /bin/sh
userpass=read
for i in `seq -f "%01g" 1 3`;
  do
        sqlplus -S  table1/$userpass@Mytable <<EOF
        @./sqlcode.sql $i
        EOF
done

I get the following error:

./test.sh: line 13: syntax error: unexpected end of file

Does anyone have any ideas on what's going on?

Cygwin Rsync Script Copying File Incorrectly

I am trying to write a simple test script that executes a single rsync call. Once I get the syntax right, the script will be expanded to incorporate several rsync instructions to save me time.

I'm using a Cygwin Terminal on Windows 7 to run Rsync.

The script is called "backup" and I call it from the cygwin terminal using "./backup". Have used chmod to make it executable.

When I execute the rsync instruction as a standalone instruction at terminal prompt, the file copies to the target folder perfectly.

However, when I try and drop the same instruction into a script, it copies the file over from it's original file name "mvi_1840.mov" to a file with the name "." -- literally a single period. I can rename the file to a .mov file and it works fine but naturally, I don't want to have to do this.

The one other thing I will mention is that the file is located in the /home/"username" directory in cygwin vs /bin. But I would not think that this would make a difference.

I have pasted the contents of the script file below:
Code:
#!/bin/bash
    rsync.exe -rltDvP --exclude "System Volume Information" --exclude
 "RECYCLER" --exclude=\$RECYCLE.BIN --delete "/cygdrive/c/users/<USERNAME>
/desktop/mvi_1840.mov" "/cygdrive/c/users/<USERNAME>/desktop/test/"

Any help would be greatly appreciated!

Thanks

Problem In Running Codes Of TORA

Hi,
I am new in linux. I have following problem while running the codes of TORA in ns-2.35 in ubuntu.Can you please help me?


num_nodes is set 6
INITIALIZE THE LIST xListHead

(_o22 cmd line 1)
invoked from within
"_o22 cmd port-dmux _o37"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o22" line 2)
(SplitObject unknown line 2)
invoked from within
"$agent port-dmux $dmux_"
(procedure "_o19" line 11)
(Node/MobileNode add-target-rtagent line 11)
invoked from within
"$self add-target-rtagent $agent $port"
(procedure "_o19" line 28)
(Node/MobileNode add-target line 28)
invoked from within
"$self add-target $agent $port"
(procedure "_o19" line 15)
(Node attach line 15)
invoked from within
"$node attach $ragent [Node set rtagent_port_]"
(procedure "_o3" line 85)
(Simulator create-wireless-node line 85)
invoked from within
"_o3 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o3" line 23)
(Simulator node line 23)
invoked from within
"$ns node"
invoked from within
"set n(0) [$ns node]"
(file "tora2.tcl" line 115)

How To Determine If Syntax Array=( Str1 Str2 Str3 ) To Declare Array Is Valid

Hi, I am creating a Korn shell script and need to create an array where each element corresponds to one line of an input file. Being able to do the following would be awesome: Code:
array=( $(cat file.txt) )

However, I'm finding that not all of my development boxes allow this. Some return this: Code:
ksh: syntax error: `(' unexpected

I suspect this has something to do with the Korn shell version. Does anyone know how I can find out what version is required in order to be able to declare arrays, as above? Or is this an OS version issue?

I would really appreciate any tips on how I can find out the minimum requirements for this syntax to be valid.

Thanks.

URGENT HELP!!! GPSR Patch With Ns-2.34 Ubuntu 12.04

Hey guys
I have been trying to patch GPSR with ns-2.34.The operating system i am using is ubuntu 12.04.
I have made all the necessary changes required in the various files .

I have another version of ns (ns-2.35 ) too but it is in a different directory.
Everytime I run my tcl file an error keeps coming up.
I will be greatful if somebody can help me.This is very very URGENT.


(_o29 cmd line 1)
invoked from within
"_o29 cmd if-queue _o23"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o29" line 2)
(SplitObject unknown line 2)
invoked from within
"$agent if-queue [$self set ifq_(0)] "
(procedure "_o17" line 28)
(Node/MobileNode add-target line 28)
invoked from within
"$self add-target $agent $port"
(procedure "_o17" line 15)
(Node attach line 15)
invoked from within
"$node attach $ragent [Node set rtagent_port_]"
(procedure "create-gpsr-routing-agent" line 29)
invoked from within
"create-gpsr-routing-agent $node $id"
(procedure "gpsr-create-mobile-node" line 41)
invoked from within
"gpsr-create-mobile-node $i"
("for" body line 2)
invoked from within
"for {set i 0} {$i < $opt(nn) } {incr i} {
gpsr-create-mobile-node $i
}"

Script Persistently Lowering Mplayer Volume

I have a similar script as follows

Code:
(sleep 5m; echo "set_property volume 85 > "fifo_file")&

mplayer -volume 95 -quiet -slave -input file="fifo_file" song1 song2 song3

This makes the current song change volume to 85 after the 5 minute sleep period, but any songs after that revert to 95.

I want to keep it at volume 85 until the mplayer command completes but start at 95 until changed.

Is this possible?

Is There Is "best" Linux Distro For Music Production?

I tried doing a search on this topic, but the only hit I got was my "Howdy" intro post from yesterday. So I thought I'd go ahead and toss out this question to the forum to see if there is a particular distribution I should be looking at.

Currently I have two PCs on my home network that share a monitor, mouse, and keyboard. One of them is my digital audio workstation (aka DAW), a computer that I use for music composition, production, and recording, and the other is the one I'm typing on at the moment, which until very recently has been just sitting around doing nothing -- through no fault of its own. It had a bad power supply which I just recently replaced. But now that I have it up and running again, I would like to use it for some experimentation. It has two drives installed, one of which is currently running Windows 7. The other has an older distribution of Ubuntu on it -- about three years old or so. Because it's such an old distribution, I'm thinking about replacing it with whatever will give me the best performance in terms of working with audio and MIDI.

I'm not very conversant at all with Linux. About all I did with this old Ubuntu distro was play around with it some. And then, when I installed Win7, it killed the Ubuntu boot sector, so it's been quite a while since I've even logged into the Linux side of things.

I don't suppose I even need to mention that I'll also be installing a boot manager so that I can go back and forth between the OSes. I've been playing around some with Grub2Win, but for some reason it doesn't find my Linux installation. I need to check into that a bit further.

SO getting back to the music production topic, is there even a significant difference in the way the various distributions would handle audio and MIDI?

I've done some googling on the subject of the best linux distributions and, what I've found is that "best" tends to vary a lot over a fairly narrow time period. Bodhi, Mint, Megeia, Ubuntu, Xubuntu, Lubunto (for laptops), OpenSUSE, etc., all of these and more make the "best of" list at one time or another over a relatively short period of time -- say three years or so in terms of a timeframe. I've got to admit that, just from a name perspective, I already have a bit of an attraction the Bodhi. Not only is its interface supposed to be beautiful, but apparently the Bodhi community are more visual-art-centric (in addition to being a musician and a whole lot of other things, I'm also a visual artist), plus my old Earthlink email address was bodhi at earthlint dot net. I closed my earthlink account some ten years ago or so, so it's naught but a fading memory. Someone else likely has it now. Anyway, I am for sure gonna give Bodhi a look-see. Right now, I'm reading through a "top seven for 2014" list put together by Carla Schroder over at linux.com.

I'm hoping I can reduce the size of this list some, not just to save time but also to save disks if I have to burn copies to disk to try them out.

So, if you happen to use Linux for making music, do you have a favorite? If so, I'd like to learn about it and why you like it.

Ns2 Black Hole Attack Code Runing Problem

I installed ns2 using (sudo apt-get install ns2)
I hav code for black hole attack in aodv manet and while trying to run it on ns2 Im getting the fallowing error message
please tell me how to fix this..??

INITIALIZE THE LIST xListHead

(_o58 cmd line 1)
invoked from within
"_o58 cmd addr"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o58" line 2)
(SplitObject unknown line 2)
invoked from within
"_o58 addr"
("eval" body line 1)
invoked from within
"eval $node addr $args"
("default" arm line 2)
invoked from within
"switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
DSR {
$self at 0.0 "$node start-dsr"
}
AODV {
set ragent [$self cre..."
(procedure "_o3" line 14)
(Simulator create-wireless-node line 14)
invoked from within
"_o3 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o3" line 23)
(Simulator node line 23)
invoked from within
"$ns node"
invoked from within
"set node_(2) [$ns node]"
(file "atk3.tcl" line 55)

Error In Umts Verical Handover Wih Wlan

Hey,
please find attached the code
I got this error :
can't read "mac_(0)": no such variable
while executing
"subst $[subst $var]"
(procedure "_o112" line 5)
(SplitObject set line 5)
invoked from within
"$iface2 set mac_(0)"
invoked from within
"set tmp2 [$iface2 set mac_(0)] "
(file "umts.tcl" line 319)




can anyone help to solve the error??