Организация доступа к базам данных в Интернет

Информация - Компьютеры, программирование

Другие материалы по предмету Компьютеры, программирование

> DI5 = 0,

PNum = 0, // Номер поля числовой

PLength = 0, // Длинна поля числовая

PStart = 0; // Начальная позиция поля чиловая

// сканирование номеров полей

while ( DI2 != MTemp){

DI3=DI2+3;

String DStr = sDic.substring(DI2,DI3);// Номер поля

DI4=DI3+5;

String DStr2 = sDic.substring(DI3,DI4);// Начальная позиция

DI5=DI4+4;

String DStr3 = sDic.substring(DI4,DI5);// Длинна поля

DI2=DI2+12;

PLength = Integer.parseInt(DStr3,10);// Узнаем длинну поля

PStart = Integer.parseInt(DStr2,10);// Узнаем начало поля

PNum = Integer.parseInt(DStr,10);// Код

byte Pole[] = new byte[PLength];

// Чтение поля из файла

for (int PIndex = 0; PIndex < PLength; PIndex++) {

Pole[PIndex] = MarcRec[PStart+PIndex];

}

String Pol = new String(Pole);

if (Pol == null) Pol=" ";

 

switch (PNum) {

case 100 : { mAvtor = TagRemove(Pol.substring(5));break;}

case 700 : { msAvtor = TagRemove(Pol.substring(5));break;}

case 245 : { mName = TagRemove(Pol.substring(5));break;}

case 490 : { mSeria = TagRemove(Pol.substring(5));break;}

case 91 : { mBBK = TagRemove(Pol.substring(5));break;}

case 90 : { mKaIndex = TagRemove(Pol.substring(5));break;}

case 260 : { mPrinter = TagRemove(Pol.substring(5));break;}

case 300 : { mSize = TagRemove(Pol.substring(5));break;}

case 653 : { mKey = TagRemove(Pol.substring(5));break;}

default : {}

}// switch

}// конец проверки полей

if ( mAvtor == null) mAvtor=" ";

if ( msAvtor == null) msAvtor=" ";

if ( mName == null) mName=" ";

if ( mPrinter == null) mPrinter=" ";

if ( mSize == null) mSize=" ";

if ( mKey == null) mKey=" ";

MarcRecord Rec = new MarcRecord( mAvtor,

msAvtor,

mName,

mPrinter,

mSize,

mKey,

mSeria,

mBBK,

mKaIndex);

if ( Rec.rAvtor.indexOf(query) != -1 ||

Rec.rsAvtor.indexOf(query) != -1 ||

Rec.rName.indexOf(query) != -1 ||

Rec.rKey.indexOf(query) != -1)

{ mE++;

"+">out.println(""+

""+

"&nbsp;&nbsp;&nbsp;Автор:&nbsp;"+

""+

Rec.rAvtor+" "+

Rec.rsAvtor+

""+

""+mE+". "+mC+

"&nbsp;&nbsp;"+

"+">Rec.rName+""+

Rec.rPrinter+" "+

"+">Rec.rSize+""+

Rec.rBBK+" "+

Rec.rKaIndex+" "+

Rec.rSeria+

"");

}

fPosMarker = fPosMarker+JIndex;

MTemp = 0;

MIndex = 0;

}

catch (IOException e) {

");"> out.println("Ошибка!!!"+"");

done=true; }

}

}

catch (IOException e) { out.println("Ошибка доступа к "+dbNamePath); }

if (mE == 0) {

out.println("Запос: "+query+" не найден");

}

} // end If

}

// Ридер файла настройки

public void INIFile(String filename, String directory, PrintStream out) {

DataInputStream inifile = null;

String path = null,

iniRecord = null,

section = null,

vname = null,

vvalue = null;

boolean done = false;

int equalIndex = 0;

//

if (filename.length() == 0) {

out.println("IOError ");

System.exit(0);

}

if (directory.length() == 0) { directory = new String("c:\\www\\db"); }

if (filename.indexOf(".") < 0) { filename = new String(filename+".ini"); }

path = new String(directory+System.getProperty("file.separator")+filename);

// открытие файла

try { inifile = new DataInputStream(new FileInputStream(path)); }

catch(FileNotFoundException e) {

out.println(filename+"not found");

System.exit(0);

}

// чтение файла

try { iniRecord = inifile.readLine(); }

catch (IOException e) { done=true; }

while (!done && iniRecord != null)

{ if (iniRecord.startsWith("["))

{ section = iniRecord.substring(1,iniRecord.lastIndexOf("]"));}

else if (!iniRecord.startsWith(";"))

{ equalIndex = iniRecord.indexOf("=");

if (equalIndex > 0)

{ //Имя ключа => Раздел.ключ

vname = new String(section+"."+iniRecord.substring(0,equalIndex));

vvalue = new String(iniRecord.substring(equalIndex+1));

INIProperties.put(vname, vvalue);

}

}

 

try { iniRecord = inifile.readLine(); }

catch (IOException e) { done=true; }

}

}

 

// извлечь значение

public String getINIVar(String key, String defValue) {

return INIProperties.getProperty(key, defValue);

}

// извлечь значение

public String getINIVar(String key) {

return INIProperties.getProperty(key);

}

public void init(ServletConfig conf) throws ServletException {

super.init(conf);

}

public void service(HttpServletRequest req, HttpServletResponse res)

throws ServletException, IOException

{

 

PrintStream out;

out = new PrintStream(res.getOutputStream());

res.setContentType("text/html; charset=Cp866");

// Печать заголовка

printPageHeader(out);

INIFile("db.ini","c:\\www\\db",out);

// Определяем кодировку

String requestEnc = req.getCharacterEncoding();

String clientEnc = requestEnc;

if ( requestEnc==null ) requestEnc=iso;

requestEnc=iso;

// Тело

");">out.println("");

");">out.println("");

");">out.println(" ");

");">out.println(" ");

&nbsp;&nbsp;&nbsp;");

&nbsp;&nbsp;&nbsp; ");

&nbsp;");

");">out.println(" ");

");">out.println(" ");<