<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:courier, monaco, monospace, sans-serif;font-size:10pt"><DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif">Thank you kindly, Mic. I have determined that I can do:</DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif"> </DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif">sqlite3 AssetStorage.db .dump > fileName</DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif"> </DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif">And that this file now contains the various fields in plain text ascii. The binary uuid's are ascii. In fact, it looks like this with 'head':</DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif"> </DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif">[grid@fc620887 bin]$ head testAssets<BR>BEGIN TRANSACTION;<BR>CREATE TABLE assets(UUID varchar(255) primary key,<BR>Name varchar(255),<BR>Description varchar(255),<BR>Type integer,<BR>InvType integer,<BR>Local integer,<BR>Temporary integer,<BR>Data blob);<BR>INSERT INTO "assets" VALUES('00000000000022223333000000000001', 'WelcomeNote', '', 7, 7, 0, 0, X'0A48656C6C6F20616E64207468616E6B20796F7520666F72207573696E67204F70656E5...A');</DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif"> </DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif">So, indeed, I will read the tutorial as I head towards understanding how to get some assets from sqlite to mysql to help out some of our users.</DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif"> </DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif">Charles<BR><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">----- Original Message ----<BR>From: "Bowman, Mic" <mic.bowman@intel.com><BR>To: opensim-dev@lists.berlios.de<BR>Sent: Thursday, January 17, 2008 2:18:56 PM<BR>Subject: Re: [Opensim-dev] moving assets from sqlite to mysql<BR><BR>Here's one of the refs for the data conversion. It has examples for<BR>converting text to binary (hex) and for creating blobs...<BR><BR><A href="http://www.dbmaker.com.tw/reference/manuals/tutorial/tutorial_07.html" target=_blank>http://www.dbmaker.com.tw/reference/manuals/tutorial/tutorial_07.html</A><BR><BR>--mic<BR><BR><BR>-----Original Message-----<BR>From: <A href="mailto:opensim-dev-bounces@lists.berlios.de" ymailto="mailto:opensim-dev-bounces@lists.berlios.de">opensim-dev-bounces@lists.berlios.de</A><BR>[mailto:<A href="mailto:opensim-dev-bounces@lists.berlios.de"
ymailto="mailto:opensim-dev-bounces@lists.berlios.de">opensim-dev-bounces@lists.berlios.de</A>] On Behalf Of Bowman, Mic<BR>Sent: Thursday, January 17, 2008 8:33 AM<BR>To: <A href="mailto:opensim-dev@lists.berlios.de" ymailto="mailto:opensim-dev@lists.berlios.de">opensim-dev@lists.berlios.de</A><BR>Subject: Re: [Opensim-dev] moving assets from sqlite to mysql<BR><BR>Rather than using the binary dump format, I used the ".dump" command<BR>from the sqlite3 command line. That will create a file of SQL statements<BR>(which are much easier to edit). I needed to make a few changes to the<BR>file before running it to recreate the assets in mysql (working with the<BR>ascii SQL statements is similar to what Melanie suggests... there are a<BR>number of good online refs for doing SQL data conversion...). <BR><BR>--mic<BR><BR><BR>-----Original Message-----<BR>From: <A href="mailto:opensim-dev-bounces@lists.berlios.de"
ymailto="mailto:opensim-dev-bounces@lists.berlios.de">opensim-dev-bounces@lists.berlios.de</A><BR>[mailto:<A href="mailto:opensim-dev-bounces@lists.berlios.de" ymailto="mailto:opensim-dev-bounces@lists.berlios.de">opensim-dev-bounces@lists.berlios.de</A>] On Behalf Of Melanie<BR>Sent: Thursday, January 17, 2008 8:18 AM<BR>To: <A href="mailto:opensim-dev@lists.berlios.de" ymailto="mailto:opensim-dev@lists.berlios.de">opensim-dev@lists.berlios.de</A><BR>Subject: Re: [Opensim-dev] moving assets from sqlite to mysql<BR><BR>Hi,<BR><BR>no. There is no cut-and-dry solution.<BR><BR>Especially with the binary format key, there is no easy conversion, <BR>also, the blabs are a problem.<BR>I have successfully migrated prim storage from MySQL to SQLite once, <BR>but it was a complex process.<BR><BR>The binary dump formats of MySQL and SQLite are sufficiently <BR>different to cause headaches.<BR><BR>MySQL uses an unquoted string preceded by 0x, e.f.
<BR>0xFABE0345BAADFOOD for a binary value. SQLite uses <BR>X'FABE0345BAADFOOD to do the same thing.<BR><BR>So, since a UUID is a hexadecimal string representing a binary <BR>value, it can be done like this:<BR><BR>"0x`sed -e \"s/'/0x/\" -e \"s/-//g\" -e \"s/'//\"`"<BR><BR>This will convert one UUID to it's MySQL binary representation.<BR><BR>Without the second term, it could be used for a blob field as well. <BR>It is your responsibility to cut apart and put back together the SQL <BR>inserts.<BR><BR>This is for Linux/Cygwin, I don't know a pure Windows way, short of <BR>writing a C(++/#) program.<BR><BR>Melanie<BR><BR><BR>Charles Krinke wrote:<BR>> Please bear with me as I need to understand this completely to ensure<BR>I get it right.<BR>> <BR>> The issue is how to move one or more assets from a regions<BR>AssetStorage.db in sqlite to import into a grids mysql database. Let me<BR>take the tables first. Here is the sqlite table for
assets.<BR>> <BR>> $ sqlite3 AssetStorage.db<BR>> sqlite> .tables<BR>> assets<BR>> sqlite> describe assets;<BR>> SQL error: near "describe": syntax error<BR>> sqlite> .schema assets<BR>> CREATE TABLE assets(UUID varchar(255) primary key,<BR>> Name varchar(255),<BR>> Description varchar(255),<BR>> Type integer,<BR>> InvType integer,<BR>> Local integer,<BR>> Temporary integer,<BR>> Data blob);<BR>> sqlite> <BR>> <BR>> mysql> describe assets;<BR>> +-------------+-------------+------+-----+---------+-------+<BR>> | Field | Type | Null | Key | Default | Extra |<BR>> +-------------+-------------+------+-----+---------+-------+<BR>> | id | binary(16) | NO | PRI | | |<BR>> | name | varchar(64) |
NO | | | |<BR>> | description| varchar(64) | NO | | | |<BR>> | assetType | tinyint(4) | NO | | | |<BR>> | invType | tinyint(4) | NO | | | |<BR>> | local | tinyint(1) | NO | | | |<BR>> | temporary | tinyint(1) | NO | | | |<BR>> | data | longblob | NO | | | |<BR>> +-------------+-------------+------+-----+---------+-------+<BR>> 8 rows in set (0.00 sec)<BR>>
mysql> <BR>> <BR>> So, we have names that are slightly different (capitalization mainly)<BR>and types that are somewhat different.<BR>> <BR>> Can one expect to do something like<BR>> <BR>> 1. $ sqlite3 AssetStorage > assetFile<BR>> 2. $ scp assetFile computerRunningGrid<BR>> 3. $ ssh computerRunningGrid<BR>> 4. $ mysql <BR>> 5. $ import from assetFile to assets;<BR>> <BR>> And expect all the details to be worked out?<BR>> <BR>> Pardon my naivety a bit as I work through something I have not done<BR>before, but I would like to understand it completely first before<BR>fubarring anything. Also, I suspect a recipe describing this would be<BR>helpful on wiki. If I can get a recipe to work, then I will be delighted<BR>to add it to the wiki.<BR>> <BR>> Charles<BR>> <BR>> <BR>><BR>------------------------------------------------------------------------<BR>> <BR>>
_______________________________________________<BR>> Opensim-dev mailing list<BR>> <A href="mailto:Opensim-dev@lists.berlios.de" ymailto="mailto:Opensim-dev@lists.berlios.de">Opensim-dev@lists.berlios.de</A><BR>> <A href="https://lists.berlios.de/mailman/listinfo/opensim-dev" target=_blank>https://lists.berlios.de/mailman/listinfo/opensim-dev</A><BR>_______________________________________________<BR>Opensim-dev mailing list<BR><A href="mailto:Opensim-dev@lists.berlios.de" ymailto="mailto:Opensim-dev@lists.berlios.de">Opensim-dev@lists.berlios.de</A><BR><A href="https://lists.berlios.de/mailman/listinfo/opensim-dev" target=_blank>https://lists.berlios.de/mailman/listinfo/opensim-dev</A><BR>_______________________________________________<BR>Opensim-dev mailing list<BR><A href="mailto:Opensim-dev@lists.berlios.de" ymailto="mailto:Opensim-dev@lists.berlios.de">Opensim-dev@lists.berlios.de</A><BR><A
href="https://lists.berlios.de/mailman/listinfo/opensim-dev" target=_blank>https://lists.berlios.de/mailman/listinfo/opensim-dev</A><BR>_______________________________________________<BR>Opensim-dev mailing list<BR><A href="mailto:Opensim-dev@lists.berlios.de" ymailto="mailto:Opensim-dev@lists.berlios.de">Opensim-dev@lists.berlios.de</A><BR><A href="https://lists.berlios.de/mailman/listinfo/opensim-dev" target=_blank>https://lists.berlios.de/mailman/listinfo/opensim-dev</A><BR></DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: courier, monaco, monospace, sans-serif"><BR></DIV></div></body></html>